From eb5573a07aec420216a29496d608b00b971f3566 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 24 Nov 2005 07:38:24 +0000 Subject: [PATCH] Specific FAItask is only assingable once per bundle git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2035 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiHook.inc | 13 +++++++++++++ plugins/admin/fai/class_faiHookEntry.inc | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index 0bf06a67c..0de6e7508 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -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; } diff --git a/plugins/admin/fai/class_faiHookEntry.inc b/plugins/admin/fai/class_faiHookEntry.inc index 472050aa6..5b36ec860 100644 --- a/plugins/admin/fai/class_faiHookEntry.inc +++ b/plugins/admin/fai/class_faiHookEntry.inc @@ -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 -- 2.30.2