Code

Attachments are now downloadable
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 25 Jan 2006 08:57:52 +0000 (08:57 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 25 Jan 2006 08:57:52 +0000 (08:57 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2570 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_glpiAccount.inc
plugins/admin/systems/class_glpiSelectUser.inc
plugins/admin/systems/glpi.tpl
plugins/admin/systems/glpiSelectUser.tpl
plugins/admin/systems/glpi_devices.tpl

index c6d3197b41bc4dd0f4016c60152874cc70a4a864..a949632ea29f06e2a84a6d4d45dc0397a1f30eda 100644 (file)
@@ -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 = "<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());
     /* 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);
index 085b48a551096ad67b698b745ad56f5342764957..85de38d3e3ab4b6ffb5fe8cbc24fb7a2a9c30143 100644 (file)
@@ -131,9 +131,9 @@ class glpiSelectUser extends plugin
     $useruse = "<a href='?plug=".$_GET['plug']."&amp;act=".$this->PostVarName."&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;'");
+      $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")."'>"), 
+      $field3 = array("string" => sprintf($useruse,base64_encode($key),"<img title='"._("Use")."' border=0 src='images/crossref.png' alt='"._("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']);
index 70e87c5c5a2cf292c08a54c650ff561681774795..f3c3511a0b82d18ed35db23993a0b7472a13a2a6 100644 (file)
                        <table summary="" width="100%"> 
                                <tr>
                                        <td>
-                                               <select name="Attachments[]" {$AttachmentsACL} style="height:120px;width:100%;" multiple>
-                                                       {html_options values=$AttachmentKeys output=$Attachments}
-                                               </select>
+                                               {$AttachmentsDiv}
                                                <input name="AddAttachment"     value="{t}Add{/t}" type="submit" {$AttachmentsACL}>     
-                                               <input name="RemoveAttachment"  value="{t}Remove{/t}" type="submit" {$AttachmentsACL}>  
                                        </td>
                                </tr>
                        </table>
index c3b154e45f57dd9195aaf244cf9fce1e047e363d..c04911eb822e51442bc17cf6fa3abd5c84309283 100644 (file)
@@ -1,8 +1,8 @@
 <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">
+  <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px;">
      {t}List of users{/t}
     </p>
   </div>
@@ -16,8 +16,8 @@
   </div>
   </td>
   <td style="vertical-align:top;">
-   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;">
-    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   <div class="contentboxh" style="border-bottom:1px solid #B0B0B0;height:20px;">
+    <p class="contentboxh" style="font-size:12px;"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
    </div>
    <div class="contentboxb">
    <p class="contentboxb">
@@ -25,8 +25,8 @@
    </p>
    </div>
    <br>
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+   <div class="contentboxh" style="height:20px;">
+    <p class="contentboxh" style="font-size:12px"><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;">
index 55687e0d5242f01b7be2ee4a86d9e984a03676c0..67d8838a283cddebca8c9fbc4393a32e0d8a3ee1 100644 (file)
@@ -31,7 +31,7 @@
                                                <td style="vertical-align:top;">{t}Monitor size{/t}
                                                </td>   
                                                <td>    
-                                                       <input name="size" value="{$size}">"
+                                                       <input name="size" value="{$size}"> {t}Inch{/t}
                                                </td>
                                        </tr>
                                </table>