update.class.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @package modx
  4. * @subpackage manager.controllers
  5. */
  6. class WebLinkUpdateManagerController extends ResourceUpdateManagerController {
  7. /**
  8. * Register custom CSS/JS for the page
  9. * @return void
  10. */
  11. public function loadCustomCssJs() {
  12. $managerUrl = $this->context->getOption('manager_url', MODX_MANAGER_URL, $this->modx->_userConfig);
  13. $this->addJavascript($managerUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js');
  14. $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
  15. $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.panel.resource.tv.js');
  16. $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.panel.resource.js');
  17. $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.panel.resource.weblink.js');
  18. $this->addJavascript($managerUrl.'assets/modext/sections/resource/update.js');
  19. $this->addJavascript($managerUrl.'assets/modext/sections/resource/weblink/update.js');
  20. $this->addHtml('
  21. <script type="text/javascript">
  22. // <![CDATA[
  23. MODx.config.publish_document = "'.$this->canPublish.'";
  24. MODx.onDocFormRender = "'.$this->onDocFormRender.'";
  25. MODx.ctx = "'.$this->resource->get('context_key').'";
  26. Ext.onReady(function() {
  27. MODx.load({
  28. xtype: "modx-page-weblink-update"
  29. ,resource: "'.$this->resource->get('id').'"
  30. ,record: '.$this->modx->toJSON($this->resourceArray).'
  31. ,publish_document: "'.$this->canPublish.'"
  32. ,preview_url: "'.$this->previewUrl.'"
  33. ,locked: '.($this->locked ? 1 : 0).'
  34. ,lockedText: "'.$this->lockedText.'"
  35. ,canSave: '.($this->canSave ? 1 : 0).'
  36. ,canEdit: '.($this->canEdit ? 1 : 0).'
  37. ,canCreate: '.($this->canCreate ? 1 : 0).'
  38. ,canCreateRoot: '.($this->canCreateRoot ? 1 : 0).'
  39. ,canDuplicate: '.($this->canDuplicate ? 1 : 0).'
  40. ,canDelete: '.($this->canDelete ? 1 : 0).'
  41. ,show_tvs: '.(!empty($this->tvCounts) ? 1 : 0).'
  42. });
  43. });
  44. // ]]>
  45. </script>');
  46. /* load RTE */
  47. $this->loadRichTextEditor();
  48. }
  49. /**
  50. * Return the location of the template file
  51. * @return string
  52. */
  53. public function getTemplateFile() {
  54. return 'resource/weblink/update.tpl';
  55. }
  56. public function process(array $scriptProperties = array()) {
  57. $placeholders = parent::process($scriptProperties);
  58. $this->resourceArray['responseCode'] = $this->resource->getProperty('responseCode','core',$_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently');
  59. return $placeholders;
  60. }
  61. }