Beispiel #1
0
 /**
  * Prepare the indexer client
  */
 public function _on_reindex($topic, $config, &$indexer)
 {
     $qb_documents = org_openpsa_documents_document_dba::new_query_builder();
     $qb_documents->add_constraint('topic', '=', $topic->id);
     $qb_documents->add_constraint('nextVersion', '=', 0);
     $qb_documents->add_constraint('orgOpenpsaObtype', '=', ORG_OPENPSA_OBTYPE_DOCUMENT);
     $schemadb_documents = midcom_helper_datamanager2_schema::load_database($config->get('schemadb_document'));
     $qb_directories = org_openpsa_documents_directory::new_query_builder();
     $qb_directories->add_constraint('up', '=', $topic->id);
     $qb_directories->add_constraint('component', '=', $this->_component);
     $schemadb_directories = midcom_helper_datamanager2_schema::load_database($config->get('schemadb_directory'));
     $indexer = new org_openpsa_documents_midcom_indexer($topic, $indexer);
     $indexer->add_query('documents', $qb_documents, $schemadb_documents);
     $indexer->add_query('directories', $qb_directories, $schemadb_directories);
     return $indexer;
 }
Beispiel #2
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_create($handler_id, array $args, array &$data)
 {
     $data['directory']->require_do('midgard:create');
     $this->_load_create_controller();
     switch ($this->_controller->process_form()) {
         case 'save':
             // Index the directory
             $indexer = new org_openpsa_documents_midcom_indexer($this->_topic);
             $indexer->index($this->_controller->datamanager);
             // Relocate to the new directory view
             return new midcom_response_relocate(midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . $this->_request_data["directory"]->name . "/");
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->_request_data['controller'] = $this->_controller;
     $this->add_breadcrumb("", $this->_l10n->get('new directory'));
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
 }
Beispiel #3
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_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);
 }
Beispiel #4
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_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'));
 }
Beispiel #5
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_edit($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     $this->_document = $this->_load_document($args[0]);
     $this->_document->require_do('midgard:update');
     $this->_load_edit_controller();
     if ($data['enable_versioning'] && !empty($_POST)) {
         $this->_backup_attachment();
     }
     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);
             $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(midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . "document/" . $this->_document->guid . "/");
     }
     $this->_request_data['controller'] =& $this->_controller;
     midcom::get('head')->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_document->title));
     // Add toolbar items
     org_openpsa_helpers::dm2_savecancel($this);
     $this->bind_view_to_object($this->_document, $this->_controller->datamanager->schema->name);
     $this->_update_breadcrumb_line('edit');
 }