コード例 #1
0
ファイル: configuration.php プロジェクト: nemein/openpsa
 /**
  * Generic handler for all the DM2 based configuration requests
  *
  * @param string $handler_id    Name of the handler
  * @param array  $args          Variable arguments
  * @param array  &$data          Miscellaneous output data
  */
 public function _handler_config($handler_id, array $args, array &$data)
 {
     // Require corresponding ACL's
     $this->_topic->require_do('midgard:update');
     $this->_topic->require_do('midcom:component_config');
     // Add DM2 link head
     $this->add_stylesheet(MIDCOM_STATIC_URL . '/midcom.helper.datamanager2/legacy.css');
     if (method_exists($this, '_load_datamanagers') && method_exists($this, '_load_objects')) {
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'config/recreate/', MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('recreate images', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/recurring.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('midcom_baseclasses_components_handler_configuration_recreateok' => true)));
     }
     // Load the midcom_helper_datamanager2_controller for form processing
     $this->_controller = $this->get_controller('simple', $this->_topic);
     // Process the form
     switch ($this->_controller->process_form()) {
         case 'save':
             midcom::get('uimessages')->add($this->_l10n_midcom->get('component configuration'), $this->_l10n_midcom->get('configuration saved'));
             return new midcom_response_relocate('');
         case 'cancel':
             midcom::get('uimessages')->add($this->_l10n_midcom->get('component configuration'), $this->_l10n_midcom->get('cancelled'));
             return new midcom_response_relocate('');
     }
     // Update the breadcrumb and page title
     $this->add_breadcrumb('config/', $this->_l10n_midcom->get('component configuration'));
     $data['component'] = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_COMPONENT);
     $data['title'] = sprintf(midcom::get('i18n')->get_string('component %s configuration for folder %s', 'midcom'), midcom::get('i18n')->get_string($data['component'], $data['component']), $data['topic']->extra);
     midcom::get('head')->set_pagetitle($data['title']);
 }
コード例 #2
0
ファイル: metadata.php プロジェクト: nemein/openpsa
 /**
  * Handler for folder metadata. Checks for updating permissions, initializes
  * the metadata and the content topic itself. Handles also the sent form.
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  * @return boolean Indicating success
  */
 public function _handler_edit($handler_id, array $args, array &$data)
 {
     $this->_object = midcom::get('dbfactory')->get_object_by_guid($args[0]);
     // FIXME: We should modify the schema according to whether or not scheduling is used
     $this->_object->require_do('midgard:update');
     midcom::get('auth')->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin');
     if (is_a($this->_object, 'midcom_db_topic')) {
         // This is a topic
         $this->_topic->require_do('midgard.admin.asgard:topic_management');
     }
     $this->_metadata = midcom_helper_metadata::retrieve($this->_object);
     if (!$this->_metadata) {
         throw new midcom_error("Failed to retrieve Metadata for " . get_class($this->_object) . " {$this->_object->guid}.");
     }
     // Load the DM2 controller instance
     $this->_controller = $this->get_controller('simple', $this->_object);
     switch ($this->_controller->process_form()) {
         case 'save':
             // Reindex the object
             //$indexer = midcom::get('indexer');
             //net_nemein_wiki_viewer::index($this->_request_data['controller']->datamanager, $indexer, $this->_topic);
             // *** FALL-THROUGH ***
             midcom::get('cache')->invalidate($this->_object->guid);
             return new midcom_response_relocate("__mfa/asgard/object/metadata/{$this->_object->guid}");
         case 'cancel':
             return new midcom_response_relocate("__mfa/asgard/object/view/{$this->_object->guid}");
     }
     $this->_prepare_request_data();
     midgard_admin_asgard_plugin::bind_to_object($this->_object, $handler_id, $data);
 }
コード例 #3
0
ファイル: lostpassword.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_lostpassword($handler_id, array $args, array &$data)
 {
     $this->_mode = $this->_config->get('lostpassword_mode');
     if ($this->_mode == 'none') {
         throw new midcom_error_notfound('This feature is disabled');
     }
     $this->_controller = $this->get_controller('nullstorage');
     switch ($this->_controller->process_form()) {
         case 'save':
             $this->_reset_password();
             $this->_processing_msg = $this->_l10n->get('password reset, mail sent.');
             $this->_processing_msg_raw = 'password reset, mail sent.';
             $this->_success = true;
             break;
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->_prepare_request_data();
     midcom::get('head')->set_pagetitle($this->_l10n->get('lost password'));
 }
コード例 #4
0
ファイル: edit.php プロジェクト: nemein/openpsa
 /**
  * Handler for folder editing. Checks for the permissions and folder integrity.
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  * @return boolean Indicating success
  */
 public function _handler_edit($handler_id, array $args, array &$data)
 {
     $this->_topic->require_do('midcom.admin.folder:topic_management');
     $this->_handler_id = str_replace('____ais-folder-', '', $handler_id);
     if ($this->_handler_id == 'create' || $this->_handler_id == 'createlink') {
         $this->_topic->require_do('midgard:create');
         if ($this->_handler_id == 'createlink') {
             $this->_topic->require_do('midcom.admin.folder:symlinks');
         }
     } else {
         $this->_topic->require_do('midgard:update');
     }
     // Load the DM2 controller
     $this->_load_controller();
     // Get the content topic prefix
     $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
     // Store the old name before editing
     $old_name = $this->_topic->name;
     // Symlink support requires that we use actual URL topic object here
     $urltopics = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_URLTOPICS);
     if ($urltopic = end($urltopics)) {
         $old_name = $urltopic->name;
     }
     switch ($this->_controller->process_form()) {
         case 'cancel':
             midcom::get('uimessages')->add($this->_l10n->get('midcom.admin.folder'), $this->_l10n->get('cancelled'));
             return new midcom_response_relocate($prefix);
         case 'save':
             if ($this->_handler_id === 'edit') {
                 $url = $this->_update_topic($prefix, $old_name);
             } else {
                 $url = $this->_create_topic($prefix);
             }
             return new midcom_response_relocate($url);
     }
     $this->_prepare_request_data();
     // Hide the button in toolbar
     $this->_node_toolbar->hide_item('__ais/folder/' . $this->_handler_id . '/');
     // Add the view to breadcrumb trail
     $this->add_breadcrumb('__ais/folder/edit/', $data['title']);
     // Set page title
     midcom::get('head')->set_pagetitle($data['title']);
     // Set the help object in the toolbar
     $help_toolbar = midcom::get('toolbars')->get_help_toolbar();
     $help_toolbar->add_help_item('edit_folder', 'midcom.admin.folder', null, null, 1);
     // Ensure we get the correct styles
     midcom::get('style')->prepend_component_styledir('midcom.admin.folder');
     $this->add_stylesheet(MIDCOM_STATIC_URL . '/midcom.admin.folder/folder.css');
 }
コード例 #5
0
ファイル: metadata.php プロジェクト: nemein/openpsa
 /**
  * Handler for folder metadata. Checks for updating permissions, initializes
  * the metadata and the content topic itself. Handles also the sent form.
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  * @return boolean Indicating success
  */
 public function _handler_metadata($handler_id, array $args, array &$data)
 {
     $this->_object = midcom::get('dbfactory')->get_object_by_guid($args[0]);
     // FIXME: We should modify the schema according to whether or not scheduling is used
     $this->_object->require_do('midgard:update');
     if (is_a($this->_object, 'midcom_db_topic')) {
         // This is a topic
         $this->_object->require_do('midcom.admin.folder:topic_management');
     } else {
         // This is a regular object, bind to view
         $this->bind_view_to_object($this->_object);
     }
     $this->_metadata = midcom_helper_metadata::retrieve($this->_object);
     if (!$this->_metadata) {
         throw new midcom_error("Failed to retrieve Metadata for " . get_class($this->_object) . " {$this->_object->guid}.");
     }
     // Load the DM2 controller instance
     $this->_load_datamanager();
     switch ($this->_controller->process_form()) {
         case 'save':
             midcom::get('cache')->invalidate($this->_object->guid);
         case 'cancel':
             return new midcom_response_relocate(midcom::get('permalinks')->create_permalink($this->_object->guid));
     }
     $object_label = midcom_helper_reflector::get($this->_object)->get_object_label($this->_object);
     if (is_a($this->_object, 'midcom_db_topic')) {
         $this->_node_toolbar->hide_item("__ais/folder/metadata/{$this->_object->guid}/");
     } else {
         $this->add_breadcrumb(midcom::get('permalinks')->create_permalink($this->_object->guid), $object_label);
         $this->_view_toolbar->hide_item("__ais/folder/metadata/{$this->_object->guid}/");
     }
     $this->add_breadcrumb("__ais/folder/metadata/{$this->_object->guid}/", $this->_l10n->get('edit metadata'));
     $data['title'] = sprintf(midcom::get('i18n')->get_string('edit metadata of %s', 'midcom.admin.folder'), $object_label);
     midcom::get('head')->set_pagetitle($data['title']);
     // Set the help object in the toolbar
     $help_toolbar = midcom::get('toolbars')->get_help_toolbar();
     $help_toolbar->add_help_item('edit_metadata', 'midcom.admin.folder', null, null, 1);
     // Ensure we get the correct styles
     midcom::get('style')->prepend_component_styledir('midcom.admin.folder');
 }