diff --git a/.gitignore b/.gitignore index 89d575b..dd154cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,10 @@ _build/build.config.php config.core.php + +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/_build/build.config.sample.php b/_build/build.config.sample.php deleted file mode 100644 index f3e5fd4..0000000 --- a/_build/build.config.sample.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * faqMan is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * faqMan is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * faqMan; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ -/** - * Define the MODX path constants necessary for installation - * - * @package faqman - * @subpackage build - */ -define('MODX_BASE_PATH', dirname(dirname(dirname(dirname(__FILE__)))) . '/modx/'); -define('MODX_CORE_PATH', MODX_BASE_PATH . 'core/'); -define('MODX_MANAGER_PATH', MODX_BASE_PATH . 'manager/'); -define('MODX_CONNECTORS_PATH', MODX_BASE_PATH . 'connectors/'); -define('MODX_ASSETS_PATH', MODX_BASE_PATH . 'assets/'); - -define('MODX_BASE_URL','/modx/'); -define('MODX_CORE_URL', MODX_BASE_URL . 'core/'); -define('MODX_MANAGER_URL', MODX_BASE_URL . 'manager/'); -define('MODX_CONNECTORS_URL', MODX_BASE_URL . 'connectors/'); -define('MODX_ASSETS_URL', MODX_BASE_URL . 'assets/'); diff --git a/_build/build.schema.php b/_build/build.schema.php index 4faa470..0dd9a12 100644 --- a/_build/build.schema.php +++ b/_build/build.schema.php @@ -34,11 +34,11 @@ define('PKG_NAME_LOWER', strtolower(PKG_NAME)); // Define sources -$root = dirname(dirname(__FILE__)).'/'; +$root = dirname(__FILE__, 2).'/'; $sources = array( 'root' => $root, 'core' => $root . 'core/components/' . PKG_NAME_LOWER . '/', - 'model' => $root . 'core/components/' . PKG_NAME_LOWER . '/model/', + 'model' => $root . 'core/components/' . PKG_NAME_LOWER . '/src/', 'assets' => $root . 'assets/components/' . PKG_NAME_LOWER . '/', ); @@ -47,7 +47,6 @@ include_once MODX_CORE_PATH . 'model/modx/modx.class.php'; $modx = new modX(); $modx->initialize('mgr'); -$modx->loadClass('transport.modPackageBuilder', '', false, true); // Used for nice formatting of log messages echo '
'; @@ -57,30 +56,10 @@ $manager = $modx->getManager(); $generator = $manager->getGenerator(); -$generator->classTemplate= <<-EOD; -$generator->platformTemplate= << -EOD; -$generator->mapHeader= << parseSchema($sources['model'] . 'schema/'.PKG_NAME_LOWER.'.mysql.schema.xml', $sources['model']); + +$generator->parseSchema($sources['core'] . '/model/schema/'.PKG_NAME_LOWER.'.mysql.schema.xml', $sources['model'], ['namespacePrefix' => 'faqMan']); +//$manager->createObjectContainer('faqMan\Model\faqManItem'); + $mtime = microtime(); $mtime = explode(" ", $mtime); diff --git a/_build/build.transport.php b/_build/build.transport.php index 5a434c6..2f72b9d 100644 --- a/_build/build.transport.php +++ b/_build/build.transport.php @@ -23,6 +23,9 @@ * @package faqman * @subpackage build */ + +use MODX\Revolution\Transport\modPackageBuilder; + $mtime = microtime(); $mtime = explode(' ', $mtime); $mtime = $mtime[1] + $mtime[0]; @@ -32,7 +35,7 @@ // Define package define('PKG_NAME','faqMan'); define('PKG_NAME_LOWER',strtolower(PKG_NAME)); -define('PKG_VERSION','2.0.1'); +define('PKG_VERSION','2.0.2'); define('PKG_RELEASE','pl'); // Define sources diff --git a/assets/components/faqman/connector.php b/assets/components/faqman/connector.php index a3cfa21..18285ce 100644 --- a/assets/components/faqman/connector.php +++ b/assets/components/faqman/connector.php @@ -22,18 +22,19 @@ * * @package faqman */ -require_once dirname(dirname(dirname(dirname(__FILE__)))).'/config.core.php'; +if (!@include_once dirname(__FILE__, 5).'/config.core.php') { + require_once dirname(__FILE__, 4).'/config.core.php'; +} require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php'; require_once MODX_CONNECTORS_PATH.'index.php'; $corePath = $modx->getOption('faqman.core_path',null,$modx->getOption('core_path').'components/faqman/'); -require_once $corePath.'model/faqman/faqman.class.php'; -$modx->faqman = new faqMan($modx); +$modx->faqman = $modx->services->get('faqMan'); $modx->lexicon->load('faqman:default'); /* handle request */ -$path = $modx->getOption('processorsPath',$modx->faqman->config,$corePath.'processors/'); +$path = $modx->getOption('processorsPath',$modx->faqman->config,$corePath.'src/Processors/'); $modx->request->handleRequest(array( 'processors_path' => $path, 'location' => '', diff --git a/assets/components/faqman/css/index.html b/assets/components/faqman/css/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/assets/components/faqman/index.html b/assets/components/faqman/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/assets/components/faqman/js/index.html b/assets/components/faqman/js/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/assets/components/faqman/js/mgr/widgets/items.grid.js b/assets/components/faqman/js/mgr/widgets/items.grid.js index 0dbba5e..8347259 100644 --- a/assets/components/faqman/js/mgr/widgets/items.grid.js +++ b/assets/components/faqman/js/mgr/widgets/items.grid.js @@ -11,7 +11,7 @@ Faqman.grid.Items = function(config) { id: 'faqman-grid-items' ,url: Faqman.config.connectorUrl ,baseParams: { - action: 'mgr/item/getList' + action: 'faqMan\\Processors\\Mgr\\Item\\getList' ,set: config.setid } ,fields: ['id', 'question', 'answer', 'set', 'rank', 'actions'] @@ -222,7 +222,7 @@ Ext.extend(Faqman.grid.Items,MODx.grid.Grid,{ ,text: _('faqman.item_remove_confirm') ,url: Faqman.config.connectorUrl ,params: { - action: 'mgr/item/remove' + action: 'faqMan\\Processors\\Mgr\\Item\\Remove' ,id: this.menu.record.id } ,listeners: { @@ -239,7 +239,7 @@ Ext.extend(Faqman.grid.Items,MODx.grid.Grid,{ MODx.Ajax.request({ url: Faqman.config.connectorUrl ,params: { - action: 'mgr/item/publish' + action: 'faqMan\\Processors\\Mgr\\Item\\Publish' ,id: this.menu.record.id } ,listeners: { @@ -254,7 +254,7 @@ Ext.extend(Faqman.grid.Items,MODx.grid.Grid,{ MODx.Ajax.request({ url: Faqman.config.connectorUrl ,params: { - action: 'mgr/item/unpublish' + action: 'faqMan\\Processors\\Mgr\\Item\\Unpublish' ,id: this.menu.record.id } ,listeners: { @@ -305,7 +305,7 @@ Faqman.window.CreateItem = function(config) { ,url: Faqman.config.connectorUrl ,closeAction: 'close' ,baseParams: { - action: 'mgr/item/create' + action: 'faqMan\\Processors\\Mgr\\Item\\Create' ,set: config.set } ,fields: [{ @@ -343,7 +343,7 @@ Faqman.window.UpdateItem = function(config) { ,width: 650 ,modal: true ,url: Faqman.config.connectorUrl - ,action: 'mgr/item/update' + ,action: 'faqMan\\Processors\\Mgr\\Item\\Update' ,closeAction: 'close' ,fields: [{ xtype: 'hidden' diff --git a/assets/components/faqman/js/mgr/widgets/sets.grid.js b/assets/components/faqman/js/mgr/widgets/sets.grid.js index 0d6b0de..235e2d9 100644 --- a/assets/components/faqman/js/mgr/widgets/sets.grid.js +++ b/assets/components/faqman/js/mgr/widgets/sets.grid.js @@ -19,7 +19,7 @@ Faqman.grid.Sets = function(config) { Ext.applyIf(config,{ id: 'faqman-grid-sets' ,url: Faqman.config.connectorUrl - ,baseParams: { action: 'mgr/set/getList' } + ,baseParams: { action: 'faqMan\\Processors\\Mgr\\Set\\getList' } ,fields: ['id','name','description','rank', 'published'] ,autoHeight: true ,paging: true @@ -28,7 +28,7 @@ Faqman.grid.Sets = function(config) { ,remoteSort: true ,anchor: '97%' ,autoExpandColumn: 'name' - ,save_action: 'mgr/set/updateFromGrid' + ,save_action: 'faqMan\\Processors\\Mgr\\Set\\UpdateFromGrid' ,autosave: true ,view: gridView ,columns: [ @@ -95,7 +95,7 @@ Ext.extend(Faqman.grid.Sets,MODx.grid.Grid,{ MODx.Ajax.request({ url: this.config.url ,params: { - action: 'mgr/set/sort' + action: 'faqMan\\Processors\\Mgr\\Set\\Sort' ,source: o.source.id ,target: o.target.id } @@ -190,7 +190,7 @@ Ext.extend(Faqman.grid.Sets,MODx.grid.Grid,{ MODx.Ajax.request({ url: this.config.url ,params: { - action: 'mgr/set/publish' + action: 'faqMan\\Processors\\Mgr\\Set\\Publish' ,id: this.menu.record.id } ,listeners: { @@ -207,7 +207,7 @@ Ext.extend(Faqman.grid.Sets,MODx.grid.Grid,{ MODx.Ajax.request({ url: this.config.url ,params: { - action: 'mgr/set/unpublish' + action: 'faqMan\\Processors\\Mgr\\Set\\Unpublish' ,id: this.menu.record.id } ,listeners: { @@ -248,7 +248,7 @@ Faqman.window.CreateSet = function(config) { ,width: 475 ,modal: true ,url: Faqman.config.connectorUrl - ,action: 'mgr/set/create' + ,action: 'faqMan\\Processors\\Mgr\\Set\\Create' ,fields: [{ xtype: 'textfield' ,fieldLabel: _('name') @@ -276,7 +276,7 @@ Faqman.window.UpdateSet = function(config) { ,width: 475 ,modal: true ,url: Faqman.config.connectorUrl - ,action: 'mgr/set/update' + ,action: 'faqMan\\Processors\\Mgr\\Set\\Update' ,fields: [{ xtype: 'hidden' ,name: 'id' diff --git a/core/components/faqman/bootstrap.php b/core/components/faqman/bootstrap.php new file mode 100644 index 0000000..fdcf9d8 --- /dev/null +++ b/core/components/faqman/bootstrap.php @@ -0,0 +1,13 @@ +addPackage('faqMan\Model', $namespace['path'] . 'src/', null, 'faqMan\\'); + +$modx->services->add('faqMan', function() use ($modx) { + return new faqMan\faqMan($modx); +}); diff --git a/core/components/faqman/composer.json b/core/components/faqman/composer.json new file mode 100644 index 0000000..baa065a --- /dev/null +++ b/core/components/faqman/composer.json @@ -0,0 +1,7 @@ +{ + "autoload": { + "psr-4": { + "faqMan\\": "src/" + } + } +} diff --git a/core/components/faqman/composer.lock b/core/components/faqman/composer.lock new file mode 100644 index 0000000..ba6fe47 --- /dev/null +++ b/core/components/faqman/composer.lock @@ -0,0 +1,18 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "d751713988987e9331980363e24189ce", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.6.0" +} diff --git a/core/components/faqman/controllers/index.class.php b/core/components/faqman/controllers/index.class.php index 611b7e2..6ff6bd7 100644 --- a/core/components/faqman/controllers/index.class.php +++ b/core/components/faqman/controllers/index.class.php @@ -21,11 +21,10 @@ * @package faqman * @subpackage controllers */ -require_once dirname(dirname(__FILE__)).'/model/faqman/faqman.class.php'; -class FaqmanIndexManagerController extends \modExtraManagerController { +class FaqmanIndexManagerController extends modExtraManagerController { public $faqman; public function initialize() { - $this->faqman = new faqMan($this->modx); + $this->faqman = $this->modx->services->get('faqMan'); $this->addCss($this->faqman->config['cssUrl'].'mgr.css'); $this->addJavascript($this->faqman->config['jsUrl'].'mgr/faqman.js'); $this->addHtml('