From: hickert Date: Fri, 28 Apr 2006 05:47:46 +0000 (+0000) Subject: Added dilvlist for fai templates X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=60c705a343bdadbee5bde6b5365c0c79f6bed4f3;p=gosa.git Added dilvlist for fai templates git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3155 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/html/getFAIscript.php b/html/getFAIscript.php index a4c242e7d..e86bdcc78 100644 --- a/html/getFAIscript.php +++ b/html/getFAIscript.php @@ -26,15 +26,23 @@ restore_error_handler(); $sr= $ldap->cat($id); $ei= ldap_first_entry($ldap->cid, $sr); - $tmp = ldap_get_values_len($ldap->cid, $ei,"FAIscript"); + if(isset($_GET['is_template'])){ + $tmp = ldap_get_values_len($ldap->cid, $ei,"FAItemplateFile"); + }else{ + $tmp = ldap_get_values_len($ldap->cid, $ei,"FAIscript"); + } $tmp2 = $ldap->fetch(); + $name= $tmp2['cn'][0]; if(in_array("FAIhookEntry",$tmp2['objectClass'])){ - $suff = ".FAIhook"; - }else{ - $suff = ".FAIscript"; + $name.= ".FAIhook"; + }elseif(in_array("FAIscriptEntry",$tmp2['objectClass'])){ + $name .= ".FAIscript"; + }elseif(isset($_GET['is_template'])){ + if(preg_match("/\//",$name)){ + $name = preg_replace("/^.*\//","",$name); + } } - $name= $tmp2['cn'][0]; if(isset($tmp[0])){ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); @@ -43,7 +51,7 @@ restore_error_handler(); header("Pragma: no-cache"); header("Cache-Control: post-check=0, pre-check=0"); header("Content-type: application/octet-stream"); - header("Content-Disposition: attachment; filename=".$name.$suff); + header("Content-Disposition: attachment; filename=".$name); echo $tmp[0]; }else{ echo sprintf("Can't query for this item '%s'",$id); diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index daf503fff..0b57d6c57 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -101,6 +101,32 @@ class faiTemplate 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]); + $this->dialog->acl = $this->acl; + $_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]); + } + } + } + /* Add new sub object */ if(isset($_POST['AddSubObject'])){ $this->dialog= new $this->subClassName($this->config,"new"); @@ -112,29 +138,6 @@ class faiTemplate extends plugin $_SESSION['objectinfo']= $this->dn; } - - /* Edit selected Sub Object */ - if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){ - - $temp = $_POST['SubObject'][0]; - - $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$temp]); - $this->dialog->acl = $this->acl; - $_SESSION['objectinfo'] = $this->SubObjects[$temp]['dn']; - $this->is_dialog=true; - } - - /* Remove Sub object */ - if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){ - foreach($_POST['SubObject'] as $temp){ - if($this->SubObjects[$temp]['status'] == "edited"){ - $this->SubObjects[$temp]['status']= "delete"; - }else{ - unset($this->SubObjects[$temp]); - } - } - } - /* Save Dialog */ if(isset($_POST['SaveSubObject'])){ $this->dialog->save_object(); @@ -188,6 +191,40 @@ class faiTemplate extends plugin return($display); } + /* Divlist added 28.02.2006 + Containing FAIscripts + */ + $divlist = new divSelectBox("FAItemplates"); + if((chkacl($this->acl,"cn")!="") || ($this->FAIstate == "freeze")){ + $img_edit = ""; + $img_remo = ""; + }else{ + $img_edit = ""; + $img_remo = ""; + } + + foreach($this->getList(true) as $key => $name){ + + if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new")){ + $down = ""; + }else{ + + $dn = $this->SubObjects[$key]['dn']; + + $down = " + "._("Download")." + "; + } + + $divlist->AddEntry(array( array("string"=>$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()); /* Magic quotes GPC, escapes every ' " \, to solve some security risks diff --git a/plugins/admin/fai/faiTemplate.tpl b/plugins/admin/fai/faiTemplate.tpl index e7b4666b0..11111ea03 100644 --- a/plugins/admin/fai/faiTemplate.tpl +++ b/plugins/admin/fai/faiTemplate.tpl @@ -31,19 +31,8 @@ {t}List of template files{/t} - - - - -
-
- - - -
+ {$Entry_divlist} +