Code

Upps
[gosa.git] / plugins / admin / fai / class_faiScriptEntry.inc
index 28d8fb07c8e48d7f213aa8baf5791d5dc4cb9fed..617de2612d6d27e72b8d0ec6a1192ccc35c730b9 100644 (file)
@@ -21,6 +21,7 @@ class faiScriptEntry extends plugin
   var $description   = "";
   var $status        = "new";
 
+  var $FAIstate      = "";
   
   function faiScriptEntry ($config, $dn= NULL,$object=false)
   {
@@ -32,8 +33,13 @@ class faiScriptEntry extends plugin
         $oname = $name;
         $this->$oname=$value;
       }
+
+      if(isset($this->attrs['FAIstate'][0])){
+        $this->FAIstate = $this->attrs['FAIstate'][0];
+      }
+
     }else{
-      if(count($object)){
+      if(is_array($object)&&count($object)){
         $this->orig_cn= $object['cn'];
         $this->dn=$object['dn'];
         foreach($object as $name=>$value){
@@ -77,9 +83,27 @@ class faiScriptEntry extends plugin
       } 
     }
 
+     /* Create download button*/
+    if($this->dn != "new"){
+      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
+        <input type='button' value='"._("Download")."'>
+        </a>");
+    }else{
+      $smarty->assign("DownMe","");
+    }
+
     for($i =0 ; $i < 100 ; $i++){
       $FAIprioritys[$i]=$i;
     }
+
+    foreach($this->attributes as $attr){
+      if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
+        $smarty->assign($attr."ACL"," disabled ");
+      }else{
+        $smarty->assign($attr."ACL","  ");
+      }
+    }
+
     $smarty->assign("FAIprioritys",$FAIprioritys);
     $display.= $smarty->fetch(get_template_path('faiScriptEntry.tpl', TRUE));
     return($display);
@@ -88,7 +112,7 @@ class faiScriptEntry 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];
@@ -102,7 +126,8 @@ class faiScriptEntry extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
   
     if(empty($this->cn)){
       $message[] = _("Please enter a name.");