/** * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. */ public function _handler_delete($handler_id, array $args, array &$data) { midcom::get('auth')->require_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface'); $this->_group = new midcom_db_group($args[0]); if (array_key_exists('org_openpsa_user_deleteok', $_POST)) { $delete_succeeded = $this->_group->delete(); $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); if ($delete_succeeded) { // Update the index $indexer = midcom::get('indexer'); $indexer->delete($this->_group->guid); return new midcom_response_relocate(''); } else { // Failure, give a message midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.user'), $this->_l10n->get("failed to delete group, reason") . ' ' . midcom_connection::get_error_string(), 'error'); return new midcom_response_relocate($prefix . 'group/' . $this->_group->guid . '/'); } } $data['view'] = midcom_helper_datamanager2_handler::get_view_controller($this, $this->_group); $data['group'] = $this->_group; org_openpsa_widgets_tree::add_head_elements(); $this->add_breadcrumb('groups/', $this->_l10n->get('groups')); $this->add_breadcrumb('', sprintf($this->_l10n_midcom->get('delete %s'), $this->_group->get_label())); $this->bind_view_to_object($this->_group); }
/** * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. */ public function _handler_view($handler_id, array $args, array &$data) { midcom::get('auth')->require_user_do('org.openpsa.user:access', null, 'org_openpsa_user_interface'); $this->_group = new midcom_db_group($args[0]); $data['group'] = $this->_group; $data['view'] = midcom_helper_datamanager2_handler::get_view_controller($this, $this->_group); org_openpsa_widgets_tree::add_head_elements(); org_openpsa_widgets_grid::add_head_elements(); $this->add_breadcrumb('groups/', $this->_l10n->get('groups')); $this->add_breadcrumb('', $this->_group->get_label()); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/edit/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get("edit"), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e')); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/delete/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get("delete"), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:delete'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/privileges/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("permissions"), MIDCOM_TOOLBAR_ICON => 'midgard.admin.asgard/permissions-16.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:privileges'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/notifications/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("notification settings"), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock-discussion.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:update'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "create/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba'))); $this->bind_view_to_object($this->_group); }
/** * Handler method for listing users * * @param string $handler_id Name of the used handler * @param mixed $args Array containing the variable arguments passed to the handler * @param mixed &$data Data passed to the show method */ public function _handler_list($handler_id, array $args, array &$data) { $auth = midcom::get('auth'); if (!$auth->can_user_do('org.openpsa.user:access', null, 'org_openpsa_user_interface')) { $person = $auth->user->get_storage(); return new midcom_response_relocate('view/' . $person->guid . '/'); } $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); $data['provider_url'] = $prefix . 'json/'; $grid_id = 'org_openpsa_user_grid'; if (sizeof($args) == 1) { $grid_id = 'org_openpsa_members_grid'; $this->_group = new org_openpsa_contacts_group_dba($args[0]); $data['group'] = $this->_group; $data['provider_url'] .= 'members/' . $this->_group->guid . '/'; } $data['grid'] = $this->_provider->get_grid($grid_id); org_openpsa_widgets_tree::add_head_elements(); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "create/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'midcom_db_person'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/create/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create group'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'midcom_db_group'))); }
/** * Handler method for listing group members * * @param string $handler_id Name of the used handler * @param mixed $args Array containing the variable arguments passed to the handler * @param mixed &$data Data passed to the show method */ public function _handler_view($handler_id, array $args, array &$data) { midcom::get('auth')->require_valid_user(); // Get the requested group object $this->_group = new org_openpsa_contacts_group_dba($args[0]); $data['group'] = $this->_group; if ($this->_group->orgOpenpsaObtype < org_openpsa_contacts_group_dba::MYCONTACTS) { $this->_type = 'group'; $data['group_tree'] = $this->_master->get_group_tree(); $data['members_grid'] = new org_openpsa_widgets_grid('members_grid', 'json'); org_openpsa_widgets_tree::add_head_elements(); } else { $this->_type = 'organization'; $root_group = org_openpsa_contacts_interface::find_root_group(); if ($this->_group->owner != $root_group->id) { $data['parent_group'] = $this->_group->get_parent(); } else { $data['parent_group'] = false; } //pass billing-data if invoices is installed if (midcom::get('componentloader')->is_installed('org.openpsa.invoices')) { $qb_billing_data = org_openpsa_invoices_billing_data_dba::new_query_builder(); $qb_billing_data->add_constraint('linkGuid', '=', $this->_group->guid); $billing_data = $qb_billing_data->execute(); if (count($billing_data) > 0) { $this->_request_data['billing_data'] = $billing_data[0]; } } // This handler uses Ajax, include the handler javascripts midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . "/org.openpsa.helpers/ajaxutils.js"); org_openpsa_widgets_ui::enable_ui_tab(); } $data['view'] = midcom_helper_datamanager2_handler::get_view($this, $this->_group); // Add toolbar items $this->_populate_toolbar(); $this->bind_view_to_object($this->_group); midcom::get('head')->set_pagetitle($this->_group->official); org_openpsa_contacts_viewer::add_breadcrumb_path_for_group($this->_group, $this); }
/** * Add necessary head elements */ public static function add_head_elements() { if (self::$_head_elements_added) { return; } $head = midcom::get('head'); $head->enable_jquery(); $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.core.min.js'); $head->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.widget.min.js'); $head->add_jsfile(MIDCOM_STATIC_URL . '/jQuery/jquery.cookie.js'); $head->add_jsfile(MIDCOM_STATIC_URL . '/org.openpsa.widgets/dynatree/jquery.dynatree.min.js'); $head->add_stylesheet(MIDCOM_STATIC_URL . "/org.openpsa.widgets/dynatree/skin/ui.dynatree.css"); $head->add_jsfile(MIDCOM_STATIC_URL . '/org.openpsa.widgets/dynatree.custom.js'); $head->add_jquery_ui_theme(); self::$_head_elements_added = true; }