-
-
Notifications
You must be signed in to change notification settings - Fork 529
/
Copy pathupdate.class.php
90 lines (83 loc) · 3.3 KB
/
update.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/*
* This file is part of MODX Revolution.
*
* Copyright (c) MODX, LLC. All Rights Reserved.
*
* For complete copyright and license information, see the COPYRIGHT and LICENSE
* files found in the top-level directory of this distribution.
*/
/**
* @package modx
* @subpackage manager.controllers
*/
class WebLinkUpdateManagerController extends ResourceUpdateManagerController
{
/**
* Register custom CSS/JS for the page
*
* @return void
*/
public function loadCustomCssJs()
{
$mgrUrl = $this->context->getOption('manager_url', MODX_MANAGER_URL, $this->modx->_userConfig);
$this->addJavascript($mgrUrl . 'assets/modext/widgets/element/modx.panel.tv.renders.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.panel.resource.tv.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.panel.resource.js');
$this->addJavascript($mgrUrl . 'assets/modext/widgets/resource/modx.panel.resource.weblink.js');
$this->addJavascript($mgrUrl . 'assets/modext/sections/resource/update.js');
$this->addJavascript($mgrUrl . 'assets/modext/sections/resource/weblink/update.js');
$neighborhood = $this->resource->getNeighborhood();
$data = [
'xtype' => 'modx-page-weblink-update',
'resource' => $this->resource->get('id'),
'record' => $this->resourceArray,
'publish_document' => $this->canPublish,
'preview_url' => $this->previewUrl,
'locked' => (int)$this->locked,
'lockedText' => $this->lockedText,
'canSave' => (int)$this->canSave,
'canEdit' => (int)$this->canEdit,
'canCreate' => (int)$this->canCreate,
'canCreateRoot' => (int)$this->canCreateRoot,
'canDuplicate' => (int)$this->canDuplicate,
'canDelete' => (int)$this->canDelete,
'show_tvs' => (int)!empty($this->tvCounts),
'next_page' => !empty($neighborhood['right'][0])
? $neighborhood['right'][0]
: 0,
'prev_page' => !empty($neighborhood['left'][0])
? $neighborhood['left'][0]
: 0,
'up_page' => $this->resource->parent
];
$this->addHtml('<script>
MODx.config.publish_document = "' . $this->canPublish . '";
MODx.onDocFormRender = "' . $this->onDocFormRender . '";
MODx.ctx = "' . $this->resource->get('context_key') . '";
Ext.onReady(function() {MODx.load(' . json_encode($data) . ')});</script>');
$this->loadRichTextEditor();
}
/**
* Return the location of the template file
*
* @return string
*/
public function getTemplateFile()
{
return 'resource/weblink/update.tpl';
}
/**
* @param array $scriptProperties
*
* @return array|mixed
*/
public function process(array $scriptProperties = [])
{
$placeholders = parent::process($scriptProperties);
$this->resourceArray['responseCode'] =
$this->resource->getProperty('responseCode', 'core', $_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
return $placeholders;
}
}