From 8cce7d888235a4d43d31b527154b3f5577c78799 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 28 Nov 2007 07:38:43 +0000 Subject: [PATCH] Updated repository list. - Its time for a new list, the old one does unpredictable things. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7921 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_servRepository.inc | 72 +++++++++---------- plugins/admin/systems/servRepository.tpl | 61 ---------------- 2 files changed, 36 insertions(+), 97 deletions(-) diff --git a/plugins/admin/systems/class_servRepository.inc b/plugins/admin/systems/class_servRepository.inc index e1c9a2e05..de72d986e 100644 --- a/plugins/admin/systems/class_servRepository.inc +++ b/plugins/admin/systems/class_servRepository.inc @@ -12,9 +12,6 @@ class servrepository extends goService var $attributes = array("FAIrepository"); var $objectclasses = array("FAIrepositoryServer"); - /* Search filter */ - var $regex = "*"; - /* Repositories */ var $repositories = array(); var $FAIrepository = array(); @@ -25,6 +22,8 @@ class servrepository extends goService var $view_logged = FALSE; var $fai_activated = FALSE; + var $divlist = NULL; + function servrepository (&$config, $dn= NULL, $parent= NULL) { plugin::plugin ($config, $dn, $parent); @@ -79,6 +78,24 @@ class servrepository extends goService $this->repositories[$tmp[2]]=$tmp2; } } + + + /* Create divlist */ + $divlist = new MultiSelectWindow($this->config,"repositories","server/servRepository"); + $divlist->SetTitle("repositories"); + $divlist->SetSummary(_("List of configured repositories.")); + $divlist->SetInformation(_("This menu allows you to create, delete and edit repository settings.")); + $divlist->EnableCloseButton(FALSE); + $divlist->EnableSaveButton(FALSE); + $divlist->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'")); + $divlist->AddHeader(array("string"=>_("Sections"))); + $divlist->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'")); + $divlist->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE); + $divlist->EnableAplhabet(TRUE); + if($this->acl_is_createable()){ + $divlist->SetListHeader(""); + } + $this->divlist = $divlist; } function execute() @@ -101,15 +118,6 @@ class servrepository extends goService $smarty->assign("is_createable",$this->acl_is_createable()); $display= ""; - /* Smarty vars*/ - $smarty->assign("infoimage", get_template_path('images/info.png')); - $smarty->assign("search_image", get_template_path('images/search.png')); - $smarty->assign("launchimage", get_template_path('images/small_filter.png')); - $smarty->assign("tree_image", get_template_path('images/tree.png')); - $smarty->assign("alphabet", generate_alphabet()); - $smarty->assign("apply", apply_filter()); - $smarty->assign("regex", $this->regex); - /* Show tab dialog headers */ /* ADD / EDIT Repository @@ -200,14 +208,14 @@ class servrepository extends goService } } } - if((isset($_GET['act']))&&($_GET['act']=="open")&&(isset($_GET['id']))){ + if((isset($_GET['act']))&&($_GET['act']=="open_repository")&&(isset($_GET['id']))){ $obj = $this->repositories[base64_decode($_GET['id'])]; $obj['initialy_was'] = $obj['Release']; $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj); $this->dialog->parent = $this; } - if(isset($_POST['repository_setup_save'])){ + if(isset($_POST['repository_setup_save']) && is_object($this->dialog)){ $this->dialog->save_object(); if(($this->dialog->is_new_name())&&(isset($this->repositories[$this->dialog->GetName()]))){ print_red(_("This name is already in use.")); @@ -246,17 +254,8 @@ class servrepository extends goService Repository setup dialog handling /END */ - $divlist = new divlist("repositories"); - $divlist->SetEntriesPerPage(0); - $divlist->setHeight(400); - $divlist->SetPluginMode(); - $divlist->setHeader(array(array("string"=>_("Release"),"attach"=>"style='width:80px;'"), - array("string"=>_("Sections")), - array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'") - ) ); - - $link = "%s"; + $link = "%s"; $edit = " "; /* Hide delete icon, if delete is not allowed */ @@ -266,22 +265,23 @@ class servrepository extends goService $delete = " "; } + $this->divlist->ClearElementsList(); foreach($this->repositories as $name => $reps){ $str = " "; - if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){ - foreach($reps['Sections'] as $sec){ - $str.=$sec." "; - } - $divlist->AddEntry(array( - array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"), - array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)), - array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text-align:right;'") - )); + if(preg_match("/".str_replace("*",".*",$this->divlist->regex)."/",$reps['Release'])){ + foreach($reps['Sections'] as $sec){ + $str.=$sec." "; + } + $this->divlist->AddElement(array( + array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"), + array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)), + array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text-align:right;'") + )); } } - $smarty -> assign("Repositories",$divlist->DrawList()); + $smarty->assign("Repositories",$this->divlist->Draw()); $display.= $smarty->fetch(get_template_path('servRepository.tpl', TRUE)); return($display); @@ -292,8 +292,8 @@ class servrepository extends goService function save_object() { plugin::save_object(); - if(isset($_POST['regex'])){ - $this->regex = $_POST['regex']; + if(is_object($this->divlist)){ + $this->divlist->save_object(); } } diff --git a/plugins/admin/systems/servRepository.tpl b/plugins/admin/systems/servRepository.tpl index 7feaf1d3c..ca42710c1 100644 --- a/plugins/admin/systems/servRepository.tpl +++ b/plugins/admin/systems/servRepository.tpl @@ -1,70 +1,9 @@ - - - - - -
-
-

- {t}List of configured repositories.{/t} -

-
-
-
-{if $is_createable} - -{/if} -
-
-
-
{$Repositories} - -
-
-
-

- [i] - {t}Information{/t} -

-
-
-

- {t}This menu allows you to create, delete and edit repository settings.{/t} -

-
-
-
-

- [F] - {t}Filters{/t} -

-
-
- - {$alphabet} -
- - - - - -
- {t}Display objects matching{/t} - - -
- {$apply} -
-

 

-

 
-

-- 2.30.2