/** * @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_create($handler_id, array $args, array &$data) { midcom::get('auth')->require_valid_user(); midcom::get('auth')->require_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba'); if (count($args) > 0) { // Get the organization $this->_group = new org_openpsa_contacts_group_dba($args[0]); $this->_group->require_do('midgard:create'); midcom::get('head')->set_pagetitle($this->_group->official); } $data['controller'] = $this->get_controller('create'); switch ($data['controller']->process_form()) { case 'save': // Index the person $indexer = new org_openpsa_contacts_midcom_indexer($this->_topic); $indexer->index($data['controller']->datamanager); return new midcom_response_relocate("person/{$this->_person->guid}/"); case 'cancel': return new midcom_response_relocate(''); } // Add toolbar items org_openpsa_helpers::dm2_savecancel($this); org_openpsa_contacts_viewer::add_breadcrumb_path_for_group($this->_group, $this); $this->add_breadcrumb("", sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('person'))); }
/** * @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_edit($handler_id, array $args, array &$data) { midcom::get('auth')->require_valid_user(); // Check if we get the group $this->_group = new org_openpsa_contacts_group_dba($args[0]); $this->_group->require_do('midgard:update'); if ($this->_group->orgOpenpsaObtype < org_openpsa_contacts_group_dba::MYCONTACTS) { $this->_type = 'group'; } else { $this->_type = 'organization'; } $data['controller'] = $this->get_controller('simple', $this->_group); switch ($data['controller']->process_form()) { case 'save': $indexer = new org_openpsa_contacts_midcom_indexer($this->_topic); $indexer->index($data['controller']->datamanager); // *** FALL-THROUGH *** // *** FALL-THROUGH *** case 'cancel': $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); return new midcom_response_relocate($prefix . "group/" . $this->_group->guid . "/"); } $root_group = org_openpsa_contacts_interface::find_root_group(); if ($this->_group->owner && $this->_group->owner != $root_group->id) { $data['parent_group'] = new org_openpsa_contacts_group_dba($this->_group->owner); } else { $data['parent_group'] = false; } $data['group'] =& $this->_group; org_openpsa_helpers::dm2_savecancel($this); $this->bind_view_to_object($this->_group); midcom::get('head')->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_group->official)); org_openpsa_contacts_viewer::add_breadcrumb_path_for_group($this->_group, $this); $this->add_breadcrumb("", sprintf($this->_l10n_midcom->get('edit %s'), $this->_l10n->get($this->_type))); }
/** * @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_create($handler_id, array $args, array &$data) { midcom::get('auth')->require_valid_user(); $this->_type = $args[0]; $this->_parent_group = false; if (count($args) > 1) { // Get the parent organization $this->_parent_group = new org_openpsa_contacts_group_dba($args[1]); $this->_parent_group->require_do('midgard:create'); } else { // This is a root level organization, require creation permissions under the component root group midcom::get('auth')->require_user_do('midgard:create', null, 'org_openpsa_contacts_group_dba'); } $data['controller'] = $this->get_controller('create'); switch ($data['controller']->process_form()) { case 'save': // Index the organization $indexer = new org_openpsa_contacts_midcom_indexer($this->_topic); $indexer->index($data['controller']->datamanager); // Relocate to group view return new midcom_response_relocate("group/" . $this->_group->guid . "/"); case 'cancel': if ($this->_parent_group) { return new midcom_response_relocate("group/" . $this->_parent_group->guid . "/"); } else { return new midcom_response_relocate(''); } } $this->add_stylesheet(MIDCOM_STATIC_URL . "/midcom.helper.datamanager2/legacy.css"); // Add toolbar items org_openpsa_helpers::dm2_savecancel($this); midcom::get('head')->set_pagetitle($this->_l10n->get("create organization")); org_openpsa_contacts_viewer::add_breadcrumb_path_for_group($this->_parent_group, $this); $this->add_breadcrumb("", sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get($this->_type))); }
/** * @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_notifications($handler_id, array $args, array &$data) { midcom::get('auth')->require_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface'); $group = new org_openpsa_contacts_group_dba($args[0]); $group->require_do('midgard:update'); $controller = $this->get_controller('simple', $group); switch ($controller->process_form()) { case 'save': // Fall-through // Fall-through case 'cancel': return new midcom_response_relocate("group/" . $group->guid . "/"); } $data['notifications_dm'] =& $controller; $data['object'] = $group; midcom::get('head')->set_pagetitle($group->get_label() . ": " . $this->_l10n->get("notification settings")); $this->add_breadcrumb('group/' . $group->guid . '/', $group->get_label()); $this->add_breadcrumb("", $this->_l10n->get("notification settings")); org_openpsa_helpers::dm2_savecancel($this); }