From ce382410d752f2aa4abb3855016f9cc00de17a8c Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 13 Aug 2009 07:42:30 +0000 Subject: [PATCH] Updated filter/listing git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14041 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_filter.inc | 2 +- gosa-core/include/class_listing.inc | 108 +++++++++++++++++++++++++--- 2 files changed, 98 insertions(+), 12 deletions(-) diff --git a/gosa-core/include/class_filter.inc b/gosa-core/include/class_filter.inc index 9d4d9384e..bde9b1726 100644 --- a/gosa-core/include/class_filter.inc +++ b/gosa-core/include/class_filter.inc @@ -225,7 +225,7 @@ class filter { function renderBase() { - $result= ""; foreach ($this->bases as $key=>$value) { $selected= ""; diff --git a/gosa-core/include/class_listing.inc b/gosa-core/include/class_listing.inc index f4b6913ac..e9085b045 100644 --- a/gosa-core/include/class_listing.inc +++ b/gosa-core/include/class_listing.inc @@ -8,7 +8,8 @@ class listing { var $departmentRootVisible= false; var $multiSelect= false; var $template; - var $summary; + var $headline; + var $module; var $header= array(); var $colprops= array(); var $filters= array(); @@ -80,24 +81,28 @@ class listing { } } + // Assign headline/module + $this->headline= xml::getLocalizedAttribute($this->xmlData['definition']['headline'], $GLOBALS['t_language']); + $this->module= $this->xmlData['definition']['module']; + return true; } function render() { -echo "Fill summary, handle empty lists differently, alternating, sorting, post_id
"; - $summary= "empty"; +echo "Handle empty lists differently, alternating, sorting, post_id, bottom list info
"; // Initialize list - $result= " + $result= "
"; + $result.= "
"; $num_cols= count($this->colprops) + ($this->multiSelect?1:0); // Build list header $result.= ""; if ($this->multiSelect) { - $result.= ""; + $result.= ""; } foreach ($this->header as $header) { $result.= $header; @@ -115,7 +120,7 @@ echo "Fill summary, handle empty lists differently, alternating, sorting, post_i // Render multi select if needed if ($this->multiSelect) { - $result.=""; + $result.=""; } foreach ($this->xmlData['table']['column'] as $index => $config) { @@ -141,15 +146,40 @@ echo "Fill summary, handle empty lists differently, alternating, sorting, post_i $result.= ""; } - $result.= "
 
"; + $result.= ""; - return $result; + $smarty= get_smarty(); + $smarty->assign("FILTER", $this->filter->render()); + $smarty->assign("LIST", $result); + + // Assign navigation elements + $nav= $this->renderNavigation(); + foreach ($nav as $key => $html) { + $smarty->assign($key, $html); + } + + // Assign action menu + $smarty->assign("ACTIONS", "TBD"); + + // Assign separator + $smarty->assign("SEPARATOR", "-"); + + // Assign summary + $smarty->assign("HEADLINE", $this->headline); + + return ($smarty->fetch(get_template_path($this->xmlData['definition']['template'], true))); } - function setEntries($entries) + function setFilter($filter) { - $this->entries= &$entries; + $this->filter= &$filter; + } + + + function update() + { + $this->entries= $this->filter->query(); } @@ -307,13 +337,69 @@ echo "Fill summary, handle empty lists differently, alternating, sorting, post_i $result= " "; $trans= call_user_func_array("sprintf", $params); if ($trans != "") { - return("$trans"); + return("$trans"); } return $result; } + function renderNavigation() + { + $result= array(); + $enableBack = true; + $enableRoot = true; + $enableHome = true; + + $ui = get_userinfo(); + + /* Check if base = first available base */ + $deps = $ui->get_module_departments($this->module); + + if(!count($deps) || $deps[0] == $this->filter->base){ + $enableBack = false; + $enableRoot = false; + } + + $listhead =""; + + /* Check if we are in users home department */ + if(!count($deps) ||$this->filter->base == get_base_from_people($ui->dn)){ + $enableHome = false; + } + + /* Draw root button */ + if($enableRoot){ + $result["ROOT"]= ""; + }else{ + $result["ROOT"]= ""._("Root").""; + } + + /* Draw back button */ + if($enableBack){ + $result["BACK"]= ""; + }else{ + $result["BACK"]= ""._("Up").""; + } + + /* Draw home button */ + if($enableHome){ + $result["HOME"]= ""; + }else{ + $result["HOME"]= ""._("Home").""; + } + + /* Draw reload button, this button is enabled everytime */ + $result["RELOAD"]= ""; + + return ($result); + } + + static function filterActions() { return "TBD"; -- 2.30.2