Code

b2079be03973534b201a5bcc98bed86bfe67e096
[gosa.git] / gosa-core / plugins / admin / users / class_userManagement.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 userManagement extends management
24 {
25   var $plHeadline     = "Users";
26   var $plDescription  = "Manage users";
27   var $plIcon  = "plugins/users/images/user.png";
29   // Tab definition 
30   protected $tabClass = "usertabs";
31   protected $tabType = "USERTABS";
32   protected $aclCategory = "users";
33   protected $aclPlugin   = "user";
34   protected $objectName   = "user";
36   function __construct($config,$ui)
37   {
38     $this->config = $config;
39     $this->ui = $ui;
40     
41     // Build filter
42     $filter = new filter(get_template_path("user-filter.xml", true));
43     $filter->setObjectStorage("ou=people,");
45     // Build headpage
46     $headpage = new listing(get_template_path("user-list.xml", true));
47     $headpage->registerElementFilter("lockLabel", "userManagement::filterLockLabel");
48     $headpage->registerElementFilter("lockImage", "userManagement::filterLockImage");
49     $headpage->setFilter($filter);
50     $this->cpHandler = new CopyPasteHandler($this->config);
51     $this->snapHandler = new SnapshotHandler($this->config);
53     parent::__construct($config, $ui, "users", $headpage);
55     $this->registerAction("new",    "newEntry");
56     $this->registerAction("edit",   "editEntry");
57     $this->registerAction("apply",  "applyChanges");
58     $this->registerAction("save",   "saveChanges");
59     $this->registerAction("cancel", "cancelEdit");
60     $this->registerAction("remove", "removeEntryRequested");
61     $this->registerAction("removeConfirmed", "removeEntryConfirmed");
63     $this->registerAction("copy",   "copyPasteHandler");
64     $this->registerAction("cut",    "copyPasteHandler");
65     $this->registerAction("paste",  "copyPasteHandler");
67     $this->registerAction("new_template", "newTemplate");
68   }
70   function newTemplate($action,$entry)
71   {
72     $this->newEntry();
73     $this->tabObject->set_template_mode ();
74   }
75 static function filterLockImage($userPassword)
76   {
77     $image= "images/empty.png";
79     if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){
80       if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){
81         $image= "images/lists/locked.png";
82       }else{
83         $image= "images/lists/unlocked.png";
84       }
85     }
87     return $image;
88   }
91   static function filterLockLabel($userPassword)
92   {
93     $label= "";
95     if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){
96       if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){
97         $label= _("Unlock account");
98       }else{
99         $label= _("Lock account");
100       }
101     }
103     return $label;
104   }
107
108 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
109 ?>