update.class.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. require_once dirname(dirname(__FILE__)) . '/update.class.php';
  3. /**
  4. * Update controller for Collections Container
  5. *
  6. * @package collections
  7. * @subpackage controller
  8. */
  9. class SelectionContainerUpdateManagerController extends CollectionContainerUpdateManagerController
  10. {
  11. /**
  12. * Register custom CSS/JS for the page
  13. * @return void
  14. */
  15. public function loadCustomCssJs()
  16. {
  17. $managerUrl = $this->context->getOption('manager_url', MODX_MANAGER_URL, $this->modx->_userConfig);
  18. $collectionsAssetsUrl = $this->modx->getOption('collections.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/collections/');
  19. $connectorUrl = $collectionsAssetsUrl . 'connector.php';
  20. $collectionsJsUrl = $collectionsAssetsUrl . 'js/mgr/';
  21. $this->addCss($collectionsAssetsUrl . 'css/mgr.css');
  22. $userCSS = $this->modx->getOption('collections.user_css', '');
  23. if ($userCSS != '') {
  24. $this->addCss($userCSS);
  25. }
  26. $this->addJavascript($managerUrl . 'assets/modext/util/datetime.js');
  27. $this->addJavascript($managerUrl . 'assets/modext/widgets/element/modx.panel.tv.renders.js');
  28. $this->addJavascript($managerUrl . 'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
  29. $this->addJavascript($managerUrl . 'assets/modext/widgets/resource/modx.panel.resource.tv.js');
  30. $this->addJavascript($managerUrl . 'assets/modext/widgets/resource/modx.panel.resource.js');
  31. $this->addJavascript($managerUrl . 'assets/modext/sections/resource/update.js');
  32. $this->addJavascript($collectionsJsUrl . 'collections.js');
  33. $this->addLastJavascript($collectionsJsUrl . 'sections/category/update.js');
  34. $this->addLastJavascript($collectionsJsUrl . 'widgets/category/collections.panel.category.js');
  35. $this->addLastJavascript($collectionsJsUrl . 'widgets/category/collections.panel.selection.js');
  36. $this->addLastJavascript($collectionsJsUrl . 'widgets/category/collections.grid.resources.js');
  37. $this->addLastJavascript($collectionsJsUrl . 'widgets/category/collections.grid.selection.js');
  38. $this->addLastJavascript($collectionsJsUrl . 'widgets/category/collections.window.js');
  39. $this->addLastJavascript($collectionsJsUrl . 'extra/collections.combo.js');
  40. $this->addLastJavascript($collectionsJsUrl . 'extra/griddraganddrop.js');
  41. $this->addLastJavascript($collectionsJsUrl . 'extra/collections.renderers.js');
  42. $userJS = $this->modx->getOption('collections.user_js', '');
  43. if ($userJS != '') {
  44. $this->addLastJavascript($userJS);
  45. }
  46. $collectionsTemplate = $this->getCollectionsTemplate();
  47. $response = $this->modx->runProcessor('system/derivatives/getlist', array(
  48. 'skip' => 'modXMLRPCResource',
  49. 'class' => 'modResource',
  50. ));
  51. $response = $this->modx->fromJSON($response->response);
  52. if ($response == '') {
  53. $response = array();
  54. } else {
  55. $response = $response['results'];
  56. }
  57. $this->loadConfig();
  58. $this->addHtml('
  59. <script type="text/javascript">
  60. // <![CDATA[
  61. collections.assetsUrl = "' . $collectionsAssetsUrl . '";
  62. collections.connectorUrl = "' . $connectorUrl . '";
  63. collections.config = ' . $this->modx->toJSON($this->collections->config) . ';
  64. collections.config.connector_url = "' . $this->collections->config['connectorUrl'] . '";
  65. MODx.config.publish_document = "' . $this->canPublish . '";
  66. MODx.onDocFormRender = "' . $this->onDocFormRender . '";
  67. MODx.ctx = "' . $this->resource->get('context_key') . '";
  68. collections.template = ' . $collectionsTemplate . ';
  69. collections.resourceDerivatives = ' . $this->modx->toJSON($response) . ';
  70. Ext.onReady(function() {
  71. MODx.load({
  72. xtype: "collections-page-selection-update"
  73. ,resource: "' . $this->resource->get('id') . '"
  74. ,record: ' . $this->modx->toJSON($this->resourceArray) . '
  75. ,publish_document: "' . $this->canPublish . '"
  76. ,preview_url: "' . $this->previewUrl . '"
  77. ,locked: ' . ($this->locked ? 1 : 0) . '
  78. ,lockedText: "' . $this->lockedText . '"
  79. ,canSave: ' . ($this->canSave ? 1 : 0) . '
  80. ,canEdit: ' . ($this->canEdit ? 1 : 0) . '
  81. ,canCreate: ' . ($this->canCreate ? 1 : 0) . '
  82. ,canDuplicate: ' . ($this->canDuplicate ? 1 : 0) . '
  83. ,canDelete: ' . ($this->canDelete ? 1 : 0) . '
  84. ,show_tvs: ' . (!empty($this->tvCounts) ? 1 : 0) . '
  85. ,mode: "update"
  86. });
  87. });
  88. // ]]>
  89. </script>');
  90. /* load RTE */
  91. $this->loadRichTextEditor();
  92. }
  93. }