Code

Added devices
[gosa.git] / gosa-plugins / systems / admin / systems / class_systemManagement.inc
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['RDN']))
50       $sP[] = $entry['RDN'];
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   
87  /*! \brief   Overridden render method of class mangement.
88   *            this allows us to add a release selection box.
89   */
90 function renderList()
91 {
92   $headpage = $this->getHeadpage();
93   $headpage->update();
95   $tD = $this->getObjectDefinitions();
96   $smarty = get_smarty();
97   foreach($tD as $name => $obj){
98     $smarty->assign("USE_".$name, (empty($obj['TABNAME']) || class_available($obj['TABNAME'])));
99   }
101   $display = $headpage->render();
102   return($this->getHeader().$display);
106   public function getObjectDefinitions()
107   {
108     $tabs = array(
109         "incoming"    => array(
110           "RDN"       => get_ou('systemIncomingRDN'),
111           "CLASS"     => "",
112           "TABNAME"   => "",
113           "TABCLASS"  => "",
114           "ACLC"      => "incoming",
115           "ACL"       => "incoming/systems"),
117         "ArpNewDevice"=> array(
118           "RDN"       => get_ou('systemIncomingRDN'),
119           "CLASS"     => "TERMTABS",
120           "TABNAME"   => "termgeneric" ,
121           "TABCLASS"  => "termtabs",
122           "ACLC"      => "incoming",
123           "ACL"       => "incoming/systems"),
125         "NewDevice"   => array(
126           "RDN"       => get_ou('systemIncomingRDN'),
127           "CLASS"     => "TERMTABS",
128           "TABNAME"   => "termgeneric",
129           "TABCLASS"  => "termtabs",
130           "ACLC"      => "incoming",
131           "ACL"       => "incoming/systems"),
133         "terminal"    => array(
134             "RDN"       => get_ou('terminalRDN'),
135             "CLASS"     => "TERMTABS",
136             "TABNAME"   => "termgeneric",
137             "TABCLASS"  => "termtabs",
138             "ACLC"      => "terminal",
139             "ACL"       => "terminal/termgeneric"),
141         "workstation" =>  array(
142             "RDN"       => get_ou('workstationRDN'),
143             "CLASS"   => "WORKTABS",
144             "TABNAME" => "workgeneric",
145             "TABCLASS"=> "worktabs",
146             "ACLC"    => "workstation",
147             "ACL"     => "workstation/workgeneric" ),
149         "server"      => array(
150             "RDN"       => get_ou('serverRDN'),
151             "CLASS"   => "SERVTABS",
152             "TABNAME" => "servgeneric",
153             "TABCLASS"=> "servtabs",
154             "ACLC"    => "server",
155             "ACL"     => "server/servgeneric"),
157         "printer"     => array(
158             "RDN"       => get_ou('printerRDN'),
159             "CLASS"   => "PRINTTABS",
160             "TABNAME" => "printgeneric",
161             "TABCLASS"=> "printtabs",
162             "ACLC"    => "printer",
163             "ACL"     => "printer/printgeneric"),
165         "phone"       => array(
166             "RDN"       => get_ou('phoneRDN'),
167             "CLASS"   => "PHONETABS",
168             "TABNAME" => "phoneGeneric",
169             "TABCLASS"=> "phonetabs",
170             "ACLC"    => "phone",
171             "ACL"     => "phone/phoneGeneric"),
173         "winstation"  => array(
174             "RDN"       => get_winstations_ou(),
175             "CLASS"   => "WINTABS",
176             "TABNAME" => "wingeneric",
177             "TABCLASS"=> "wintabs",
178             "ACLC"    => "winworkstation",
179             "ACL"     => "winworkstation/wingeneric"),
181         "component"   => array(
182             "RDN"       => get_ou('componentRDN'),
183             "CLASS"   => "COMPONENTTABS",
184             "TABNAME" => "componentGeneric",
185             "TABCLASS"=> "componenttabs",
186             "ACLC"    => "component",
187             "ACL"     => "component/componentGeneric"),
189         "opsi_client" => array(
190             "RDN"     => "",
191             "CLASS"   => "OPSITABS",
192             "TABNAME" => "opsiGeneric" ,
193             "TABCLASS"=> "opsi_tabs",
194             "ACLC"    => "opsi" ,
195             "ACL"     => "opsi/opsiGeneric"));
197     return($tabs);
198   }
201
202 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
203 ?>