Code

* Code cleanup for non pre-defined ttag variable
[gosa.git] / include / class_plugin.inc
index c41ac56fa96d78e279ab205772067eec37dfd660..8e992dccc33c03b894848d7fe53767a16b168040 100644 (file)
@@ -107,6 +107,9 @@ class plugin
   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
@@ -380,6 +383,11 @@ class plugin
         }
       }
     }
+
+    /* 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 */
@@ -506,15 +514,20 @@ class plugin
   /* 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\">&nbsp;</p></td></tr></table>";
+    $display.= "<input type=submit value=\"$button_text\" name=\"modify_state\" ".$state.">".
+                "<p class=\"seperator\">&nbsp;</p></td></tr></table>";
 
     return($display);
   }
@@ -528,6 +541,12 @@ class plugin
     }
 
     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)){
@@ -536,11 +555,6 @@ class plugin
       }
       $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");
@@ -562,6 +576,12 @@ class plugin
     }
 
     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)){
@@ -570,11 +590,6 @@ class plugin
       }
       $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");
@@ -596,6 +611,12 @@ class plugin
     }
 
     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)){