Code

Added several comments
[gosa.git] / plugins / admin / fai / class_faiHookEntry.inc
index 8a7f0c990cef0ef446a8b78c42123af350945d1f..9a9450c77c9731b6a6fe035623e8af53e795b807 100644 (file)
@@ -79,9 +79,9 @@ class faiHookEntry extends plugin
     }
 
     /* Create download button*/
-    if($this->dn != "new"){
-      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."' target='_blank'>
-        <input type='button' value='"._("Download")."'>
+    if($this->dn != "new" && $this->acl_is_readable("FAIscript")){
+      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
+          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0 class='center'>
         </a>");
     }else{
       $smarty->assign("DownMe","");  
@@ -107,12 +107,13 @@ class faiHookEntry extends plugin
       }
     }
 
-    foreach($this->attributes as $attr){
-      if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
-        $smarty->assign($attr."ACL"," disabled ");
-      }else{
-        $smarty->assign($attr."ACL","  ");
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $acl = $this->getacl($name);
+      if($this->FAIstate == "freezed"){
+        $acl = preg_replace("/w/","",$acl);
       }
+      $smarty->assign($name."ACL",$acl);
     }
 
     $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE));
@@ -124,10 +125,12 @@ class faiHookEntry extends plugin
   {
     if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
       foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }else{
-          $this->$attrs = "";
+        if($this->acl_is_writeable($attrs)){
+          if(isset($_POST[$attrs])){
+            $this->$attrs = $_POST[$attrs];
+          }else{
+            $this->$attrs = "";
+          }
         }
       }
     }
@@ -136,7 +139,9 @@ class faiHookEntry extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
     if(empty($this->FAIscript)) {
       $message[]=_("Please enter a value for script.");
     }
@@ -167,6 +172,26 @@ class faiHookEntry extends plugin
     $tmp['status']  = $this->status;  
     return($tmp);
   }
+
+    /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Hook entry"),
+          "plDescription" => _("FAI hook entry"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 21,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "FAItask"           => _("Task"),
+            "FAIscript"         => _("FAI script"))
+          ));
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>