summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eb3f2ef)
raw | patch | inline | side by side (parent: eb3f2ef)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 25 Jan 2006 09:13:24 +0000 (09:13 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 25 Jan 2006 09:13:24 +0000 (09:13 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2574 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_glpiPrinterAccount.inc | patch | blob | history | |
plugins/admin/systems/glpiPrinter.tpl | patch | blob | history |
diff --git a/plugins/admin/systems/class_glpiPrinterAccount.inc b/plugins/admin/systems/class_glpiPrinterAccount.inc
index 2fbffd147c576f7b3b8ebf3862c14208c693cae2..af76ba9ccc21e5abeb951b3b0c14608fc3f21e51 100644 (file)
/* Remove Attachment from 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']))){
if(isset($this->usedAttachments[$_POST['Attachments']])){
unset($this->usedAttachments[$_POST['Attachments']]);
/* Assign used Attachments
*/
+
+ $divlist = new divSelectBox("glpiAttachmentsList");
+ $divlist-> SetHeight(150);
+ $atts = $this->getUsedAttachments(true);
+ $downlink = "<a href='get_attachment.php?id=%s' target='_blank'>%s</a>";
+ $del_link = "<input type='image' src='images/edittrash.png' name='delAttachment_%s'>";
+ 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());
$smarty->assign("Attachments", $this->getUsedAttachments());
$smarty->assign("AttachmentKeys", array_flip($this->getUsedAttachments()));
}
/* 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);
index 835a00eca76a3cce466c2be5640ac494d8303b0e..960420b769a62147d22c827dbd0146cb333612c8 100644 (file)
<table summary="" width="100%">
<tr>
<td>
- <select name="Attachments" {$AttachmentsACL} style="height:100px;width:100%;" multiple>
- {html_options values=$AttachmentKeys output=$Attachments}
- </select>
+ {$AttachmentsDiv}
<input name="AddAttachment" value="{t}Add{/t}" type="submit">
- <input name="RemoveAttachment" value="{t}Remove{/t}" type="submit">
</td>
</tr>
</table>