| @@ 96-123 (lines=28) @@ | ||
| 93 | * @param array $args The argument list. |
|
| 94 | * @param array &$data The local request data. |
|
| 95 | */ |
|
| 96 | public function _handler_edit($handler_id, array $args, array &$data) |
|
| 97 | { |
|
| 98 | $this->_article = new midcom_db_article($args[0]); |
|
| 99 | ||
| 100 | // Relocate for the correct content topic, let the true content topic take care of the ACL |
|
| 101 | if ($this->_article->topic !== $this->_content_topic->id) |
|
| 102 | { |
|
| 103 | $nap = new midcom_helper_nav(); |
|
| 104 | $node = $nap->get_node($this->_article->topic); |
|
| 105 | ||
| 106 | if (!empty($node[MIDCOM_NAV_ABSOLUTEURL])) |
|
| 107 | { |
|
| 108 | return new midcom_response_relocate($node[MIDCOM_NAV_ABSOLUTEURL] . "edit/{$args[0]}/"); |
|
| 109 | } |
|
| 110 | throw new midcom_error_notfound("The article with GUID {$args[0]} was not found."); |
|
| 111 | } |
|
| 112 | ||
| 113 | $this->_article->require_do('midgard:update'); |
|
| 114 | midcom::get()->head->set_pagetitle($this->_l10n->get('edit article')); |
|
| 115 | ||
| 116 | $this->_load_controller(); |
|
| 117 | $workflow = $this->get_workflow('datamanager2', array |
|
| 118 | ( |
|
| 119 | 'controller' => $this->_controller, |
|
| 120 | 'save_callback' => array($this, 'save_callback') |
|
| 121 | )); |
|
| 122 | return $workflow->run(); |
|
| 123 | } |
|
| 124 | ||
| 125 | public function save_callback(midcom_helper_datamanager2_controller $controller) |
|
| 126 | { |
|
| @@ 93-119 (lines=27) @@ | ||
| 90 | * @param array $args The argument list. |
|
| 91 | * @param array &$data The local request data. |
|
| 92 | */ |
|
| 93 | public function _handler_edit($handler_id, array $args, array &$data) |
|
| 94 | { |
|
| 95 | $this->_article = new midcom_db_article($args[0]); |
|
| 96 | ||
| 97 | // Relocate for the correct content topic, let the true content topic take care of the ACL |
|
| 98 | if ($this->_article->topic !== $this->_content_topic->id) |
|
| 99 | { |
|
| 100 | $nap = new midcom_helper_nav(); |
|
| 101 | $node = $nap->get_node($this->_article->topic); |
|
| 102 | ||
| 103 | if (!empty($node[MIDCOM_NAV_ABSOLUTEURL])) |
|
| 104 | { |
|
| 105 | return new midcom_response_relocate($node[MIDCOM_NAV_ABSOLUTEURL] . "edit/{$args[0]}/"); |
|
| 106 | } |
|
| 107 | throw new midcom_error_notfound("The article with GUID {$args[0]} was not found."); |
|
| 108 | } |
|
| 109 | ||
| 110 | $this->_article->require_do('midgard:update'); |
|
| 111 | midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_article->title)); |
|
| 112 | ||
| 113 | $workflow = $this->get_workflow('datamanager2', array |
|
| 114 | ( |
|
| 115 | 'controller' => $this->_load_controller(), |
|
| 116 | 'save_callback' => array($this, 'save_callback') |
|
| 117 | )); |
|
| 118 | return $workflow->run(); |
|
| 119 | } |
|
| 120 | ||
| 121 | public function save_callback(midcom_helper_datamanager2_controller $controller) |
|
| 122 | { |
|