예제 #1
0
파일: create.php 프로젝트: nemein/openpsa
 /**
  * Handle the creation phase
  *
  * @param String $handler_id    Name of the request handler
  * @param array $args           Variable arguments
  * @param array &$data          Public request data, passed by reference
  */
 public function _handler_create($handler_id, array $args, array &$data)
 {
     // Get the root event
     $this->_root_event = org_openpsa_calendar_interface::find_root_event();
     // ACL handling: require create privileges
     $this->_root_event->require_do('midgard:create');
     if (isset($args[0])) {
         $this->_person = new midcom_db_person($args[0]);
     }
     if (isset($args[1])) {
         $this->_requested_time = (int) $args[1];
     }
     // Load the controller instance
     $data['controller'] = $this->get_controller('create');
     // Process form
     switch ($data['controller']->process_form()) {
         case 'save':
             $indexer = new org_openpsa_calendar_midcom_indexer($this->_topic);
             $indexer->index($data['controller']->datamanager);
             //FALL-THROUGH
         //FALL-THROUGH
         case 'cancel':
             midcom::get('head')->add_jsonload('window.opener.location.reload();');
             midcom::get('head')->add_jsonload('window.close();');
             break;
     }
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     // Hide the ROOT style
     midcom::get()->skip_page_style = true;
 }
예제 #2
0
파일: edit.php 프로젝트: nemein/openpsa
 /**
  * @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)));
 }
예제 #3
0
파일: admin.php 프로젝트: nemein/openpsa
 /**
  * Handle the editing phase
  *
  * @param String $handler_id    Name of the request handler
  * @param array $args           Variable arguments
  * @param array &$data          Public request data, passed by reference
  */
 public function _handler_edit($handler_id, array $args, array &$data)
 {
     // Get the event
     $this->_event = new org_openpsa_calendar_event_dba($args[0]);
     $this->_event->require_do('midgard:update');
     // Load schema database
     $schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb'));
     // Load the controller
     $data['controller'] = midcom_helper_datamanager2_controller::create('simple');
     $data['controller']->schemadb = $schemadb;
     $data['controller']->set_storage($this->_event);
     if (!$data['controller']->initialize()) {
         throw new midcom_error("Failed to initialize a DM2 controller instance for article {$this->_article->id}.");
     }
     switch ($data['controller']->process_form()) {
         case 'save':
             $indexer = new org_openpsa_calendar_midcom_indexer($this->_topic);
             $indexer->index($data['controller']->datamanager);
             //FALL-THROUGH
         //FALL-THROUGH
         case 'cancel':
             midcom::get('head')->add_jsonload('window.opener.location.reload();');
             midcom::get('head')->add_jsonload('window.close();');
             // This will _midcom_stop_request(well, in a way...)
     }
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
 }
예제 #4
0
파일: create.php 프로젝트: nemein/openpsa
 /**
  * @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')));
 }
예제 #5
0
파일: crud.php 프로젝트: nemein/openpsa
 /**
  * Method for adding the supported operations into the toolbar.
  *
  * @param mixed $handler_id The ID of the handler.
  */
 public function _populate_toolbar($handler_id)
 {
     if ($this->_mode == 'create' || $this->_mode == 'update') {
         org_openpsa_helpers::dm2_savecancel($this);
     } else {
         if ($this->_mode == 'delete') {
             org_openpsa_helpers::dm2_savecancel($this, 'delete');
         }
     }
     if ($this->_mode == 'create') {
         return;
     }
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "task/edit/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e'));
     if ($this->_object->reportedHours == 0) {
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "task/delete/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:delete'), MIDCOM_TOOLBAR_ACCESSKEY => 'd'));
     }
     if ($this->_mode == 'read') {
         $this->_populate_read_toolbar($handler_id);
     }
     switch ($handler_id) {
         case 'task_edit':
             $this->_view_toolbar->disable_item("task/edit/{$this->_object->guid}/");
             break;
         case 'task_delete':
             $this->_view_toolbar->disable_item("task/delete/{$this->_object->guid}/");
             break;
     }
 }
예제 #6
0
파일: edit.php 프로젝트: nemein/openpsa
 /**
  * Looks up a product to display.
  *
  * @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)
 {
     $this->_group = new org_openpsa_products_product_group_dba($args[0]);
     $this->_request_data['controller'] = midcom_helper_datamanager2_controller::create('simple');
     $this->_request_data['controller']->schemadb =& $this->_request_data['schemadb_group'];
     $this->_request_data['controller']->set_storage($this->_group);
     if (!$this->_request_data['controller']->initialize()) {
         throw new midcom_error("Failed to initialize a DM2 controller instance for product {$this->_group->id}.");
     }
     switch ($this->_request_data['controller']->process_form()) {
         case 'save':
             if ($this->_config->get('index_groups')) {
                 // Index the group
                 $indexer = midcom::get('indexer');
                 org_openpsa_products_viewer::index($this->_request_data['controller']->datamanager, $indexer, $this->_topic);
             }
             midcom::get('cache')->invalidate($this->_topic->guid);
         case 'cancel':
             return new midcom_response_relocate("{$this->_group->guid}/");
     }
     $this->_update_breadcrumb_line();
     $this->_prepare_request_data();
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     $this->_view_toolbar->bind_to($this->_group);
     midcom::get('metadata')->set_request_metadata($this->_group->metadata->revised, $this->_group->guid);
     midcom::get('head')->set_pagetitle($this->_group->title);
 }
예제 #7
0
파일: crud.php 프로젝트: nemein/openpsa
 /**
  * Method for adding the supported operations into the toolbar.
  *
  * @param mixed $handler_id The ID of the handler.
  */
 public function _populate_toolbar($handler_id)
 {
     if ($this->_mode == 'create' || $this->_mode == 'update') {
         org_openpsa_helpers::dm2_savecancel($this);
     } else {
         if ($this->_mode == 'read') {
             $this->_add_read_toolbar($handler_id);
         }
     }
 }
예제 #8
0
파일: crud.php 프로젝트: nemein/openpsa
 public function _populate_toolbar($handler_id)
 {
     if ($this->_mode == 'delete') {
         org_openpsa_helpers::dm2_savecancel($this, 'delete');
     }
     if ($this->_object->can_do('midgard:update')) {
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "productlink/edit/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ACCESSKEY => 'e'));
     }
     if ($this->_object->can_do('midgard:delete')) {
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "productlink/delete/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ACCESSKEY => 'd'));
     }
 }
예제 #9
0
파일: create.php 프로젝트: nemein/openpsa
 /**
  * @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_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface');
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.user'), sprintf($this->_l10n->get('group %s saved'), $this->_group->name));
             return new midcom_response_relocate('group/' . $this->_group->guid);
         case 'cancel':
             return new midcom_response_relocate('groups/');
     }
     $this->add_breadcrumb('groups/', $this->_l10n->get('groups'));
     $this->add_breadcrumb('', sprintf($this->_l10n->get('create group')));
     org_openpsa_helpers::dm2_savecancel($this);
 }
예제 #10
0
파일: edit.php 프로젝트: nemein/openpsa
 /**
  * @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_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface');
     $this->_group = new midcom_db_group($args[0]);
     $data['controller'] = $this->get_controller('simple', $this->_group);
     switch ($data['controller']->process_form()) {
         case 'save':
             midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.user'), sprintf($this->_l10n->get('group %s saved'), $this->_group->get_label()));
             // Fall-through
         // Fall-through
         case 'cancel':
             return new midcom_response_relocate('group/' . $this->_group->guid . '/');
     }
     $this->add_breadcrumb('groups/', $this->_l10n->get('groups'));
     $this->add_breadcrumb('', sprintf($this->_l10n_midcom->get('edit %s'), $this->_group->get_label()));
     org_openpsa_helpers::dm2_savecancel($this);
     $this->bind_view_to_object($this->_group);
 }
예제 #11
0
 /**
  * @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');
     $person = new org_openpsa_contacts_person_dba($args[0]);
     $person->require_do('midgard:update');
     $controller = $this->get_controller('simple', $person);
     switch ($controller->process_form()) {
         case 'save':
             // Fall-through
         // Fall-through
         case 'cancel':
             return new midcom_response_relocate("view/" . $person->guid . "/");
     }
     $data['notifications_dm'] =& $controller;
     $data['object'] = $person;
     midcom::get('head')->set_pagetitle($person->get_label() . ": " . $this->_l10n->get("notification settings"));
     $this->add_breadcrumb('view/' . $person->guid . '/', $person->get_label());
     $this->add_breadcrumb("", $this->_l10n->get("notification settings"));
     org_openpsa_helpers::dm2_savecancel($this);
 }
예제 #12
0
 /**
  * @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_privileges($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface');
     // Check if we get the group
     $this->_group = new midcom_db_group($args[0]);
     $this->_group->require_do('midgard:privileges');
     $data['group'] = $this->_group;
     $data['acl_dm'] = $this->get_controller('simple', $this->_group);
     switch ($data['acl_dm']->process_form()) {
         case 'save':
             // Fall-through
         // Fall-through
         case 'cancel':
             return new midcom_response_relocate(midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . "group/" . $this->_group->guid . "/");
     }
     midcom::get('head')->set_pagetitle($this->_group->official);
     org_openpsa_helpers::dm2_savecancel($this);
     $this->add_breadcrumb("group/{$this->_group->guid}/", $this->_group->name);
     $this->add_breadcrumb("", $this->_l10n->get('permissions'));
 }
예제 #13
0
파일: edit.php 프로젝트: nemein/openpsa
 /**
  * @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)
 {
     $data['directory']->require_do('midgard:update');
     $this->_load_edit_controller();
     switch ($this->_controller->process_form()) {
         case 'save':
             // TODO: Update the URL name?
             // Update the Index
             $indexer = new org_openpsa_documents_midcom_indexer($this->_topic);
             $indexer->index($this->_controller->datamanager);
             $this->_view = "default";
             return new midcom_response_relocate(midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX));
         case 'cancel':
             $this->_view = "default";
             return new midcom_response_relocate(midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX));
     }
     $this->_request_data['controller'] = $this->_controller;
     $this->add_breadcrumb("", sprintf($this->_l10n_midcom->get('edit %s'), $this->_l10n->get('directory')));
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     $this->bind_view_to_object($this->_request_data['directory'], $this->_controller->datamanager->schema->name);
 }
예제 #14
0
파일: chooser.php 프로젝트: nemein/openpsa
 /**
  * @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)
 {
     $this->_dbaclass = $args[0];
     midcom::get('auth')->require_user_do('midgard:create', null, $this->_dbaclass);
     $this->_load_component_node();
     $this->_controller = $this->get_controller('create');
     switch ($this->_controller->process_form()) {
         case 'save':
             $this->_post_create_actions();
             //TODO: indexing
             $this->_action = 'save';
             break;
         case 'cancel':
             $this->_action = 'cancel';
             break;
     }
     $data['controller'] =& $this->_controller;
     $data['action'] =& $this->_action;
     midcom::get()->skip_page_style = true;
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
 }
예제 #15
0
파일: create.php 프로젝트: nemein/openpsa
 /**
  * @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_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface');
     if (count($args) > 0) {
         // Get the organization
         $this->_group = new midcom_db_group($args[0]);
         $this->_group->require_do('midgard:create');
         midcom::get('head')->set_pagetitle($this->_group->official);
         $this->add_breadcrumb('group/' . $this->_group->guid . '/', $this->_group->get_label());
     }
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.user'), sprintf($this->_l10n->get('person %s created'), $this->_person->name));
             $this->_master->create_account($this->_person, $data["controller"]->formmanager);
             return new midcom_response_relocate('view/' . $this->_person->guid . '/');
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->add_breadcrumb('', sprintf($this->_l10n->get('create person')));
     org_openpsa_helpers::dm2_savecancel($this);
 }
예제 #16
0
파일: create.php 프로젝트: nemein/openpsa
 /**
  * Displays an article edit view.
  *
  * Note, that the article for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation article
  *
  * @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)
 {
     $this->_request_data['up'] = (int) $args[0];
     if ($this->_request_data['up'] == 0) {
         midcom::get('auth')->require_user_do('midgard:create', null, 'org_openpsa_products_product_group_dba');
     } else {
         $parent = new org_openpsa_products_product_group_dba($data['up']);
         $parent->require_do('midgard:create');
         $data['parent'] = $parent;
     }
     $data['selected_schema'] = $args[1];
     if (!array_key_exists($data['selected_schema'], $data['schemadb_group'])) {
         throw new midcom_error_notfound('Schema ' . $data['selected_schema'] . ' was not found it schemadb');
     }
     $this->_schema =& $data['selected_schema'];
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             if ($this->_config->get('index_groups')) {
                 // Index the group
                 $indexer = midcom::get('indexer');
                 org_openpsa_products_viewer::index($data['controller']->datamanager, $indexer, $this->_topic);
             }
             midcom::get('cache')->invalidate($this->_topic->guid);
             return new midcom_response_relocate("{$this->_group->guid}/");
         case 'cancel':
             if ($this->_request_data['up'] == 0) {
                 return new midcom_response_relocate('');
             } else {
                 return new midcom_response_relocate("{$this->_request_data['up']}/");
             }
     }
     $this->_prepare_request_data();
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     $this->_request_data['view_title'] = sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get($this->_schemadb[$this->_schema]->description));
     midcom::get('head')->set_pagetitle($this->_request_data['view_title']);
     $this->_update_breadcrumb_line();
 }
예제 #17
0
파일: admin.php 프로젝트: nemein/openpsa
 /**
  * Displays a deliverable edit view.
  *
  * Note, that the deliverable for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation deliverable
  *
  * @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)
 {
     $this->_deliverable = new org_openpsa_sales_salesproject_deliverable_dba($args[0]);
     $this->_deliverable->require_do('midgard:update');
     $this->_load_controller();
     switch ($this->_controller->process_form()) {
         case 'save':
             $formdata = $this->_controller->datamanager->types;
             if (!empty($formdata['at_entry']->value)) {
                 $entry = new midcom_services_at_entry_dba((int) $formdata['at_entry']->value);
                 $next_cycle = 0;
                 if (isset($formdata['next_cycle']) && !$formdata['next_cycle']->is_empty()) {
                     $next_cycle = (int) $formdata['next_cycle']->value->format('U');
                 }
                 //@todo If next_cycle is changed to be in the past, should we check if this would lead
                 //to multiple runs immediately? i.e. if you set a monthly subscriptions next cycle to
                 //one year in the past, this would trigger twelve consecutive runs and maybe
                 //the user needs to be warned about that...
                 if ($next_cycle != $entry->start) {
                     $entry->start = $next_cycle;
                     $entry->update();
                 }
             }
             $this->_master->process_notify_date($formdata, $this->_deliverable);
             // Reindex the deliverable
             //$indexer = midcom::get('indexer');
             //org_openpsa_sales_viewer::index($this->_controller->datamanager, $indexer, $this->_content_topic);
             // *** FALL-THROUGH ***
         // Reindex the deliverable
         //$indexer = midcom::get('indexer');
         //org_openpsa_sales_viewer::index($this->_controller->datamanager, $indexer, $this->_content_topic);
         // *** FALL-THROUGH ***
         case 'cancel':
             return new midcom_response_relocate("deliverable/{$this->_deliverable->guid}/");
     }
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     $this->_prepare_request_data($handler_id);
     $this->bind_view_to_object($this->_deliverable, $this->_request_data['controller']->datamanager->schema->name);
     $this->_update_breadcrumb_line($handler_id);
     midcom::get('head')->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_deliverable->title));
 }
예제 #18
0
파일: base.php 프로젝트: nemein/openpsa
 /**
  * @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_query_form($handler_id, array $args, array &$data)
 {
     $this->_set_active_leaf();
     midcom::get('auth')->require_valid_user();
     if (isset($args[0])) {
         $data['query'] = $this->_load_query($args[0], $this->module);
         $data['query']->require_do('midgard:update');
         $this->_load_edit_controller();
     } else {
         $this->_load_create_controller();
     }
     // Process the form
     switch ($this->_controller->process_form()) {
         case 'save':
             // Relocate to report view
             $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
             return new midcom_response_relocate($prefix . $this->module . '/' . $this->_request_data['query']->guid . "/");
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->_request_data['controller'] =& $this->_controller;
     $this->_request_data['datamanager'] = $this->_datamanagers[$this->module];
     org_openpsa_helpers::dm2_savecancel($this);
     if (isset($data['query'])) {
         $breadcrumb_label = sprintf($this->_l10n->get('edit report %s'), $data['query']->title);
     } else {
         $breadcrumb_label = $this->_l10n->get('define custom report');
     }
     $this->add_breadcrumb("", $breadcrumb_label);
 }
예제 #19
0
파일: admin.php 프로젝트: nemein/openpsa
 /**
  * Looks up an hour_report to edit.
  *
  * @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)
 {
     $this->_hour_report = new org_openpsa_projects_hour_report_dba($args[0]);
     $this->_load_schemadb();
     $this->_controller = midcom_helper_datamanager2_controller::create('simple');
     $this->_controller->schemadb =& $this->_schemadb;
     $this->_controller->set_storage($this->_hour_report);
     if (!$this->_controller->initialize()) {
         throw new midcom_error("Failed to initialize a DM2 controller instance for hour_report {$this->_hour_report->id}.");
     }
     switch ($this->_controller->process_form()) {
         case 'save':
             $this->_hour_report->modify_hours_by_time_slot();
             // *** FALL-THROUGH ***
         // *** FALL-THROUGH ***
         case 'cancel':
             $task = new org_openpsa_projects_task_dba($this->_hour_report->task);
             return new midcom_response_relocate("hours/task/" . $task->guid . "/");
     }
     $this->_prepare_request_data();
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "hours/delete/{$this->_hour_report->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ACCESSKEY => 'd'));
     $parent = $this->_hour_report->get_parent();
     $this->_add_toolbar_items($parent);
     $this->_view_toolbar->bind_to($this->_hour_report);
     midcom::get('metadata')->set_request_metadata($this->_hour_report->metadata->revised, $this->_hour_report->guid);
     midcom::get('head')->set_pagetitle($this->_l10n->get($handler_id));
     $this->_update_breadcrumb_line($handler_id);
 }
예제 #20
0
파일: crud.php 프로젝트: nemein/openpsa
 function _populate_toolbar($handler_id)
 {
     if ($this->_mode == 'update' || $this->_mode == 'create') {
         // Add toolbar items
         org_openpsa_helpers::dm2_savecancel($this);
     } else {
         if ($this->_mode == 'delete') {
             org_openpsa_helpers::dm2_savecancel($this, 'delete');
         }
     }
     if ($this->_mode == 'read') {
         $this->_populate_read_toolbar($handler_id);
     }
 }
예제 #21
0
파일: create.php 프로젝트: nemein/openpsa
 /**
  * @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)));
 }
예제 #22
0
파일: add.php 프로젝트: nemein/openpsa
 /**
  * Looks up a deliverable to display.
  *
  * @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_add($handler_id, array $args, array &$data)
 {
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         throw new midcom_error_forbidden('Only POST requests are allowed here.');
     }
     $this->_salesproject = new org_openpsa_sales_salesproject_dba($args[0]);
     $this->_salesproject->require_do('midgard:create');
     if (!array_key_exists('product', $_POST)) {
         throw new midcom_error('No product specified, aborting.');
     }
     $this->_product = new org_openpsa_products_product_dba((int) $_POST['product']);
     $this->_prepare_datamanager();
     $data['controller'] = $this->_controller;
     // Process form
     switch ($data['controller']->process_form()) {
         case 'save':
             $formdata = $data['controller']->datamanager->types;
             $this->_master->process_notify_date($formdata, $this->_deliverable);
         case 'cancel':
             return new midcom_response_relocate("salesproject/{$this->_salesproject->guid}/");
     }
     org_openpsa_helpers::dm2_savecancel($this);
     $this->add_breadcrumb("salesproject/{$this->_salesproject->guid}/", $this->_salesproject->title);
     $this->add_breadcrumb('', $this->_l10n->get('add offer'));
 }
예제 #23
0
파일: admin.php 프로젝트: nemein/openpsa
 /**
  * Displays an message edit view.
  *
  * Note, that the message for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation message,
  */
 public function _handler_edit($handler_id, array $args, array &$data)
 {
     $this->_message = new org_openpsa_directmarketing_campaign_message_dba($args[0]);
     $this->_message->require_do('midgard:update');
     $data['campaign'] = new org_openpsa_directmarketing_campaign_dba($this->_message->campaign);
     $this->set_active_leaf('campaign_' . $data['campaign']->id);
     $this->_load_controller();
     $data['message_dm'] =& $this->_controller;
     switch ($this->_controller->process_form()) {
         case 'save':
             // Reindex the message
             //$indexer = midcom::get('indexer');
             //org_openpsa_directmarketing_viewer::index($this->_controller->datamanager, $indexer, $this->_content_topic);
             // *** FALL-THROUGH ***
         // Reindex the message
         //$indexer = midcom::get('indexer');
         //org_openpsa_directmarketing_viewer::index($this->_controller->datamanager, $indexer, $this->_content_topic);
         // *** FALL-THROUGH ***
         case 'cancel':
             return new midcom_response_relocate("message/{$this->_message->guid}/");
     }
     org_openpsa_helpers::dm2_savecancel($this);
     $this->_prepare_request_data($handler_id);
     midcom::get('head')->set_pagetitle($this->_message->title);
     $this->bind_view_to_object($this->_message, $this->_request_data['controller']->datamanager->schema->name);
     $this->_update_breadcrumb_line($handler_id);
 }
예제 #24
0
 private function _prepare_output($mode)
 {
     midcom::get('head')->enable_jquery();
     midcom::get('head')->set_pagetitle(sprintf($this->_l10n_midcom->get($mode . " %s"), $this->_l10n->get("billing data")));
     $this->_update_breadcrumb();
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     $this->_request_data['controller'] =& $this->_controller;
 }
예제 #25
0
파일: admin.php 프로젝트: nemein/openpsa
 /**
  * Displays a contact edit view.
  *
  * Note, that the contact for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation contact
  *
  * @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)
 {
     $this->_contact = new org_openpsa_contacts_person_dba($args[0]);
     $this->_contact->require_do('midgard:update');
     $this->_load_controller();
     switch ($this->_controller->process_form()) {
         case 'save':
             // Reindex the contact
             $indexer = new org_openpsa_contacts_midcom_indexer($this->_topic);
             $indexer->index($this->_controller->datamanager);
             // *** FALL-THROUGH ***
         // *** FALL-THROUGH ***
         case 'cancel':
             return new midcom_response_relocate("person/{$this->_contact->guid}/");
     }
     org_openpsa_helpers::dm2_savecancel($this);
     $this->_prepare_request_data($handler_id);
     midcom::get('head')->set_pagetitle($this->_contact->name);
     $this->bind_view_to_object($this->_contact, $this->_controller->datamanager->schema->name);
     $this->_update_breadcrumb_line($handler_id);
 }
예제 #26
0
 public function _handler_edit($handler_id, array $args, array &$data)
 {
     $this->_journal_entry = new org_openpsa_relatedto_journal_entry_dba($args[0]);
     $this->_current_object = midcom::get('dbfactory')->get_object_by_guid($this->_journal_entry->linkGuid);
     $data['controller'] = $this->get_controller('simple', $this->_journal_entry);
     $url_prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . "__mfa/org.openpsa.relatedto/journalentry/";
     switch ($data['controller']->process_form()) {
         case 'save':
         case 'cancel':
             $url_prefix = $url_prefix . $this->_current_object->guid . "/html/";
             return new midcom_response_relocate($url_prefix);
     }
     org_openpsa_helpers::dm2_savecancel($this);
     //delete-button
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $url_prefix . "delete/" . $this->_journal_entry->guid . "/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_journal_entry->can_do('midgard:delete'), MIDCOM_TOOLBAR_ACCESSKEY => 'd'));
     $this->_prepare_breadcrumb();
     $this->bind_view_to_object($this->_journal_entry, $data['controller']->datamanager->schema->name);
 }
예제 #27
0
파일: edit.php 프로젝트: nemein/openpsa
 /**
  * @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_new($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     midcom::get('auth')->require_user_do('midgard:create', null, 'org_openpsa_sales_salesproject_dba');
     $this->_defaults['code'] = org_openpsa_sales_salesproject_dba::generate_salesproject_number();
     $this->_defaults['owner'] = midcom_connection::get_user();
     if (!isset($this->_datamanager)) {
         $this->_initialize_datamanager($this->_config->get('schemadb_salesproject'));
     }
     $this->_load_create_controller();
     switch ($this->_controller->process_form()) {
         case 'save':
             // Relocate to main view
             $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
             return new midcom_response_relocate($prefix . "salesproject/edit/" . $this->_salesproject->guid . "/");
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->_request_data['controller'] =& $this->_controller;
     midcom::get('head')->set_pagetitle(sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('salesproject')));
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
 }
예제 #28
0
파일: create.php 프로젝트: nemein/openpsa
 /**
  * Displays an campaign edit view.
  *
  * Note, that the campaign for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation campaign,
  */
 public function _handler_create($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_user_do('midgard:create', null, 'org_openpsa_directmarketing_campaign_dba');
     $this->_schema = $args[0];
     $this->load_schemadb();
     if (!array_key_exists($this->_schema, $this->_schemadb)) {
         throw new midcom_error_notfound('The campaign type ' . $this->_schema . 'isn\'t available in the schemadb');
     }
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             // Index the campaign
             //$indexer = midcom::get('indexer');
             //org_openpsa_directmarketing_viewer::index($data['controller']->datamanager, $indexer, $this->_topic);
             return new midcom_response_relocate("campaign/{$this->_campaign->guid}/");
         case 'cancel':
             return new midcom_response_relocate('');
     }
     if ($this->_campaign != null) {
         midcom::get('metadata')->set_request_metadata($this->_campaign->metadata->revised, $this->_campaign->guid);
     }
     $data['view_title'] = sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get($this->_schemadb[$this->_schema]->description));
     midcom::get('head')->set_pagetitle($data['view_title']);
     $this->add_breadcrumb("create/{$this->_schema}/", sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get($this->_schemadb[$this->_schema]->description)));
     org_openpsa_helpers::dm2_savecancel($this);
 }
예제 #29
0
파일: create.php 프로젝트: nemein/openpsa
 /**
  * @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)
 {
     $data['directory']->require_do('midgard:create');
     $this->_defaults = array('topic' => $this->_request_data['directory']->id, 'author' => midcom_connection::get_user(), 'orgOpenpsaAccesstype' => $this->_topic->get_parameter('org.openpsa.core', 'orgOpenpsaAccesstype'), 'orgOpenpsaOwnerWg' => $this->_topic->get_parameter('org.openpsa.core', 'orgOpenpsaOwnerWg'));
     $this->_load_create_controller();
     switch ($this->_controller->process_form()) {
         case 'save':
             /* Index the document */
             $indexer = new org_openpsa_documents_midcom_indexer($this->_topic);
             $indexer->index($this->_controller->datamanager);
             // Relocate to document view
             $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
             if ($this->_document->topic != $this->_topic->id) {
                 $nap = new midcom_helper_nav();
                 $node = $nap->get_node($this->_document->topic);
                 $prefix = $node[MIDCOM_NAV_ABSOLUTEURL];
             }
             return new midcom_response_relocate($prefix . "document/" . $this->_document->guid . "/");
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->_request_data['controller'] =& $this->_controller;
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     $this->add_breadcrumb("", $this->_l10n->get('create document'));
 }
예제 #30
0
파일: admin.php 프로젝트: nemein/openpsa
 /**
  * @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_valid_user();
     $this->_document = $this->_load_document($args[0]);
     $this->_document->require_do('midgard:delete');
     $data['controller'] = midcom_helper_datamanager2_handler::get_delete_controller();
     switch ($data['controller']->process_form()) {
         case 'delete':
             if ($this->_document->delete()) {
                 // Update the index
                 $indexer = midcom::get('indexer');
                 $indexer->delete($this->_document->guid);
                 // Redirect to the directory
                 return new midcom_response_relocate('');
             } else {
                 // Failure, give a message
                 midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.documents'), $this->_l10n->get("failed to delete document, reason ") . midcom_connection::get_error_string(), 'error');
             }
             //Fall-through
         //Fall-through
         case 'cancel':
             return new midcom_response_relocate("document/" . $this->_document->guid . "/");
     }
     $data['document_dm'] = $this->_datamanager;
     $data['document'] = $this->_document;
     org_openpsa_helpers::dm2_savecancel($this, 'delete');
     $this->_update_breadcrumb_line('delete');
 }