Code

Added some gpi stuff, not complete,
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 2 Jan 2006 10:25:30 +0000 (10:25 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 2 Jan 2006 10:25:30 +0000 (10:25 +0000)
-tech person, manufactuerer, type and os are selectable and will be saved.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2389 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_glpiAccount.inc
plugins/admin/systems/class_glpiManufacturer.inc [new file with mode: 0644]
plugins/admin/systems/class_glpiSelectUser.inc [new file with mode: 0644]
plugins/admin/systems/glpi.tpl
plugins/admin/systems/glpiManufacturer.tpl [new file with mode: 0644]
plugins/admin/systems/glpiManufacturerAdd.tpl [new file with mode: 0644]
plugins/admin/systems/glpiSelectUser.tpl [new file with mode: 0644]
plugins/admin/systems/glpi_edit_os.tpl [new file with mode: 0644]
plugins/admin/systems/glpi_edit_type.tpl [new file with mode: 0644]

index 5632cb462ae2c242a49b10f3e2c7193ed26d4cde..593c5408e623020bab42c97eb5928e5191604650 100644 (file)
@@ -9,20 +9,51 @@ class glpiAccount extends plugin
 
   /* attribute list for save action */
   var $ignore_account= TRUE;
-  var $attributes= array();
+  var $attributes= array("ID","name","contact",
+                         "tech_num","comments","date_mod","os","location","domain","network",
+                         "model","type","is_template","FK_glpi_enterprise","deleted");
+
+  var $ID                 ;
+  var $name               ="";
+  var $contact            ="";
+
+  var $tech_num           ="";
+  var $comments           ="";
+
+  var $date_mod           ="";
+  var $os                 =0;
+  var $location           =0;
+  var $domain             =0;
+  var $network            =0; 
+
+  var $model              =0;
+  var $type               =0;
+  var $is_template        =0;
+  var $FK_glpi_enterprise =0;
+  var $deleted            ="N";
+
   var $objectclasses= array("whatever");
 
   var $initialy_was_account = false;
 
+  var $edit_type    =false;
+  var $edit_os    =false;
+
   var $data;
   var $handle = NULL;
 
+  var $cur_dialog = NULL;
+
+  var $orig_dn;
+  var $ui;
+
   /* Contructor 
-     Sets default values and checks if we already hae an existing glpi account
+     Sets default values and checks if we already have an existing glpi account
   */
   function glpiAccount ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
+    $this->ui= get_userinfo();
 
     if(!isset($this->config->data['SERVERS']['GLPI'])){
       return;
@@ -42,10 +73,18 @@ class glpiAccount extends plugin
 
     if($this->handle->is_account($this->dn)){
       $this->is_account = true;
+      $tmp = ($this->handle->getComputerInformations($this->dn));
+
+      foreach(array("tech_num","os","FK_glpi_enterprise","type","comments") as $attr){
+        $this->$attr = $tmp[0][$attr];
+      }
+
     }else{
       $this->is_account = false;
     }
 
+    $this->name = $this->dn;
+    $this->orig_dn = $this->dn;
     $this->initialy_was_account = $this->is_account;
   }
 
@@ -58,13 +97,153 @@ class glpiAccount extends plugin
     $smarty= get_smarty();
     $display= "";
 
+    // #fixme
+    // Check if mysql a.s.o. is available.
+    
+
+    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+    $users = ($this->handle->getUsers());
+
+    $ldap= $this->config->get_ldap_link();
+
+
+  /* System type management
+   */
+  if(isset($_POST['edit_type'])){
+    $this->dialog = true;
+    $this->edit_type=true;
+  }
+
+  if(isset($_POST['close_edit_type'])){
+    $this->edit_type=false;
+    $this->dialog = false;
+  }
+
+  if((isset($_POST['add_type']))&&(!empty($_POST['type_string']))){
+    $this->handle->addSystemType($_POST['type_string']);  
+  }
+
+  if((isset($_POST['del_type']))&&(!empty($_POST['select_type']))){
+    $this->handle->removeSystemType_byID($_POST['select_type']);  
+  }
+
+  if((isset($_POST['rename_type']))&&(!empty($_POST['select_type']))&&(!empty($_POST['type_string']))){
+    $this->handle->updateSystemType($_POST['type_string'],$_POST['select_type']);
+  }
+
+  if($this->edit_type){
+    $smarty->assign("SystemTypes",            $this->handle->getSystemTypes());
+    $smarty->assign("SystemTypeKeys",         array_flip($this->handle->getSystemTypes()));
+
+    $display= $smarty->fetch(get_template_path('glpi_edit_type.tpl', TRUE));
+    return($display);
+  }
+
+  /*  ENDE, Systemtype management.
+   */
+  
+  /* System os management
+   */
+  if(isset($_POST['edit_os'])){
+    $this->dialog = true;
+    $this->edit_os=true;
+  }
+
+  if(isset($_POST['close_edit_os'])){
+    $this->edit_os=false;
+    $this->dialog = false;
+  }
+
+  if((isset($_POST['add_os']))&&(!empty($_POST['is_string']))){
+    $this->handle->addOS($_POST['is_string']);  
+  }
+
+  if((isset($_POST['del_os']))&&(!empty($_POST['select_os']))){
+    $this->handle->removeOS_byID($_POST['select_os']);  
+  }
+
+  if((isset($_POST['rename_os']))&&(!empty($_POST['select_os']))&&(!empty($_POST['is_string']))){
+    $this->handle->updateOS($_POST['is_string'],$_POST['select_os']);
+  }
+
+  if($this->edit_os){
+    $smarty->assign("OSKeys",                 array_flip($this->handle->getOSTypes()));
+    $smarty->assign("OSs",                    $this->handle->getOSTypes());
+
+    $display= $smarty->fetch(get_template_path('glpi_edit_os.tpl', TRUE));
+    return($display);
+  }
+
+  /*  ENDE, os management.
+   */
+  
+  if(isset($_POST['edit_manufacturer'])){
+    $this->cur_dialog = new glpiManufacturer($this->config,$this->dn);
+    $this->cur_dialog->parent = &$this;
+  }
+
+  if(isset($_POST['close_edit_manufacturer'])){
+    $this->cur_dialog = false;
+  }
+
+
+    if(isset($_POST['SelectTechPerson'])){
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn);
+    }
+
+    /* Technical responsible person selected*/
+    if(isset($_GET['act'])&&($_GET['act']=="user_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->handle->addUser($tmp,$id);
+      }
+      
+      /* Re-read users */
+      $users = ($this->handle->getUsers());
+
+      /* Get user */
+      $tmp = array_flip($users);
+      $id=$tmp[$id];
+    
+      /* Use user id, close dialog */
+      $this->tech_num = $id;
+      $this->cur_dialog   = false;
+      $this->dialog= false;
+    }
+
+    if($this->cur_dialog){
+      $this->cur_dialog->save_object();
+      $this->dialog=true;
+      return($this->cur_dialog->execute());
+    }
+
     /* Assign smarty defaults */ 
-    foreach(array("SystemTypes","Manufacturers","OSs","TechnicalResponsibles","InstalledDevices","Attachments") as $attr){
+    foreach(array("SystemTypes","SystemTypeKeys","Manufacturers","OSs","TechnicalResponsibles","InstalledDevices","Attachments") as $attr){
       $smarty->assign($attr,array());
       $smarty->assign($attr."ACL"," disabled ");
     }
 
-    foreach(array("SystemType","Manufacturer","OS","TechnicalResponsible") as $attr){
+    foreach(array("type","FK_glpi_enterprise","os","tech_num") as $attr){
       $smarty->assign($attr,"");
       $smarty->assign($attr."ACL"," disabled ");
     }
@@ -86,7 +265,7 @@ class glpiAccount extends plugin
     $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
 
     if(!$this->handle->is_connected){
-      print_red(_("Can't copnnect to specified database."));
+      print_red(_("Can't connect to specified database."));
       return($smarty->fetch(get_template_path('glpi.tpl', TRUE)));
     }
 
@@ -102,32 +281,52 @@ class glpiAccount extends plugin
     /* Show tab dialog headers */
     if ($this->is_account){
       $display= $this->show_header(_("Remove DNS service"),
-          _("This server has DNS features enabled. You can disable them by clicking below."));
+          _("This server has inventory features enabled. You can disable them by clicking below."));
     } else {
       $display= $this->show_header(_("Add DNS service"),
-          _("This server has DNS features disabled. You can enable them by clicking below."));
+          _("This server has inventory features disabled. You can enable them by clicking below."));
       return ($display);
     }
 
 
-    foreach(array("SystemType","Manufacturer","OS","TechnicalResponsible","InstalledDevices","Attachments") as $attr){
-      $smarty->assign($attr,"");
+    foreach($this->attributes as $attr){
       $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
     }
-    
-
-    $smarty->assign("SystemTypes",$this->handle->getSystemTypes());
-    $smarty->assign("SystemType","os");
-
-    $smarty->assign("OSs",$this->handle->getOSTypes());
-    $smarty->assign("OS","is");
-
-    $smarty->assign("Manufacturers",$this->handle->getEnterprisesTypes());
-    $smarty->assign("Manufacturer","still");
-
-    $smarty->assign("TechnicalResponsibles",array("os","is","still","missing"));
-    $smarty->assign("TechnicalResponsible","missing");
 
+    
+    $smarty->assign("SystemTypeKeys",         array_flip($this->handle->getSystemTypes()));
+    $smarty->assign("SystemTypes",            $this->handle->getSystemTypes());
+    $smarty->assign("type",                   $this->type);
+
+    $smarty->assign("OSKeys",                 array_flip($this->handle->getOSTypes()));
+    $smarty->assign("OSs",                    $this->handle->getOSTypes());
+    $smarty->assign("os",                     $this->os);
+
+    $smarty->assign("ManufacturerKeys",       array_flip($this->handle->getEnterprisesTypes()));
+    $smarty->assign("Manufacturers",          $this->handle->getEnterprisesTypes());
+    $smarty->assign("FK_glpi_enterprise",     $this->FK_glpi_enterprise);
+
+    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"));
+    }
+    $smarty->assign("comments",               $this->comments);
 
     $display.= $smarty->fetch(get_template_path('glpi.tpl', TRUE));
     return($display);
@@ -142,6 +341,11 @@ class glpiAccount extends plugin
   function save_object()
   {
     plugin::save_object();
+    foreach($this->attributes as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }
+    }
   }
 
 
@@ -150,13 +354,29 @@ class glpiAccount extends plugin
   {
     $message= array();
 
+//    if($this->TechnicalResponsible == ""){
+//      $message[] = _("Please select a technical responsible person for this entry.");
+//    }
+
     return ($message);
   }
 
-
   /* Save to LDAP */
   function save()
   {
+    $attrs = array();
+    $this->date_mod = date("Y-m-d H:i:s");
+    foreach($this->attributes as $attr){
+      $attrs[$attr] = $this->$attr;
+    }
+    $attrs['name'] = $this->dn;
+    unset($attrs['ID']);
+    $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
+    if($this->initialy_was_account&&$this->is_account){
+      $this->handle->updateComputerInformations($attrs,$this->dn);
+    }elseif($this->is_account){
+      $this->handle->addComputerInformations($attrs,$this->dn);
+    }
   }
 
 }
diff --git a/plugins/admin/systems/class_glpiManufacturer.inc b/plugins/admin/systems/class_glpiManufacturer.inc
new file mode 100644 (file)
index 0000000..8463743
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+
+class glpiManufacturer 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("name","type","address","website","phonenumber","comments","deleted","fax","email");
+  var $objectclasses= array("whatever");
+
+  var $ui;
+
+  var $editMode = false;
+  var $Edit_Add = "edit";
+
+  var $name       ="";
+  var $type       ="";
+  var $address    ="";
+  var $website    ="";
+  var $phonenumber="";
+  var $comments   ="";
+  var $deleted    ="";
+  var $fax        ="";
+  var $email      ="";
+  var $ID         =-1;
+
+  function glpiManufacturer($config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+    $this->ui = get_userinfo();  
+  }
+
+  function execute()
+  {
+    $smarty  = get_smarty();
+    $display = "";
+
+    if((isset($_POST['remove_manu']))&&(isset($_POST['manufacturer']))){
+      $this->parent->handle->removeEnterprisesType($_POST['manufacturer']);
+    }
+
+    if(isset($_POST['add_manu'])){
+      $this->editMode = true;
+      $this->Edit_Add = "add";
+      foreach($this->attributes as $atr){
+        $this->$atr = "";
+      }
+    }
+
+    if((isset($_POST['edit_manu']))&&(isset($_POST['manufacturer']))){
+      $this->editMode = true;
+      $this->Edit_Add = "edit";
+      $tmp = $this->parent->handle->getEnterprise($_POST['manufacturer']);
+      $tmp = $tmp[0];
+      foreach($this->attributes as $atr){
+        $this->$atr = "";
+      }
+      foreach($this->attributes as $atr){
+        if(isset($tmp[$atr])){
+          $this->$atr = $tmp[$atr];
+        }
+      }
+      $this->ID = $_POST['manufacturer'];
+    }
+
+    if(isset($_POST['close_manufacturer'])){
+      $this->editMode=false;
+    }
+
+    if(isset($_POST['save_manufacturer'])){
+
+      $tmp = array();
+      foreach($this->attributes as $attrs){
+        $tmp[$attrs]=$this->$attrs;
+      }
+
+      if($this->Edit_Add == "add"){
+        $this->parent->handle->addEnterprisesType($tmp);
+      }else{
+        $this->parent->handle->updateEnterprisesType($tmp,$this->ID);
+      }
+
+      $this->editMode=false;
+    }
+
+    if($this->editMode == true){
+      $this->save_object();
+      foreach($this->attributes as $attrs){
+        $smarty->assign($attrs,$this->$attrs);
+      }
+
+      $display.= $smarty->fetch(get_template_path('glpiManufacturerAdd.tpl', TRUE));
+      return($display);
+    }
+
+
+    $smarty->assign("Manus",    $this->parent->handle->getEnterprisesTypes());
+    $smarty->assign("ManuKeys", array_flip($this->parent->handle->getEnterprisesTypes()));
+    $display.= $smarty->fetch(get_template_path('glpiManufacturer.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+  }
+
+  function save_object()
+  {
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = $_POST[$attr];
+      }
+    }
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/class_glpiSelectUser.inc b/plugins/admin/systems/class_glpiSelectUser.inc
new file mode 100644 (file)
index 0000000..27cd281
--- /dev/null
@@ -0,0 +1,240 @@
+<?php
+
+class glpiSelectUser 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();
+  var $objectclasses= array("whatever");
+
+  var $users = array();
+  var $departments = array();
+
+  var $ui;
+
+  function glpiSelectUser ($config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+
+    if(!isset($_SESSION['glpi_user_filter'])){
+      $tmp['users_regex'] = "*";
+      $tmp['base']       = $this->config->current['BASE'];
+      $_SESSION['glpi_user_filter'] = $tmp;
+    }
+
+    $this->ui = get_userinfo();  
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    $filter = $_SESSION['glpi_user_filter'];
+
+    $s_action="";
+
+    /* Test Posts */
+    foreach($_POST as $key => $val){
+      // Post for delete
+      if(preg_match("/dep_back.*/i",$key)){
+        $s_action="back";
+      }elseif(preg_match("/user_new.*/",$key)){
+        $s_action="new";
+      }elseif(preg_match("/dep_home.*/i",$key)){
+        $s_action="home";
+      }
+    }
+
+    /* Homebutton is posted */
+    if($s_action=="home"){
+      $filter['base']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
+      $filter['base']=(preg_replace("/^[^,]+,/","",$filter['base']));
+    }
+
+    if($s_action=="root"){
+      $filter['base']=($this->config->current['BASE']);
+    }
+
+
+    /* If Backbutton is Posted */
+    if($s_action=="back"){
+      $base_back          = preg_replace("/^[^,]+,/","",$filter['base']);
+      $base_back          = convert_department_dn($base_back);
+
+      if(isset($this->config->departments[trim($base_back)])){
+        $filter['base']= $this->config->departments[trim($base_back)];
+      }else{
+        $filter['base']= $this->config->departments["/"];
+      }
+    }
+
+    if((isset($_GET['act']))&&($_GET['act']=="dep_open")){
+      $entry = base64_decode($_GET['dep_id']);
+      $filter['base']= ($this->config->departments[$entry]); 
+    }    
+
+    $_SESSION['glpi_user_filter'] = $filter;
+
+    $this->reload();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    $divlist = new divlist("glpi users");
+    $divlist->SetEntriesPerPage(0);
+    $divlist->SetHeader(array(
+          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
+          array("string" => _("Users")." / "._("Departments"), "attach" => "style=''"),
+          array("string" => _("Use"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
+    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
+    foreach($this->departments as $key=> $val){
+
+      if(!isset($this->config->departments[trim($key)])){
+        $this->config->departments[trim($key)]="";
+      }
+
+      $non_empty="";
+      $keys= str_replace("/","\/",$key);
+      foreach($this->config->departments as $keyd=>$vald ){
+        if(preg_match("/".$keys."\/.*/",$keyd)){
+          $non_empty="full";
+        }
+      }
+
+      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style=''");
+      $field3 = array("string" => "&nbsp;", "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+      $divlist->AddEntry(array($field1,$field2,$field3));
+    }
+
+    $useruse = "<a href='?plug=".$_GET['plug']."&amp;act=user_tech_num&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;'");
+      $field2 = array("string" => sprintf($useruse,base64_encode($key),$user), "attach" => "style=''");
+      $field3 = array("string" => sprintf($useruse,base64_encode($key),"<img border=0 src='images/crossref.png' alt='"._("use")."'>"), 
+        "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+      $divlist->AddEntry(array($field1,$field2,$field3));
+      
+    }
+
+
+
+
+
+
+
+
+
+    $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;".
+      " <input class='center' type='image' src='images/list_root.png' 
+      align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
+      "</div>";
+
+
+    $filter= $_SESSION['glpi_user_filter'];
+    $smarty->assign("usershead", $listhead);
+    $smarty->assign("users", $divlist->DrawList());
+    $smarty->assign("search_image", get_template_path('images/search.png'));
+    $smarty->assign("searchu_image", get_template_path('images/search_user.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("apply", apply_filter());
+    $smarty->assign("alphabet", generate_alphabet());
+    $smarty->assign("users_regex", $filter['users_regex']);
+
+
+    $display.= $smarty->fetch(get_template_path('glpiSelectUser.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+
+    /* Optionally execute a command after we're done */
+#$this->handle_post_events($mode);
+  }
+
+  function reload()
+  {
+
+    $filter= $_SESSION['glpi_user_filter'];
+
+    $base = $filter['base'];
+    $regex= $filter['users_regex'];
+    /* NEW LIST MANAGMENT
+     * We also need to search for the departments
+     * So we are able to navigate like in konquerer
+     */
+
+    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+        TRUE, $base, array("ou", "description"), TRUE);
+
+    $this->departments= array();
+    $tmp = array();
+    foreach ($res3 as $value){
+      $tmp[strtolower($value['dn']).$value['dn']]=$value;
+    }
+    ksort($tmp);
+    foreach($tmp as $value){
+      if(isset($value["description"][0])){
+        $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+      }else{
+        $this->departments[$value['dn']]=convert_department_dn2($value['dn']);//$value["description"][0];
+      }
+    }
+
+    /* END NEW LIST MANAGMENT
+     */
+    $ou = get_people_ou();
+    $res2 = get_list($this->ui->subtreeACL, "(&(|(cn=$regex)(sn=$regex))(objectClass=person))",
+        TRUE,$ou.$base, array("cn","sn","uid","givenName", "description"), TRUE);
+
+    $tmp = array();
+
+    foreach($res2 as $val){
+      $str = "";
+      if(isset($val['givenName'][0])){
+        $str .= $val['givenName'][0];
+      }
+      if(isset($val['sn'][0])){
+        $str .= $val['sn'][0];
+      }
+      if(isset($val['uid'][0])){
+        $str .= $val['uid'][0];
+      }
+
+      $tmp[$str] = $val;
+    }
+
+    ksort($tmp);
+    $this->users = array();
+    foreach($tmp as $value){
+      if (isset($value["givenName"][0]) && isset($value["sn"][0])){
+        $this->users[$value['dn']]= $value["sn"][0].", ".
+          $value["givenName"][0].
+          " [".$value["uid"][0]."]";
+      } else {
+        $this->users[$value["dn"]]= "[".$value["uid"][0]."]";
+      }
+    }
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 120ca6e652fd283c9fe2c7eefa74299418b9f982..91001397620265c34b61a7b054d5500d1536336b 100644 (file)
@@ -6,39 +6,40 @@
                        <h2>{t}Generic{/t}</h2>
                        <table summary="">
                                <tr>
-                                       <td>{t}System type{/t}
+                                       <td width="150">{t}System type{/t}
                                        </td>
                                        <td>
-                                               <select name="SystemType" {$SystemTypeACL}>
-                                                       {html_options values=$SystemTypes output=$SystemTypes selected=$SystemType}
-                                               </select>       
+                                               <select name="type" {$typeACL}>
+                                                       {html_options values=$SystemTypeKeys output=$SystemTypes selected=$type}
+                                               </select>
+                                               <input type="submit" value="{t}edit{/t}" name="edit_type">      
                                        </td>
                                </tr>
                                <tr>
                                        <td>{t}Operating system{/t}
                                        </td>
                                        <td>
-                                               <select name="OS" {$OSACL}>
-                                                       {html_options values=$OSs output=$OSs selected=$OS}
+                                               <select name="os" {$osACL}>
+                                                       {html_options values=$OSKeys output=$OSs selected=$os}
                                                </select>       
+                                               <input type="submit" value="{t}edit{/t}" name="edit_os">        
                                        </td>
                                </tr>
                                <tr>
                                        <td>{t}Manufacturer{/t}
                                        </td>
                                        <td>
-                                               <select name="Manufacturer" {$ManufacturerACL}>
-                                                       {html_options values=$Manufacturers output=$Manufacturers selected=$Manufacturer}
+                                               <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">      
                                        </td>
                                </tr>
                                <tr>
-                                       <td>{t}Technicalresposible{/t}
+                                       <td>{t}Technicalresposible{/t}&nbsp;
                                        </td>
                                        <td>
-                                               <select name="TechnicalResponsible" {$TechnicalResponsibleACL}>
-                                                       {html_options values=$TechnicalResponsibles output=$TechnicalResponsibles selected=$TechnicalResponsible}
-                                               </select>       
+                                               <i>{$tech_num}</i>&nbsp;<input type="submit" value="{t}Choose{/t}" name="SelectTechPerson">
                                        </td>
                                </tr>
                        </table>
                                </tr>
                                <tr>
                                        <td>
-                                               {t}Comments{/t}
+                                               {t}Coments{/t}
                                        </td>
                                        <td>
-                                               <textarea name="Comments" style="width:100%;height:110px;" ></textarea>
+                                               <textarea name="comments" style="width:100%;height:110px;" >{$comments}</textarea>
                                        </td>
                                </tr>
                        </table>
diff --git a/plugins/admin/systems/glpiManufacturer.tpl b/plugins/admin/systems/glpiManufacturer.tpl
new file mode 100644 (file)
index 0000000..df6469c
--- /dev/null
@@ -0,0 +1,15 @@
+<br>
+<select name="manufacturer" style="width:600px;" size="8">
+  {html_options values=$ManuKeys output=$Manus}
+</select>
+<br>
+<input name="add_manu"                 value="{t}Add{/t}"              type="submit">
+<input name="edit_manu"        value="{t}Edit{/t}"     type="submit">
+<input name="remove_manu"      value="{t}Remove{/t}"   type="submit">
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+<p>
+       <input name="close_edit_manufacturer" value="{t}Close{/t}" type="submit">
+</p>
+</div>
diff --git a/plugins/admin/systems/glpiManufacturerAdd.tpl b/plugins/admin/systems/glpiManufacturerAdd.tpl
new file mode 100644 (file)
index 0000000..e4d24a6
--- /dev/null
@@ -0,0 +1,89 @@
+<table summary="" width="100%">
+       <tr>
+               <td width="50%">
+                       <table summary="" width="100%">
+                               <tr>
+                                       <td>{t}Name{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="name" value="{$name}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Type{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="type" value="{$type}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Address{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="address" value="{$address}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Website{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="website" value="{$website}">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+               <td>
+                       <table summary="" width="100%">
+                               <tr>
+                                       <td>{t}Phone number{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="phonenumber" value="{$phonenumber}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Comments{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="comments" value="{$comments}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Fax{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="fax" value="{$fax}">
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Email{/t}
+                                       </td>
+                                       <td>
+                                               <input type="text" name="email" value="{$email}">
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+
+
+
+
+
+
+
+
+
+
+
+
+
+<br>
+<p class="seperator">&nbsp;</p>
+<div align="right">
+<p>
+       <input name="save_manufacturer" value="{t}Save{/t}" type="submit">
+       <input name="close_manufacturer" value="{t}Close{/t}" type="submit">
+</p>
+</div>
diff --git a/plugins/admin/systems/glpiSelectUser.tpl b/plugins/admin/systems/glpiSelectUser.tpl
new file mode 100644 (file)
index 0000000..166ce51
--- /dev/null
@@ -0,0 +1,53 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:50%;" >
+  <div class="contentboxh">
+    <p class="contentboxh">
+     {t}List of users{/t}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$usershead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$users}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top;">
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb">
+   <p class="contentboxb">
+    {t}This dialog allows you to select a user as technical responsible person.{/t}
+   </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+   </div>
+   <div class="contentboxb">
+     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+      {$alphabet}
+     </table>
+<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+<tr>
+<td><LABEL for="regex"><img alt="{t}Display users matching{/t}" src="{$search_image}" align=middle></label></td>
+<td width="99%">
+<input type='text' style='width:99%' name='regex' maxlength='20' value='{$users_regex}' title='{t}Regular expression for matching user names{/t}' onChange="mainform.submit()">
+</td>
+</tr>
+</table>
+   {$apply}
+   </div>
+  </td>
+</tr>
+</table>
+
+<input type="hidden" name="ignore">
+<p class="seperator">&nbsp;</p>
+<div align="right">
+       <input type="submit" name="SelectUserCancel" value="{t}Cancel{/t}">
+</div>
diff --git a/plugins/admin/systems/glpi_edit_os.tpl b/plugins/admin/systems/glpi_edit_os.tpl
new file mode 100644 (file)
index 0000000..9f31bbd
--- /dev/null
@@ -0,0 +1,15 @@
+<br>
+     <select name="select_os" size="8" style="width:80%">
+                            {html_options values=$OSKeys output=$OSs}
+     </select><br>
+        <input name="is_string">
+        <input type="submit" name="add_os"             value="{t}Add{/t}" >
+        <input type="submit" name="rename_os"  value="{t}Rename{/t}" >
+        <input type="submit" name="del_os"             value="{t}Delete{/t}" >
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+<p>
+<input name="close_edit_os" value="{t}close{/t}" type="submit">
+</p>
+</div>
diff --git a/plugins/admin/systems/glpi_edit_type.tpl b/plugins/admin/systems/glpi_edit_type.tpl
new file mode 100644 (file)
index 0000000..a9a01ba
--- /dev/null
@@ -0,0 +1,15 @@
+<br>
+     <select name="select_type" size="8" style="width:80%">
+                            {html_options values=$SystemTypeKeys output=$SystemTypes}
+     </select><br>
+        <input name="type_string">
+        <input type="submit" name="add_type"           value="{t}Add{/t}" >
+        <input type="submit" name="rename_type"        value="{t}Rename{/t}" >
+        <input type="submit" name="del_type"           value="{t}Delete{/t}" >
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+<p>
+<input name="close_edit_type" value="{t}close{/t}" type="submit">
+</p>
+</div>