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 systemManagement extends management
24 {
25 var $plHeadline = "Systems";
26 var $plDescription = "List of systems";
27 var $plIcon = "plugins/systems/images/plugin.png";
29 // Tab definition
30 protected $tabClass = "";
31 protected $tabType = "";
32 protected $aclCategory = "";
33 protected $aclPlugin = "";
34 protected $objectName = "";
36 protected $objectInfo = array();
38 protected $opsi = NULL;
40 function __construct($config,$ui)
41 {
42 $this->config = $config;
43 $this->ui = $ui;
45 // Set storage points
46 $tD = $this->getObjectDefinitions();
47 $sP = array();
48 foreach($tD as $entry){
49 if(!empty($entry['ou']))
50 $sP[] = $entry['ou'];
51 }
52 $this->storagePoints = array_unique($sP);
54 # // Build filter
55 # if (session::global_is_set(get_class($this)."_filter")){
56 # $filter= session::global_get(get_class($this)."_filter");
57 # } else {
58 $filter = new filter(get_template_path("system-filter.xml", true));
59 $filter->setObjectStorage($this->storagePoints);
60 # }
61 $this->setFilter($filter);
63 // Build headpage
64 $headpage = new listing(get_template_path("system-list.xml", true));
65 $headpage->setFilter($filter);
67 $filter->setConverter('INCOMING', 'systemManagement::incomingFilterConverter');
69 // Add copy&paste and snapshot handler.
70 if ($this->config->boolValueIsTrue("main", "copyPaste")){
71 $this->cpHandler = new CopyPasteHandler($this->config);
72 }
73 if($this->config->get_cfg_value("enableSnapshots") == "true"){
74 $this->snapHandler = new SnapshotHandler($this->config);
75 }
76 parent::__construct($config, $ui, "systems", $headpage);
77 }
79 static function incomingFilterConverter($filter)
80 {
81 $rdn = preg_replace("/^[^=]*=/", "", get_ou('systemIncomingRDN'));
82 $rdn = preg_replace("/,.*$/","",$rdn);
83 return(preg_replace("/%systemIncomingRDN/", $rdn,$filter));
84 }
86 function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
87 {
88 $headpage = $this->getHeadpage();
89 foreach($target as $id){
90 $type = $headpage->getType($id);
91 echo $type."<br>";
92 }
93 }
97 /*! \brief Overridden render method of class mangement.
98 * this allows us to add a release selection box.
99 */
100 function renderList()
101 {
102 $headpage = $this->getHeadpage();
103 $headpage->update();
105 $tD = $this->getObjectDefinitions();
106 $smarty = get_smarty();
107 foreach($tD as $name => $obj){
108 $smarty->assign("USE_".$name, (empty($obj['TABNAME']) || class_available($obj['TABNAME'])));
109 }
111 $display = $headpage->render();
112 return($this->getHeader().$display);
113 }
116 public function getObjectDefinitions()
117 {
119 # "workstation" => array(
120 # "RDN" => get_ou('workstationRDN'),
121 # "CLASS" => "WORKTABS",
122 # "TABNAME" => "workgeneric",
123 # "TABCLASS"=> "worktabs",
124 # "ACLC" => "workstation",
125 # "ACL" => "workstation/workgeneric" ),
128 $tabs = array(
129 "FAKE_OC_OpsiHost" => array(
130 "ou" => "",
131 "plugClass" => "opsiGeneric",
132 "tabClass" => "opsi_tabs",
133 "tabDesc" => "OPSITABS",
134 "aclClass" => "opsiGeneric",
135 "aclCategory" => "opsi"),
137 "goServer" => array(
138 "ou" => get_ou('serverRDN'),
139 "plugClass" => "servgeneric",
140 "tabClass" => "servtabs",
141 "tabDesc" => "SERVTABS",
142 "aclClass" => "servgeneric",
143 "aclCategory" => "server"),
145 "gotoWorkstation" => array(
146 "ou" => get_ou('workstationRDN'),
147 "plugClass" => "workgeneric",
148 "tabClass" => "worktabs",
149 "tabDesc" => "WORKTABS",
150 "aclClass" => "workstation",
151 "aclCategory" => "workgeneric"),
153 "gotoTerminal" => array(
154 "ou" => get_ou('terminalRDN'),
155 "plugClass" => "termgeneric",
156 "tabClass" => "termtabs",
157 "tabDesc" => "TERMTABS",
158 "aclClass" => "terminal",
159 "aclCategory" => "termgeneric"),
161 "gotoPrinter" => array(
162 "ou" => get_ou('printerRDN'),
163 "plugClass" => "printgeneric",
164 "tabClass" => "printtabs",
165 "tabDesc" => "PRINTABS",
166 "aclClass" => "printer",
167 "aclCategory" => "printgeneric"),
169 "FAKE_OC_NewDevice" => array(
170 "ou" => get_ou('systemIncomingRDN'),
171 "plugClass" => "termgeneric",
172 "tabClass" => "termtabs",
173 "tabDesc" => "TERMTABS",
174 "aclClass" => "terminal",
175 "aclCategory" => "termgeneric"),
177 "goFonHardware" => array(
178 "ou" => get_ou('phoneRDN'),
179 "plugClass" => "phoneGeneric",
180 "tabClass" => "phonetabs",
181 "tabDesc" => "PHONETABS",
182 "aclClass" => "phone",
183 "aclCategory" => "phoneGeneric"),
185 "FAKE_OC_winstation" => array(
186 "ou" => get_winstations_ou(),
187 "plugClass" => "wingeneric",
188 "tabClass" => "wintabs",
189 "tabDesc" => "WINTABS",
190 "aclClass" => "wingeneric",
191 "aclCategory" => "winworkstation"),
193 "ieee802Device" => array(
194 "ou" => get_ou('componentRDN'),
195 "plugClass" => "componentGeneric",
196 "tabClass" => "componenttabs",
197 "tabDesc" => "COMPONENTTABS",
198 "aclClass" => "componentGeneric",
199 "aclCategory" => "component"),
200 );
202 // Now map some special types
203 $tabs['FAKE_OC_NewWorkstation'] = &$tabs['gotoWorkstation'];
204 $tabs['FAKE_OC_NewTerminal'] = &$tabs['gotoTerminal'];
205 $tabs['FAKE_OC_NewServer'] = &$tabs['gotoWorkstation'];
206 $tabs['gotoWorkstation__IS_BUSY'] = &$tabs['gotoWorkstation'];
207 $tabs['gotoWorkstation__IS_ERROR'] = &$tabs['gotoWorkstation'];
208 $tabs['gotoWorkstation__IS_LOCKED'] = &$tabs['gotoWorkstation'];
209 $tabs['gotoTerminal__IS_BUSY'] = &$tabs['gotoTerminal'];
210 $tabs['gotoTerminal__IS_ERROR'] = &$tabs['gotoTerminal'];
211 $tabs['gotoTerminal__IS_LOCKED'] = &$tabs['gotoTerminal'];
212 $tabs['goServer__IS_BUSY'] = &$tabs['goServer'];
213 $tabs['goServer__IS_ERROR'] = &$tabs['goServer'];
214 $tabs['goServer__ISLOCKED'] = &$tabs['goServer'];
216 $tabs['FAKE_OC_NewUnknownDevice'] = &$tabs['FAKE_OC_NewDevice'];
218 return($tabs);
219 }
220 }
221 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
222 ?>