From: hickert Date: Wed, 25 Jan 2006 08:57:52 +0000 (+0000) Subject: Attachments are now downloadable X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dff5bd9c49897c772bf4ca140042504c69df5252;p=gosa.git Attachments are now downloadable git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2570 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc index c6d3197b4..a949632ea 100644 --- a/plugins/admin/systems/class_glpiAccount.inc +++ b/plugins/admin/systems/class_glpiAccount.inc @@ -224,6 +224,18 @@ class glpiAccount extends plugin /* Remove Attachment fro this tab */ + + $once = true; + foreach($_POST as $name => $value){ + if((preg_match("/^delAttachment_/",$name))&&($once)){ + $once= false; + $name = preg_replace("/^delAttachment_/","",$name); + $entry = preg_replace("/_.*$/","",$name); + if(isset($this->usedAttachments[$entry])){ + unset($this->usedAttachments[$entry]); + } + } + } if((isset($_POST['RemoveAttachment']))&&(isset($_POST['Attachments']))){ foreach($_POST['Attachments'] as $entry){ if(isset($this->usedAttachments[$entry])){ @@ -538,9 +550,25 @@ class glpiAccount extends plugin /* Assign used Attachments */ - $smarty->assign("Attachments", $this->getUsedAttachments()); - $smarty->assign("AttachmentKeys", array_flip($this->getUsedAttachments())); + $divlist = new divSelectBox("glpiAttachmentsList"); + $divlist-> SetHeight(150); + $atts = $this->getUsedAttachments(true); + $downlink = "%s"; + $del_link = ""; + foreach($atts as $id => $attachment){ + $divlist->AddEntry + ( + array( + array("string"=>$attachment['name']), + array("string"=>$attachment['mime']), + array("string"=>sprintf($downlink,$id,$attachment['filename'])), + array("string"=>sprintf($del_link,$attachment['ID']),"attach"=>"style='border-right:0px;'"), + ) + ); + } + + $smarty->assign("AttachmentsDiv" ,$divlist->DrawList()); /* Handle contact person Assign name ... to smarty, if set */ @@ -649,22 +677,25 @@ class glpiAccount extends plugin } /* Return used attachments */ - function getUsedAttachments() + function getUsedAttachments($divlist = false) { $atts =$this->handle->getAttachments(); $ret = array(); foreach($atts as $entry){ if(in_array($entry['ID'],$this->usedAttachments)){ + if($divlist){ + $ret[$entry['ID']] = $entry; + }else{ + $cm =""; + if(isset($entry['comment'])){ + $cm=" [".$entry['comment']."]"; + } + if(isset($entry['mime'])){ + $cm.=" -".$entry['mime'].""; + } - $cm =""; - if(isset($entry['comment'])){ - $cm=" [".$entry['comment']."]"; + $ret[$entry['ID']]= $entry['name'].$cm; } - if(isset($entry['mime'])){ - $cm.=" -".$entry['mime'].""; - } - - $ret[$entry['ID']]= $entry['name'].$cm; } } return($ret); diff --git a/plugins/admin/systems/class_glpiSelectUser.inc b/plugins/admin/systems/class_glpiSelectUser.inc index 085b48a55..85de38d3e 100644 --- a/plugins/admin/systems/class_glpiSelectUser.inc +++ b/plugins/admin/systems/class_glpiSelectUser.inc @@ -131,9 +131,9 @@ class glpiSelectUser extends plugin $useruse = "%s"; foreach($this->users as $key=>$user){ - $field1 = array("string" => "user", "attach" => "style='text-align:center;width:20px;'"); + $field1 = array("string" => "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),""._("use").""), + $field3 = array("string" => sprintf($useruse,base64_encode($key),""._("use").""), "attach" => "style='width:60px;border-right:0px;text-align:right;'"); $divlist->AddEntry(array($field1,$field2,$field3)); @@ -155,8 +155,8 @@ class glpiSelectUser extends plugin $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("infoimage", get_template_path('images/info_small.png')); + $smarty->assign("launchimage", get_template_path('images/small_filter.png')); $smarty->assign("apply", apply_filter()); $smarty->assign("alphabet", generate_alphabet()); $smarty->assign("users_regex", $filter['users_regex']); diff --git a/plugins/admin/systems/glpi.tpl b/plugins/admin/systems/glpi.tpl index 70e87c5c5..f3c3511a0 100644 --- a/plugins/admin/systems/glpi.tpl +++ b/plugins/admin/systems/glpi.tpl @@ -96,11 +96,8 @@
- + {$AttachmentsDiv} -
diff --git a/plugins/admin/systems/glpiSelectUser.tpl b/plugins/admin/systems/glpiSelectUser.tpl index c3b154e45..c04911eb8 100644 --- a/plugins/admin/systems/glpiSelectUser.tpl +++ b/plugins/admin/systems/glpiSelectUser.tpl @@ -1,8 +1,8 @@
-
-

+

+

{t}List of users{/t}

@@ -16,8 +16,8 @@
-
-

[i]{t}Information{/t}

+
+

[i]{t}Information{/t}

@@ -25,8 +25,8 @@


-
-

[F]{t}Filters{/t}

+
+

[F]{t}Filters{/t}

diff --git a/plugins/admin/systems/glpi_devices.tpl b/plugins/admin/systems/glpi_devices.tpl index 55687e0d5..67d8838a2 100644 --- a/plugins/admin/systems/glpi_devices.tpl +++ b/plugins/admin/systems/glpi_devices.tpl @@ -31,7 +31,7 @@
{t}Monitor size{/t} - " + {t}Inch{/t}