create.class.php 2.1 KB

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