Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
_build/build.config.php
config.core.php

.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
36 changes: 0 additions & 36 deletions _build/build.config.sample.php

This file was deleted.

33 changes: 6 additions & 27 deletions _build/build.schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '/',
);

Expand All @@ -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 '<pre>';
Expand All @@ -57,30 +56,10 @@
$manager = $modx->getManager();
$generator = $manager->getGenerator();

$generator->classTemplate= <<<EOD
<?php
/**
* [+phpdoc-package+]
*/
class [+class+] extends [+extends+] {}
?>
EOD;
$generator->platformTemplate= <<<EOD
<?php
/**
* [+phpdoc-package+]
*/
require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\\\', '/') . '/[+class-lowercase+].class.php');
class [+class+]_[+platform+] extends [+class+] {}
?>
EOD;
$generator->mapHeader= <<<EOD
<?php
/**
* [+phpdoc-package+]
*/
EOD;
$generator->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);
Expand Down
5 changes: 4 additions & 1 deletion _build/build.transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
* @package faqman
* @subpackage build
*/

use MODX\Revolution\Transport\modPackageBuilder;

$mtime = microtime();
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions assets/components/faqman/connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '',
Expand Down
Empty file.
Empty file.
Empty file.
12 changes: 6 additions & 6 deletions assets/components/faqman/js/mgr/widgets/items.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down Expand Up @@ -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: [{
Expand Down Expand Up @@ -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'
Expand Down
14 changes: 7 additions & 7 deletions assets/components/faqman/js/mgr/widgets/sets.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: [
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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'
Expand Down
13 changes: 13 additions & 0 deletions core/components/faqman/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* @var \MODX\Revolution\modX $modx
* @var array $namespace
*/

require_once $namespace['path'] . 'vendor/autoload.php';

$modx->addPackage('faqMan\Model', $namespace['path'] . 'src/', null, 'faqMan\\');

$modx->services->add('faqMan', function() use ($modx) {
return new faqMan\faqMan($modx);
});
7 changes: 7 additions & 0 deletions core/components/faqman/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"autoload": {
"psr-4": {
"faqMan\\": "src/"
}
}
}
18 changes: 18 additions & 0 deletions core/components/faqman/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions core/components/faqman/controllers/index.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('<script>
Expand Down
18 changes: 8 additions & 10 deletions core/components/faqman/elements/snippets/snippet.faqman.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
*
* @package faqman
*/
$faqMan = $modx->getService(
'faqman',
'faqMan',
$modx->getOption('faqman.core_path', null, $modx->getOption('core_path').'components/faqman/').'model/faqman/',
$scriptProperties
);
if (!($faqMan instanceof faqMan)) return '';
use \faqMan\Model\faqManSet;
use \faqMan\Model\faqManItem;

$faqMan = $modx->services->get('faqMan');
if (!($faqMan instanceof \faqMan\faqMan)) return '';

$set = $modx->getOption('set', $scriptProperties, null);
$sets = $modx->getOption('sets', $scriptProperties, null);
Expand All @@ -26,7 +24,7 @@
$setOutputSeparator = $modx->getOption('setOutputSeparator', $scriptProperties, "\n");

/* build query */
$c = $modx->newQuery('faqManSet');
$c = $modx->newQuery(faqManSet::class);

if (!empty($set)) {
$c->where(array(
Expand All @@ -48,7 +46,7 @@
if (!empty($limit)) $c->limit($limit);

// Get collection of FAQ sets based on query
$sets = $modx->getCollection('faqManSet', $c);
$sets = $modx->getCollection(faqManSet::class, $c);

// Loop through found FAQ sets and build the output
$list = array();
Expand All @@ -58,7 +56,7 @@
$setArray = $set->toArray();

// Loop through items and set output to array
$ci = $modx->newQuery('faqManItem');
$ci = $modx->newQuery(faqManItem::class);

// Hide unpublished items
if (!$showUnpublished) {
Expand Down
Loading