dfab7aeff04b3eb18c78241d53c41bb9c6ebc744
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 var $sn = "";
30 var $givenName = "";
31 var $uid = "";
32 var $got_uid = "";
33 var $edit_uid = "";
35 var $pwd_change_queue = array();
37 // Tab definition
38 protected $tabClass = "usertabs";
39 protected $tabType = "USERTABS";
40 protected $aclCategory = "users";
41 protected $aclPlugin = "user";
42 protected $objectName = "user";
44 function __construct($config,$ui)
45 {
46 $this->config = $config;
47 $this->ui = $ui;
49 $this->storagePoints = array(get_ou("userRDN"));
51 // Build filter
52 if (session::global_is_set(get_class($this)."_filter")){
53 $filter= session::global_get(get_class($this)."_filter");
54 } else {
55 $filter = new filter(get_template_path("user-filter.xml", true));
56 $filter->setObjectStorage($this->storagePoints);
57 }
58 $this->setFilter($filter);
60 // Build headpage
61 $headpage = new listing(get_template_path("user-list.xml", true));
62 $headpage->registerElementFilter("lockLabel", "userManagement::filterLockLabel");
63 $headpage->registerElementFilter("lockImage", "userManagement::filterLockImage");
64 $headpage->registerElementFilter("filterProperties", "userManagement::filterProperties");
65 $headpage->setFilter($filter);
67 // Add copy&paste and snapshot handler.
68 if ($this->config->boolValueIsTrue("main", "copyPaste")){
69 $this->cpHandler = new CopyPasteHandler($this->config);
70 }
71 if($this->config->get_cfg_value("enableSnapshots") == "true"){
72 $this->snapHandler = new SnapshotHandler($this->config);
73 }
75 parent::__construct($config, $ui, "users", $headpage);
77 // Register special user actions
78 $this->registerAction("lock", "lockEntry");
79 $this->registerAction("lockUsers", "lockUsers");
80 $this->registerAction("unlockUsers", "lockUsers");
81 $this->registerAction("new_template", "newTemplate");
82 $this->registerAction("newfromtpl", "newUserFromTemplate");
83 $this->registerAction("templateContinue", "templateContinue");
84 $this->registerAction("templatize", "templatizeUsers");
85 $this->registerAction("templatizeContinue", "templatizeContinue");
87 $this->registerAction("password", "changePassword");
88 $this->registerAction("passwordQueue", "handlePasswordQueue");
89 $this->registerAction("passwordCancel", "closeDialogs");
91 $this->registerAction("sendMessage", "sendMessage");
92 $this->registerAction("saveEventDialog", "saveEventDialog");
93 $this->registerAction("abortEventDialog", "closeDialogs");
95 // Register shortcut icon actions
96 $this->registerAction("edit_user","editEntry");
97 $this->registerAction("edit_posixAccount","editEntry");
98 $this->registerAction("edit_mailAccount","editEntry");
99 $this->registerAction("edit_sambaAccount","editEntry");
100 $this->registerAction("edit_netatalk","editEntry");
101 $this->registerAction("edit_environment","editEntry");
102 $this->registerAction("edit_gofaxAccount","editEntry");
103 $this->registerAction("edit_phoneAccount","editEntry");
104 }
107 // Inject user actions
108 function detectPostActions()
109 {
110 $action = management::detectPostActions();
111 if(isset($_POST['template_continue'])) $action['action'] = "templateContinue";
112 if(isset($_POST['templatize_continue'])) $action['action'] = "templatizeContinue";
113 if(isset($_POST['save_event_dialog'])) $action['action'] = "saveEventDialog";
114 if(isset($_POST['abort_event_dialog'])) $action['action'] = "abortEventDialog";
115 if(isset($_POST['password_cancel'])){
116 $action['action'] = "passwordCancel";
117 }elseif((count($this->pwd_change_queue) || isset($_POST['password_finish']))){
118 $action['action'] = "passwordQueue";
119 }
120 return($action);
121 }
124 function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
125 {
126 management::editEntry($action,$target);
128 if(preg_match("/^edit_/",$action)){
129 $tab = preg_replace("/^edit_/","",$action);
130 if(isset($this->tabObject->by_object[$tab])){
131 $this->tabObject->current = $tab;
132 }else{
133 trigger_error("Unknown tab: ".$tab);
134 }
135 }
136 }
139 function closeDialogs()
140 {
141 management::closeDialogs();
142 $this->pwd_change_queue = array();
143 }
146 /*! \brief Sends a message to a set of users using gosa-si events.
147 */
148 function sendMessage($action="",$target=array(),$all=array())
149 {
150 if(class_available("DaemonEvent")){
151 $uids = array();
152 $ldap = $this->config->get_ldap_link();
153 $ldap->cd($this->config->current['BASE']);
154 foreach($target as $dn){
155 $ldap->cat($dn,array('uid'));
156 $attrs = $ldap->fetch();
157 if(isset($attrs['uid'][0])){
158 $uids[] = $attrs['uid'][0];
159 }
160 }
161 if(count($uids)){
162 $events = DaemonEvent::get_event_types(USER_EVENT);
163 $event = "DaemonEvent_notify";
164 if(isset($events['BY_CLASS'][$event])){
165 $type = $events['BY_CLASS'][$event];
166 $this->dialogObject = new $type['CLASS_NAME']($this->config);
167 $this->dialogObject->add_users($uids);
168 $this->dialogObject->set_type(SCHEDULED_EVENT);
169 }
170 }
171 }
172 }
175 /*! \brief Sends a message to a set of users using gosa-si events.
176 */
177 function saveEventDialog()
178 {
179 $this->dialogObject->save_object();
180 $msgs = $this->dialogObject->check();
181 if(count($msgs)){
182 msg_dialog::displayChecks($msgs);
183 }else{
184 $o_queue = new gosaSupportDaemon();
185 $o_queue->append($this->dialogObject);
186 if($o_queue->is_error()){
187 msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
188 }
189 $this->closeDialogs();
190 }
191 }
194 /*! \brief Intiates template creation.
195 */
196 function newTemplate($action,$entry)
197 {
198 $this->newEntry();
199 $this->tabObject->set_template_mode ();
200 }
203 /*! \brief Queues a set of users for password changes
204 */
205 function changePassword($action="",$target=array(),$all=array())
206 {
207 $this->dn ="";
208 $this->pwd_change_queue = $target;
210 // Check permisions
211 $disallowed = array();
212 foreach($this->pwd_change_queue as $key => $dn){
213 if(!preg_match("/w/",$this->ui->get_permissions($dn,$this->aclCategory."/password"))){
214 unset($this->pwd_change_queue[$key]);
215 $disallowed[] = $dn;
216 }
217 }
218 if(count($disallowed)){
219 msg_dialog::display(_("Permission"),msgPool::permModify($disallowed),INFO_DIALOG);
220 }
222 // Now display change dialog.
223 return($this->handlePasswordQueue());
224 }
227 function handlePasswordQueue()
228 {
229 // Get next entry from queue.
230 if(empty($this->dn) && count($this->pwd_change_queue)){
231 $this->dn = array_pop($this->pwd_change_queue);
232 set_object_info($this->dn);
233 $smarty = get_smarty();
234 return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
235 }
237 // Check permissions
238 $dn = $this->dn;
239 $acl = $this->ui->get_permissions($dn, "users/password");
240 $cacl= $this->ui->get_permissions($dn, "users/user");
241 if (preg_match('/w/', $acl) || preg_match('/c/', $cacl)){
242 $message= array();
243 if ($_POST['new_password'] != $_POST['repeated_password']){
244 $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
245 } else {
246 if ($_POST['new_password'] == ""){
247 $message[] = msgPool::required(_("New password"));
248 }
249 }
251 // Display errors
252 if (count($message) != 0){
253 msg_dialog::displayChecks($message);
254 $smarty = get_smarty();
255 return($smarty->fetch(get_template_path('password.tpl', TRUE)));
256 }
258 // Change cassword
259 if(!change_password ($this->dn, $_POST['new_password'])){
260 return($smarty->fetch(get_template_path('password.tpl', TRUE)));
261 }
262 if ($this->config->get_cfg_value("passwordHook") != ""){
263 exec($this->config->get_cfg_value("passwordHook")." ".$username." ".$_POST['new_password'], $resarr);
264 }
265 new log("modify","users/".get_class($this),$this->dn,array(),"Password has been changed");
266 $this->dn ="";
268 } else {
269 msg_dialog::display(_("Password change"),
270 _("You have no permission to change this users password!"),
271 WARNING_DIALOG);
272 }
274 // Cleanup
275 if(!count($this->pwd_change_queue)){
276 $this->remove_lock();
277 $this->closeDialogs();
278 }else{
279 return($this->handlePasswordQueue());
280 }
281 }
284 /*! \brief Save user modifications.
285 * Whenever we save a 'new' user, request a password change for him.
286 */
287 function saveChanges()
288 {
289 management::saveChanges();
290 if($this->last_dn == "new"){
291 $this->pwd_change_queue[] = $this->last_tabObject->dn;
292 return($this->handlePasswordQueue());
293 }
294 }
297 /*! \brief Intiates user creation.
298 * If we've user templates, then the user will be asked to use to use one.
299 * -> See 'templateContinue' for further handling.
300 */
301 function newUserFromTemplate($action="",$target=array(),$all=array())
302 {
303 // Call parent method, it knows whats to do, locking and so on ...
304 management::newEntry($action,$target,$all);
306 // Reset uid selection.
307 $this->got_uid= "";
309 // Use template if there are any of them
310 $templates = array();
311 $templates['none']= _("none");
312 $templates = array_merge($templates,$this->get_templates());
314 // We've templates, so preset the current template and display the input dialog.
315 if (count($templates)){
316 $smarty = get_smarty();
317 foreach(array("sn", "givenName", "uid", "got_uid") as $attr){
318 $smarty->assign("$attr", "");
319 }
320 $smarty->assign("template", array_pop($target));
321 $smarty->assign("templates", $templates);
322 $smarty->assign("edit_uid", "");
323 return($smarty->fetch(get_template_path('template.tpl', TRUE)));
325 // -> See 'templateContinue' for further handling!
326 }
327 }
331 /*! \brief Intiates user creation.
332 * If we've user templates, then the user will be asked
333 * if he wants to use one.
334 * -> See 'templateContinue' for further handling.
335 */
336 function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
337 {
339 // Call parent method, it manages everything, locking, object creation...
340 management::newEntry($action,$target,$all);
342 // If we've at least one template, then ask the user if he wants to use one?
343 $templates = array();
344 $templates['none']= _("none");
345 $templates = array_merge($templates,$this->get_templates());
347 // Display template selection
348 if (count($templates)){
349 $smarty = get_smarty();
351 // Set default variables, normally empty.
352 foreach(array("sn", "givenName", "uid", "got_uid") as $attr){
353 $smarty->assign($attr, "");
354 }
355 $smarty->assign("template", "none");
356 $smarty->assign("templates", $templates);
357 $smarty->assign("edit_uid", "");
358 return($smarty->fetch(get_template_path('template.tpl', TRUE)));
360 // -> See 'templateContinue' for further handling!
361 }
362 }
365 /* !\brief This method is called whenever a template selection was displayed.
366 * Here we act on the use selection.
367 * - Does the user want to create a user from template?
368 * - Create user without template?
369 * - Input correct, every value given and valid?
370 */
371 function templateContinue()
372 {
373 // Get the list of available templates.
374 $templates = array();
375 $templates['none']= _("none");
376 $templates = array_merge($templates,$this->get_templates());
378 // Input validation, if someone wants to create a user from a template
379 // then validate the given values.
380 $message = array();
381 if(!isset($_POST['template']) || (empty($_POST['template']))){
382 $message[]= msgPool::invalid(_("Template"));
383 }
384 if(!isset($_POST['sn']) || (empty($_POST['sn']))){
385 $message[]= msgPool::required(_("Name"));
386 }
387 if(!isset($_POST['givenName']) || (empty($_POST['givenName']))){
388 $message[]= msgPool::required(_("Given name"));
389 }
391 /********************
392 * 1 We've had input errors - Display errors and show input dialog again.
393 ********************/
395 if (count($message) > 0){
396 msg_dialog::displayChecks($message);
398 // Preset input fields with user input.
399 $smarty = get_smarty();
400 foreach(array("sn", "givenName", "uid", "template") as $attr){
401 if(isset($_POST[$attr])){
402 $smarty->assign("$attr", get_post($attr));
403 }else{
404 $smarty->assign("$attr", "");
405 }
406 }
408 $smarty->assign("templates",$templates);
409 $smarty->assign("got_uid", $this->got_uid);
410 $smarty->assign("edit_uid",false);
411 return($smarty->fetch(get_template_path('template.tpl', TRUE)));
412 }
415 /********************
416 * 2 There was a template selected, now ask for the uid.
417 ********************/
419 if ($_POST['template'] != 'none' && !isset($_POST['uid'])){
421 // Remember user input.
422 $smarty = get_smarty();
423 $this->sn = $_POST['sn'];
424 $this->givenName = $_POST['givenName'];
426 // Avoid duplicate entries, check if such a user already exists.
427 $dn= preg_replace("/^[^,]+,/i", "", $_POST['template']);
428 $ldap= $this->config->get_ldap_link();
429 $ldap->cd ($dn);
430 $ldap->search ("(&(sn=".normalizeLdap($this->sn).")(givenName=".normalizeLdap($this->givenName)."))", array("givenName"));
431 if ($ldap->count () != 0){
432 msg_dialog::displayChecks(array(msgPool::duplicated(_("Name"))));
433 }else{
435 // Preset uid field by using the idGenerator
436 $attributes= array('sn' => $this->sn, 'givenName' => $this->givenName);
437 if ($this->config->get_cfg_value("idGenerator") != ""){
438 $uids= gen_uids ($this->config->get_cfg_value("idGenerator"), $attributes);
439 if (count($uids)){
440 $smarty->assign("edit_uid", "false");
441 $smarty->assign("uids", $uids);
442 $this->uid= current($uids);
443 }
444 } else {
445 $smarty->assign("edit_uid", "");
446 $this->uid= "";
447 }
448 $this->got_uid= true;
449 }
451 // Assign user input
452 foreach(array("sn", "givenName", "uid", "got_uid") as $attr){
453 $smarty->assign("$attr", $this->$attr);
454 }
455 if (isset($_POST['template'])){
456 $smarty->assign("template", $_POST['template']);
457 }
458 $smarty->assign("templates",$templates);
459 return($smarty->fetch(get_template_path('template.tpl', TRUE)));
460 }
463 /********************
464 * 3 No template - Ok. Lets fill the data into the user object and skip templating here.
465 ********************/
466 if ($_POST['template'] == 'none'){
467 foreach(array("sn", "givenName", "uid") as $attr){
468 if (isset($_POST[$attr])){
469 $this->tabObject->by_object['user']->$attr= $_POST[$attr];
470 }
471 }
473 // The user Tab object is already instantiated, so just go back and let the
474 // management class do the rest.
475 return("");
476 }
479 /********************
480 * 4 Template selected and uid given - Ok, then lets adapt tempalte values.
481 ********************/
482 if(isset($_POST['uid'])){
484 // Move user supplied data to sub plugins
485 foreach(array("uid","sn","givenName") as $attr){
486 $this->$attr = $_POST[$attr];
487 $this->tabObject->$attr = $this->$attr;
488 $this->tabObject->by_object['user']->$attr = $this->$attr;
489 }
491 // Adapt template values.
492 $template_dn = $_POST['template'];
493 $this->tabObject->adapt_from_template($template_dn, array("uid","cn","givenName","sn"));
494 $template_base = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/')."/", '', $template_dn);
495 $this->tabObject->by_object['user']->base= $template_base;
497 // The user Tab object is already instantiated, so just go back and let the
498 // management class do the rest.
499 return("");
500 }
501 }
504 /* !\brief This method applies a template to a set of users.
505 */
506 function templatizeUsers($action="",$target=array(),$all=array())
507 {
508 $this->dns = array();
509 if(count($target)){
511 // Get the list of available templates.
512 $templates = $this->get_templates();
514 // Check entry locking
515 foreach($target as $dn){
516 if (($user= get_lock($dn)) != ""){
517 return(gen_locked_message ($user, $dn));
518 }
519 $this->dns[] = $dn;
520 }
522 // Display template
523 $smarty = get_smarty();
524 $smarty->assign("templates", $templates);
525 return($smarty->fetch(get_template_path('templatize.tpl', TRUE)));
526 }
527 }
530 /* !\brief This method is called whenever the templatize dialog was used.
531 */
532 function templatizeContinue()
533 {
534 // Template readable?
535 $template= get_post('template');
536 $acl = $this->ui->get_permissions($template, $this->aclCategory."/".$this->aclPlugin);
537 if (preg_match('/r/', $acl)){
538 $tab = $this->tabClass;
539 foreach ($this->dns as $dn){
541 // User writeable
542 $acl = $this->ui->get_permissions($dn, $this->aclCategory."/".$this->aclPlugin);
543 if (preg_match('/w/', $acl)){
544 $this->tabObject= new $tab($this->config, $this->config->data['TABS'][$this->tabType], $dn, $this->aclCategory);
545 $this->tabObject->adapt_from_template($template, array("sn", "givenName", "uid"));
546 $this->tabObject->save();
547 } else {
548 msg_dialog::display(_("Permission error"), msgPool::permModify($dn), ERROR_DIALOG);
549 }
550 }
551 } else {
552 msg_dialog::display(_("Permission error"), msgPool::permView($template), ERROR_DIALOG);
553 }
555 // Cleanup!
556 $this->remove_lock();
557 $this->closeDialogs();
558 }
561 /* !\brief Lock/unlock multiple users.
562 */
563 function lockUsers($action,$target,$all)
564 {
565 if($action == "lockUsers"){
566 $this->lockEntry($action,$target, $all, "lock");
567 }else{
568 $this->lockEntry($action,$target, $all, "unlock");
569 }
570 }
573 /* !\brief Locks/unlocks the given user(s).
574 */
575 function lockEntry($action,$entry, $all, $type = "toggle")
576 {
578 // Filter out entries we are not allowed to modify
579 $disallowed = array();
580 $dns = array();
581 foreach($entry as $dn){
582 if (!preg_match("/w/",$this->ui->get_permissions($dn,"users/password"))){
583 $disallowed[] = $dn;
584 }else{
585 $allowed[] = $dn;
586 }
587 }
588 if(count($disallowed)){
589 msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
590 }
592 // Try to lock/unlock the rest of the entries.
593 $ldap = $this->config->get_ldap_link();
594 foreach($allowed as $dn){
595 $ldap->cat($dn, array('userPassword'));
596 if($ldap->count() == 1){
598 // We can't lock empty passwords.
599 $val = $ldap->fetch();
600 if(!isset($val['userPassword'])){
601 continue;
602 }
604 // Detect the password method and try to lock/unlock.
605 $pwd = $val['userPassword'][0];
606 $method = passwordMethod::get_method($pwd,$val['dn']);
607 $success= true;
608 if($method instanceOf passwordMethod){
609 if($type == "toggle"){
610 if($method->is_locked($this->config,$val['dn'])){
611 $success= $method->unlock_account($this->config,$val['dn']);
612 }else{
613 $success= $method->lock_account($this->config,$val['dn']);
614 }
615 }elseif($type == "lock" && !$method->is_locked($this->config,$val['dn'])){
616 $success= $method->lock_account($this->config,$val['dn']);
617 }elseif($type == "unlock" && $method->is_locked($this->config,$val['dn'])){
618 $success= $method->unlock_account($this->config,$val['dn']);
619 }
621 // Check if everything went fine.
622 if (!$success){
623 $hn= $method->get_hash_name();
624 if (is_array($hn)){
625 $hn= $hn[0];
626 }
627 msg_dialog::display(_("Account locking"),
628 sprintf(_("Password method '%s' does not support locking. Account (%s) has not been locked!"),
629 $hn,$dn),WARNING_DIALOG);
630 }
631 }else{
632 // Can't lock unknown methods.
633 }
634 }
635 }
636 }
639 /* !\brief This method returns a list of all available templates.
640 */
641 function get_templates()
642 {
643 $templates= array();
644 $ldap= $this->config->get_ldap_link();
645 foreach ($this->config->departments as $key => $value){
646 $acl = $this->ui->get_permissions($value,$this->aclCategory."/".$this->aclPlugin);
647 if (preg_match("/c/",$acl)){
649 // Search all templates from the current dn.
650 $ldap->cd (get_people_ou().$value);
651 $ldap->search ("(objectClass=gosaUserTemplate)", array("uid"));
652 if ($ldap->count() != 0){
653 while ($attrs= $ldap->fetch()){
654 $templates[$ldap->getDN()]= $attrs['uid'][0]." - ".LDAP::fix($key);
655 }
656 }
657 }
658 }
659 natcasesort ($templates);
660 reset ($templates);
661 return($templates);
662 }
665 function copyPasteHandler($action="",$target=array(),$all=array(),
666 $altTabClass ="", $altTabType = "", $altAclCategory="",$altAclPlugin="")
667 {
668 $this->cpHandler->lastdn = "";
669 $str = management::copyPasteHandler($action,$target,$all);
670 if($this->cpHandler->lastdn != "" && isset($_POST['passwordTodo']) && $_POST['passwordTodo'] == "new"){
671 $this->pwd_change_queue[] = $this->cpHandler->lastdn;
672 return($this->handlePasswordQueue());
673 }
674 return($str);
675 }
678 static function filterLockImage($userPassword)
679 {
680 $image= "images/empty.png";
681 if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){
682 if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){
683 $image= "images/lists/locked.png";
684 }else{
685 $image= "images/lists/unlocked.png";
686 }
687 }
688 return $image;
689 }
692 static function filterLockLabel($userPassword)
693 {
694 $label= "";
695 if(isset($userPassword[0]) && preg_match("/^\{[^\}]/",$userPassword[0])){
696 if(preg_match("/^[^\}]*+\}!/",$userPassword[0])){
697 $label= _("Unlock account");
698 }else{
699 $label= _("Lock account");
700 }
701 }
702 return $label;
703 }
706 static function filterProperties($row, $classes)
707 {
708 $result= "";
709 $map= array( "gosaAccount" => array( "image" => "plugins/users/images/select_user.png",
710 "plugin" => "user",
711 "alt" => _("Generic"),
712 "title" => _("Edit generic properties")),
713 "posixAccount" => array("image" => "images/penguin.png",
714 "plugin" => "posixAccount",
715 "alt" => _("POSIX"),
716 "title" => _("Edit POSIX properties")),
717 "gosaMailAccount" => array("image" => "images/mailto.png",
718 "alt" => _("Mail"),
719 "plugin" => "mailAccount",
720 "title" => _("Edit mail properties")),
721 "sambaSamAccount" => array("image" => "plugins/systems/images/select_winstation.png",
722 "plugin" => "sambaAccount",
723 "alt" => _("Samba"),
724 "title" => _("Edit samba properties")),
725 "apple-user" => array("image" => "plugins/netatalk/images/select_netatalk.png",
726 "plugin" => "netatalk",
727 "alt" => _("Netatalk"),
728 "title" => _("Edit netatalk properties")),
729 "gotoEnvironment" => array("image" => "plugins/users/images/small_environment.png",
730 "plugin" => "environment",
731 "alt" => _("Environment"),
732 "title" => _("Edit environment properties")),
733 "goFaxAccount" => array("image" => "plugins/users/images/fax_small.png",
734 "plugin" => "gofaxAccount",
735 "alt" => _("FAX"),
736 "title" => _("Edit FAX properties")),
737 "goFonAccount" => array("image" => "plugins/gofon/images/select_phone.png",
738 "plugin" => "phoneAccount",
739 "alt" => _("Phone"),
740 "title" => _("Edit phone properties")));
742 // Walk thru map
743 foreach ($map as $oc => $properties) {
744 if (in_array_ics($oc, $classes) || 1) {
745 $result.="<input class='center' type='image' src='".$properties['image']."' ".
746 "alt='".$properties['alt']."' title='".$properties['title'].
747 "' name='listing_edit_".$properties['plugin']."_$row' style='padding:1px'>";
748 } else {
749 $result.="<img src='images/empty.png' alt=' ' class='center' style='padding:1px'>";
750 }
751 }
752 return $result;
753 }
755 }
756 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
757 ?>