index.class.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * xBug
  4. *
  5. * Copyright 2010 by Shaun McCormick <shaun+xbug@modx.com>
  6. *
  7. * xBug is free software; you can redistribute it and/or modify it under the
  8. * terms of the GNU General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option) any later
  10. * version.
  11. *
  12. * xBug is distributed in the hope that it will be useful, but WITHOUT ANY
  13. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  14. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * xBug; if not, write to the Free Software Foundation, Inc., 59 Temple
  18. * Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. * @package xbug
  21. */
  22. /**
  23. * Loads the home page.
  24. *
  25. * @package xbug
  26. * @subpackage controllers
  27. */
  28. if (!class_exists('xBugManagerController')) {
  29. require_once dirname(dirname(__FILE__)).'/index.class.php';
  30. }
  31. class xBugIndexManagerController extends xBugManagerController {
  32. public function process(array $scriptProperties = array()) {
  33. }
  34. public function getPageTitle() { return $this->modx->lexicon('xbug'); }
  35. public function loadCustomCssJs() {
  36. $ace = $this->modx->getObject('transport.modTransportPackage', array('package_name' => 'Ace', 'disabled' => 0));
  37. if ($ace) {
  38. $ace = $this->modx->getService('ace','Ace',$this->modx->getOption('ace.core_path',null,$this->modx->getOption('core_path').'components/ace/').'model/ace/');
  39. $ace->initialize();
  40. $script = "
  41. setTimeout(function(){
  42. var textArea = Ext.getCmp('xbug-editor-text');
  43. var textEditor = MODx.load({
  44. xtype: 'modx-texteditor',
  45. enableKeyEvents: true,
  46. anchor: textArea.anchor,
  47. width: 'auto',
  48. height: textArea.container.getHeight(),
  49. name: textArea.name,
  50. flext : 1,
  51. value: textArea.getValue(),
  52. mimeType: 'application/x-php',
  53. id : 'xbug-editor-ace'
  54. });
  55. textArea.el.dom.removeAttribute('name');
  56. textArea.el.setStyle('display', 'none');
  57. textEditor.render(textArea.el.dom.parentNode);
  58. textEditor.on('keydown', function(e){textArea.fireEvent('keydown', e);});
  59. });";
  60. $this->addHtml('<script>Ext.onReady(function() {' . $script . '});</script>');
  61. }
  62. $this->addLastJavascript($this->xbug->config['jsUrl'].'mgr/widgets/index.panel.js');
  63. $this->addLastJavascript($this->xbug->config['jsUrl'].'mgr/sections/index.js');
  64. }
  65. public function getTemplateFile() { return $this->xbug->config['templatesPath'].'index.tpl'; }
  66. }