f85567701c92426b3dd9c05188de3101c51b9b62
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;
41 $this->storagePoints = array(get_ou("groupRDN"));
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 "gotoEnvironment" =>
124 array(
125 "image" => "plugins/groups/images/environment.png",
126 "plugin" => "environment",
127 "alt" => _("Environment"),
128 "title" => _("Edit environment properties")
129 )
130 );
133 // Walk thru map
134 foreach ($map as $oc => $properties) {
135 if (in_array_ics($oc, $classes)) {
136 $result.="<input class='center' type='image' src='".$properties['image']."' ".
137 "alt='".$properties['alt']."' title='".$properties['title'].
138 "' name='listing_edit_".$properties['plugin']."_$row' style='padding:1px'>";
139 } else {
140 $result.="<img src='images/empty.png' alt=' ' class='center' style='padding:1px'>";
141 }
142 }
143 return $result;
144 }
145 }
146 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
147 ?>