Code

Specific FAItask is only assingable once per bundle
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 Nov 2005 07:38:24 +0000 (07:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 Nov 2005 07:38:24 +0000 (07:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2035 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiHook.inc
plugins/admin/fai/class_faiHookEntry.inc

index 0bf06a67cbebb2c6acafeeacb293b8b3f8a1c8f6..0de6e7508d28dcc5318983ff52da452f4f34c0b1 100644 (file)
@@ -78,6 +78,17 @@ class faiHook extends plugin
     }
   }
 
+  function getUsedFAItask()
+  {
+    $ret = array();
+    foreach($this->SubObjects as $name => $class){
+      if($class['status'] != "delete"){
+        $ret[$class['FAItask']] = $class['FAItask'];
+      }
+    }
+    return($ret);
+  }
+
   function execute()
   {
        /* Call parent execute */
@@ -90,6 +101,7 @@ class faiHook extends plugin
     /* Add new sub object */
     if(isset($_POST['AddSubObject'])){
       $this->dialog= new $this->subClassName($this->config,"new");
+      $this->dialog->parent = &$this;
       $this->is_dialog=true;
     }
   
@@ -99,6 +111,7 @@ class faiHook extends plugin
     /* Edit selected Sub Object */
     if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
       $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
+      $this->dialog->parent = &$this;
       $_SESSION['objectinfo'] = $this->SubObjects[$_POST['SubObject']]['dn'];
       $this->is_dialog=true;
     }
index 472050aa6e531ce14cc738a6688bec2b6809e773..5b36ec8601f7c9b2b7ab5cca2610f82f7cf5c55d 100644 (file)
@@ -60,7 +60,15 @@ class faiHookEntry extends plugin
         $this->FAIscript = $str;
       }
     }
-    $smarty->assign("tasks", $this->tasks);
+
+    $used_tasks = $this->parent->getUsedFAItask();
+    $tasks = $this->tasks;
+    foreach($this->tasks as $id => $task){
+      if(in_array($task,$used_tasks)){
+        unset($tasks[$id]);
+      }
+    }
+    $smarty->assign("tasks", $tasks);
 
      /* Magic quotes GPC, escapes every ' " \, to solve some security risks
      * If we post the escaped strings they will be escaped again