Code

Added acls for printer glpi
[gosa.git] / plugins / admin / systems / class_baseSelectDialog.inc
index 6739c1848b042a10bc6555d86a9d28296841f45b..0a1040c7a22909d72193cfec8ba8122ab60fb998 100644 (file)
@@ -4,19 +4,21 @@ class baseSelectDialog extends MultiSelectWindow
 {
   var $selectedBase        = ""; // Used for navigation 
   var $base_selection_regex = "*"; // Used regex ... 
-//  var $Doesnothing          = ""; // Checkbox which does nothing 
-
   var $BaseToUse         = false;  // used to specify the selected base, 
                                       // false if none is selected
 
   var $allowedBases         = array();
+  var $parent               = NULL;
  
-  function baseSelectDialog ($config,$onlyAllowThisBases = array())
+  function baseSelectDialog ($config,$parent,$onlyAllowThisBases = array())
   {
-    MultiSelectWindow::MultiSelectWindow($config,"BASEselectWindow");
-    
+    echo "Need to pass module via parameter!<br>";
+    $module= "all";
+    MultiSelectWindow::MultiSelectWindow($config, "BASEselectWindow", $module);
+   
+    $this->parent = $parent;
     $this->selectedBase = $config->current['BASE'];
-  
     $this->allowedBases  = $onlyAllowThisBases;
 
     $this->SetTitle("Base");
@@ -136,6 +138,9 @@ class baseSelectDialog extends MultiSelectWindow
 
   function save_object()
   {
+    /* Save current base */
+    $old_base = $this->selectedBase;
+  
     /* Save automatic created POSTs like regex, checkboxes */
     MultiSelectWindow::save_object();   
     
@@ -182,6 +187,11 @@ class baseSelectDialog extends MultiSelectWindow
         $this->selectedBase= $this->config->departments["/"];
       }
     }
+
+    /* Restore old base, if selected base is not allowed */
+    if(count($this->allowedBases) && !isset($this->allowedBases[$this->selectedBase])){
+      $this->selectedBase = $old_base;
+    }
   }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: