Code

Some acl udpates
[gosa.git] / plugins / personal / environment / class_selectPrinterDialog.inc
index c5584545a511fabee648aacb9b5939247857baf0..2400b2857909eb1b3fd9a89f33406f0c94de54d8 100644 (file)
@@ -11,22 +11,22 @@ class selectPrinterDialog extends plugin
   var $ignore_account       = TRUE;
   var $attributes           = array();
   var $objectclasses        = array("whatever");
-  var $use_existing         = false;  
+  var $AlreadyAssigned      = array();  
   var $regex                = "*";
   var $depselect            = "/";
   var $deplist              = "/";
 
-  function selectPrinterDialog ($config, $dn= NULL,$use_existing=false )
+  function selectPrinterDialog ($config, $dn= NULL,$alreadyused=array() )
   {
-    $this->use_existing = $use_existing;
+    $this->AlreadyAssigned = $alreadyused;
     plugin::plugin ($config, $dn);
     $this->depselect = $this->config->current['BASE'];
   }
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
 
     /* Fill templating stuff */
     $smarty= get_smarty();
@@ -42,7 +42,7 @@ class selectPrinterDialog extends plugin
       $this->regex=preg_replace("/\*\*/","*",$this->regex);
     }
 
-    $this->deplist=array_flip($this->config->departments);
+    $this->deplist=$this->config->idepartments;
 
     $smarty->assign("regexPrinter"    ,$this->regex);
     $smarty->assign("deplistPrinter"  ,$this->deplist);
@@ -54,7 +54,7 @@ class selectPrinterDialog extends plugin
     $smarty->assign("search_image", get_template_path('images/search.png'));
     $smarty->assign("tree_image", get_template_path('images/tree.png'));
     $smarty->assign("infoimage", get_template_path('images/info.png'));
-    $smarty->assign("launchimage", get_template_path('images/launch.png'));
+    $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
     $smarty->assign("deplist", $this->config->idepartments);
 
     $display.= $smarty->fetch(get_template_path('selectPrinterDialog.tpl', TRUE,dirname(__FILE__)));
@@ -62,7 +62,9 @@ class selectPrinterDialog extends plugin
   }
 
   function check(){
-    $message=array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
     if(empty($_POST['gotoPrinter'])){
       $message[] = _("Please select a printer or press cancel.");
     }
@@ -85,6 +87,9 @@ class selectPrinterDialog extends plugin
     $ldap->cd($this->depselect);
     $ldap->search("(&(objectClass=gotoPrinter)(cn=".$this->regex."))",array("*"));
     while($printer = $ldap->fetch()){
+
+      if(isset($this->AlreadyAssigned[$printer['cn'][0]])) continue;
+
       if($detailed ==true){
         $a_return[$printer['cn'][0]] = $printer;
       }else{