Code

Updated preg_matches
[gosa.git] / plugins / admin / fai / class_faiHookEntry.inc
index 83396e99214b69922e0ca0744cb0c14042d09b3c..c73d2e886a54b9820edeac61c0aa99266349e588 100644 (file)
@@ -22,6 +22,8 @@ class faiHookEntry extends plugin
   var $FAIscript     = "";
   var $description   = "";
   var $status        = "new";
+
+  var $FAIstate      = "";
   
   function faiHookEntry ($config, $dn= NULL,$object=false)
   {
@@ -33,6 +35,11 @@ class faiHookEntry extends plugin
         $oname = $name;
         $this->$oname=$value;
       }
+
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
     }elseif(is_array($object)){
       if(count($object)){
         $this->orig_cn= $object['cn'];
@@ -73,7 +80,7 @@ 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'>
+      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
         <input type='button' value='"._("Download")."'>
         </a>");
     }else{
@@ -100,6 +107,14 @@ 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","  ");
+      }
+    }
+
     $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE));
     return($display);
   }
@@ -107,7 +122,7 @@ class faiHookEntry extends plugin
   /* Save data to object */
   function save_object()
   {
-    if(isset($_POST['SubObjectFormSubmitted'])){
+    if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
       foreach($this->attributes as $attrs){
         if(isset($_POST[$attrs])){
           $this->$attrs = $_POST[$attrs];
@@ -121,7 +136,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.");
     }