create.class.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /*
  3. * This file is part of MODX Revolution.
  4. *
  5. * Copyright (c) MODX, LLC. All Rights Reserved.
  6. *
  7. * For complete copyright and license information, see the COPYRIGHT and LICENSE
  8. * files found in the top-level directory of this distribution.
  9. */
  10. class StaticResourceCreateManagerController extends ResourceCreateManagerController {
  11. /**
  12. * Register custom CSS/JS for the page
  13. * @return void
  14. */
  15. public function loadCustomCssJs() {
  16. $mgrUrl = $this->modx->getOption('manager_url',null,MODX_MANAGER_URL);
  17. $this->addJavascript($mgrUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js');
  18. $this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.grid.resource.security.local.js');
  19. $this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.tv.js');
  20. $this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.js');
  21. $this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.static.js');
  22. $this->addJavascript($mgrUrl.'assets/modext/sections/resource/create.js');
  23. $this->addJavascript($mgrUrl.'assets/modext/sections/resource/static/create.js');
  24. $this->addHtml('<script type="text/javascript">
  25. // <![CDATA[
  26. MODx.config.publish_document = "'.$this->canPublish.'";
  27. MODx.onDocFormRender = "'.$this->onDocFormRender.'";
  28. MODx.ctx = "'.$this->ctx.'";
  29. Ext.onReady(function() {
  30. MODx.load({
  31. xtype: "modx-page-static-create"
  32. ,record: '.$this->modx->toJSON($this->resourceArray).'
  33. ,publish_document: "'.$this->canPublish.'"
  34. ,canSave: "'.($this->modx->hasPermission('save_document') ? 1 : 0).'"
  35. ,show_tvs: '.(!empty($this->tvCounts) ? 1 : 0).'
  36. ,mode: "create"
  37. });
  38. });
  39. // ]]>
  40. </script>');
  41. /* load RTE */
  42. $this->loadRichTextEditor();
  43. }
  44. /**
  45. * Return the location of the template file
  46. * @return string
  47. */
  48. public function getTemplateFile() {
  49. return 'resource/staticresource/create.tpl';
  50. }
  51. }