Code

Updated settings
[gosa.git] / gosa-core / plugins / admin / groups / class_groupManagement.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 groupManagement extends management
24 {
25   var $plHeadline     = "Groups";
26   var $plDescription  = "Group administration";
27   var $plIcon  = "plugins/groups/images/plugin.png";
29   // Tab definition 
30   protected $tabClass = "grouptabs";
31   protected $tabType = "GROUPTABS";
32   protected $aclCategory = "groups";
33   protected $aclPlugin   = "group";
34   protected $objectName   = "group";
36   function __construct($config,$ui)
37   {
38     $this->config = $config;
39     $this->ui = $ui;
40    
41     $this->storagePoints = array(get_ou("groupRDN"));
42  
43     // Build filter
44     if (session::global_is_set(get_class($this)."_filter")){
45       $filter= session::global_get(get_class($this)."_filter");
46     } else {
47       $filter = new filter(get_template_path("group-filter.xml", true));
48       $filter->setObjectStorage($this->storagePoints);
49     }
50     $this->setFilter($filter);
52     // Build headpage
53     $headpage = new listing(get_template_path("group-list.xml", true));
54     $headpage->registerElementFilter("filterProperties", "groupManagement::filterProperties");
55     $headpage->setFilter($filter);
57     // Add copy&paste and snapshot handler.
58     if ($this->config->boolValueIsTrue("main", "copyPaste")){
59       $this->cpHandler = new CopyPasteHandler($this->config);
60     }
61     if($this->config->get_cfg_value("enableSnapshots") == "true"){
62       $this->snapHandler = new SnapshotHandler($this->config);
63     }
64     parent::__construct($config, $ui, "groups", $headpage);
66     $this->registerAction("edit_group","editEntry");
67     $this->registerAction("edit_environment","editEntry");
68     $this->registerAction("edit_appgroup","editEntry");
69     $this->registerAction("edit_mailgroup","editEntry");
70   }
72   function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
73   {
74     management::editEntry($action,$target);
76     if(preg_match("/^edit_/",$action)){
77       $tab = preg_replace("/^edit_/","",$action);
78       if(isset($this->tabObject->by_object[$tab])){
79         $this->tabObject->current = $tab;
80       }else{
81         trigger_error("Unknown tab: ".$tab);
82       }
83     }
84   }
86   static function filterProperties($row, $classes)
87   {
88     $result= "";
90     $map = array(
91         "posixGroup" => 
92         array(
93           "image" => "plugins/groups/images/groups.png",
94           "plugin" => "group",
95           "alt" => _("Posix"),
96           "title" => _("Edit posix properties")
97           ),
99         "gosaMailAccount" => 
100         array(
101           "image" => "plugins/groups/images/mail.png",
102           "plugin" => "mailgroup",
103           "alt" => _("Mail"),
104           "title" => _("Edit mail properties")
105           ),
107         "sambaGroupMapping" => 
108         array(
109           "image" => "plugins/groups/images/samba.png",
110           "plugin" => "group",
111           "alt" => _("Samba"),
112           "title" => _("Edit samba properties")
113           ),
115         "goFonPickupGroup" => 
116           array(
117               "image" => "plugins/groups/images/asterisk.png",
118               "plugin" => "group",
119               "alt" => _("Phone"),
120               "title" => _("Edit phone properties")
121               ),
123         "gotoMenuGroup" => 
124           array(
125               "image" => "plugins/groups/images/menu.png",
126               "plugin" => "groupApplication",
127               "alt" => _("Menu"),
128               "title" => _("Edit start menu properties")
129               ),
131         "gotoEnvironment" => 
132           array(
133               "image" => "plugins/groups/images/environment.png",
134               "plugin" => "environment",
135               "alt" => _("Environment"),
136               "title" => _("Edit environment properties")
137               )
138           );
141     // Walk thru map
142     foreach ($map as $oc => $properties) {
143       if (in_array_ics($oc, $classes)) {
144         $result.="<input class='center' type='image' src='".$properties['image']."' ".
145           "alt='".$properties['alt']."' title='".$properties['title'].
146                  "' name='listing_edit_".$properties['plugin']."_$row' style='padding:1px'>";
147       } else {
148         $result.="<img src='images/empty.png' alt=' ' class='center' style='padding:1px'>";
149       }
150     }
151     return $result;
152   }
153
154 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
155 ?>