From bb4876b4c4daea5aba8a90eec6d1f77dfa029ed8 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 28 Feb 2006 06:04:43 +0000 Subject: [PATCH] Added download button for Scripts/Hooks git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2755 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiHook.inc | 75 ++++++++++++++++++++-- plugins/admin/fai/class_faiHookEntry.inc | 9 +++ plugins/admin/fai/class_faiScriptEntry.inc | 9 +++ plugins/admin/fai/faiHook.tpl | 5 +- plugins/admin/fai/faiHookEntry.tpl | 1 + plugins/admin/fai/faiScriptEntry.tpl | 1 + 6 files changed, 95 insertions(+), 5 deletions(-) diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index 4dbff3b89..eef163f88 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -100,6 +100,32 @@ class faiHook extends plugin $smarty= get_smarty(); $display= ""; + /* New Listhandling + */ + $once = true; + foreach($_POST as $name => $value){ + if(preg_match("/^editscript_/",$name)&&($once)){ + $once = false; + $entry = preg_replace("/^editscript_/","",$name); + $entry = base64_decode(preg_replace("/_.*/","",$entry)); + $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$entry]); + $_SESSION['objectinfo'] = $this->SubObjects[$entry]['dn']; + $this->dialog->parent = &$this; + $this->is_dialog=true; + } + if(preg_match("/^deletescript_/",$name)&&($once)){ + $once = false; + $entry = preg_replace("/^deletescript_/","",$name); + $entry = base64_decode(preg_replace("/_.*/","",$entry)); + if($this->SubObjects[$entry]['status'] == "edited"){ + $this->SubObjects[$entry]['status']= "delete"; + }else{ + unset($this->SubObjects[$entry]); + } + } + } + ///// Ende new list handling + /* Add new sub object */ if(isset($_POST['AddSubObject'])){ $this->dialog= new $this->subClassName($this->config,"new"); @@ -194,6 +220,37 @@ class faiHook extends plugin return($display); } + + + /* Divlist added 28.02.2006 + Containing FAIscripts + */ + $divlist = new divSelectBox("FAIhooks"); + $img_edit = ""; + $img_remo = ""; + + foreach($this->getList(true) as $key => $name){ + + if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new")){ + $down = ""; + }else{ + $down = " + "._("Download")." + "; + } + + $divlist->AddEntry(array( array("string"=>$name['name']), + array("string"=>$down , "attach" => "style='width:20px;'"), + array("string"=>str_replace("%s",base64_encode($key),$img_edit.$img_remo), + "attach"=>"style='border-right: 0px;width:50px;text-align:right;'"))); + } + $smarty->assign("Entry_divlist",$divlist->DrawList()); + /* Divlist creation complete + */ + + + + $smarty->assign("SubObjects",$this->getList()); $smarty->assign("SubObjectKeys",array_flip($this->getList())); @@ -214,20 +271,30 @@ class faiHook extends plugin /* Generate listbox friendly SubObject list */ - function getList(){ + function getList($use_dns=false){ $a_return=array(); foreach($this->SubObjects as $obj){ if($obj['status'] != "delete"){ - if((isset($obj['description']))&&(!empty($obj['description']))){ - $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]"; + if($use_dns){ + if((isset($obj['description']))&&(!empty($obj['description']))){ + $a_return[$obj['cn']]['name']= $obj['cn']." [".$obj['description']."]"; + }else{ + $a_return[$obj['cn']]['name']= $obj['cn']; + } + $a_return[$obj['cn']]['dn']= $obj['dn']; }else{ - $a_return[$obj['cn']]= $obj['cn']; + if((isset($obj['description']))&&(!empty($obj['description']))){ + $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]"; + }else{ + $a_return[$obj['cn']]= $obj['cn']; + } } } } return($a_return); } + /* Delete me, and all my subtrees */ function remove_from_parent() diff --git a/plugins/admin/fai/class_faiHookEntry.inc b/plugins/admin/fai/class_faiHookEntry.inc index 3a7e455e0..83396e992 100644 --- a/plugins/admin/fai/class_faiHookEntry.inc +++ b/plugins/admin/fai/class_faiHookEntry.inc @@ -71,6 +71,15 @@ class faiHookEntry extends plugin } } + /* Create download button*/ + if($this->dn != "new"){ + $smarty->assign("DownMe"," + + "); + }else{ + $smarty->assign("DownMe",""); + } + $used_tasks = $this->parent->getUsedFAItask($this->cn); $tasks = $this->tasks; foreach($this->tasks as $id => $task){ diff --git a/plugins/admin/fai/class_faiScriptEntry.inc b/plugins/admin/fai/class_faiScriptEntry.inc index bc7e26f19..f52c123c5 100644 --- a/plugins/admin/fai/class_faiScriptEntry.inc +++ b/plugins/admin/fai/class_faiScriptEntry.inc @@ -77,6 +77,15 @@ class faiScriptEntry extends plugin } } + /* Create download button*/ + if($this->dn != "new"){ + $smarty->assign("DownMe"," + + "); + }else{ + $smarty->assign("DownMe",""); + } + for($i =0 ; $i < 100 ; $i++){ $FAIprioritys[$i]=$i; } diff --git a/plugins/admin/fai/faiHook.tpl b/plugins/admin/fai/faiHook.tpl index eb9ea7f6a..68f2c9132 100644 --- a/plugins/admin/fai/faiHook.tpl +++ b/plugins/admin/fai/faiHook.tpl @@ -37,12 +37,15 @@
+ {$Entry_divlist} + +
diff --git a/plugins/admin/fai/faiHookEntry.tpl b/plugins/admin/fai/faiHookEntry.tpl index 8ec11bd47..699528a40 100644 --- a/plugins/admin/fai/faiHookEntry.tpl +++ b/plugins/admin/fai/faiHookEntry.tpl @@ -61,6 +61,7 @@
  + {$DownMe}

 

diff --git a/plugins/admin/fai/faiScriptEntry.tpl b/plugins/admin/fai/faiScriptEntry.tpl index 96a160346..cc1eee23c 100644 --- a/plugins/admin/fai/faiScriptEntry.tpl +++ b/plugins/admin/fai/faiScriptEntry.tpl @@ -61,6 +61,7 @@
  + {$DownMe}

-- 2.30.2