Code

Allow department edit again
[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   }
70   function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
71   {
72     $types= $this->get_support_departments();
73     $type = $this->headpage->getType($target[0]);
74     management::editEntry($action,$target,$all,$this->tabClass,$types[$type]['TAB'],$this->aclCategory);
75   }
77   
79   function openEntry($action,$entry)
80   {
81     $this->headpage->setBase(array_pop($entry));
82   }
85   static function filterDepLabel($row,$dn,$params,$ou,$pid,$base)
86   {
87     $ou = $ou[0];
88     if($dn == $base){
89       $ou =".";
90     }
91     $dn= LDAP::fix(func_get_arg(1));
92     return("<a href='?plug=".$_GET['plug']."&amp;PID=$pid&amp;act=listing_open_$row' title='$dn'>$ou</a>");
93   }
96   /*! \brief  Returns information about all container types that GOsa con handle.
97     @return Array   Informations about departments supported by GOsa.
98    */
99   public static function get_support_departments()
100   {
101     /* Domain 
102      */ 
103     $types = array();
104     $types['domain']['ACL']     = "domain"; 
105     $types['domain']['CLASS']   = "domain"; 
106     $types['domain']['ATTR']    = "dc"; 
107     $types['domain']['TAB']     = "DOMAIN_TABS"; 
108     $types['domain']['OC']      = "domain"; 
109     $types['domain']['IMG']     = "plugins/departments/images/domain.png"; 
110     $types['domain']['IMG_FULL']= "plugins/departments/images/domain.png"; 
111     $types['domain']['TITLE']   = _("Domain"); 
112     $types['domain']['TPL']     = "domain.tpl"; 
114     /* Domain component 
115      */
116     $types['dcObject']['ACL']     = "dcObject";
117     $types['dcObject']['CLASS']   = "dcObject";
118     $types['dcObject']['ATTR']    = "dc";
119     $types['dcObject']['TAB']     = "DCOBJECT_TABS";
120     $types['dcObject']['OC']      = "dcObject";
121     $types['dcObject']['IMG']     = "plugins/departments/images/dc.png";
122     $types['dcObject']['IMG_FULL']= "plugins/departments/images/dc.png";
123     $types['dcObject']['TITLE']   = _("Domain Component");
124     $types['dcObject']['TPL']     = "dcObject.tpl";
126     /* Country object
127      */
128     $types['country']['ACL']     = "country";
129     $types['country']['CLASS']   = "country";
130     $types['country']['TAB']     = "COUNTRY_TABS";
131     $types['country']['ATTR']    = "c";
132     $types['country']['OC']      = "country";
133     $types['country']['IMG']     = "plugins/departments/images/country.png";
134     $types['country']['IMG_FULL']= "plugins/departments/images/country.png";
135     $types['country']['TITLE']   = _("Country");
136     $types['country']['TPL']     = "country.tpl";
138     /* Locality object
139      */
140     $types['locality']['ACL']     = "locality";
141     $types['locality']['CLASS']   = "locality";
142     $types['locality']['TAB']     = "LOCALITY_TABS";
143     $types['locality']['ATTR']    = "l";
144     $types['locality']['OC']      = "locality";
145     $types['locality']['IMG']     = "plugins/departments/images/locality.png";
146     $types['locality']['IMG_FULL']= "plugins/departments/images/locality.png";
147     $types['locality']['TITLE']   = _("Locality");
148     $types['locality']['TPL']     = "locality.tpl";
150     /* Organization
151      */
152     $types['organization']['ACL']     = "organization";
153     $types['organization']['CLASS']   = "organization";
154     $types['organization']['TAB']     = "ORGANIZATION_TABS";
155     $types['organization']['ATTR']    = "o";
156     $types['organization']['OC']      = "organization";
157     $types['organization']['IMG']     = "plugins/departments/images/organization.png";
158     $types['organization']['IMG_FULL']= "plugins/departments/images/organization.png";
159     $types['organization']['TITLE']   = _("Organization");
160     $types['organization']['TPL']     = "organization.tpl";
162     /* Department
163      */
164     $types['organizationalUnit']['ACL']     = "department";
165     $types['organizationalUnit']['CLASS']   = "department";
166     $types['organizationalUnit']['TAB']     = "DEPTABS";
167     $types['organizationalUnit']['ATTR']    = "ou";
168     $types['organizationalUnit']['OC']      = "organizationalUnit";
169     $types['organizationalUnit']['IMG']     = "images/lists/folder.png";//plugins/departments/images/department.png";
170     $types['organizationalUnit']['IMG_FULL']= "images/lists/folder-full.png";//:wplugins/departments/images/department.png";
171     $types['organizationalUnit']['TITLE']   = _("Department");
172     $types['organizationalUnit']['TPL']     = "generic.tpl";
174 #  /* Alias
175 #   */
176 #  $types['alias']['ACL']     = "alias";
177 #  $types['alias']['CLASS']   = "alias";
178 #  $types['alias']['TAB']     = "ALIASTABS";
179 #  $types['alias']['ATTR']    = "???";
180 #  $types['alias']['OC']      = "???";
181 #  $types['alias']['IMG']     = "plugins/departments/images/department_alias.png";
182 #  $types['alias']['IMG_FULL']= "plugins/departments/images/department_alias.png";
183 #  $types['alias']['TITLE']   = _("Alias");
184 #  $types['alias']['TPL']     = "alias.tpl";
186 #  /* Referal
187 #   */
188 #  $types['referal']['ACL']     = "referal";
189 #  $types['referal']['CLASS']   = "referal";
190 #  $types['referal']['TAB']     = "REFERALTABS";
191 #  $types['referal']['ATTR']    = "???";
192 #  $types['referal']['OC']      = "???";
193 #  $types['referal']['IMG']     = "plugins/departments/images/department_referal.png";
194 #  $types['referal']['IMG_FULL']= "plugins/departments/images/department_referal.png";
195 #  $types['referal']['TITLE']   = _("Referal");
196 #  $types['referal']['TPL']     = "referal.tpl";
198     return($types);
199   }
200
201 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
202 ?>