X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_glpiDeviceManagement.inc;h=19541ba4105371b31ea171336175492b09f85c85;hb=d77692031a0b3343cb7306f9bdd449208291eb17;hp=6e77e39f0e9bc13996e8333c33abeef5d033cd6c;hpb=783f7134cb859b55c89b11bde80f4f0a11602fbe;p=gosa.git diff --git a/plugins/admin/systems/class_glpiDeviceManagement.inc b/plugins/admin/systems/class_glpiDeviceManagement.inc index 6e77e39f0..19541ba41 100644 --- a/plugins/admin/systems/class_glpiDeviceManagement.inc +++ b/plugins/admin/systems/class_glpiDeviceManagement.inc @@ -24,6 +24,8 @@ class glpiDeviceManagement extends plugin var $Selected = array(); + var $delete = array(); + function glpiDeviceManagement ($config, $dn= NULL,$used=NULL) { plugin::plugin ($config, $dn); @@ -51,8 +53,11 @@ class glpiDeviceManagement extends plugin $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->DeviceAttrs['monitor'] = array("name","comments","serial","otherserial","size", + "flags_micro","flags_speaker","flags_subd","flags_bnc", + "location","type","FK_glpi_enterprise","is_global","deleted","is_template","tplname"); - $this->AllowedDevices=array("case","moboard","sndcard","processor","iface","ram","hdd","drive","control","gfxcard","power","pci"); + $this->AllowedDevices=array("case","moboard","sndcard","processor","iface","ram","hdd","drive","control","gfxcard","power","pci","monitor"); } function execute() @@ -99,7 +104,23 @@ class glpiDeviceManagement extends plugin if((isset($_GET['act']))&&($_GET['act']=="del_device")){ $id = base64_decode($_GET['id']); $tmp = $this->devices[$id]; - $this->parent->handle->deleteDevice($tmp); + + $this->delete = $tmp; + + if(isset($tmp['name'])){ + $smarty->assign("warning", sprintf(_("You're about to delete the glpi device '%s'."), $tmp['name'])); + }elseif(isset($tmp['designation'])){ + $smarty->assign("warning", sprintf(_("You're about to delete the glpi device '%s'."), $tmp['designation'])); + }else{ + print_a(_("Can't detect object name.")); + } + + return($smarty->fetch(get_template_path('remove_glpi.tpl', TRUE))); + } + + + if(isset($_POST['delete_glpi_confirm'])){ + $this->parent->handle->deleteDevice($this->delete); $this->reload(); } @@ -156,14 +177,25 @@ class glpiDeviceManagement extends plugin foreach($this->devices as $key=>$user){ - if(isset($this->Selected[$user['device_type']][$user['designation']])){ + if(isset($user['designation'])){ + $str = "designation"; + }else{ + $str = "name"; + } + + if(isset($this->Selected[$user['device_type']][$user[$str]])){ $use = " checked "; }else{ $use =""; } + /* Dawn databse struckture ....*/ + if(empty($user['comment'])) { + $user['comment'] = $user['comments']; + } + $field1 = array("string" => preg_replace("/%s/",base64_encode($key),preg_replace("/%USE%/",$use,$useDevice)), "attach" => "style='text-align:center;width:20px;'"); - $field2 = array("string" => sprintf($edit,base64_encode($key),$user['designation']." [".$user['comment']."]"), "attach" => "style=''"); + $field2 = array("string" => sprintf($edit,base64_encode($key),$user[$str]." [".$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)); @@ -171,6 +203,8 @@ class glpiDeviceManagement extends plugin } $listhead = "