From bec0b267059af47bad39e9327da8a6d58df14453 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 18 Jan 2010 09:30:55 +0000 Subject: [PATCH] Updated management class -Allow to skip the page header. Updated class_baseSelectDialog to use the new generation lists git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15165 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_baseSelectDialog.inc | 113 ++++++++++--------- gosa-core/include/class_management.inc | 5 + 2 files changed, 63 insertions(+), 55 deletions(-) diff --git a/gosa-core/include/class_baseSelectDialog.inc b/gosa-core/include/class_baseSelectDialog.inc index d43da2ee6..1aebc8328 100644 --- a/gosa-core/include/class_baseSelectDialog.inc +++ b/gosa-core/include/class_baseSelectDialog.inc @@ -20,81 +20,84 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -class baseSelectDialog extends MultiSelectWindow +class baseSelectDialog extends management { - var $selectedBase = ""; // Used for navigation - var $base_selection_regex = "*"; // Used regex ... - var $BaseToUse = false; // used to specify the selected base, - // false if none is selected + // The plugin description + public $plugname = "Base"; + public $plIcon = "plugins/departments/images/plugin.png"; + public $plDescription = "Choose a base"; + public $plHeadline = "Base"; - var $allowedBases = array(); - var $parent = NULL; - - function baseSelectDialog (&$config,$parent,$onlyAllowThisBases = array()) - { - $module= "department"; - MultiSelectWindow::MultiSelectWindow($config, "BASEselectWindow", $module); - - $this->parent = $parent; - - $this->selectedBase = $config->current['BASE']; - $this->allowedBases = $onlyAllowThisBases; - - $this->SetTitle("Base"); - $this->SetSummary(_("Choose a base")); - $this->SetListHeader("
". - "  ". - "  ". - "  ". - "  ". - "
"); + protected $skipHeader = TRUE; + protected $allowedBases = array(); - $this->SetInformation(_("Step in the prefered tree and click save to use the current subtree as base. Or click the image at the end of each entry.")); + // #FIXME - Updated plugins to use a function instead of the public class var. + public $BaseToUse = ""; - $this->EnableAplhabet (true); - $this->EnableCloseButton(true); - $this->EnableSaveButton (true); + function __construct (&$config,$parent,$onlyAllowThisBases = array()) + { + $this->config = $config; + $this->ui = get_userinfo(); + $this->allowedBases = $onlyAllowThisBases; - $this->SetSaveButtonString(_("Use")); - $this->SetCloseButtonString(_("Cancel")); +# // Build filter +# if (session::global_is_set(get_class($this)."_filter")){ +# $filter= session::global_get(get_class($this)."_filter"); +# } else { + $filter = new filter(get_template_path("dep-filter.xml")); +# } + $this->setFilter($filter); - $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'")); - $this->AddHeader(array("string"=>_("Base"))); - - /* Name ,Text ,Default , Connect with alphabet */ - $this->AddRegex ("base_selection_regex",_("Filter entries with this syntax"),"*" , true); + // Build headpage + $headpage = new listing(get_template_path("dep-list.xml")); + $headpage->registerElementFilter("depLabel", "baseSelectDialog::filterDepLabel"); + $headpage->setFilter($filter); + parent::__construct($config, $this->ui, "departments", $headpage); } - function execute() - { - $this->ClearElementsList(); - $this->AddDepartments($this->selectedBase,2); - return($this->Draw()); - } - function setEntries() + // A filter which allows to open a department by clicking on the departments name. + static function filterDepLabel($row,$dn,$params,$ou,$pid,$base) { - // Do nothing here + $ou = $ou[0]; + if($dn == $base){ + $ou ="."; + } + $dn= LDAP::fix(func_get_arg(1)); + return("$ou"); } - function Save() + + function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="") { - MultiSelectWindow :: Save(); - $this->BaseToUse = $this->selectedBase; + if(count($target) == 1){ + $this->BaseToUse = array_pop($target); + } } - function isSelected() + function save_object() { - return($this->BaseToUse); + // Damn ... , we've to call post detection manually & thus twice ... + // #FIXME - We should fix the class handling in the plugins to match the class_management style. + // - save_object isn't needed anymore, just call execute... + $this->handleActions($this->detectPostActions()); } - function setCurrentBase($base) + function isClosed() { - $this->selectedBase = $base; + return(!empty($this->BaseToUse)); } + + function isSelected() + { + return($this->BaseToUse); + } + + function setCurrentBase($base) + { + $headpage = $this->getHeadpage(); + $headpage->setBase = $base; + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-core/include/class_management.inc b/gosa-core/include/class_management.inc index 544051dd0..98f02cee2 100644 --- a/gosa-core/include/class_management.inc +++ b/gosa-core/include/class_management.inc @@ -60,6 +60,9 @@ class management // Whether to display the apply button or not protected $displayApplyBtn = FALSE; + // Whether to display a header or not. + protected $skipHeader = false; + // Whether to display a footer or not. protected $skipFooter = false; @@ -203,6 +206,8 @@ class management */ protected function getHeader() { + if($this->skipHeader) return(""); + if (get_object_info() != ""){ $display= print_header(get_template_path($this->plIcon),_($this->plDescription), "\"\"". -- 2.30.2