Code

Some changes for glpi
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 3 Jan 2006 13:18:35 +0000 (13:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 3 Jan 2006 13:18:35 +0000 (13:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2395 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_glpiAccount.inc
plugins/admin/systems/class_glpiDeviceManagement.inc [new file with mode: 0644]
plugins/admin/systems/class_glpiManufacturer.inc
plugins/admin/systems/glpiDeviceManagement.tpl [new file with mode: 0644]
plugins/admin/systems/glpiManufacturerAdd.tpl
plugins/admin/systems/glpi_devices.tpl [new file with mode: 0644]

index 593c5408e623020bab42c97eb5928e5191604650..117aa379252699a08db0270f4e689ce3deb0e490 100644 (file)
@@ -10,8 +10,8 @@ class glpiAccount extends plugin
   /* attribute list for save action */
   var $ignore_account= TRUE;
   var $attributes= array("ID","name","contact",
-                         "tech_num","comments","date_mod","os","location","domain","network",
-                         "model","type","is_template","FK_glpi_enterprise","deleted");
+      "tech_num","comments","date_mod","os","location","domain","network",
+      "model","type","is_template","FK_glpi_enterprise","deleted");
 
   var $ID                 ;
   var $name               ="";
@@ -49,7 +49,7 @@ class glpiAccount extends plugin
 
   /* Contructor 
      Sets default values and checks if we already have an existing glpi account
-  */
+   */
   function glpiAccount ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
@@ -58,15 +58,15 @@ class glpiAccount extends plugin
     if(!isset($this->config->data['SERVERS']['GLPI'])){
       return;
     }
-    
+
     $this->data = $this->config->data['SERVERS']['GLPI'];
-    
+
     if(!is_callable("mysql_connect")){
       return;
     }
-    
+
     $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
-    
+
     if(!$this->handle->is_connected){
       return;
     } 
@@ -90,8 +90,8 @@ class glpiAccount extends plugin
 
   function execute()
   {
-       /* Call parent execute */
-         plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
 
     /* Fill templating stuff */
     $smarty= get_smarty();
@@ -99,93 +99,103 @@ class glpiAccount extends plugin
 
     // #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();
 
+    if(isset($_POST['AddDevice'])){
+      $this->dialog =true;
+      $this->cur_dialog = new glpiDeviceManagement($this->config,$this->dn);
+    }
 
-  /* 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;
-  }
+    /* System type management
+     */
+    if(isset($_POST['edit_type'])){
+      $this->dialog = true;
+      $this->edit_type=true;
+    }
 
-  if((isset($_POST['add_type']))&&(!empty($_POST['type_string']))){
-    $this->handle->addSystemType($_POST['type_string']);  
-  }
+    if(isset($_POST['close_edit_type'])){
+      $this->edit_type=false;
+      $this->dialog = false;
+    }
 
-  if((isset($_POST['del_type']))&&(!empty($_POST['select_type']))){
-    $this->handle->removeSystemType_byID($_POST['select_type']);  
-  }
+    if((isset($_POST['add_type']))&&(!empty($_POST['type_string']))){
+      $this->handle->addSystemType($_POST['type_string']);  
+    }
 
-  if((isset($_POST['rename_type']))&&(!empty($_POST['select_type']))&&(!empty($_POST['type_string']))){
-    $this->handle->updateSystemType($_POST['type_string'],$_POST['select_type']);
-  }
+    if((isset($_POST['del_type']))&&(!empty($_POST['select_type']))){
+      $this->handle->removeSystemType_byID($_POST['select_type']);  
+    }
 
-  if($this->edit_type){
-    $smarty->assign("SystemTypes",            $this->handle->getSystemTypes());
-    $smarty->assign("SystemTypeKeys",         array_flip($this->handle->getSystemTypes()));
+    if((isset($_POST['rename_type']))&&(!empty($_POST['select_type']))&&(!empty($_POST['type_string']))){
+      $this->handle->updateSystemType($_POST['type_string'],$_POST['select_type']);
+    }
 
-    $display= $smarty->fetch(get_template_path('glpi_edit_type.tpl', TRUE));
-    return($display);
-  }
+    if($this->edit_type){
+      $smarty->assign("SystemTypes",            $this->handle->getSystemTypes());
+      $smarty->assign("SystemTypeKeys",         array_flip($this->handle->getSystemTypes()));
 
-  /*  ENDE, Systemtype management.
-   */
-  
-  /* System os management
-   */
-  if(isset($_POST['edit_os'])){
-    $this->dialog = true;
-    $this->edit_os=true;
-  }
+      $display= $smarty->fetch(get_template_path('glpi_edit_type.tpl', TRUE));
+      return($display);
+    }
 
-  if(isset($_POST['close_edit_os'])){
-    $this->edit_os=false;
-    $this->dialog = false;
-  }
+    /*  ENDE, Systemtype management.
+     */
 
-  if((isset($_POST['add_os']))&&(!empty($_POST['is_string']))){
-    $this->handle->addOS($_POST['is_string']);  
-  }
+    /* System os management
+     */
+    if(isset($_POST['edit_os'])){
+      $this->dialog = true;
+      $this->edit_os=true;
+    }
 
-  if((isset($_POST['del_os']))&&(!empty($_POST['select_os']))){
-    $this->handle->removeOS_byID($_POST['select_os']);  
-  }
+    if(isset($_POST['close_edit_os'])){
+      $this->edit_os=false;
+      $this->dialog = false;
+    }
 
-  if((isset($_POST['rename_os']))&&(!empty($_POST['select_os']))&&(!empty($_POST['is_string']))){
-    $this->handle->updateOS($_POST['is_string'],$_POST['select_os']);
-  }
+    if((isset($_POST['add_os']))&&(!empty($_POST['is_string']))){
+      $this->handle->addOS($_POST['is_string']);  
+    }
 
-  if($this->edit_os){
-    $smarty->assign("OSKeys",                 array_flip($this->handle->getOSTypes()));
-    $smarty->assign("OSs",                    $this->handle->getOSTypes());
+    if((isset($_POST['del_os']))&&(!empty($_POST['select_os']))){
+      $this->handle->removeOS_byID($_POST['select_os']);  
+    }
 
-    $display= $smarty->fetch(get_template_path('glpi_edit_os.tpl', TRUE));
-    return($display);
-  }
+    if((isset($_POST['rename_os']))&&(!empty($_POST['select_os']))&&(!empty($_POST['is_string']))){
+      $this->handle->updateOS($_POST['is_string'],$_POST['select_os']);
+    }
 
-  /*  ENDE, os management.
-   */
-  
-  if(isset($_POST['edit_manufacturer'])){
-    $this->cur_dialog = new glpiManufacturer($this->config,$this->dn);
-    $this->cur_dialog->parent = &$this;
-  }
+    if($this->edit_os){
+      $smarty->assign("OSKeys",                 array_flip($this->handle->getOSTypes()));
+      $smarty->assign("OSs",                    $this->handle->getOSTypes());
 
-  if(isset($_POST['close_edit_manufacturer'])){
-    $this->cur_dialog = false;
-  }
+      $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->dialog = true;
+    }
+
+    if(isset($_POST['close_edit_manufacturer'])){
+      $this->dialog = false;
+      $this->cur_dialog = false;
+    }
 
+    if(isset($_POST['SelectUserCancel'])){
+      $this->dialog = false;
+      $this->cur_dialog = false;
+    }
 
     if(isset($_POST['SelectTechPerson'])){
       $this->cur_dialog= new glpiSelectUser($this->config,$this->dn);
@@ -204,8 +214,8 @@ class glpiAccount extends plugin
         $atr = $ldap->fetch($ldap->cat($id));
         $tmp = array();
         $use = array( "cn"              =>"name",
-                      "mail"            =>"email",
-                      "telephoneNumber" =>"phone");
+            "mail"            =>"email",
+            "telephoneNumber" =>"phone");
 
         /* Create array */
         foreach($use as $gosa => $glpi){
@@ -213,18 +223,18 @@ class glpiAccount extends plugin
             $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;
@@ -234,6 +244,7 @@ class glpiAccount extends plugin
     if($this->cur_dialog){
       $this->cur_dialog->save_object();
       $this->dialog=true;
+      $this->cur_dialog->parent = &$this;
       return($this->cur_dialog->execute());
     }
 
@@ -280,10 +291,10 @@ class glpiAccount extends plugin
 
     /* Show tab dialog headers */
     if ($this->is_account){
-      $display= $this->show_header(_("Remove DNS service"),
+      $display= $this->show_header(_("Remove inventory service"),
           _("This server has inventory features enabled. You can disable them by clicking below."));
     } else {
-      $display= $this->show_header(_("Add DNS service"),
+      $display= $this->show_header(_("Add inventory service"),
           _("This server has inventory features disabled. You can enable them by clicking below."));
       return ($display);
     }
@@ -293,7 +304,7 @@ class glpiAccount extends plugin
       $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
     }
 
-    
+
     $smarty->assign("SystemTypeKeys",         array_flip($this->handle->getSystemTypes()));
     $smarty->assign("SystemTypes",            $this->handle->getSystemTypes());
     $smarty->assign("type",                   $this->type);
@@ -316,7 +327,7 @@ class glpiAccount extends plugin
       if(isset($tr['sn'][0])){
         $str .= $tr['sn'][0]." ";
       }
-  
+
       if(isset($tr['uid'][0])){
         $str .= "[".$tr['uid'][0]."]";
       }
@@ -354,9 +365,9 @@ class glpiAccount extends plugin
   {
     $message= array();
 
-//    if($this->TechnicalResponsible == ""){
-//      $message[] = _("Please select a technical responsible person for this entry.");
-//    }
+    //    if($this->TechnicalResponsible == ""){
+    //      $message[] = _("Please select a technical responsible person for this entry.");
+    //    }
 
     return ($message);
   }
diff --git a/plugins/admin/systems/class_glpiDeviceManagement.inc b/plugins/admin/systems/class_glpiDeviceManagement.inc
new file mode 100644 (file)
index 0000000..195bea3
--- /dev/null
@@ -0,0 +1,293 @@
+<?php
+
+class glpiDeviceManagement 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 $devices = array();
+  var $ui;
+
+  var $parent   ;
+  var $EditEntry;
+  var $editMode =false;
+
+  var $DeviceAttrs = array();
+  var $AllowedDevices = array();
+
+
+  function glpiDeviceManagement ($config, $dn= NULL)
+  {
+    plugin::plugin ($config, $dn);
+
+    if(!isset($_SESSION['glpiDeviceRegex'])){
+      $tmp['device_regex'] = "*";
+      $_SESSION['glpiDeviceRegex'] = $tmp;
+    }
+    $this->ui = get_userinfo();  
+    /* Specify which vars are allowed for a sepcific type of device */ 
+    $this->DeviceAttrs['case']      = array("designation","format","comment","FK_glpi_enterprise");
+    $this->DeviceAttrs['moboard']   = array("designation","chipset","comment","FK_glpi_enterprise");
+    $this->DeviceAttrs['processor'] = array("designation","frequence","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['iface']     = array("designation","bandwidth","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['ram']       = array("designation","frequence","comment","FK_glpi_enterprise","specif_default","type");
+    $this->DeviceAttrs['hdd']       = array("designation","rpm","interface","cache","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['drive']     = array("designation","speed","interface","is_writer","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['control']   = array("designation","interface","raid","comment","FK_glpi_enterprise");
+    $this->DeviceAttrs['gfxcard']   = array("designation","ram","interface","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['sndcard']   = array("designation","type","comment","FK_glpi_enterprise","specif_default");
+    $this->DeviceAttrs['power']     = array("designation","power","comment","FK_glpi_enterprise","atx");
+    $this->DeviceAttrs['pci']       = array("designation","comment","FK_glpi_enterprise","specif_default");
+
+    $this->AllowedDevices=array("case","moboard","sndcard","processor","iface","ram","hdd","drive","control","gfxcard","power","pci");
+  }
+
+  function execute()
+  {
+    /* Call parent execute */
+    plugin::execute();
+
+    /* Get all defined devices */
+    $this->reload();
+
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Check if we should create a new entry .... */
+    $only_once = true;
+    foreach($_POST as $name => $value){
+      
+      /* All Post vars starts with new */
+      if((preg_match("/^new_/",$name))&&($only_once)){
+    
+        /* do this twice */
+        $only_once = false;
+
+        /*extract device device_type */
+        $deviceType = preg_replace("/_.*$/","",preg_replace("/^new_/","",$name));
+
+        /* Check if type is allowed, and create empty entry */
+        $tmp = array();
+        if((!isset($this->DeviceAttrs[$deviceType]))||((!in_array($deviceType,$this->AllowedDevices)))){
+          print_red(sprintf(_("Internal Error can't create device of type '%s'"),$deviceType));
+        }else{
+          foreach($this->DeviceAttrs[$deviceType] as $attr){
+            $tmp[$attr] = "";
+          }
+          $tmp['device_type'] = $deviceType;
+          $this->EditEntry = $tmp;
+          $this->editMode =true;
+        }
+      }
+    }
+
+    /* Open entry for editing if requested */
+    if((isset($_GET['act']))&&($_GET['act']=="del_device")){
+      $id = base64_decode($_GET['id']);
+      $tmp = $this->devices[$id];
+      $this->parent->handle->deleteDevice($tmp);
+      $this->reload();
+    }
+
+    /* Open entry for editing if requested */
+    if((isset($_GET['act']))&&($_GET['act']=="edit_device")){
+      $id = base64_decode($_GET['id']);
+      $this->editMode =true;
+      $this->EditEntry = $this->devices[$id];
+    }
+
+    /* Abort editing this entry */
+    if(isset($_POST['AbortDeviceChanges'])){
+      $this->EditEntry = array();
+      $this->editMode = false;
+    }
+
+    /* Save all changes made on currently selected entry */
+    if(isset($_POST['SaveDeviceChanges'])){
+    
+      /* First check if all changes made are allowed */
+      if(count($this->check($this->EditEntry))==0){
+        $this->save($this->EditEntry);
+        $this->editMode = false;
+        $this->reload();
+      }else{
+        foreach($this->check($this->EditEntry) as $msg){
+          print_red($msg);
+        }
+      }
+      
+    }
+
+    /* Check if we are currently editing something ? */
+    if($this->editMode == true){
+      return ($this->editDevice($this->EditEntry));
+    }
+
+    /*  ENDE :  GET / POST handling 
+     *  Below, only output generation for headpage
+     */
+
+    $divlist = new divlist("glpi devices");
+    $divlist->SetEntriesPerPage(0);
+    $divlist->SetHeader(array(
+          array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
+          array("string" => _("devices")." / "._("Departments"), "attach" => "style=''"),
+          array("string" => _("Use"), "attach" => "style='width:60px;border-right:0px;text-align:right;'" )));
+
+    $edit = "<a href='?plug=".$_GET['plug']."&amp;act=edit_device&amp;id=%s'>%s</a>";
+    $editdel = "<a href='?plug=".$_GET['plug']."&amp;act=edit_device&amp;id=%s'><img src='images/edit.png' alt='"._("Edit")."' border=0></a>";
+    $editdel.= "<a href='?plug=".$_GET['plug']."&amp;act=del_device&amp;id=%s'><img src='images/edittrash.png' alt='"._("Delete")."' border=0></a>";
+    
+    $useDevice = "<input type='checkbox' value='%s' name='useDevice_%s' >";
+
+    foreach($this->devices as $key=>$user){
+      $field1 = array("string" => sprintf($useDevice,base64_encode($key),base64_encode($key)), "attach" => "style='text-align:center;width:20px;'");
+      $field2 = array("string" => sprintf($edit,base64_encode($key),$user['designation']."&nbsp;[".$user['comment']."]"), "attach" => "style=''");
+      $field3 = array("string" => sprintf($editdel,base64_encode($key),base64_encode($key)), 
+        "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/keyboard.png' title='"._("New mainbord")."' alt='"._("MB")."' name='new_moboard'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New processor")."' alt='"._("P")."' name='new_processor'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New case")."' alt='"._("C")."' name='new_case'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New network interface")."' alt='"._("NI")."' name='new_iface'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New ram")."' alt='"._("R")."' name='new_ram'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New hard disk drive")."' alt='"._("HDD")."' name='new_hdd'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New drives")."' alt='"._("D")."' name='new_drive'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New controllers")."' alt='"._("CS")."' name='new_control'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New graphics card")."' alt='"._("GC")."' name='new_gfxcard'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New sound card")."' alt='"._("SC")."' name='new_sndcard'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New power supply")."' alt='"._("PS")."' name='new_power'>&nbsp;".
+      " <input class='center' type='image' align='middle' 
+      src='mages/list_back.png' title='"._("New other peripherals")."' alt='"._("OC")."' name='new_pci'>&nbsp;".
+      "</div>";
+    $filter= $_SESSION['glpiDeviceRegex'];
+    $smarty->assign("devicehead", $listhead);
+    $smarty->assign("devices", $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("device_regex", $filter['device_regex']);
+
+
+    $display.= $smarty->fetch(get_template_path('glpiDeviceManagement.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save device to glpi database 
+   * If this is a new device, create a new entry, else update this entry 
+   */
+  function save()
+  {
+    if($this->parent->handle->deviceExists($this->EditEntry)){
+      $this->parent->handle->updateDevices($this->EditEntry);
+    }else{
+      $this->parent->handle->addDevice($this->EditEntry);
+    }
+
+  }
+
+  /* this only gets all already defined devices */
+  function reload()
+  {
+    $this->devices = $this->parent->handle->getDevices();
+    ksort($this->devices);
+  }
+
+  /* This funtions saves all POST variables.
+     The variable must be in the array $this->EditEntry 
+  */
+  function save_object()
+  {
+    if(is_array($this->EditEntry)){
+      foreach($this->EditEntry as $name => $value){
+        if(isset($_POST[$name])){
+          $this->EditEntry[$name] = $_POST[$name];
+        }
+
+      }
+    }
+  }
+
+  /* This function cehck all created devices if you wan't to create device specific check 
+      use >>if($attr['device_type']=="moboard")<< to create a device type depending check
+  */
+  function check($attr)
+  {
+    $message = array();
+    if(empty($attr['designation'])){
+      $message[]=(_("You have to specify a valid name for this device."));
+    }
+    return($message);
+  }
+
+  /* This funtions displays the tempalte for all available devices 
+   * This funtion is also used if we create a new device
+   */
+  function editDevice($entry)
+  {
+    $smarty = get_smarty();
+
+    /* Transfer given data to smarty */
+    foreach($this->EditEntry as $name => $value){
+      $smarty->assign($name,$value);
+    }
+  
+    /* Set default select boxes, manufacturers ... */
+    $smarty->assign("device_type",$entry['device_type']);
+
+    $none = array(0 => _("none"));
+    $manufacturer = array_merge($none,$this->parent->handle->getEnterprisesTypes());
+
+    $ramtypes = $this->parent->handle->getRAMTypes();
+
+    $smarty->assign("RAMtypes",     $ramtypes);
+    $smarty->assign("RAMtypeKeys",  array_flip($ramtypes));
+
+    $deviceControlTypes = array_merge($none,$this->parent->handle->getGlpiDeviceControlTypes());
+
+    $smarty->assign("HDDInterfaceKeys",array_flip($deviceControlTypes));
+    $smarty->assign("HDDInterfaces"   , $deviceControlTypes);
+    
+    $gfxControlTypes = array("0"=>_("None"),"AGP"=>"AGP","PCI"=>"PCI","PCI-X"=>"PCI-X","Other"=>_("Other")); 
+
+    $smarty->assign("GFXInterfaceKeys",array_flip($gfxControlTypes));
+    $smarty->assign("GFXInterfaces"   , $gfxControlTypes);
+    
+    $smarty->assign("FK_glpi_enterpriseKeys",array_flip($manufacturer));
+    $smarty->assign("FK_glpi_enterprises", $manufacturer);
+
+    $smarty->assign("formats",array("Large","Medium","Micro"));
+    $smarty->assign("formatKeys",array('Grand','Moyen','Micro'));
+    return($smarty->fetch(get_template_path('glpi_devices.tpl', TRUE)));
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 8463743a2ccae2684c5030105e2068cd9a80f40a..aeedaa4d2ddc07d2098f576214f4c810be8b8359 100644 (file)
@@ -78,13 +78,21 @@ class glpiManufacturer extends plugin
         $tmp[$attrs]=$this->$attrs;
       }
 
-      if($this->Edit_Add == "add"){
-        $this->parent->handle->addEnterprisesType($tmp);
-      }else{
-        $this->parent->handle->updateEnterprisesType($tmp,$this->ID);
+      $allok = true;
+      if(empty($tmp['name'])){
+        print_red(_("Please specify a name."));
+        $allok = false;
       }
 
-      $this->editMode=false;
+      if($allok){
+        if($this->Edit_Add == "add"){
+          $this->parent->handle->addEnterprisesType($tmp);
+          $this->editMode=false;
+        }else{
+          $this->parent->handle->updateEnterprisesType($tmp,$this->ID);
+          $this->editMode=false;
+        }
+      }
     }
 
     if($this->editMode == true){
diff --git a/plugins/admin/systems/glpiDeviceManagement.tpl b/plugins/admin/systems/glpiDeviceManagement.tpl
new file mode 100644 (file)
index 0000000..9c64ae6
--- /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 devices{/t}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$devicehead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$devices}
+    <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 attach a device to your currently edited computer.{/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 devices matching{/t}" src="{$search_image}" align=middle></label></td>
+<td width="99%">
+<input type='text' style='width:99%' name='device_regex' maxlength='20' value='{$device_regex}' title='{t}Regular expression for matching device 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>
index e4d24a65e2a6c0c4858ba3ff191979ce5f548202..f31c6d639fd00c39674ceb231c56b26c11a393da 100644 (file)
@@ -9,25 +9,25 @@
                                                <input type="text" name="name" value="{$name}">
                                        </td>
                                </tr>
-                               <tr>
+<!--                           <tr>
                                        <td>{t}Type{/t}
                                        </td>
                                        <td>
                                                <input type="text" name="type" value="{$type}">
                                        </td>
-                               </tr>
+                               </tr>-->
                                <tr>
-                                       <td>{t}Address{/t}
+                                       <td>{t}Website{/t}
                                        </td>
                                        <td>
-                                               <input type="text" name="address" value="{$address}">
+                                               <input type="text" name="website" value="{$website}">
                                        </td>
                                </tr>
                                <tr>
-                                       <td>{t}Website{/t}
+                                       <td>{t}Address{/t}
                                        </td>
                                        <td>
-                                               <input type="text" name="website" value="{$website}">
+                                               <textarea  name="address">{$address}</textarea>
                                        </td>
                                </tr>
                        </table>
                                        </td>
                                </tr>
                                <tr>
-                                       <td>{t}Comments{/t}
+                                       <td>{t}Fax{/t}
                                        </td>
                                        <td>
-                                               <input type="text" name="comments" value="{$comments}">
+                                               <input type="text" name="fax" value="{$fax}">
                                        </td>
                                </tr>
                                <tr>
-                                       <td>{t}Fax{/t}
+                                       <td>{t}Email{/t}
                                        </td>
                                        <td>
-                                               <input type="text" name="fax" value="{$fax}">
+                                               <input type="text" name="email" value="{$email}">
                                        </td>
                                </tr>
                                <tr>
-                                       <td>{t}Email{/t}
+                                       <td>{t}Comments{/t}
                                        </td>
                                        <td>
-                                               <input type="text" name="email" value="{$email}">
+                                               <textarea name="comments">{$comments}</textarea>
                                        </td>
                                </tr>
                        </table>
diff --git a/plugins/admin/systems/glpi_devices.tpl b/plugins/admin/systems/glpi_devices.tpl
new file mode 100644 (file)
index 0000000..608469e
--- /dev/null
@@ -0,0 +1,645 @@
+
+{if $device_type=="pci"}
+
+       <h2>{t}Other devices{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="power"}
+
+       <h2>{t}Power supply{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Atx{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="radio" name="atx" value="Y" {if ($atx == "Y")||($atx=="")}checked {/if}>{t}Yes{/t}
+                                                       <input type="radio" name="atx" value="N" {if $atx == "N"}checked {/if}>{t}No{/t}
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Power{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="power" value="{$power}">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{elseif $device_type=="gfxcard"}
+
+       <h2>{t}Gfxcard{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Interface{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="interface">
+                                                               {html_options values=$GFXInterfaceKeys output=$GFXInterfaces selected=$interface}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Ram{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="ram" value="{$ram}">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{elseif $device_type=="control"}
+
+       <h2>{t}Controllers{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Interface{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="interface">
+                                                               {html_options values=$HDDInterfaceKeys output=$HDDInterfaces selected=$interface}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Size{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="radio" name="raid" value="Y" {if ($raid == "Y")||($raid=="")}checked {/if}>{t}Yes{/t}
+                                                       <input type="radio" name="raid" value="N" {if $raid == "N"}checked {/if}>{t}No{/t}
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="drive"}
+
+       <h2>{t}Drive{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Speed{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="speed" value="{$speed}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Interface{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="interface">
+                                                               {html_options values=$HDDInterfaceKeys output=$HDDInterfaces selected=$interface}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Writeable{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="radio" name="is_writer" value="Y" {if ($is_writer == "Y")||($is_writer=="")}checked {/if}>{t}Yes{/t}
+                                                       <input type="radio" name="is_writer" value="N" {if $is_writer == "N"}checked {/if}>{t}No{/t}
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="hdd"}
+       <h2>{t}Hdd{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Rpm{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="rpm" value="{$rpm}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Cache{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="cache" value="{$cache}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Size{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="specif_default" value="{$specif_default}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Type{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="interface">
+                                                               {html_options values=$HDDInterfaceKeys output=$HDDInterfaces selected=$interface}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="ram"}
+
+       <h2>{t}RAM{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Frequenz{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="frequence" value="{$frequence}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Size{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="specif_default" value="{$specif_default}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Type{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="type">
+                                                               {html_options values=$RAMtypeKeys output=$RAMtypes selected=$type}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       
+                               </table>
+                       </td>
+               </tr>
+       </table>
+
+{elseif $device_type=="sndcard"}
+       <h2>{t}Soundcard{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Type{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="type" value="{$type}">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{elseif $device_type=="iface"}
+ <h2>{t}Network interface{/t}</h2>
+    <table summary="" width="100%">
+        <tr>
+            <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                <table summary="" width="100%">
+                    <tr>
+                        <td>{t}Name{/t}
+                        </td>
+                        <td>
+                            <input name="designation" value="{$designation}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td style="vertical-align:top;">{t}Comment{/t}
+                        </td>
+                        <td>
+                            <textarea name="comment">{$comment}</textarea>
+                        </td>
+                    </tr>
+                </table>
+            </td>
+            <td>
+                <table summary="" width="100%">
+                    <tr>
+                        <td>{t}Manufacturer{/t}
+                        </td>
+                        <td>
+                            <select name="FK_glpi_enterprise">
+                                {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}MAC address{/t}
+                        </td>
+                        <td>
+                            <input type="text" name="specif_default" value="{$specif_default}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}Bandwidth{/t}
+                        </td>
+                        <td>
+                            <input type="text" name="bandwidth" value="{$bandwidth}">
+                        </td>
+                    </tr>
+                </table>
+            </td>
+        </tr>
+    </table>
+{elseif $device_type=="processor"}
+ <h2>{t}Processor{/t}</h2>
+    <table summary="" width="100%">
+        <tr>
+            <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                <table summary="" width="100%">
+                    <tr>
+                        <td>{t}Name{/t}
+                        </td>
+                        <td>
+                            <input name="designation" value="{$designation}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td style="vertical-align:top;">{t}Comment{/t}
+                        </td>
+                        <td>
+                            <textarea name="comment">{$comment}</textarea>
+                        </td>
+                    </tr>
+                </table>
+            </td>
+            <td>
+                <table summary="" width="100%">
+                    <tr>
+                        <td>{t}Manufacturer{/t}
+                        </td>
+                        <td>
+                            <select name="FK_glpi_enterprise">
+                                {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                            </select>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}Frequenz{/t}
+                        </td>
+                        <td>
+                            <input type="text" name="frequence" value="{$frequence}">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>{t}Default frequenz{/t}
+                        </td>
+                        <td>
+                            <input type="text" name="specif_default" value="{$specif_default}">
+                        </td>
+                    </tr>
+                </table>
+            </td>
+        </tr>
+    </table>
+
+{elseif $device_type=="moboard"}
+       <h2>{t}Motherboard{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>{t}Chipset{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input type="text" name="chipset" value="{$chipset}">
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{elseif $device_type=="case"}
+       <h2>{t}Computer case{/t}</h2>
+       <table summary="" width="100%">
+               <tr>
+                       <td width="50%" style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;">
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Name{/t}
+                                               </td>   
+                                               <td>    
+                                                       <input name="designation" value="{$designation}">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}Comment{/t}
+                                               </td>   
+                                               <td>    
+                                                       <textarea name="comment">{$comment}</textarea>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+                       <td>
+                               <table summary="" width="100%">
+                                       <tr>
+                                               <td>{t}Manufacturer{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="FK_glpi_enterprise">
+                                                               {html_options values=$FK_glpi_enterpriseKeys output=$FK_glpi_enterprises selected=$FK_glpi_enterprise}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td style="vertical-align:top;">{t}format{/t}
+                                               </td>   
+                                               <td>    
+                                                       <select name="format">
+                                                               {html_options values=$formatKeys output=$formats selected=$format}
+                                                       </select>
+                                               </td>
+                                       </tr>
+                               </table>
+                       </td>
+               </tr>
+       </table>
+{/if}
+
+
+<p class="seperator">&nbsp;</p>
+<div align="right">
+       <p>
+               <input type="submit" value="{t}Save{/t}" name="SaveDeviceChanges">
+               <input type="submit" value="{t}Cancel{/t}" name="AbortDeviceChanges">
+       </p> 
+</div>