Code

Some glpi changes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 20 Jan 2006 08:20:59 +0000 (08:20 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 20 Jan 2006 08:20:59 +0000 (08:20 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2531 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_glpiAccount.inc
plugins/admin/systems/class_glpiPrinterAccount.inc
plugins/admin/systems/class_glpiPrinterCartridges.inc
plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc [new file with mode: 0644]
plugins/admin/systems/class_glpiSelectUser.inc
plugins/admin/systems/glpiPrinterCartridges.tpl
plugins/admin/systems/glpiPrinterCartridgesEdit.tpl [new file with mode: 0644]
plugins/admin/systems/glpiSelectUser.tpl
plugins/admin/systems/glpi_edit_cartridge_type.tpl [new file with mode: 0644]

index 8a5f8d993908a31f4d8b82a171f6aaa354f92f5f..b15af4bde4b1b1b90defbc95a27cdecf45bb3d8d 100644 (file)
@@ -336,7 +336,7 @@ class glpiAccount extends plugin
      */
     if(isset($_POST['SelectContactPerson'])){
       $this->addUser = "contact";
-      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn);
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
     }
 
     /* Open dialog which allows to edit the manufacturers
@@ -355,6 +355,7 @@ class glpiAccount extends plugin
 
     /* Abort user selection
      */
+    $smarty->assign("AbortSelectUser","SelectUserCancel");
     if(isset($_POST['SelectUserCancel'])){
       $this->dialog = false;
       $this->addUser ="";
@@ -365,7 +366,7 @@ class glpiAccount extends plugin
      */
     if(isset($_POST['SelectTechPerson'])){
       $this->addUser ="tech";
-      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn);
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
     }
 
     /* Technical responsible person selected*/
index 7c86816893efac3be2284de5e8a6efe33a4732b8..c6f3f281da4c3578ee2ea983076288b8c49b998d 100644 (file)
@@ -39,6 +39,8 @@ class glpiPrinterAccount extends plugin
   var $contact            = "";    // Empty
   var $deleted            = "N";   // Deleted entries should have this set to Y
 
+  var $editManufacturer   = false;
+
   /* Not necessary, cause we use mysql databse */
   var $objectclasses= array("whatever");
 
@@ -258,13 +260,15 @@ class glpiPrinterAccount extends plugin
     if(isset($_POST['edit_manufacturer'])){
       $this->cur_dialog = new glpiManufacturer($this->config,$this->dn);
       $this->dialog = true;
+      $this->editManufacturer =true;
     }
 
     /* Close manufacturer editing dialog
      */
-    if(isset($_POST['close_edit_manufacturer'])){
+    if((isset($_POST['close_edit_manufacturer']))&&($this->editManufacturer)){
       $this->dialog = false;
       $this->cur_dialog = false;
+      $this->editManufacturer=false;
     }
 
 
@@ -279,18 +283,19 @@ class glpiPrinterAccount extends plugin
      */
     if(isset($_POST['SelectContactPerson'])){
       $this->addUser = "contact";
-      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn);
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
     }
 
     /* Selecte technical responsible person
      */
     if(isset($_POST['SelectTechPerson'])){
       $this->addUser ="tech";
-      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn);
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_tech_num");
     }
 
     /* Abort user selection
      */
+    $smarty->assign("AbortSelectUser","SelectUserCancel");
     if(isset($_POST['SelectUserCancel'])){
       $this->dialog = false;
       $this->addUser ="";
@@ -536,14 +541,14 @@ class glpiPrinterAccount extends plugin
   /* Save data to object */
   function save_object()
   {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
+    if(isset($_POST['glpiPrinterFlagsPosted'])){
+      plugin::save_object();
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }
       }
-    }
 
-    if(isset($_POST['glpiPrinterFlagsPosted'])){
       foreach(array("flags_serial","flags_par","flags_usb") as $checkboxes){
         if(isset($_POST[$checkboxes])){
           $this->$checkboxes = 1;
index a6ff09895d18db89e4bffadff87b3a606550b387..0276ce1e2870d7c89dbb2902ddbb396b572696c3 100644 (file)
@@ -16,7 +16,14 @@ class glpiPrinterCartridges extends plugin
   var $usedCartridges   = array();    // IDs of used cartridges for this printer 
   var $PrinterType      = 0;          // Specifies which cartridge types are available
 
-  function glpiPrinterCartridges ($config, $dn= NULL,$type)
+  var $cur_dialog       = false;
+  var $cur_sub_dialog   = false;
+
+  var $editManufacturer = false;
+  var $del              = 0;
+
+
+  function glpiPrinterCartridges ($config,$dn,$type)
   {
     plugin::plugin ($config, $dn);
 
@@ -36,6 +43,34 @@ class glpiPrinterCartridges extends plugin
     plugin::execute();
     $display ="";
     $smarty = get_smarty();
+    $filter = $_SESSION['glpiCartridgeRegex'];
+
+    /* Filter settings, remove double* */
+    if(isset($_GET['search'])){
+      $filter = preg_replace("/\*\**/","*",$_GET['search']."*");
+    }elseif(isset($_POST['cartridge_regex'])){
+      $filter = preg_replace("/\*\**/","*",$_POST['cartridge_regex']);
+    }
+    if(empty($filter)) {
+      $filter = "*";
+    }
+    $_SESSION['glpiCartridgeRegex']= $filter;
+
+    /* Open dialog which allows to edit the manufacturers
+     */
+    if(isset($_POST['edit_manufacturer_cartridges'])){
+      $this->cur_sub_dialog = new glpiManufacturer($this->config,$this->dn);
+      $this->dialog = true;
+      $this->editManufacturer =true;
+    }
+
+    /* Close manufacturer editing dialog
+     */
+    if((isset($_POST['close_edit_manufacturer']))&&($this->editManufacturer)){
+      $this->dialog = false;
+      $this->cur_sub_dialog = false;
+      $this->editManufacturer=false;
+    }
 
     /* Check poted vars and do the requested job, but only once */
     $only_once = true;
@@ -43,22 +78,72 @@ class glpiPrinterCartridges extends plugin
 
       /* We have to create a new cartridge */
       if(preg_match("/^newcartridge/",$name)&&($only_once)){
-        echo "new Cartridge";
-        
+        $this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType); 
         $only_once = false;
       }
     }
   
     /* Edit cartridge */
     if(isset($_GET['act'])&&$_GET['act']=="edit_cartridge"){
-      print_a($this->parent->handle->getCartridgeTypeInformations($_GET['id']));
-      echo "edit";
+      $val = ($this->parent->handle->getCartridgeTypeInformations($_GET['id']));
+      $this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType,$val[$_GET['id']]); 
     }
  
     /* remove cartridge */ 
     if(isset($_GET['act'])&&$_GET['act']=="del_cartridge"){
-      print_a($this->parent->handle->getCartridgeTypeInformations($_GET['id']));
-      echo "remove";
+        /* remove attach from db */
+        $this->del = $_GET['id'];
+        $val = ($this->parent->handle->getCartridgeTypeInformations($_GET['id']));
+        $smarty->assign("warning", sprintf(_("You're about to delete the glpi cartridge type '%s'."), $val[$this->del]['name']));
+        return($smarty->fetch(get_template_path('remove_glpi.tpl', TRUE)));
+    }
+
+    if(isset($_POST['delete_cancel'])){
+      $this->del = false;
+    }
+
+    /* Delete this entry */
+    if(isset($_POST['delete_glpi_confirm'])&&($this->del)) {
+      if(count($this->parent->handle->getCartridgesWhichUseThisType($this->del))){
+        print_red(_("You can't delete this cartridge type, it is still in use."));
+      }else{
+        $val = ($this->parent->handle->getCartridgeTypeInformations($this->del));
+        $this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType,$val[$this->del]); 
+        $this->cur_dialog->parent = $this->parent;
+        $this->cur_dialog->remove_from_parent();
+        $this->cur_dialog= false;
+      } 
+    }
+
+    /* Abort edit / add dialog */
+    if(isset($_POST['CancelCartridge'])){
+      $this->cur_dialog = false;
+    }
+  
+    /* Save changes if check is ok */
+    if(isset($_POST['SaveCartridge'])){
+      if(count($this->cur_dialog->check())) {
+        foreach($this->cur_dialog->check() as $checks){
+          print_red($checks);
+        }
+      }else{
+        $this->cur_dialog->save_object();
+        $this->cur_dialog->save();
+        $this->cur_dialog = false;
+      }
+    }
+
+    /* If we have a dialog open, display it */
+    if($this->cur_sub_dialog){
+      $this->cur_sub_dialog->parent = $this->parent;
+      $this->cur_sub_dialog->save_object();
+      return($this->cur_sub_dialog->execute());
+    }
+    /* If we have a dialog open, display it */
+    if($this->cur_dialog){
+      $this->cur_dialog->parent = $this->parent;
+      $this->cur_dialog->save_object();
+      return($this->cur_dialog->execute());
     }
 
     /* Create divlist */
@@ -79,8 +164,20 @@ class glpiPrinterCartridges extends plugin
 
     /* Add cartridges */ 
     $cart = $this->getCartridgeTypes();
+
+    /* Remove typically error possibilities */
+    $f = str_replace("/","\/",$filter);
+    $f = str_replace(".","\.",$f);
+    $f = str_replace("*",".*",$f);
+
+    /* Assign cartridges */
     foreach($cart as $key=>$cartr){
 
+      /* Skip if filter doesn't match*/
+      if(!preg_match("/^".$f."$/i",$cartr['cartridgeName'])){
+        continue;
+      }
+
       /* check if this cartridge is selected */
       $chk = "";
       if(isset($this->usedCartridges[$key])){
@@ -88,10 +185,13 @@ class glpiPrinterCartridges extends plugin
       }
 
       /* Add fields */
-      $field1 = array("string" => preg_replace("/%s/",($key),preg_replace("/%CHECKED%/",$chk,$useCartridge)), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($edit,($key),$cartr['cartridgeName']."&nbsp;[".$cartr['cartridgeTypeName']."]"), "attach" => "style=''");
+      $field1 = array("string" => preg_replace("/%s/",($key),preg_replace("/%CHECKED%/",$chk,$useCartridge)), 
+                      "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($edit,($key),$cartr['cartridgeName']."&nbsp;[".$cartr['cartridgeTypeName']."]"), 
+                      "attach" => "style=''");
       $field3 = array("string" => sprintf($editdel,($key),($key)), 
-        "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+                      "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+
       $divlist->AddEntry(array($field1,$field2,$field3));
       
     }
@@ -113,7 +213,7 @@ class glpiPrinterCartridges extends plugin
     $smarty->assign("launchimage", get_template_path('images/launch.png'));
     $smarty->assign("apply", apply_filter());
     $smarty->assign("alphabet", generate_alphabet());
-    $smarty->assign("cartridge_regex", $filter['device_regex']);
+    $smarty->assign("cartridge_regex", $filter);
 
     $display.= $smarty->fetch(get_template_path('glpiPrinterCartridges.tpl', TRUE));
     return($display);
diff --git a/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc b/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc
new file mode 100644 (file)
index 0000000..5607b51
--- /dev/null
@@ -0,0 +1,346 @@
+<?php
+
+class glpiPrinterCartridgesEdit extends plugin
+{
+  /* CLI vars */
+  var $cli_summary          = "Manage server basic objects";
+  var $cli_description      = "Some longer text\nfor help";
+  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account       = TRUE;
+  var $attributes           = array("ID","name","ref","location","type","FK_glpi_enterprise","tech_num","deleted","comments","alarm");
+  var $objectclasses        = array("whatever");
+
+  var $printer_type      = 0;
+
+  var $additional_printer= array();
+  var $needToCatch       = true;
+
+  var $parent           = NULL;
+
+  var $ID                 = "";
+  var $name               = "";
+  var $ref                = "";
+  var $location           = "";
+  var $type               = "";
+  var $FK_glpi_enterprise = "";
+  var $tech_num           = "";
+  var $deleted            = "";
+  var $comments           = "";
+  var $alarm              = "";  
+
+  var $cur_dialog         = false;
+  var $edit_type          =false;
+
+
+  function glpiPrinterCartridgesEdit ($config, $dn,$printer_type,$values = NULL )
+  {
+    plugin::plugin ($config, $dn);
+
+    $ui= get_userinfo();
+    $acl= get_permissions ($this->dn, $ui->subtreeACL);
+    $this->acl= get_module_permission($acl, "component", $this->dn);
+    
+
+    foreach($this->attributes as $val){
+      if(isset($values[$val])){
+        $this->$val = $values[$val];
+      }else{
+        $this->$val = "";
+      }
+    }
+
+    $this->needToCatch = true;
+    
+    $this->printer_type = $printer_type;
+
+  }
+
+  function remove_from_parent()
+  {
+    if($this->ID > 0){
+      $this->parent->handle->removeCartridgeDropdownType($this->ID);
+    }
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Get all currently used/supported printer types for this cartridge type
+     */
+    if($this->needToCatch){
+      $this->needToCatch = false;
+      if(!empty($this->type)){
+        $this->additional_printer= $this->parent->handle->getSupportedPrinterTypeIDsForCartridge($this->ID);
+      }
+    }
+
+
+
+
+
+  
+    /* Printer type management
+     */
+    if(isset($_POST['edit_type_cartridge'])){
+      $this->dialog = true;
+      $this->edit_type=true;
+    }
+
+    /* This closes the printer type editing dialog
+     */
+    if(isset($_POST['close_edit_type_cartridge'])){
+      $this->edit_type=false;
+      $this->dialog = false;
+    }
+
+    /* This appends a new printer to our sytem types
+     */
+    if((isset($_POST['add_cartridge_type']))&&(!empty($_POST['cartridge_type_string']))){
+      print "Add";
+      $this->parent->handle->addCartridgeDropdownType($_POST['cartridge_type_string']);
+    }
+
+    /* Remove selected type from our printer types list
+     */
+    if((isset($_POST['del_cartridge_type']))&&(!empty($_POST['select_type_cartridge']))){
+      $this->parent->handle->removeCartridgeDropdownType($_POST['select_type_cartridge']);
+    }
+
+    /* Rename selected printer type to given string
+     */
+    /* Update*/
+    if((isset($_POST['rename_cartridge_type']))&&(!empty($_POST['select_type_cartridge']))&&(!empty($_POST['cartridge_type_string']))){
+      $this->parent->handle->updateCartridgeDropdownType($_POST['cartridge_type_string'],$_POST['select_type_cartridge']);
+    }
+
+    /* Someone wants to edit the printer types ...
+       So, lets open a new dialog which provides some buttons to edit the types
+     */
+    if($this->edit_type){
+      $smarty->assign("PrinterTypes",            $this->parent->handle->getCartridgeTypes());
+      $smarty->assign("PrinterTypeKeys",         array_flip($this->parent->handle->getCartridgeTypes()));
+      $display= $smarty->fetch(get_template_path('glpi_edit_cartridge_type.tpl', TRUE));
+      return($display);
+    }
+
+
+
+
+
+
+
+    /* Assign attributes */ 
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+      $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
+    }
+
+    /* Selecte technical responsible person
+     */
+    if(isset($_POST['SelectCartridgeTechPerson'])){
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn,"user_cartridge_tech_num");
+    }
+
+    /* Abort user selection
+     */
+    $smarty->assign("AbortSelectUser","SelectCartridgeUserCancel");
+    $smarty->assign("SaveSelectUser" ,"user_cartridge_tech_num");
+    if(isset($_POST['SelectCartridgeUserCancel'])){
+      $this->dialog = false;
+      $this->addUser ="";
+      $this->cur_dialog = false;
+    }
+
+    /* Start ldap, and get all glpiUsers */
+    $ldap = $this->config->get_ldap_link();
+    $users = ($this->parent->handle->getUsers());
+
+    /* Technical responsible/contact person selected 
+    */
+    if(isset($_GET['act'])&&($_GET['act']=="user_cartridge_tech_num")){
+
+      /* Get posted id */
+      $id = base64_decode($_GET['id']);
+
+      /* Check if user is already created in glpi database */
+      if(!in_array($id,$users)){
+
+        /* If this user doesn't exists in glpi db, we must create him */
+        $atr = $ldap->fetch($ldap->cat($id));
+        $tmp = array();
+        $use = array( "cn"              =>"name",
+            "mail"            =>"email",
+            "telephoneNumber" =>"phone");
+
+        /* Create array */
+        foreach($use as $gosa => $glpi){
+          if(isset($atr[$gosa])){
+            $tmp[$glpi]= $atr[$gosa][0];
+          }
+        }
+
+        /* Add this user */
+        $this->parent->handle->addUser($tmp,$id);
+      }
+
+      /* Re-read users */
+      $users = ($this->parent->handle->getUsers());
+
+      /* Get user */
+      $tmp = array_flip($users);
+      $id=$tmp[$id];
+    
+      /* Close dialog and use this user */
+      $this->tech_num = $id;
+      $this->cur_dialog   = false;
+      $this->dialog= false;
+    }
+
+    /* Execute dialog*/
+    if($this->cur_dialog){
+      $this->cur_dialog->save_object();
+      $this->dialog=true;
+      $this->cur_dialog->parent = &$this;
+      return($this->cur_dialog->execute());
+    }else{
+      $this->dialog= false;
+    }
+
+    /* Create matrix with all possible printer types 
+     */
+    $matrix = "<table summary=''><tr>";
+    $types = $this->parent->handle->getPrinterTypes();
+   
+    /* Specifies number of cols */ 
+    $spalten = 2;
+    
+    $spalt = $spalten; 
+    foreach($types as $key => $type){
+      $spalt -- ; 
+
+      /* Create new row, if cols for this row reached $spalten */
+      if($spalt < 0) {
+        $spalt = $spalten -1;
+        $matrix .= "</tr><tr>";
+      }
+
+      /* Avoid deselecting every checkbox */
+      if($key == $this->printer_type){
+        $matrix.= "<td><input type='checkbox' name='UsePrinterType_".$key."' disabled checked>".$type."</td>";
+      }else{
+      
+        /* Cehck checkbox */
+        $check = "";
+        if(isset($this->additional_printer[$key])){
+          $check = " checked "; 
+        }
+        $matrix.= "<td><input type='checkbox' name='UsePrinterType_".$key."' ".$check." ><input type='hidden' name='wasOnPage_".$key."' ".$check.">".$type."</td>";
+      }
+    }
+    
+    /* Complete table row, to avoid html errors */
+    if($spalt >0){
+      while($spalt >0){
+        $spalt -- ;
+        $matrix .="<td>&nbsp;</td>";
+      }
+    }
+    
+    $matrix .= "</tr></table>";
+
+     /* Append manufacturers
+     */
+    $smarty->assign("PrinterTypeMatrix",      $matrix);
+    
+    $smarty->assign("ManufacturerKeys",       array_flip($this->parent->handle->getEnterprises()));
+    $smarty->assign("Manufacturers",          $this->parent->handle->getEnterprises());
+    $smarty->assign("FK_glpi_enterprise",     $this->FK_glpi_enterprise);
+
+    $smarty->assign("typeKeys",               array_flip($this->parent->handle->getCartridgeTypes()));
+    $smarty->assign("types",                  $this->parent->handle->getCartridgeTypes());
+    $smarty->assign("type",                   $this->type);
+
+     /* Handle tech person
+       Assign name ... to smarty, if set
+     */
+    if(isset($users[$this->tech_num])){
+      $tr = $ldap->fetch($ldap->cat($users[$this->tech_num]));
+      $str = "";
+      if(isset($tr['givenName'][0])){   $str .= $tr['givenName'][0]." ";      }
+      if(isset($tr['sn'][0])) {         $str .= $tr['sn'][0]." ";             }
+      if(isset($tr['uid'][0])){         $str .= "[".$tr['uid'][0]."]";        }
+      $smarty->assign("tech_num",               $str);
+    }else{
+      $smarty->assign("tech_num",               _("N/A"));
+    }
+
+
+    $display.= $smarty->fetch(get_template_path('glpiPrinterCartridgesEdit.tpl', TRUE,dirname(__FILE__)));
+    return($display);
+  }
+
+  /* Check given values */
+  function check(){
+    $message=array();
+  
+    /* Avoid choosing an already used name */
+    $types = $this->parent->handle->getCartridgeTypeInformations();
+    foreach($types as $type){
+      if($type['name'] == $this->name){
+        if($type['ID'] != $this->ID){
+          $message[]= _("The selected name is already in use.");
+        }        
+      }
+    }  
+    return $message;
+  }
+
+  /* Save Post data */
+  function save_object()
+  {
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr= $_POST[$attr];
+      }
+    }
+
+    /* Get selected checkboxes */
+    foreach($_POST as $name => $value){
+      if(preg_match("/wasOnPage_/",$name)){
+        $id = preg_replace("/wasOnPage_/","",$name);
+        if(isset($_POST['UsePrinterType_'.$id])){
+          $this->additional_printer[$id]=$id;
+        }else{
+          if(isset($this->additional_printer[$id])){
+            unset($this->additional_printer[$id]);
+          }
+        }
+      }
+    }
+  }
+
+  /* Create / Update database with this new infos */
+  function save()
+  {
+    $tmp  = array();
+    foreach($this->attributes as $attr){
+      $tmp[$attr] = $this-> $attr;
+    }
+    $types = array();
+    $types = $this->additional_printer;
+    $types[$this->printer_type]=$this->printer_type;
+    $this->parent->handle->Add_UpdateCatrigdeType($tmp,$types);
+  }
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 27cd281cca0b529b8afcea9a7db1dd1a7296ece0..085b48a551096ad67b698b745ad56f5342764957 100644 (file)
@@ -17,10 +17,14 @@ class glpiSelectUser extends plugin
 
   var $ui;
 
-  function glpiSelectUser ($config, $dn= NULL)
+  var $PostVarName      = "";
+
+  function glpiSelectUser ($config, $dn= NULL,$postvar)
   {
     plugin::plugin ($config, $dn);
 
+    $this->PostVarName = $postvar;
+
     if(!isset($_SESSION['glpi_user_filter'])){
       $tmp['users_regex'] = "*";
       $tmp['base']       = $this->config->current['BASE'];
@@ -37,8 +41,18 @@ class glpiSelectUser extends plugin
 
     $filter = $_SESSION['glpi_user_filter'];
 
-    $s_action="";
+    /* Filter settings, remove double* */
+    if(isset($_GET['search'])){
+      $filter['users_regex'] = preg_replace("/\*\**/","*",$_GET['search']."*");
+    }elseif(isset($_POST['regex'])){
+      $filter['users_regex'] = preg_replace("/\*\**/","*",$_POST['regex']);
+    }
+    if(empty($filter['users_regex'])) {
+      $filter = "*";
+    }
+
 
+    $s_action="";
     /* Test Posts */
     foreach($_POST as $key => $val){
       // Post for delete
@@ -114,7 +128,7 @@ class glpiSelectUser extends plugin
       $divlist->AddEntry(array($field1,$field2,$field3));
     }
 
-    $useruse = "<a href='?plug=".$_GET['plug']."&amp;act=user_tech_num&amp;id=%s'>%s</a>";
+    $useruse = "<a href='?plug=".$_GET['plug']."&amp;act=".$this->PostVarName."&amp;id=%s'>%s</a>";
     
     foreach($this->users as $key=>$user){
       $field1 = array("string" => "<img src='images/select_user.png' alt='user'>", "attach" => "style='text-align:center;width:20px;'");
@@ -125,14 +139,6 @@ class glpiSelectUser extends plugin
       
     }
 
-
-
-
-
-
-
-
-
     $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
       " <input class='center' type='image' align='middle' 
       src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
@@ -181,7 +187,7 @@ class glpiSelectUser extends plugin
      * So we are able to navigate like in konquerer
      */
 
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=*)(description=*))(objectClass=gosaDepartment))",
         TRUE, $base, array("ou", "description"), TRUE);
 
     $this->departments= array();
index de7110f48f039609effb457ecb452af0da21eee9..d1cea49978cd2bb1f46c32cc8ad9f33b99cd23d2 100644 (file)
@@ -49,6 +49,8 @@
 <input type="hidden" name="ignore">
 <p class="seperator">&nbsp;</p>
 <div align="right">
+       <p>
        <input type="submit" name="SelectCartridgeSave" value="{t}Use{/t}">
        <input type="submit" name="SelectCartridgeCancel" value="{t}Cancel{/t}">
+       </p>
 </div>
diff --git a/plugins/admin/systems/glpiPrinterCartridgesEdit.tpl b/plugins/admin/systems/glpiPrinterCartridgesEdit.tpl
new file mode 100644 (file)
index 0000000..e740afa
--- /dev/null
@@ -0,0 +1,77 @@
+<table summary="" title="" style="width: 100%;">
+       <tr>
+               <td>
+                       <h2>{t}Generic{/t}</h2>
+                       <table summary="" title="" width="100%" style="vertical-align:top;">    
+                               <tr>
+                                       <td>{t}Name{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="name" value="{$name}" {$nameACL}>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Reference{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="ref" value="{$ref}" {$refACL}>
+                                       </td>
+                               </tr>
+                       </table>
+                       <p class="seperator">&nbsp;</p>
+                       <h2>{t}Comments{/t}</h2>
+                       <table summary="" title="" width="100%" style="vertical-align:top;">    
+                               <tr>
+                                       <td>{t}Comment{/t}
+                                       </td>
+                                       <td>
+                                               <textarea name="comments" {$commentsACL} style="width:100%;">{$comments}</textarea>     
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td style="vertical-align:top;border-left: 1px solid rgb(160, 160, 160);padding-right: 5px;">
+                       <h2>{t}Generic{/t}</h2>
+            <table summary="" title="" width="100%" style="vertical-align:top;">
+                <tr>
+                    <td>{t}Type{/t}
+                    </td>
+                    <td>
+                                               <select name="type" {$typeACL}>
+                            {html_options values=$typeKeys output=$types selected=$type}
+                        </select>
+                        <input type="submit" value="{t}edit{/t}" name="edit_type_cartridge" {$typeACL}>
+                    </td>
+                       </tr>
+                <tr>
+                    <td>{t}Manufacturer{/t}
+                    </td>
+                    <td>
+                                               <select name="FK_glpi_enterprise" {$FK_glpi_enterpriseACL}>
+                            {html_options values=$ManufacturerKeys output=$Manufacturers selected=$FK_glpi_enterprise}
+                        </select>
+                        <input type="submit" value="{t}edit{/t}" name="edit_manufacturer_cartridges" {$FK_glpi_enterpriseACL}>
+                    </td>
+                       </tr>
+                               <tr>
+                    <td>{t}Technical responsible{/t}&nbsp;
+                    </td>
+                    <td>
+                        <i>{$tech_num}&nbsp; </i>&nbsp;
+                        <input type="submit" value="{t}Choose{/t}" name="SelectCartridgeTechPerson" {$tech_numACL}>
+                    </td>
+                </tr>
+                       </table>
+                       <p class="seperator">&nbsp;</p>
+                       {$PrinterTypeMatrix}
+               </td>
+       </tr>
+</table>
+
+<p class="seperator">&nbsp;</p>
+<div style="text-align:right;">
+       <p>
+               <input type="submit" name="SaveCartridge"       value="{t}Save{/t}">&nbsp;
+               <input type="submit" name="CancelCartridge" value="{t}Cancel{/t}"><br>
+       </p>
+</div>
index 9762498e20971c22b4fdbcb6f94d5c40af20eadb..c3b154e45f57dd9195aaf244cf9fce1e047e363d 100644 (file)
@@ -49,5 +49,7 @@
 <input type="hidden" name="ignore">
 <p class="seperator">&nbsp;</p>
 <div align="right">
-       <input type="submit" name="SelectUserCancel" value="{t}Cancel{/t}">
+       <p>
+       <input type="submit" name="{$AbortSelectUser}" value="{t}Cancel{/t}">
+</p>
 </div>
diff --git a/plugins/admin/systems/glpi_edit_cartridge_type.tpl b/plugins/admin/systems/glpi_edit_cartridge_type.tpl
new file mode 100644 (file)
index 0000000..d3f42d0
--- /dev/null
@@ -0,0 +1,15 @@
+<br>
+     <select name="select_type_cartridge" size="8" style="width:80%">
+                            {html_options values=$PrinterTypeKeys output=$PrinterTypes}
+     </select><br>
+        <input name="cartridge_type_string">
+        <input type="submit" name="add_cartridge_type"                 value="{t}Add{/t}" >
+        <input type="submit" name="rename_cartridge_type"      value="{t}Rename{/t}" >
+        <input type="submit" name="del_cartridge_type"                 value="{t}Delete{/t}" >
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+<p>
+<input name="close_edit_type_cartridge" value="{t}close{/t}" type="submit">
+</p>
+</div>