/** * @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_change($handler_id, array $args, array &$data) { if ($_SERVER['REQUEST_METHOD'] != 'POST') { throw new midcom_error_forbidden('Only POST requests are allowed here.'); } $this->_page = $this->_master->load_page($args[0]); $this->_page->require_do('midgard:update'); // Change schema to redirect $this->_page->parameter('midcom.helper.datamanager2', 'schema_name', $_POST['change_to']); // Redirect to editing return new midcom_response_relocate("edit/{$this->_page->name}/"); }
/** * @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, $args, &$data, $delete_mode = true) { $this->_page = $this->_master->load_page($args[0]); $this->_page->require_do('midgard:delete'); if (array_key_exists('net_nemein_wiki_deleteok', $_POST)) { $wikiword = $this->_page->title; if ($this->_page->delete()) { midcom::get('uimessages')->add($this->_request_data['l10n']->get('net.nemein.wiki'), sprintf($this->_request_data['l10n']->get('page %s deleted'), $wikiword), 'ok'); // Update the index $indexer = midcom::get('indexer'); $indexer->delete($this->_page->guid); return new midcom_response_relocate(midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX)); } else { throw new midcom_error("Failed to delete wikipage, reason " . midcom_connection::get_error_string()); } } $this->_load_datamanager(); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n_midcom']->get('cancel'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/cancel.png')); $this->_view_toolbar->bind_to($this->_page); $this->add_breadcrumb("{$this->_page->name}/", $this->_page->title); $this->add_breadcrumb("delete/{$this->_page->name}/", $this->_l10n_midcom->get('delete')); midcom::get('head')->set_pagetitle($this->_page->title); }