Code

Made apps compatible to snapshots
[gosa.git] / plugins / admin / applications / class_applicationManagement.inc
index 9df2492d1c16c1a278de64e7233f92f8222ec31a..117ef50df85bbf5e43f94ada3eb6a90854f0910d 100644 (file)
@@ -34,6 +34,16 @@ class applicationManagement extends plugin
   var $acl                      = "";
   var $enableReleaseManagement  = false;
 
+  function IsReleaseManagementActivated()
+  {
+    /* Check if we should enable the release selection */
+    $tmp = search_config($this->config->data,"faiManagement","CLASS");
+    if(!empty($tmp)){
+      return(true);
+    }
+    return(false);
+  }
+
   function applicationManagement ($config, $ui)
   {
     /* Save configuration for internal use */
@@ -48,9 +58,8 @@ class applicationManagement extends plugin
     /* Creat dialog object */
     $this->DivListApplication = new divListApplication($this->config,$this);
 
+    if($this->IsReleaseManagementActivated()){
     /* Check if we should enable the release selection */
-    $tmp = search_config($this->config->data,"faiManagement","CLASS");
-    if(!empty($tmp)){
       $this->enableReleaseManagement = true;
 
       /* Hide SubSearch checkbox */
@@ -188,7 +197,7 @@ class applicationManagement extends plugin
     /* Finish apps edit is triggered by the tabulator dialog, so
        the user wants to save edited data. Check and save at this
        point. */
-    if ((isset($_POST['edit_finish'])) && (isset($this->apptabs->config))){
+    if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->apptabs->config))){
 
       /* Check tabs, will feed message array */
       $this->apptabs->last= $this->apptabs->current;
@@ -203,14 +212,16 @@ class applicationManagement extends plugin
         $this->apptabs->save();
         gosa_log ("Application object'".$this->dn."' has been saved");
 
-        /* Application has been saved successfully, remove lock from
-           LDAP. */
-        if ($this->dn != "new"){
-          del_lock ($this->dn);
+        if (!isset($_POST['edit_apply'])){
+          /* Application has been saved successfully, remove lock from
+             LDAP. */
+          if ($this->dn != "new"){
+            del_lock ($this->dn);
+          }
+          unset ($this->apptabs);
+          $this->apptabs= NULL;
+          unset ($_SESSION['objectinfo']);
         }
-        unset ($this->apptabs);
-        $this->apptabs= NULL;
-        unset ($_SESSION['objectinfo']);
       } else {
         /* Ok. There seem to be errors regarding to the tab data,
            show message and continue as usual. */
@@ -336,8 +347,12 @@ class applicationManagement extends plugin
       /* Don't show buttons if tab dialog requests this */
       if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){
         $display.= "<p style=\"text-align:right\">\n";
-        $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Save")."\">\n";
+        $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
         $display.= "&nbsp;\n";
+        if ($this->dn != "new"){
+          $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+          $display.= "&nbsp;\n";
+        }
         $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
         $display.= "</p>";
       }
@@ -349,7 +364,13 @@ class applicationManagement extends plugin
       Dialog display
      ****************/
 
+    /* Check if there is a snapshot dialog open */
+    if($str = $this->showSnapshotDialog($this->DivListApplication->selectedBase,"ou=apps,")){
+      return($str);
+    }
+
     /* Display dialog with system list */
+    $this->DivListApplication->parent = $this;
     $this->DivListApplication->execute();
     $this->DivListApplication->AddDepartments($this->DivListApplication->selectedBase);
     $this->reload();