Code

Fixed acls.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Sep 2006 08:59:34 +0000 (08:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Sep 2006 08:59:34 +0000 (08:59 +0000)
Fixed picture and script download, they work together now.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4615 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/applications/class_applicationGeneric.inc
plugins/admin/applications/class_applicationParameters.inc
plugins/admin/applications/generic.tpl

index 0d4d5ea88d2369037dee56ada7f2ab7def015a83..c483bb97d3e71f8fb6338caed3e79767b3e5e848 100644 (file)
@@ -128,9 +128,21 @@ class application extends plugin
       return ($display);
     }
 
-    $_SESSION['binary']       = $this->gotoLogonScript;
-    $_SESSION['binarytype']   = "octet-stream";
-    $_SESSION['binaryfile']   = $this->cn.".gosaApplication";
+    /* Download requested */
+    foreach($_POST as $name => $value){
+      if(preg_match("/^downloadScript/",$name)){
+        $_SESSION['binary']       = $this->gotoLogonScript;
+        $_SESSION['binarytype']   = "octet-stream";
+        $_SESSION['binaryfile']   = $this->cn.".gosaApplication";
+        header("location: getbin.php ");
+        exit();
+      }
+    }
+
+    /* Reassign picture data, sometimes its corrupt cause we started a download of application scripts */
+    $_SESSION['binary']     = $this->iconData;
+    $_SESSION['binarytype'] = "image/jpeg";
+    
     $smarty->assign("rand", rand(0, 10000));
     $head = $this->generateTemplate();
     $this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
@@ -509,7 +521,6 @@ class application extends plugin
             "gosaApplicationIcon"     => _("Icon"),
             "gosaApplicationFlags"    => _("Flag"),
             "gotoLogonScript"         => _("Script content"),
-            "gosaApplicationParameter"=> _("Application parameter"),
 
             "exec_for_groupmembers" => _("Only executable for members"),              // G
             "place_on_desktop"      => _("Place icon on members desktop"),            // D
index 0de0560404742f56211a64a9b378e3ba35a9c239..d65636b2e15f142cbe12a7087a9333f67634572d 100644 (file)
@@ -90,14 +90,38 @@ class applicationParameters extends plugin
                $this->option_name[]= "";
                $this->option_value[]= "";
        }
+
+       
+       $acl = $this->getacl("gosaApplicationParameter")        ;
        $table= "<table summary=\"\"><tr><td>"._("Variable")."</td><td>"._("Default value")."</td><td></td></tr>";
        if (count ($this->option_name)){
+               
                for ($i= 0; $i < count($this->option_name); $i++){
-                       $table.="<tr><td><input name=\"option$i\" size=25 maxlength=50 ".
-                               "value=\"".$this->option_name[$i]."\"></td><td><input name=\"value$i\" ".
-                               "size=60 maxlength=250 value=\"".$this->option_value[$i]."\"><br></td><td>".
-                               "<input type=\"submit\" name=\"remove$i\" value=\"".
-                               _("Remove")."\"></td></tr>";
+                       $name = $this->option_name[$i];
+                       $value= $this->option_value[$i];
+
+                       $tag = "";
+                       if(!preg_match("/w/",$acl)){
+                               $tag = " disabled ";
+                       }
+
+                       if(!preg_match("/r/",$acl)){
+                               $name = "";
+                               $value= "";
+                       }
+
+                       $table.="<tr>".
+                               " <td>".
+                               "  <input name=\"option$i\" size=25 maxlength=50 value=\"".$name."\" ".$tag.">".
+                               " </td>".
+                               " <td>".
+                               "  <input name=\"value$i\" size=60 maxlength=250 value=\"".$value."\" ".$tag.">".
+                               "  <br>".
+                                " </td>".
+                               " <td>".
+                               "  <input type=\"submit\" name=\"remove$i\" value=\""._("Remove")."\" ".$tag.">".
+                               " </td>".
+                               "</tr>";
                }
        }
        $table.= "</table>";
@@ -105,6 +129,11 @@ class applicationParameters extends plugin
 
        /* Show main page */
        $smarty= get_smarty();
+       $tmp = $this->plInfo();
+       foreach($tmp['plProvidedAcls'] as $name => $translation){
+               $smarty->assign($name."ACL",$this->getacl($name));
+       }
+
        $smarty->assign("table", $table);
        $display.= $smarty->fetch(get_template_path('parameters.tpl', TRUE));
        $this->parent->by_object['application']->generateTemplate();
@@ -193,6 +222,25 @@ class applicationParameters extends plugin
        $this->handle_post_events('modify');
   }
 
+  /* Return plugin informations for acl handling
+      #FIXME FAIscript seams to ununsed within this class... */
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Parameter"),
+          "plDescription" => _("Parameter configuration"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("application"),
+
+          "plProvidedAcls"=> array(
+            "gosaApplicationParameter"      => _("Application parameter settings"))  
+           ));
+  }
+
+
 }
 
 ?>
index 78ee97f97266ff1f79d4049bc7fceba7f0476d78..8628945b5bbc459a109b9e3a1da44b3b4cce5991 100644 (file)
 {render acl=$gotoLogonScriptACL}
                        <input type="submit" name="upLoad" value="{t}Upload{/t}">
 {/render}
-                       <a href='getbin?rand={$rand}'><img src='images/save.png' title='{t}Download{/t}' alt='{t}Download{/t}'></a>
+                       <input type='image' name='downloadScript'  src='images/save.png' title='{t}Download{/t}'>
                </td>
        </tr>
 </table>