Code

Fixed multi query editor
[gosa.git] / gosa-core / include / class_management.inc
index 4604eecbe2bed502cf9de24c2976224f055e1bb4..c8a385764debb8cd96a303884be872887a1cdd01 100644 (file)
@@ -119,6 +119,9 @@ class management
     $this->registerAction("saveSnapshot","saveSnapshot");
     $this->registerAction("restoreSnapshot","restoreSnapshot");
     $this->registerAction("cancelSnapshot","closeDialogs");
+
+    $this->registerAction("config-filter","editFilter");
+    $this->registerAction("saveFilter","saveFilter");
   }
 
   /*! \brief  Execute this plugin
@@ -130,6 +133,8 @@ class management
     $vars = array('/^act$/','/^listing/','/^PID$/','/^FILTER_PID$/');
     session::set('LOCK_VARS_TO_USE',$vars);
 
+    pathNavigator::registerPlugin($this);
+
     /* Display the copy & paste dialog, if it is currently open */
     $ret = $this->copyPasteHandler("",array());
     if($ret){
@@ -178,18 +183,13 @@ class management
       $this->snapHandler->setSnapshotBases($bases);
     }
   
-    // Dummy filter editor 
-    $dummy = "<button type='submit' name='editFilter'>!!</button>";
-    $this->registerAction("editFilter", "editFilter");
     // Display list
-    return($dummy.$this->renderList());
+    return($this->renderList());
   }
  
   function editFilter()
   {
-    $headpage = $this->getHeadpage();
-    $this->dialogObject = new userFilter($this->config,$headpage->categories);
+    $this->dialogObject = new userFilter($this->config,$this->getHeadpage());
   }
  
   function renderList()
@@ -251,13 +251,13 @@ class management
 
       // Display ok, (apply) and cancel buttons
       $str.= "<p style=\"text-align:right\">\n";
-      $str.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
+      $str.= "<button type=\"submit\" name=\"edit_finish\" style=\"width:80px\">".msgPool::okButton()."</button>\n";
       $str.= "&nbsp;\n";
       if($this->displayApplyBtn){
-        $str.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
+        $str.= "<button type=\"submit\" name=\"edit_apply\">".msgPool::applyButton()."</button>\n";
         $str.= "&nbsp;\n";
       }
-      $str.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
+      $str.= "<button type=\"submit\" name=\"edit_cancel\">".msgPool::cancelButton()."</button>\n";
       $str.= "</p>";
     }
     return($str);
@@ -375,8 +375,7 @@ class management
     if(isset($_POST['edit_cancel'])) $action['action'] = "cancel";    
     if(isset($_POST['delete_confirmed'])) $action['action'] = "removeConfirmed";   
     if(isset($_POST['delete_cancel'])) $action['action'] = "cancelDelete";   
-    if(isset($_POST['editFilter'])) $action['action'] = "editFilter";   
-    if(isset($_POST['saveFilter'])) $action['action'] = "save";   
+    if(isset($_POST['saveFilter'])) $action['action'] = "saveFilter";   
     if(isset($_POST['cancelFilter'])) $action['action'] = "cancel";   
 
     // Detect Snapshot actions
@@ -689,6 +688,25 @@ class management
   }
 
 
+  /*! \brief  Save filter modifcations.
+   */
+  protected function saveFilter()
+  {
+    if($this->dialogObject instanceOf userFilter){
+      $msgs = $this->dialogObject->check();
+      if(count($msgs)){
+        msg_dialog::displayChecks($msgs); 
+        return("");
+      }else{
+        $this->dialogObject->save();
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dns,"Entry saved!");
+        $this->remove_lock();
+        $this->closeDialogs();
+      }
+    }
+  }
+
+
   /*! \brief  Save object modifications and closes dialogs (returns to object listing).
    *          - Calls '::check' to validate the given input.
    *          - Calls '::save' to save back object modifications (e.g. to ldap).