Code

Added shortcur icons to ogroups.
[gosa.git] / gosa-core / plugins / admin / ogroups / class_ogroupManagement.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 ogroupManagement extends management
24 {
25   var $plHeadline     = "Object groups";
26   var $plDescription  = "Manage object groups";
27   var $plIcon  = "plugins/ogroups/images/plugin.png";
29   // Tab definition 
30   protected $tabClass = "ogrouptabs";
31   protected $tabType = "OGROUPTABS";
32   protected $aclCategory = "ogroups";
33   protected $aclPlugin   = "ogroup";
34   protected $objectName   = "object group";
36   function __construct($config,$ui)
37   {
38     $this->config = $config;
39     $this->ui = $ui;
41     $this->storagePoints = array(get_ou("ogroupRDN"));
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("ogroup-filter.xml", true));
48   $filter->setObjectStorage($this->storagePoints);
49 #   }
50   $this->setFilter($filter);
52   // Build headpage
53   $headpage = new listing(get_template_path("ogroup-list.xml", true));
54   $headpage->registerElementFilter("filterProperties", "ogroupManagement::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, "ogroups", $headpage);
66   $this->registerAction("edit_ogroup","editEntry");
67   $this->registerAction("edit_phonequeue","editEntry");
68   $this->registerAction("edit_workstartup","editEntry");
69   $this->registerAction("edit_termgroup","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, $gosaGroupObjects)
87   {
89     $conv= array(
90         "Y" => array("plugins/users/images/select_template.png",_("Templates") , "ogroup"),
91         "U" => array("plugins/generic/images/head.png"        ,_("User")        , "ogroup"),
92         "G" => array("plugins/groups/images/groups.png"       ,_("Group")       , "ogroup"),
93         "A" => array("plugins/ogroups/images/application.png" ,_("Application") , "ogroup"),
94         "D" => array("plugins/departments/department.png"     ,_("Department")  , "ogroup"),
95         "S" => array("plugins/ogroups/images/server.png"      ,_("Server")      , "ogroup"),
96         "F" => array("plugins/ogroups/images/asterisk.png"    ,_("Phone")       , "phonequeue"),
97         "W" => array("plugins/ogroups/images/workstation.png" ,_("Workstation") , "workstartup"),
98         "O" => array("plugins/ogroups/images/winstation.png"  ,_("Windows Install") , "ogroup"),
99         "T" => array("plugins/ogroups/images/terminal.png"    ,_("Terminal")    , "termgroup"),
100         "P" => array("plugins/ogroups/images/printer.png"     ,_("Printer")     , "ogroup"));
102     $types = preg_replace("/[^a-z]/i","",$gosaGroupObjects[0]);
103     $result ="";
104     for($i = 0 ; $i < strlen($types); $i++){
105       $type = $types[$i];
106       $result.="<input class='center' type='image' src='".$conv[$type][0]."' ".
107         "alt='".$conv[$type][1]."' title='".$conv[$type][1].
108         "' name='listing_edit_".$conv[$type][2]."_$row' style='padding:1px'>";
110     }
111     return($result);
112   }
113
114 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
115 ?>