update.class.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /*
  3. * This file is part of the Fred package.
  4. *
  5. * Copyright (c) MODX, LLC
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. require_once dirname(dirname(dirname(__FILE__))) . '/index.class.php';
  11. /**
  12. * @package fred
  13. * @subpackage controllers
  14. */
  15. class FredBlueprintUpdateManagerController extends FredBaseManagerController
  16. {
  17. protected $permissions = [];
  18. public function process(array $scriptProperties = array())
  19. {
  20. $this->loadPermissions();
  21. }
  22. public function getPageTitle()
  23. {
  24. return $this->modx->lexicon('fred.blueprints.update');
  25. }
  26. public function loadCustomCssJs()
  27. {
  28. $this->addJavascript($this->fred->getOption('jsUrl') . 'utils/utils.js');
  29. $this->addJavascript($this->fred->getOption('jsUrl') . 'utils/combos.js');
  30. $this->addJavascript($this->fred->getOption('jsUrl') . 'blueprint/panel.js');
  31. $this->addLastJavascript($this->fred->getOption('jsUrl') . 'blueprint/page.js');
  32. $this->addHtml('
  33. <script type="text/javascript">
  34. Ext.onReady(function() {
  35. MODx.load({
  36. xtype: "fred-page-blueprint",
  37. permission: ' . json_encode($this->permissions) . '
  38. });
  39. });
  40. </script>
  41. ');
  42. }
  43. public function getTemplateFile()
  44. {
  45. return $this->fred->getOption('templatesPath') . 'blueprint.tpl';
  46. }
  47. public function checkPermissions()
  48. {
  49. if (!$this->modx->hasPermission('fred_blueprints_save')) {
  50. return false;
  51. }
  52. return parent::checkPermissions();
  53. }
  54. protected function loadPermissions()
  55. {
  56. $this->permissions = [
  57. 'fred_blueprints_create_public' => (int)$this->modx->hasPermission('fred_blueprints_create_public'),
  58. ];
  59. }
  60. }