From 5cb74818831f307eac54418ef33987d66c0899fc Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 27 Oct 2009 09:13:47 +0000 Subject: [PATCH] Updated user management. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14644 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_management.inc | 11 ++++ .../admin/users/class_userManagement.inc | 63 +++++++++++++++++-- gosa-core/plugins/admin/users/user-list.xml | 19 ++++++ 3 files changed, 89 insertions(+), 4 deletions(-) diff --git a/gosa-core/include/class_management.inc b/gosa-core/include/class_management.inc index 617b02260..f4375e8b6 100644 --- a/gosa-core/include/class_management.inc +++ b/gosa-core/include/class_management.inc @@ -83,6 +83,16 @@ class management $str = $this->handleActions($this->detectPostActions()); if($str) return($this->getHeader().$str); + // Open single dialog objects + if(is_object($this->dialogObject)){ + if(method_exists($this->dialogObject,'save_object')) $this->dialogObject->save_object(); + if(method_exists($this->dialogObject,'execute')){ + $display = $this->dialogObject->execute(); + $display.= $this->_getTabFooter(); + return($this->getHeader().$display); + } + } + // Display tab object. if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){ $this->tabObject->save_object(); @@ -341,6 +351,7 @@ class management $this->dn = ""; $this->dns = array(); $this->tabObject = null; + $this->dialogObject = null; set_object_info(); } diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index 8082f9f4f..0fc4d93f0 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -53,8 +53,14 @@ class userManagement extends management $headpage->registerElementFilter("lockLabel", "userManagement::filterLockLabel"); $headpage->registerElementFilter("lockImage", "userManagement::filterLockImage"); $headpage->setFilter($filter); - $this->cpHandler = new CopyPasteHandler($this->config); - $this->snapHandler = new SnapshotHandler($this->config); + + // Add copy&paste and snapshot handler. + if ($this->config->boolValueIsTrue("main", "copyPaste")){ + $this->cpHandler = new CopyPasteHandler($this->config); + } + if($this->config->get_cfg_value("enableSnapshots") == "true"){ + $this->snapHandler = new SnapshotHandler($this->config); + } parent::__construct($config, $ui, "users", $headpage); @@ -79,24 +85,73 @@ class userManagement extends management $this->registerAction("templateContinue", "templateContinue"); $this->registerAction("templatize", "templatizeUsers"); $this->registerAction("templatizeContinue", "templatizeContinue"); + + $this->registerAction("sendMessage", "sendMessage"); + $this->registerAction("saveEventDialog", "saveEventDialog"); + $this->registerAction("abortEventDialog", "closeDialogs"); } + // Inject user actions function detectPostActions() { $action = management::detectPostActions(); if(isset($_POST['template_continue'])) $action['action'] = "templateContinue"; if(isset($_POST['templatize_continue'])) $action['action'] = "templatizeContinue"; + if(isset($_POST['save_event_dialog'])) $action['action'] = "saveEventDialog"; + if(isset($_POST['abort_event_dialog'])) $action['action'] = "abortEventDialog"; return($action); } + /*! \brief Sends a message to a set of users using gosa-si events. + */ + function sendMessage($action="",$target=array(),$all=array()) + { + if(class_available("DaemonEvent")){ + $uids = array(); + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + foreach($target as $dn){ + $ldap->cat($dn,array('uid')); + $attrs = $ldap->fetch(); + if(isset($attrs['uid'][0])){ + $uids[] = $attrs['uid'][0]; + } + } + if(count($uids)){ + $events = DaemonEvent::get_event_types(USER_EVENT); + $event = "DaemonEvent_notify"; + if(isset($events['BY_CLASS'][$event])){ + $type = $events['BY_CLASS'][$event]; + $this->dialogObject = new $type['CLASS_NAME']($this->config); + $this->dialogObject->add_users($uids); + $this->dialogObject->set_type(SCHEDULED_EVENT); + } + } + } + } + - function alert($action,$values) + /*! \brief Sends a message to a set of users using gosa-si events. + */ + function saveEventDialog() { - print_a(array($action,$values)); + $this->dialogObject->save_object(); + $msgs = $this->dialogObject->check(); + if(count($msgs)){ + msg_dialog::displayChecks($msgs); + }else{ + $o_queue = new gosaSupportDaemon(); + $o_queue->append($this->dialogObject); + if($o_queue->is_error()){ + msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG); + } + $this->closeDialogs(); + } } + /*! \brief Intiates template creation. */ function newTemplate($action,$entry) diff --git a/gosa-core/plugins/admin/users/user-list.xml b/gosa-core/plugins/admin/users/user-list.xml index 7ab138502..ed2f59cc0 100644 --- a/gosa-core/plugins/admin/users/user-list.xml +++ b/gosa-core/plugins/admin/users/user-list.xml @@ -122,6 +122,13 @@ + + sendMessage + entry + plugins/goto/images/notify.png + + + separator @@ -136,6 +143,18 @@ exporter + + + separator + + + + copypaste + + + + snapshot + -- 2.30.2