예제 #1
0
파일: view.php 프로젝트: nemein/openpsa
 private function _populate_toolbar()
 {
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n_midcom']->get('view'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png', MIDCOM_TOOLBAR_ACCESSKEY => 'v'));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "edit/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n_midcom']->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ACCESSKEY => 'e', MIDCOM_TOOLBAR_ENABLED => $this->_page->can_do('midgard:update')));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "delete/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n_midcom']->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ACCESSKEY => 'd', MIDCOM_TOOLBAR_ENABLED => $this->_page->can_do('midgard:delete')));
     foreach (array_keys($this->_request_data['schemadb']) as $name) {
         if ($name == $this->_datamanager->schema->name) {
             // The page is already of this type, skip
             continue;
         }
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "change/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n->get('change to %s'), $this->_l10n->get($this->_request_data['schemadb'][$name]->description)), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_refresh.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('change_to' => $name), MIDCOM_TOOLBAR_ENABLED => $this->_page->can_do('midgard:update')));
     }
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "whatlinks/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('what links'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/jump-to.png'));
     if (midcom::get('auth')->user) {
         $user = midcom::get('auth')->user->get_storage();
         if ($this->_page->parameter('net.nemein.wiki:watch', $user->guid)) {
             $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "subscribe/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('unsubscribe'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('unsubscribe' => 1)));
         } else {
             $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "subscribe/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('subscribe'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('subscribe' => 1)));
         }
     }
     if ($this->_page->can_do('midgard:update')) {
         midcom::get('head')->add_link_head(array('rel' => 'alternate', 'type' => 'application/x-wiki', 'title' => $this->_request_data['l10n_midcom']->get('edit'), 'href' => midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . "edit/{$this->_page->name}/"));
     }
     if (midcom::get('componentloader')->is_installed('org.openpsa.relatedto')) {
         org_openpsa_relatedto_plugin::add_button($this->_view_toolbar, $this->_page->guid);
     }
     $this->bind_view_to_object($this->_page, $this->_datamanager->schema->name);
 }
예제 #2
0
파일: edit.php 프로젝트: nemein/openpsa
 /**
  * Check the edit request
  *
  * @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->_page = $this->_master->load_page($args[0]);
     $this->_page->require_do('midgard:update');
     $this->_load_controller();
     switch ($this->_controller->process_form()) {
         case 'preview':
             $this->_preview = true;
             $data['formmanager'] =& $this->_controller->formmanager;
             break;
         case 'save':
             // Reindex the article
             $indexer = midcom::get('indexer');
             net_nemein_wiki_viewer::index($this->_controller->datamanager, $indexer, $this->_topic);
             midcom::get('uimessages')->add($this->_request_data['l10n']->get('net.nemein.wiki'), sprintf($this->_request_data['l10n']->get('page %s saved'), $this->_page->title), 'ok');
             // *** FALL-THROUGH ***
         // *** FALL-THROUGH ***
         case 'cancel':
             if ($this->_page->name == 'index') {
                 return new midcom_response_relocate(midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX));
             } else {
                 return new midcom_response_relocate(midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . "{$this->_page->name}/");
             }
     }
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n_midcom']->get('view'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png', MIDCOM_TOOLBAR_ACCESSKEY => 'v'));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "delete/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n_midcom']->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ACCESSKEY => 'd', MIDCOM_TOOLBAR_ENABLED => $this->_page->can_do('midgard:delete')));
     foreach (array_keys($this->_request_data['schemadb']) as $name) {
         if ($name == $this->_controller->datamanager->schema->name) {
             // The page is already of this type, skip
             continue;
         }
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "change/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n->get('change to %s'), $this->_l10n->get($this->_request_data['schemadb'][$name]->description)), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_refresh.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('change_to' => $name), MIDCOM_TOOLBAR_ENABLED => $this->_page->can_do('midgard:update')));
     }
     $this->bind_view_to_object($this->_page, $this->_controller->datamanager->schema->name);
     $data['view_title'] = sprintf($this->_request_data['l10n']->get('edit %s'), $this->_page->title);
     midcom::get('head')->set_pagetitle($data['view_title']);
     // Set the breadcrumb pieces
     $this->add_breadcrumb("{$this->_page->name}/", $this->_page->title);
     $this->add_breadcrumb("edit/{$this->_page->name}/", $this->_l10n_midcom->get('edit'));
     // Set the help object in the toolbar
     $this->_view_toolbar->add_help_item('markdown', 'net.nemein.wiki');
 }