Code

Added download link
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 23 Feb 2006 14:29:12 +0000 (14:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 23 Feb 2006 14:29:12 +0000 (14:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2733 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiScript.inc
plugins/admin/fai/faiScript.tpl

index 51b674c3810819cc3fa5329bf1379f85c8f8e1f3..671ace2235356a2060dafde04510d2cb9556d8be 100644 (file)
@@ -99,6 +99,32 @@ class faiScript extends plugin
     }
 
 
+    /* New Listhandling 
+     */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^editscript_/",$name)&&($once)){
+        $once = false;
+        $entry = preg_replace("/^editscript_/","",$name);
+        $entry = base64_decode(preg_replace("/_.*/","",$entry));
+        $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$entry]);
+        $_SESSION['objectinfo'] = $this->SubObjects[$entry]['dn'];
+        $this->is_dialog=true;
+      }
+      if(preg_match("/^deletescript_/",$name)&&($once)){
+        $once = false;
+        $entry = preg_replace("/^deletescript_/","",$name);
+        $entry = base64_decode(preg_replace("/_.*/","",$entry));
+        if($this->SubObjects[$entry]['status'] == "edited"){
+          $this->SubObjects[$entry]['status']= "delete";
+        }else{
+          unset($this->SubObjects[$entry]);
+        }
+      }
+    }
+    ///// Ende new list handling
+    
+
     /* Edit selected Sub Object */
     if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
       $script = $_POST['SubObject'][0];
@@ -173,6 +199,22 @@ class faiScript extends plugin
       return($display);
     }
 
+    /* Divlist            added 23.02.2006 
+       Containing FAIscripts 
+     */
+    $divlist = new divSelectBox("FAIscripts");
+    $img_edit = "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
+    $img_remo = "<input type='image' src='images/edittrash.png' name='deletescript_%s'  title='"._("delete")."' alt='"._("delete")."'>";
+    foreach($this->getList(true) as $key => $name){
+      $divlist->AddEntry(array( array("string"=>$name['name']),
+                                array("string"=>"<a href='getFAIscript.php?id=".base64_encode($name['dn'])."' target='_blank'>download</a>"),
+                                array("string"=>str_replace("%s",base64_encode($key),$img_edit.$img_remo),"attach"=>"style='border-right: 0px;width:40px;'")));
+    }
+    $smarty->assign("Entry_divlist",$divlist->DrawList());
+
+    /* Divlist creation complete
+     */
+
     $smarty->assign("SubObjects",$this->getList());
     $smarty->assign("SubObjectKeys",array_flip($this->getList()));
      
@@ -193,14 +235,23 @@ class faiScript extends plugin
 
   /* Generate listbox friendly SubObject list
   */
-  function getList(){
+  function getList($use_dns=false){
     $a_return=array();
     foreach($this->SubObjects as $obj){
       if($obj['status'] != "delete"){
-        if((isset($obj['description']))&&(!empty($obj['description']))){
-          $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
+        if($use_dns){
+          if((isset($obj['description']))&&(!empty($obj['description']))){
+            $a_return[$obj['cn']]['name']= $obj['cn']." [".$obj['description']."]";
+          }else{
+            $a_return[$obj['cn']]['name']= $obj['cn'];
+          }
+          $a_return[$obj['cn']]['dn']= $obj['dn'];
         }else{
-          $a_return[$obj['cn']]= $obj['cn'];
+          if((isset($obj['description']))&&(!empty($obj['description']))){
+            $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
+          }else{
+            $a_return[$obj['cn']]= $obj['cn'];
+          }
         }
       }
     }
index 67d25a1e95d9bf85359a1cb10b929eb8228a256d..1a646b3d91e3de92a4a1598ad4057572a7806af3 100644 (file)
                                <table width="100%" summary="">
                                <tr>
                                        <td>
+                                               {$Entry_divlist}
+                                               <!--
                                                <select name="SubObject[]" title="{t}Choose a script to delete or edit{/t}" style="width:100%;" size="20" id="SubObject" multiple>
                                                        {html_options values=$SubObjectKeys output=$SubObjects}
                                                </select><br>
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
                                                <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
                                                <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
+                                               -->
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
                                        </td>
                                </tr>
                                </table>