index d1af40e8564fe97326ecaabf22e21edd56b1906f..8e992dccc33c03b894848d7fe53767a16b168040 100644 (file)
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
var $new= TRUE;
var $saved_attributes= array();
+ /* This can be set to render the tabulators in another stylesheet */
+ var $pl_notify= FALSE;
+
/*! \brief plugin constructor
If 'dn' is set, the node loads the given 'dn' from LDAP
\param dn Distinguished name to initialize plugin from
\sa plugin()
*/
- function plugin ($config, $dn= NULL)
+ function plugin ($config, $dn= NULL, $parent= NULL)
{
/* Configuration is fine, allways */
$this->config= $config;
if ($dn != NULL){
/* Load data to 'attrs' and save 'dn' */
- $ldap->cat ($dn);
- $this->attrs= $ldap->fetch();
+ if ($parent != NULL){
+ $this->attrs= $parent->attrs;
+ } else {
+ $ldap->cat ($dn);
+ $this->attrs= $ldap->fetch();
+ }
/* Copy needed attributes */
foreach ($this->attributes as $val){
}
}
}
+
+ /* Update saved attributes and ensure that next cleanups will be successful too */
+ foreach($this->attrs as $name => $value){
+ $this->saved_attributes[$name] = $value;
+ }
}
/* Check formular input */
/* Show header message for tab dialogs */
function show_header($button_text, $text, $disabled= FALSE)
{
+ $state = "disabled";
+ if($this->is_account && $this->acl == "#all#"){
+ $state= "";
+ }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){
+ $state= "";
+ }
+
if ($disabled == TRUE){
$state= "disabled";
- } else {
- $state= "";
}
+
$display= "<table summary=\"\" width=\"100%\"><tr>\n<td colspan=2><p><b>$text</b></p>\n";
- $display.= "<input type=submit value=\"$button_text\" name=\"modify_state\" ".
- chkacl($this->acl, "all")." ".$state.
- "><p class=\"seperator\"> </p></td></tr></table>";
+ $display.= "<input type=submit value=\"$button_text\" name=\"modify_state\" ".$state.">".
+ "<p class=\"seperator\"> </p></td></tr></table>";
return($display);
}
}
if ($command != ""){
+
+ /* Additional attributes */
+ foreach ($add_attrs as $name => $value){
+ $command= preg_replace("/%$name/", $value, $command);
+ }
+
/* Walk through attribute list */
foreach ($this->attributes as $attr){
if (!is_array($this->$attr)){
}
$command= preg_replace("/%dn/", $this->dn, $command);
- /* Additional attributes */
- foreach ($add_attrs as $name => $value){
- $command= preg_replace("/%$name/", $value, $command);
- }
-
if (check_command($command)){
@DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
$command, "Execute");
}
if ($command != ""){
+
+ /* Additional attributes */
+ foreach ($add_attrs as $name => $value){
+ $command= preg_replace("/%$name/", $value, $command);
+ }
+
/* Walk through attribute list */
foreach ($this->attributes as $attr){
if (!is_array($this->$attr)){
}
$command= preg_replace("/%dn/", $this->dn, $command);
- /* Additional attributes */
- foreach ($add_attrs as $name => $value){
- $command= preg_replace("/%$name/", $value, $command);
- }
-
if (check_command($command)){
@DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
$command, "Execute");
}
if ($command != ""){
+
+ /* Additional attributes */
+ foreach ($add_attrs as $name => $value){
+ $command= preg_replace("/%$name/", $value, $command);
+ }
+
/* Walk through attribute list */
foreach ($this->attributes as $attr){
if (!is_array($this->$attr)){
}
$todo[] = "is_account";
foreach($todo as $var){
- $this->$var = $source->$var;
+ if (isset($source->$var)){
+ $this->$var= $source->$var;
+ }
}
}