1 <?php
2 /*
3 * This code is part of GOsa (http://www.gosa-project.org)
4 * Copyright (C) 2003-2008 GONICUS GmbH
5 *
6 * ID: $$Id$$
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
23 class baseSelectDialog extends MultiSelectWindow
24 {
25 var $selectedBase = ""; // Used for navigation
26 var $base_selection_regex = "*"; // Used regex ...
27 var $BaseToUse = false; // used to specify the selected base,
28 // false if none is selected
30 var $allowedBases = array();
31 var $parent = NULL;
33 function baseSelectDialog (&$config,$parent,$onlyAllowThisBases = array())
34 {
35 $module= "department";
36 MultiSelectWindow::MultiSelectWindow($config, "BASEselectWindow", $module);
38 $this->parent = $parent;
40 $this->selectedBase = $config->current['BASE'];
41 $this->allowedBases = $onlyAllowThisBases;
43 $this->SetTitle("Base");
44 $this->SetSummary(_("Choose a base"));
45 $this->SetListHeader("<div style='background:#F0F0F9;padding:5px;'>".
46 " <input class='center' type='image' src='images/lists/root.png' align='middle'
47 title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
48 " <input class='center' type='image' align='middle' src='images/lists/back.png'
49 title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
50 " <input class='center' type='image' align='middle' src='images/lists/home.png'
51 title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
52 " <input class='center' type='image' src='images/lists/reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ".
53 "</div>");
55 $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."));
57 $this->EnableAplhabet (true);
58 $this->EnableCloseButton(true);
59 $this->EnableSaveButton (true);
61 $this->SetSaveButtonString(_("Use"));
62 $this->SetCloseButtonString(_("Cancel"));
64 $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
65 $this->AddHeader(array("string"=>_("Base")));
67 /* Name ,Text ,Default , Connect with alphabet */
68 $this->AddRegex ("base_selection_regex",_("Filter entries with this syntax"),"*" , true);
69 }
71 function execute()
72 {
73 $this->ClearElementsList();
74 $this->AddDepartments($this->selectedBase,2);
75 return($this->Draw());
76 }
78 function setEntries()
79 {
80 // Do nothing here
81 }
83 function Save()
84 {
85 MultiSelectWindow :: Save();
86 $this->BaseToUse = $this->selectedBase;
87 }
89 function isSelected()
90 {
91 return($this->BaseToUse);
92 }
94 function setCurrentBase($base)
95 {
96 $this->selectedBase = $base;
97 }
98 }
99 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
100 ?>