|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author tarjei huse |
|
4
|
|
|
* @package midgard.admin.asgard |
|
5
|
|
|
* @copyright The Midgard Project, http://www.midgard-project.org |
|
6
|
|
|
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
10
|
|
|
use midgard\portable\api\error\exception as mgd_exception; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Simple styling class to make html out of diffs and get a simple way |
|
14
|
|
|
* to provide rcs functionality |
|
15
|
|
|
* |
|
16
|
|
|
* @package midgard.admin.asgard |
|
17
|
|
|
*/ |
|
18
|
|
|
class midgard_admin_asgard_handler_object_rcs extends midcom_services_rcs_handler |
|
19
|
|
|
{ |
|
20
|
|
|
use midgard_admin_asgard_handler; |
|
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
protected string $style_prefix = 'midgard_admin_asgard_rcs_'; |
|
23
|
|
|
|
|
24
|
|
|
protected string $url_prefix = '__mfa/asgard/object/rcs/'; |
|
25
|
|
|
|
|
26
|
3 |
|
protected function load_object(string $guid) : midcom_core_dbaobject |
|
27
|
|
|
{ |
|
28
|
|
|
try { |
|
29
|
3 |
|
return parent::load_object($guid); |
|
30
|
|
|
} catch (midcom_error_midgard $e) { |
|
31
|
|
|
$mgd_exception = $e->getPrevious(); |
|
32
|
|
|
if ( $mgd_exception |
|
33
|
|
|
&& $mgd_exception->getCode() == mgd_exception::OBJECT_DELETED) { |
|
34
|
|
|
return $this->load_deleted($guid); |
|
35
|
|
|
} |
|
36
|
|
|
throw $e; |
|
37
|
|
|
} |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
protected function get_object_url() : string |
|
41
|
|
|
{ |
|
42
|
|
|
return $this->router->generate('object_open', ['guid' => $this->object->guid]); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
3 |
|
protected function get_breadcrumbs() : array |
|
46
|
|
|
{ |
|
47
|
3 |
|
midgard_admin_asgard_plugin::bind_to_object($this->object, $this->_request_data['handler_id'], $this->_request_data); |
|
48
|
3 |
|
return midcom_core_context::get()->get_custom_key('midcom.helper.nav.breadcrumb') ?: []; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
3 |
|
protected function reply(string $element) : Response |
|
52
|
|
|
{ |
|
53
|
3 |
|
return $this->get_response($element); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Load l10n |
|
58
|
|
|
*/ |
|
59
|
3 |
|
public function _on_initialize() |
|
60
|
|
|
{ |
|
61
|
3 |
|
midcom::get()->auth->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin'); |
|
62
|
3 |
|
$this->_component = 'midcom.admin.rcs'; |
|
63
|
3 |
|
$this->_request_data['l10n'] = $this->_i18n->get_l10n('midcom.admin.rcs'); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|