Code

Updated department listing
[gosa.git] / gosa-core / plugins / admin / departments / class_departmentManagement.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 departmentManagement extends management
24 {
25   var $plHeadline     = "Departments";
26   var $plDescription  = "Manage departmentw";
28   // Tab definition 
29   protected $tabClass = "deptabs";
30   protected $tabType = "DEPTABS";
31   protected $aclCategory = "departement";
32   protected $aclPlugin   = "generic";
33   protected $objectName   = "department";
35   function __construct($config,$ui)
36   {
37     $this->config = $config;
38     $this->ui = $ui;
39    
40     $this->storagePoints = array("");
41  
42     // Build filter
43     #if (session::global_is_set(get_class($this)."_filter")){
44       $filter= session::global_get(get_class($this)."_filter");
45 #    } else {
46       $filter = new filter(get_template_path("dep-filter.xml", true));
47  #     $filter->setObjectStorage($this->storagePoints);
48  #   }
49     $this->setFilter($filter);
51     // Build headpage
52     $headpage = new listing(get_template_path("dep-list.xml", true));
53     $headpage->registerElementFilter("depLabel", "departmentManagement::filterDepLabel");
54     $headpage->setFilter($filter);
56     // Add copy&paste and snapshot handler.
57     if ($this->config->boolValueIsTrue("main", "copyPaste")){
58       $this->cpHandler = new CopyPasteHandler($this->config);
59     }
60     if($this->config->get_cfg_value("enableSnapshots") == "true"){
61       $this->snapHandler = new SnapshotHandler($this->config);
62     }
64     parent::__construct($config, $ui, "departments", $headpage);
66     $this->registerAction("open","openEntry");
67   }
69   function openEntry($action,$entry)
70   {
71     $this->headpage->setBase(array_pop($entry));
72   }
75   static function filterDepLabel($row,$dn,$params,$ou,$pid,$base)
76   {
77     $ou = $ou[0];
78     if($dn == $base){
79       $ou =".";
80     }
81     $dn= LDAP::fix(func_get_arg(1));
82     return("<a href='?plug=".$_GET['plug']."&amp;PID=$pid&amp;act=listing_open_$row' title='$dn'>$ou</a>");
83   }
87   /*! \brief  Returns information about all container types that GOsa con handle.
88     @return Array   Informations about departments supported by GOsa.
89    */
90   public static function get_support_departments()
91   {
92     /* Domain 
93      */ 
94     $types = array();
95     $types['domain']['ACL']     = "domain"; 
96     $types['domain']['CLASS']   = "domain"; 
97     $types['domain']['ATTR']    = "dc"; 
98     $types['domain']['TAB']     = "DOMAIN_TABS"; 
99     $types['domain']['OC']      = "domain"; 
100     $types['domain']['IMG']     = "plugins/departments/images/domain.png"; 
101     $types['domain']['IMG_FULL']= "plugins/departments/images/domain.png"; 
102     $types['domain']['TITLE']   = _("Domain"); 
103     $types['domain']['TPL']     = "domain.tpl"; 
105     /* Domain component 
106      */
107     $types['dcObject']['ACL']     = "dcObject";
108     $types['dcObject']['CLASS']   = "dcObject";
109     $types['dcObject']['ATTR']    = "dc";
110     $types['dcObject']['TAB']     = "DCOBJECT_TABS";
111     $types['dcObject']['OC']      = "dcObject";
112     $types['dcObject']['IMG']     = "plugins/departments/images/dc.png";
113     $types['dcObject']['IMG_FULL']= "plugins/departments/images/dc.png";
114     $types['dcObject']['TITLE']   = _("Domain Component");
115     $types['dcObject']['TPL']     = "dcObject.tpl";
117     /* Country object
118      */
119     $types['country']['ACL']     = "country";
120     $types['country']['CLASS']   = "country";
121     $types['country']['TAB']     = "COUNTRY_TABS";
122     $types['country']['ATTR']    = "c";
123     $types['country']['OC']      = "country";
124     $types['country']['IMG']     = "plugins/departments/images/country.png";
125     $types['country']['IMG_FULL']= "plugins/departments/images/country.png";
126     $types['country']['TITLE']   = _("Country");
127     $types['country']['TPL']     = "country.tpl";
129     /* Locality object
130      */
131     $types['locality']['ACL']     = "locality";
132     $types['locality']['CLASS']   = "locality";
133     $types['locality']['TAB']     = "LOCALITY_TABS";
134     $types['locality']['ATTR']    = "l";
135     $types['locality']['OC']      = "locality";
136     $types['locality']['IMG']     = "plugins/departments/images/locality.png";
137     $types['locality']['IMG_FULL']= "plugins/departments/images/locality.png";
138     $types['locality']['TITLE']   = _("Locality");
139     $types['locality']['TPL']     = "locality.tpl";
141     /* Organization
142      */
143     $types['organization']['ACL']     = "organization";
144     $types['organization']['CLASS']   = "organization";
145     $types['organization']['TAB']     = "ORGANIZATION_TABS";
146     $types['organization']['ATTR']    = "o";
147     $types['organization']['OC']      = "organization";
148     $types['organization']['IMG']     = "plugins/departments/images/organization.png";
149     $types['organization']['IMG_FULL']= "plugins/departments/images/organization.png";
150     $types['organization']['TITLE']   = _("Organization");
151     $types['organization']['TPL']     = "organization.tpl";
153     /* Department
154      */
155     $types['organizationalUnit']['ACL']     = "department";
156     $types['organizationalUnit']['CLASS']   = "department";
157     $types['organizationalUnit']['TAB']     = "DEPTABS";
158     $types['organizationalUnit']['ATTR']    = "ou";
159     $types['organizationalUnit']['OC']      = "organizationalUnit";
160     $types['organizationalUnit']['IMG']     = "images/lists/folder.png";//plugins/departments/images/department.png";
161     $types['organizationalUnit']['IMG_FULL']= "images/lists/folder-full.png";//:wplugins/departments/images/department.png";
162     $types['organizationalUnit']['TITLE']   = _("Department");
163     $types['organizationalUnit']['TPL']     = "generic.tpl";
165 #  /* Alias
166 #   */
167 #  $types['alias']['ACL']     = "alias";
168 #  $types['alias']['CLASS']   = "alias";
169 #  $types['alias']['TAB']     = "ALIASTABS";
170 #  $types['alias']['ATTR']    = "???";
171 #  $types['alias']['OC']      = "???";
172 #  $types['alias']['IMG']     = "plugins/departments/images/department_alias.png";
173 #  $types['alias']['IMG_FULL']= "plugins/departments/images/department_alias.png";
174 #  $types['alias']['TITLE']   = _("Alias");
175 #  $types['alias']['TPL']     = "alias.tpl";
177 #  /* Referal
178 #   */
179 #  $types['referal']['ACL']     = "referal";
180 #  $types['referal']['CLASS']   = "referal";
181 #  $types['referal']['TAB']     = "REFERALTABS";
182 #  $types['referal']['ATTR']    = "???";
183 #  $types['referal']['OC']      = "???";
184 #  $types['referal']['IMG']     = "plugins/departments/images/department_referal.png";
185 #  $types['referal']['IMG_FULL']= "plugins/departments/images/department_referal.png";
186 #  $types['referal']['TITLE']   = _("Referal");
187 #  $types['referal']['TPL']     = "referal.tpl";
189     return($types);
190   }
191
192 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
193 ?>