diff --git a/_build/build.config.sample.php b/_build/build.config.sample.php deleted file mode 100644 index 97920f7..0000000 --- a/_build/build.config.sample.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * Define the MODX path constants necessary for installation - * - * @package batcher - * @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/'); \ No newline at end of file diff --git a/_build/build.schema.php b/_build/build.schema.php deleted file mode 100644 index 6c260b9..0000000 --- a/_build/build.schema.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * Build Schema script - * - * @package batcher - * @subpackage build - */ -$mtime = microtime(); -$mtime = explode(" ", $mtime); -$mtime = $mtime[1] + $mtime[0]; -$tstart = $mtime; -set_time_limit(0); - -/* define package name */ -define('PKG_NAME','Batcher'); -define('PKG_NAME_LOWER',strtolower(PKG_NAME)); - -/* define sources */ -$root = dirname(dirname(__FILE__)).'/'; -$sources = array( - 'root' => $root, - 'core' => $root.'core/components/'.PKG_NAME_LOWER.'/', - 'model' => $root.'core/components/'.PKG_NAME_LOWER.'/model/', - 'assets' => $root.'assets/components/'.PKG_NAME_LOWER.'/', -); - -/* load modx and configs */ -require_once dirname(__FILE__) . '/build.config.php'; -include_once MODX_CORE_PATH . 'model/modx/modx.class.php'; -$modx= new modX(); -$modx->initialize('mgr'); -$modx->loadClass('transport.modPackageBuilder','',false, true); -echo '
'; /* used for nice formatting of log messages */
-$modx->setLogLevel(modX::LOG_LEVEL_INFO);
-$modx->setLogTarget('ECHO');
-
-$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']);
-
-
-$mtime= microtime();
-$mtime= explode(" ", $mtime);
-$mtime= $mtime[1] + $mtime[0];
-$tend= $mtime;
-$totalTime= ($tend - $tstart);
-$totalTime= sprintf("%2.4f s", $totalTime);
-
-echo "\nExecution time: {$totalTime}\n";
-
-exit ();
\ No newline at end of file
diff --git a/_build/build.transport.php b/_build/build.transport.php
deleted file mode 100644
index 2083b96..0000000
--- a/_build/build.transport.php
+++ /dev/null
@@ -1,118 +0,0 @@
-
- *
- * This file is part of Batcher, a batch resource editing Extra.
- *
- * Batcher 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.
- *
- * Batcher 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
- * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package batcher
- */
-/**
- * Batcher build script
- *
- * @package batcher
- * @subpackage build
- */
-$mtime = microtime();
-$mtime = explode(" ", $mtime);
-$mtime = $mtime[1] + $mtime[0];
-$tstart = $mtime;
-set_time_limit(0);
-
-/* define package */
-define('PKG_NAME','Batcher');
-define('PKG_NAME_LOWER','batcher');
-define('PKG_VERSION','1.1.1');
-define('PKG_RELEASE','pl');
-
-/* define sources */
-$root = dirname(dirname(__FILE__)).'/';
-$sources= array (
-    'root' => $root,
-    'build' => $root .'_build/',
-    'resolvers' => $root . '_build/resolvers/',
-    'data' => $root . '_build/data/',
-    'source_core' => $root.'core/components/'.PKG_NAME_LOWER,
-    'source_assets' => $root.'assets/components/'.PKG_NAME_LOWER,
-    'lexicon' => $root . 'core/components/'.PKG_NAME_LOWER.'/lexicon/',
-    'docs' => $root.'core/components/'.PKG_NAME_LOWER.'/docs/',
-);
-unset($root);
-
-/* override with your own defines here (see build.config.sample.php) */
-require_once $sources['build'] . 'build.config.php';
-require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
-
-$modx= new modX();
-$modx->initialize('mgr');
-$modx->setLogLevel(modX::LOG_LEVEL_INFO);
-$modx->setLogTarget('ECHO'); echo '
'; flush();
-
-$modx->loadClass('transport.modPackageBuilder','',false, true);
-$builder = new modPackageBuilder($modx);
-$builder->createPackage(PKG_NAME_LOWER,PKG_VERSION,PKG_RELEASE);
-$builder->registerNamespace(PKG_NAME_LOWER,false,true,'{core_path}components/'.PKG_NAME_LOWER.'/');
-
-/* load action/menu */
-$menu = include $sources['data'].'transport.menu.php';
-$vehicle= $builder->createVehicle($menu,array (
-    xPDOTransport::PRESERVE_KEYS => true,
-    xPDOTransport::UPDATE_OBJECT => true,
-    xPDOTransport::UNIQUE_KEY => 'text',
-    xPDOTransport::RELATED_OBJECTS => true,
-    xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
-        'Action' => array (
-            xPDOTransport::PRESERVE_KEYS => false,
-            xPDOTransport::UPDATE_OBJECT => true,
-            xPDOTransport::UNIQUE_KEY => array ('namespace','controller'),
-        ),
-    ),
-));
-$vehicle->resolve('file',array(
-    'source' => $sources['source_core'],
-    'target' => "return MODX_CORE_PATH . 'components/';",
-));
-$vehicle->resolve('file',array(
-    'source' => $sources['source_assets'],
-    'target' => "return MODX_ASSETS_PATH . 'components/';",
-));
-$builder->putVehicle($vehicle);
-unset($vehicle,$action);
-
-/* now pack in the license file, readme and setup options */
-$builder->setPackageAttributes(array(
-    'license' => file_get_contents($sources['docs'] . 'license.txt'),
-    'readme' => file_get_contents($sources['docs'] . 'readme.txt'),
-//    'setup-options' => array(
-//        'source' => $sources['build'].'setup.options.php',
-//    ),
-));
-$modx->log(modX::LOG_LEVEL_INFO,'Packaged in package attributes.'); flush();
-
-$modx->log(modX::LOG_LEVEL_INFO,'Packing...'); flush();
-$builder->pack();
-
-$mtime= microtime();
-$mtime= explode(" ", $mtime);
-$mtime= $mtime[1] + $mtime[0];
-$tend= $mtime;
-$totalTime= ($tend - $tstart);
-$totalTime= sprintf("%2.4f s", $totalTime);
-
-$modx->log(modX::LOG_LEVEL_INFO,"\n
Package Built.
\nExecution time: {$totalTime}\n"); - -exit (); \ No newline at end of file diff --git a/_build/config.json b/_build/config.json deleted file mode 100644 index e1a8679..0000000 --- a/_build/config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "Batcher", - "lowCaseName": "batcher", - "description": "Batcher is a batch-editing component for MODx Revolution. It allows you to perform basic actions on multiple Resources.", - "author": "Sterc", - "version": "2.0.0", - "package": { - "menus": [{ - "text": "batcher", - "description": "batcher.menu_desc", - "action": "home" - }] - }, - "build": { - "readme": "docs/readme.txt", - "license": "docs/license.txt", - "changelog": "docs/changelog.txt", - "resolver": { - "after": ["setupoptions.resolver.php", "stercextra.resolver.php"] - }, - "setupOptions":{ - "source": "setup.options.php" - } - } -} \ No newline at end of file diff --git a/_build/gpm.yaml b/_build/gpm.yaml new file mode 100644 index 0000000..586b03a --- /dev/null +++ b/_build/gpm.yaml @@ -0,0 +1,15 @@ +name: Batcher +lowCaseName: batcher +description: Batcher is a batch-editing component for MODx Revolution. It allows you to perform basic actions on multiple Resources. +author: Sterc +version: 3.0.0-alpha +menus: + - text: batcher + description: batcher.menu_desc + action: home +build: + readme: core/components/batcher/docs/readme.md + license: core/components/batcher/docs/license.txt + changelog: core/components/batcher/docs/changelog.md + requires: + modx: '>=3.0.0-alpha' \ No newline at end of file diff --git a/_build/resolvers/setupoptions.resolver.php b/_build/resolvers/setupoptions.resolver.php deleted file mode 100644 index d6f5d2c..0000000 --- a/_build/resolvers/setupoptions.resolver.php +++ /dev/null @@ -1,47 +0,0 @@ -xpdo->getObject( - 'modSystemSetting', - array('key' => strtolower($package) . '.' . $key) - ); - - if ($settingObject) { - $settingObject->set('value', $options[$key]); - $settingObject->save(); - } else { - $error = '[' . $package . '] ' . strtolower($package) . '.' . $key . ' setting could not be found,'; - $error .= ' so the setting could not be changed.'; - - $object->xpdo->log( - xPDO::LOG_LEVEL_ERROR, - $error - ); - } - } - } - - $success = true; - break; - case xPDOTransport::ACTION_UNINSTALL: - $success = true; - break; -} - -return $success; diff --git a/_build/resolvers/stercextra.resolver.php b/_build/resolvers/stercextra.resolver.php deleted file mode 100644 index 8356f17..0000000 --- a/_build/resolvers/stercextra.resolver.php +++ /dev/null @@ -1,118 +0,0 @@ -xpdo; -$c = $modx->newQuery('transport.modTransportPackage'); -$c->where( - array( - 'workspace' => 1, - "(SELECT - `signature` - FROM {$modx->getTableName('modTransportPackage')} AS `latestPackage` - WHERE `latestPackage`.`package_name` = `modTransportPackage`.`package_name` - ORDER BY - `latestPackage`.`version_major` DESC, - `latestPackage`.`version_minor` DESC, - `latestPackage`.`version_patch` DESC, - IF(`release` = '' OR `release` = 'ga' OR `release` = 'pl','z',`release`) DESC, - `latestPackage`.`release_index` DESC - LIMIT 1,1) = `modTransportPackage`.`signature`", - ) -); -$c->where( - array( - array( - 'modTransportPackage.package_name' => strtolower($package) - ), - 'installed:IS NOT' => null - ) -); -$c->limit(1); - -/** @var modTransportPackage $oldPackage */ -$oldPackage = $modx->getObject('transport.modTransportPackage', $c); - -$oldVersion = ''; -if ($oldPackage) { - $oldVersion = $oldPackage->get('version_major') . '.' . $oldPackage->get('version_minor'); - $oldVersion .= '.' . $oldPackage->get('version_patch'); - $oldVersion .= '-' . $oldPackage->get('release'); -} - -$version = ''; -if ($options['topic']) { - $topic = trim($options['topic'], '/'); - $topic = explode('/', $topic); - $signature = end($topic); - $version = str_replace(strtolower($package) . '-', '', $signature); -} - -$userNameObj = $modx->getObject( - 'modSystemSetting', - array('key' => strtolower($package) . '.user_name') -); -$userName = ($userNameObj) ? $userNameObj->get('value') : ''; - -$userEmailObj = $modx->getObject( - 'modSystemSetting', - array('key' => strtolower($package) . '.user_email') -); -$userEmail = ($userEmailObj) ? $userEmailObj->get('value') : ''; - -$modxVersionObj = $modx->getObject('modSystemSetting', array('key' => 'settings_version')); -$modxVersion = ($modxVersionObj) ? $modxVersionObj->get('value') : ''; -$managerLang = $modx->getOption('manager_language'); - -$action = ''; -switch ($options[xPDOTransport::PACKAGE_ACTION]) { - case xPDOTransport::ACTION_INSTALL: - $action = 'install'; - break; - case xPDOTransport::ACTION_UPGRADE: - $action = 'upgrade'; - break; - case xPDOTransport::ACTION_UNINSTALL: - $action = 'uninstall'; - - $version = $oldVersion; - $setupOptionsPath = explode('/', $options['setup-options']); - $signature = $setupOptionsPath[0]; - $oldVersion = str_replace(strtolower($package) . '-', '', $signature); - - break; -} - -$params = array( - 'name' => $options['namespace'], - 'url' => $_SERVER['SERVER_NAME'], - 'user_name' => $userName, - 'user_email' => $userEmail, - 'php_version' => phpversion(), - 'modx_version' => $modxVersion, - 'manager_lang' => $managerLang, - 'installation_type' => $action, - 'package_version_from' => $oldVersion, - 'package_version' => $version, - 'date' => time() -); - -/** - * Curl POST. - */ -$curl = curl_init(); -curl_setopt($curl, CURLOPT_URL, $url); -curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: STERC-A64XHC7PNY8G61L79E')); -curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); -curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 120); -curl_setopt($curl, CURLOPT_POST, true); -curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params)); -curl_setopt($curl, CURLOPT_TIMEOUT, 120); - -$response = curl_exec($curl); -$responseInfo = curl_getinfo($curl); -$curlError = curl_error($curl); -curl_close($curl); - -return true; diff --git a/_build/setup.options.php b/_build/setup.options.php deleted file mode 100644 index b7efd50..0000000 --- a/_build/setup.options.php +++ /dev/null @@ -1,51 +0,0 @@ - 'user_name', - 'value' => '', - 'name' => 'Name' - ), - array( - 'key' => 'user_email', - 'value' => '', - 'name' => 'Email address' - ), -); -switch ($options[xPDOTransport::PACKAGE_ACTION]) { - case xPDOTransport::ACTION_INSTALL: - case xPDOTransport::ACTION_UPGRADE: - foreach ($settings as $key => $setting) { - $settingObject = $modx->getObject( - 'modSystemSetting', - array('key' => strtolower($package) . '.' . $setting['key']) - ); - if ($settingObject) { - $settings[$key]['value'] = $settingObject->get('value'); - } - } - break; - case xPDOTransport::ACTION_UNINSTALL: - break; -} - -$output = array(); -foreach ($settings as $setting) { - $str = ''; - $str .= ''; - - $output[] = $str; -} - -$output[] = '

Please enter your name and email address below to receive priority updates about Batcher. -Be the first to know about Batcher updates and new features. This is not required to use Batcher.

'; - -return implode('

', $output); diff --git a/_packages/batcher-2.0.0-pl.transport.zip b/_packages/batcher-2.0.0-pl.transport.zip deleted file mode 100644 index 1912213..0000000 Binary files a/_packages/batcher-2.0.0-pl.transport.zip and /dev/null differ diff --git a/assets/components/batcher/connector.php b/assets/components/batcher/connector.php deleted file mode 100644 index d202bd4..0000000 --- a/assets/components/batcher/connector.php +++ /dev/null @@ -1,22 +0,0 @@ -getOption('batcher.core_path',null,$modx->getOption('core_path').'components/batcher/'); -require_once $batcherCorePath.'model/batcher/batcher.class.php'; -$modx->batcher = new Batcher($modx); - -$modx->lexicon->load('batcher:default'); - -/* handle request */ -$path = $modx->getOption('processorsPath',$modx->batcher->config,$batcherCorePath.'processors/'); -$modx->request->handleRequest(array( - 'processors_path' => $path, - 'location' => '', -)); \ No newline at end of file diff --git a/assets/components/batcher/css/mgr.css b/assets/components/batcher/css/mgr.css index f376ff9..bd6b592 100644 --- a/assets/components/batcher/css/mgr.css +++ b/assets/components/batcher/css/mgr.css @@ -1,19 +1,17 @@ - .batcher-resource-body { padding: 10px 0 10px 20px; } - .batcher-grid .batcher-unpublished, .batcher-grid .batcher-unpublished span, .batcher-grid .batcher-unpublished a { color: gray; } + .x-grid3-body .x-grid3-td-checker { background-image: none !important; } - .batcher-deleted, .batcher-deleted span, .batcher-deleted a, .batcher-grid .batcher-deleted, .batcher-grid .batcher-deleted span, .batcher-grid .batcher-deleted a { color: red !important; @@ -26,9 +24,11 @@ box-shadow: none; color: #3697cd; } + .batcher-btn-link button { font-size: 13px; } + .batcher-btn-link:hover, .batcher-btn-link:focus, .batcher-btn-link:active, @@ -36,6 +36,7 @@ background-color: transparent !important; box-shadow: none !important; } + .batcher-btn-link:hover button, .batcher-btn-link:focus button, .batcher-btn-link:active button, diff --git a/assets/components/batcher/js/sections/template/tvs.defaults.js b/assets/components/batcher/js/sections/template/tvs.defaults.js deleted file mode 100644 index 0fbb9de..0000000 --- a/assets/components/batcher/js/sections/template/tvs.defaults.js +++ /dev/null @@ -1,38 +0,0 @@ -Ext.onReady(function() { - MODx.load({ xtype: 'batcher-page-template-tv-defaults'}); -}); - -Batcher.page.TemplateTVDefaults = function(config) { - config = config || {}; - Ext.applyIf(config,{ - formpanel: 'modx-panel-resource' - ,actions: { - 'new': MODx.request.a - ,edit: MODx.request.a - ,cancel: MODx.request.a - } - ,components: [{ - xtype: 'batcher-panel-template-tvs' - ,renderTo: 'batcher-panel-template-tvs-div' - ,processor: 'changeDefaultTVs' - ,intromsg: 'batcher.template.tvdefaults.intro_msg' - }] - ,buttons: [{ - process: 'mgr/template/changedefaulttvs' - ,text: _('save') - ,method: 'remote' - ,keys: [{ - key: 's' - ,alt: true - ,ctrl: true - }] - },'-',{ - process: 'cancel' - ,text: _('cancel') - ,params: {a:MODx.request.a} - }] - }); - Batcher.page.TemplateTVDefaults.superclass.constructor.call(this,config); -}; -Ext.extend(Batcher.page.TemplateTVDefaults,MODx.Component); -Ext.reg('batcher-page-template-tv-defaults',Batcher.page.TemplateTVDefaults); \ No newline at end of file diff --git a/assets/components/batcher/js/sections/template/tvs.js b/assets/components/batcher/js/sections/template/tvs.js deleted file mode 100644 index 103c7bc..0000000 --- a/assets/components/batcher/js/sections/template/tvs.js +++ /dev/null @@ -1,38 +0,0 @@ -Ext.onReady(function() { - MODx.load({ xtype: 'batcher-page-template-tvs'}); -}); - -Batcher.page.TemplateTVs = function(config) { - config = config || {}; - Ext.applyIf(config,{ - formpanel: 'modx-panel-resource' - ,actions: { - 'new': MODx.request.a - ,edit: MODx.request.a - ,cancel: MODx.request.a - } - ,components: [{ - xtype: 'batcher-panel-template-tvs' - ,renderTo: 'batcher-panel-template-tvs-div' - ,processor: 'changeTVs' - ,intromsg: 'batcher.template.tvs.intro_msg' - }] - ,buttons: [{ - process: 'mgr/template/changetvs' - ,text: _('save') - ,method: 'remote' - ,keys: [{ - key: 's' - ,alt: true - ,ctrl: true - }] - },'-',{ - process: 'cancel' - ,text: _('cancel') - ,params: {a:MODx.request.a} - }] - }); - Batcher.page.TemplateTVs.superclass.constructor.call(this,config); -}; -Ext.extend(Batcher.page.TemplateTVs,MODx.Component); -Ext.reg('batcher-page-template-tvs',Batcher.page.TemplateTVs); \ No newline at end of file diff --git a/assets/components/batcher/js/widgets/element.grid.js b/assets/components/batcher/js/widgets/element.grid.js index e6214b5..6cfbafb 100644 --- a/assets/components/batcher/js/widgets/element.grid.js +++ b/assets/components/batcher/js/widgets/element.grid.js @@ -4,9 +4,9 @@ Batcher.grid.Elements = function(config) { this.sm = new Ext.grid.CheckboxSelectionModel(); Ext.applyIf(config,{ - url: Batcher.config.connector_url + url: MODx.config.connector_url ,baseParams: { - action: 'mgr/element/getList' + action: 'Batcher\\Processors\\Element\\GetList' ,thread: config.thread } ,fields: ['id', 'name', 'description', 'category', 'category_name'] @@ -55,12 +55,12 @@ Batcher.grid.Elements = function(config) { ,id: 'batcher-element-type' ,store: new Ext.data.SimpleStore({ data: [ - ['modTemplate', _('template')], - ['modTemplateVar', _('tv')], - ['modChunk', _('chunk')], - ['modSnippet', _('snippet')], - ['modPlugin', _('plugin')], - ['modCategory', _('category')] + ['MODX\\Revolution\\modTemplate', _('template')], + ['MODX\\Revolution\\modTemplateVar', _('tv')], + ['MODX\\Revolution\\modChunk', _('chunk')], + ['MODX\\Revolution\\modSnippet', _('snippet')], + ['MODX\\Revolution\\modPlugin', _('plugin')], + ['MODX\\Revolution\\modCategory', _('category')] ], id: 0, fields: ["value", "text"] @@ -68,7 +68,7 @@ Batcher.grid.Elements = function(config) { ,valueField: 'value' ,displayField: 'text' ,mode: 'local' - ,value: 'modTemplate' + ,value: 'MODX\\Revolution\\modTemplate' ,emptyText: _('batcher.filter.element_type') ,listeners: { 'select': {fn:this.filterType,scope:this} @@ -118,7 +118,7 @@ Ext.extend(Batcher.grid.Elements,MODx.grid.Grid,{ } ,clearFilter: function() { this.getStore().baseParams = { - action: 'mgr/element/getList' + action: 'Batcher\\Processors\\Element\\GetList' }; Ext.getCmp('batcher-element-type').reset(); Ext.getCmp('batcher-element-search').reset(); @@ -166,28 +166,28 @@ Ext.extend(Batcher.grid.Elements,MODx.grid.Grid,{ return cs; } - ,batchAction: function(act,btn,e) { - var cs = this.getSelectedAsList(); - if (cs === false) return false; + // ,batchAction: function(act,btn,e) { + // var cs = this.getSelectedAsList(); + // if (cs === false) return false; - MODx.Ajax.request({ - url: this.config.url - ,params: { - action: 'mgr/resource/batch' - ,resources: cs - ,batch: act - } - ,listeners: { - 'success': {fn:function(r) { - this.getSelectionModel().clearSelections(true); - this.refresh(); - var t = Ext.getCmp('modx-resource-tree'); - if (t) { t.refresh(); } - },scope:this} - } - }); - return true; - } + // MODx.Ajax.request({ + // url: this.config.url + // ,params: { + // action: 'mgr/resource/batch' + // ,resources: cs + // ,batch: act + // } + // ,listeners: { + // 'success': {fn:function(r) { + // this.getSelectionModel().clearSelections(true); + // this.refresh(); + // var t = Ext.getCmp('modx-resource-tree'); + // if (t) { t.refresh(); } + // },scope:this} + // } + // }); + // return true; + // } ,changeCategory: function(btn,e) { var cs = this.getSelectedAsList(); if (cs === false) return false; @@ -228,9 +228,9 @@ Batcher.window.ChangeCategory = function(config) { config = config || {}; Ext.applyIf(config,{ title: _('batcher.change_category') - ,url: Batcher.config.connector_url + ,url: MODx.config.connector_url ,baseParams: { - action: 'mgr/element/changecategory' + action: 'Batcher\\Processors\\Element\\ChangeCategory' } ,width: 400 ,fields: [{ diff --git a/assets/components/batcher/js/widgets/resource.grid.js b/assets/components/batcher/js/widgets/resource.grid.js index 4fa535e..36b7e84 100644 --- a/assets/components/batcher/js/widgets/resource.grid.js +++ b/assets/components/batcher/js/widgets/resource.grid.js @@ -4,9 +4,9 @@ Batcher.grid.Resources = function(config) { this.sm = new Ext.grid.CheckboxSelectionModel(); Ext.applyIf(config,{ - url: Batcher.config.connector_url + url: MODx.config.connector_url ,baseParams: { - action: 'mgr/resource/getList' + action: 'Batcher\\Processors\\Resource\\GetList' ,thread: config.thread } ,fields: ['id','pagetitle','template','templatename','alias','deleted','published','createdon','editedon','hidemenu','context_key'] @@ -46,12 +46,14 @@ Batcher.grid.Resources = function(config) { ,dataIndex: 'published' ,sortable: true ,editor: { xtype: 'combo-boolean' ,renderer: 'boolean' } + ,editable: false ,width: 60 },{ header: _('batcher.hidemenu') ,dataIndex: 'hidemenu' ,sortable: true ,editor: { xtype: 'combo-boolean' ,renderer: 'boolean' } + ,editable: false ,width: 60 },{ header: _('batcher.editedon') @@ -175,11 +177,11 @@ Ext.extend(Batcher.grid.Resources,MODx.grid.Grid,{ if(cb.getValue() == 1){ field = 'published'; value = 1; - } + } if(cb.getValue() == 2){ field = 'published'; value = '0'; - } + } if(cb.getValue() == 3){ field = 'deleted'; value = 1; @@ -216,7 +218,7 @@ Ext.extend(Batcher.grid.Resources,MODx.grid.Grid,{ } ,clearFilter: function() { this.getStore().baseParams = { - action: 'mgr/resource/getList' + action: 'Batcher\\Processors\\Resource\\GetList' }; Ext.getCmp('batcher_resource_status').reset(); Ext.getCmp('batcher_resource_template').reset(); @@ -274,7 +276,7 @@ Ext.extend(Batcher.grid.Resources,MODx.grid.Grid,{ MODx.Ajax.request({ url: this.config.url ,params: { - action: 'mgr/resource/batch' + action: 'Batcher\\Processors\\Resource\\Batch' ,resources: cs ,batch: act } @@ -296,9 +298,9 @@ Ext.extend(Batcher.grid.Resources,MODx.grid.Grid,{ MODx.msg.confirm({ title: _('batcher.permanentdelete.title') ,text: _('batcher.permanentdelete.message') - ,url: Batcher.config.connector_url + ,url: MODx.config.connector_url ,params: { - action: 'mgr/resource/remove' + action: 'Batcher\\Processors\\Resource\\Remove' ,resources: cs } ,listeners: { @@ -509,12 +511,12 @@ Ext.extend(Batcher.grid.Resources,MODx.grid.Grid,{ ,width: 160 ,emptyText: _('batcher.filter.field') ,fieldLabel: 'Site filters' - ,url: Batcher.config.connector_url + ,url: MODx.config.connector_url ,fields: ['key', 'value'] ,valueField: 'key' ,displayField: 'value' ,baseParams: { - action: 'mgr/filters/getlist' + action: 'Batcher\\Processors\\Filters\\GetList' } ,emptyValue: 0 },{ @@ -603,9 +605,9 @@ Batcher.window.ChangeParent = function(config) { config = config || {}; Ext.applyIf(config,{ title: _('batcher.change_parent') - ,url: Batcher.config.connector_url + ,url: MODx.config.connector_url ,baseParams: { - action: 'mgr/resource/changeparent' + action: 'Batcher\\Processors\\Resource\\ChangeParent' } ,width: 400 ,fields: [{ @@ -627,9 +629,9 @@ Batcher.window.ChangeTemplate = function(config) { config = config || {}; Ext.applyIf(config,{ title: _('batcher.change_template') - ,url: Batcher.config.connector_url + ,url: MODx.config.connector_url ,baseParams: { - action: 'mgr/resource/changetemplate' + action: 'Batcher\\Processors\\Resource\\ChangeTemplate' } ,width: 400 ,fields: [{ @@ -653,9 +655,9 @@ Batcher.window.ChangeAuthors = function(config) { config = config || {}; Ext.applyIf(config,{ title: _('batcher.change_authors') - ,url: Batcher.config.connector_url + ,url: MODx.config.connector_url ,baseParams: { - action: 'mgr/resource/changeauthors' + action: 'Batcher\\Processors\\Resource\\ChangeAuthors' } ,width: 400 ,fields: [{ @@ -690,9 +692,9 @@ Batcher.window.ChangeDates = function(config) { config = config || {}; Ext.applyIf(config,{ title: _('batcher.change_dates') - ,url: Batcher.config.connector_url + ,url: MODx.config.connector_url ,baseParams: { - action: 'mgr/resource/changedates' + action: 'Batcher\\Processors\\Resource\\ChangeDates' } ,width: 500 ,fields: [{ diff --git a/assets/components/batcher/js/widgets/template/template.tvs.panel.js b/assets/components/batcher/js/widgets/template/template.tvs.panel.js deleted file mode 100644 index 94260ca..0000000 --- a/assets/components/batcher/js/widgets/template/template.tvs.panel.js +++ /dev/null @@ -1,86 +0,0 @@ -Batcher.panel.TemplateTVs = function(config) { - config = config || {}; - Ext.apply(config,{ - id: 'modx-panel-resource' - ,url: Batcher.config.connector_url - ,baseParams: { - action: 'mgr/template/'+config.processor - } - ,fileUpload: true - ,border: false - ,baseCls: 'modx-formpanel' - ,cls: 'container form-with-labels' - ,items: [{ - html: '

'+_('template')+': '+Batcher.template.templatename+'

' - ,border: false - ,cls: 'modx-page-header' - ,id: 'batcher-panel-header' - },{ - xtype: 'modx-tabs' - ,bodyStyle: 'padding: 10px' - ,defaults: { border: false ,autoHeight: true } - ,border: true - ,stateful: true - ,stateId: 'batcher-template-tvs-tabpanel' - ,stateEvents: ['tabchange'] - ,getState:function() { - return {activeTab:this.items.indexOf(this.getActiveTab())}; - } - ,items: [{ - title: _('batcher.tvs') - ,defaults: { autoHeight: true } - ,items: [{ - html: '

'+_(config.intromsg)+'

' - ,border: false - ,bodyStyle: 'padding: 10px' - ,height: 10 - ,maxHeight: 10 - ,autoScroll: true - },{ - xtype: 'hidden' - ,name: 'template' - ,value: Batcher.template.id - },{ - html: '' - ,xtype: 'panel' - ,border: false - ,width: '97%' - ,anchor: '100%' - ,bodyStyle: 'padding: 15px;' - ,autoHeight: true - ,autoLoad: { - url: Batcher.config.connectorUrl - ,method: 'GET' - ,params: { - action: 'mgr/loadtvs' - ,class_key: 'modResource' - ,template: Batcher.template.id - ,resource: 0 - ,showCheckbox: 1 - } - ,scripts: true - ,callback: function() { - MODx.fireEvent('ready'); - - } - ,scope: this - } - },{ - html: (Batcher.resources ? '
'+Batcher.resources : '') - ,border: false - ,bodyStyle: 'padding: 15px' - }] - }] - }] - }); - Batcher.panel.TemplateTVs.superclass.constructor.call(this,config); -}; -Ext.extend(Batcher.panel.TemplateTVs,MODx.FormPanel); -Ext.reg('batcher-panel-template-tvs',Batcher.panel.TemplateTVs); - - -MODx.triggerRTEOnChange = function() { -}; -MODx.fireResourceFormChange = function(f,nv,ov) { - Ext.getCmp('modx-panel-resource').fireEvent('fieldChange'); -}; \ No newline at end of file diff --git a/core/components/batcher/bootstrap.php b/core/components/batcher/bootstrap.php new file mode 100644 index 0000000..83a41ce --- /dev/null +++ b/core/components/batcher/bootstrap.php @@ -0,0 +1,14 @@ +addPsr4('Batcher\\', $namespace['path'] . 'src/'); +} +catch (\Exception $e) { + $modx->log(xPDO::LOG_LEVEL_ERROR, $e->getMessage()); +} diff --git a/core/components/batcher/controllers/home.class.php b/core/components/batcher/controllers/home.class.php index d2f617e..270bbb5 100644 --- a/core/components/batcher/controllers/home.class.php +++ b/core/components/batcher/controllers/home.class.php @@ -25,21 +25,56 @@ * @package batcher * @subpackage controllers */ +use MODX\Revolution\modExtraManagerController; +use Batcher\Batcher; -require_once dirname(dirname(__FILE__)) . '/index.class.php'; +class BatcherHomeManagerController extends modExtraManagerController +{ + public $batcher; -class BatcherHomeManagerController extends BatcherBaseManagerController { + public function initialize() + { + $this->batcher = new Batcher($this->modx); - public function process(array $scriptProperties = array()) { - + $this->addCss($this->batcher->config['cssUrl'].'mgr.css'); + $this->addJavascript($this->batcher->config['jsUrl'].'batcher.js'); + $this->addHtml(''); } - public function getPageTitle() { return $this->modx->lexicon('batcher'); } - public function loadCustomCssJs() { + + public function getLanguageTopics() + { + return array('batcher:default'); + } + + public function checkPermissions() + { + return true; + } + + public function process(array $scriptProperties = array()) + { + } + + public function getPageTitle() + { + return $this->modx->lexicon('batcher'); + } + + public function loadCustomCssJs() + { $this->addJavascript($this->modx->getOption('manager_url').'assets/modext/util/datetime.js'); $this->addJavascript($this->batcher->config['jsUrl'].'widgets/element.grid.js'); $this->addJavascript($this->batcher->config['jsUrl'].'widgets/resource.grid.js'); $this->addJavascript($this->batcher->config['jsUrl'].'widgets/home.panel.js'); $this->addLastJavascript($this->batcher->config['jsUrl'].'sections/home.js'); } - public function getTemplateFile() { return $this->batcher->config['templatesPath'].'home.tpl'; } + + public function getTemplateFile() + { + return $this->batcher->config['templatesPath'].'home.tpl'; + } } \ No newline at end of file diff --git a/core/components/batcher/controllers/template/tvdefaults.class.php b/core/components/batcher/controllers/template/tvdefaults.class.php deleted file mode 100644 index 2a362a5..0000000 --- a/core/components/batcher/controllers/template/tvdefaults.class.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * @package batcher - * @subpackage controllers - */ -class BatcherTemplateTvdefaultsManagerController extends BatcherManagerController { - /** @var modTemplate $template */ - public $template; - public function process(array $scriptProperties = array()) { - if (empty($scriptProperties['template'])) return $this->failure($this->modx->lexicon('batcher.template_err_ns')); - $this->template = $this->modx->getObject('modTemplate',$scriptProperties['template']); - if (empty($this->template)) return $this->failure($this->modx->lexicon('batcher.template_err_nf')); - } - public function getPageTitle() { return $this->modx->lexicon('batcher'); } - public function loadCustomCssJs() { - $managerUrl = $this->modx->getOption('manager_url'); - $this->addJavascript($managerUrl.'assets/modext/util/datetime.js'); - $this->addJavascript($managerUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); - $this->addJavascript($this->batcher->config['jsUrl'].'widgets/template/template.tvs.panel.js'); - $this->addLastJavascript($this->batcher->config['jsUrl'].'sections/template/tvs.defaults.js'); - - $tj = $this->template->get(array('id','templatename','description')); - $tj = $this->modx->toJSON($tj); - $this->addHtml(''); - } - public function getTemplateFile() { return $this->batcher->config['templatesPath'].'template/tvdefaults.tpl'; } -} \ No newline at end of file diff --git a/core/components/batcher/controllers/template/tvdefaults.php b/core/components/batcher/controllers/template/tvdefaults.php deleted file mode 100644 index a3a4b40..0000000 --- a/core/components/batcher/controllers/template/tvdefaults.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * Loads the home page. - * - * @package batcher - * @subpackage controllers - */ - -if (empty($_REQUEST['template'])) return $modx->error->failure($modx->lexicon('batcher.template_err_ns')); -$template = $modx->getObject('modTemplate',$_REQUEST['template']); -if (empty($template)) return $modx->error->failure($modx->lexicon('batcher.template_err_nf')); - -$tj = $template->get(array('id','templatename','description')); -$tj = $modx->toJSON($tj); -$modx->regClientStartupHTMLBlock(''); - -$managerUrl = $modx->getOption('manager_url'); -$modx->regClientStartupScript($managerUrl.'assets/modext/util/datetime.js'); -$modx->regClientStartupScript($managerUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); -$modx->regClientStartupScript($batcher->config['jsUrl'].'widgets/template/template.tvs.panel.js'); -$modx->regClientStartupScript($batcher->config['jsUrl'].'sections/template/tvs.defaults.js'); -$output = '
'; - -return $output; diff --git a/core/components/batcher/controllers/template/tvs.class.php b/core/components/batcher/controllers/template/tvs.class.php deleted file mode 100644 index 98750d3..0000000 --- a/core/components/batcher/controllers/template/tvs.class.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * @package batcher - * @subpackage controllers - */ -class BatcherTemplateTvsManagerController extends BatcherManagerController { - /** @var modTemplate $template */ - public $template; - public $resourcesOutput = array(); - - public function process(array $scriptProperties = array()) { - $placeholders = array(); - if (empty($scriptProperties['template'])) return $this->failure($this->modx->lexicon('batcher.template_err_ns')); - $this->template = $this->modx->getObject('modTemplate',$scriptProperties['template']); - if (empty($this->template)) return $this->failure($this->modx->lexicon('batcher.template_err_nf')); - - /* get all resources for template */ - $c = $this->modx->newQuery('modResource'); - $c->where(array( - 'template' => $this->template->get('id'), - )); - $c->sortby('pagetitle','ASC'); - $resources = $this->template->getMany('Resources',$c); - $this->resourcesOutput[] = '

'.$this->modx->lexicon('batcher.resources_affect').'

    '; - $i = 1; - foreach ($resources as $resource) { - if ($i > 50) { - $this->resourcesOutput[] = '
  1. - '.$this->modx->lexicon('batcher.and_others',array('count' => (count($resources) - $i - 1))).'
  2. '; - break; - } - $this->resourcesOutput[] = '
  3. - '.$resource->get('pagetitle').' ('.$resource->get('id').')
  4. '; - $i++; - } - $this->resourcesOutput[] = '
'; - - return $placeholders; - } - public function getPageTitle() { return $this->modx->lexicon('batcher'); } - public function loadCustomCssJs() { - $managerUrl = $this->modx->getOption('manager_url'); - - $tj = $this->template->get(array('id','templatename','description')); - $tj = $this->modx->toJSON($tj); - $this->addHtml(''); - $this->addJavascript($managerUrl.'assets/modext/util/datetime.js'); - $this->addJavascript($managerUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); - $this->addJavascript($this->batcher->config['jsUrl'].'widgets/template/template.tvs.panel.js'); - $this->addLastJavascript($this->batcher->config['jsUrl'].'sections/template/tvs.js'); - } - public function getTemplateFile() { return $this->batcher->config['templatesPath'].'template/tvs.tpl'; } -} \ No newline at end of file diff --git a/core/components/batcher/controllers/template/tvs.php b/core/components/batcher/controllers/template/tvs.php deleted file mode 100644 index a9ca61f..0000000 --- a/core/components/batcher/controllers/template/tvs.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * Loads the home page. - * - * @package batcher - * @subpackage controllers - */ - -if (empty($_REQUEST['template'])) return $modx->error->failure($modx->lexicon('batcher.template_err_ns')); -$template = $modx->getObject('modTemplate',$_REQUEST['template']); -if (empty($template)) return $modx->error->failure($modx->lexicon('batcher.template_err_nf')); - -/* get all resources for template */ -$c = $modx->newQuery('modResource'); -$c->where(array( - 'template' => $template->get('id'), -)); -$c->sortby('pagetitle','ASC'); -$resources = $template->getMany('Resources',$c); -$ro = '

'.$modx->lexicon('batcher.resources_affect').'

    '; -$i = 1; -foreach ($resources as $resource) { - if ($i > 50) { - $ro .= '
  1. - '.$modx->lexicon('batcher.and_others',array('count' => (count($resources) - $i - 1))).'
  2. '; - break; - } - $ro .= '
  3. - '.$resource->get('pagetitle').' ('.$resource->get('id').')
  4. '; - $i++; -} -$ro .= '
'; - -$tj = $template->get(array('id','templatename','description')); -$tj = $modx->toJSON($tj); -$modx->regClientStartupHTMLBlock(''); - -$managerUrl = $modx->getOption('manager_url'); -$modx->regClientStartupScript($managerUrl.'assets/modext/util/datetime.js'); -$modx->regClientStartupScript($managerUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); -$modx->regClientStartupScript($batcher->config['jsUrl'].'widgets/template/template.tvs.panel.js'); -$modx->regClientStartupScript($batcher->config['jsUrl'].'sections/template/tvs.js'); -$output = '
'; - -return $output; diff --git a/core/components/batcher/docs/changelog.txt b/core/components/batcher/docs/changelog.md similarity index 55% rename from core/components/batcher/docs/changelog.txt rename to core/components/batcher/docs/changelog.md index 218ef19..090e22e 100644 --- a/core/components/batcher/docs/changelog.txt +++ b/core/components/batcher/docs/changelog.md @@ -1,8 +1,11 @@ ---------------------- -Changelog for Batcher ---------------------- -Batcher 2.0.0 -================================================================ +# Changelog for Batcher + +## Batcher 3.0.0 + +- Rewrite for MODX 3 + +## Batcher 2.0.0 + - Added advanced filter option to Resources tab - Added empty value to template filter combobox - Added filter by context @@ -10,29 +13,29 @@ Batcher 2.0.0 - Added Dutch translation - Removed functionality to change TV values -Batcher 1.2.0 -================================================================ +## Batcher 1.2.0 + - Fixes for MODX 2.2 -Batcher 1.1.1 -================================================================ +## Batcher 1.1.1 + - Fixes for MODX 2.1 -Batcher 1.1.0 -================================================================ +## Batcher 1.1.0 + - Added fix for bug with Firefox and batch editing - Updated Russian translation - Added batch change TV default values for a Template - Added batch change TV values for all Resources in a Template - Added batch change Template category -Batcher 1.0.1 -================================================================ +## Batcher 1.0.1 + - Fixed bug with changeDates due to Revo RC-3 changes - Added German translation - Added French translation -Batcher 1.0.0 -================================================================ +## Batcher 1.0.0 + - Added Russian translation - Initial commit \ No newline at end of file diff --git a/core/components/batcher/docs/readme.txt b/core/components/batcher/docs/readme.md similarity index 65% rename from core/components/batcher/docs/readme.txt rename to core/components/batcher/docs/readme.md index 4f1fe88..9caf98e 100644 --- a/core/components/batcher/docs/readme.txt +++ b/core/components/batcher/docs/readme.md @@ -1,25 +1,29 @@ --------------------- -Batcher --------------------- -Version: 2.0.0-pl -Author: Sterc -License: GNU GPLv2 --------------------- -=== BATCHER - PERFORM BASIC ACTIONS ON MULTIPLE RESOURCES AT THE SAME TIME === +# Batcher + +- Version: 3.0.0-alpha +- Author: Sterc +- License: GNU GPLv2 + +## Batcher - Perform basic actions on multiple resources at the same time + Batcher is a batch-editing Extra for MODX Revolution. It allows you to perform basic actions on multiple resources or elements. More information can be found here: https://docs.modx.com/extras/revo/batcher -== REQUIREMENTS == -> MODx Revolution 2.0.0-RC-2 or later -> PHP5 or later +## Requirements + +MODx Revolution 3.0.0-alpha or later -== DOWNLOAD == -It can be downloaded from within the MODX Revolution manager via Package Management, or from the MODX Extras Repository, here: https://rtfm.modx.com/extras/revo/batcher +## Download + +It can be downloaded from within the MODX Revolution manager via Package Management, or from the MODX Extras Repository, here: https://modx.com/extras/package/batcher + +## Usage -== USAGE == After installing, simply reload the page, and the 'Batcher' menu option should be available through the top Extras menu. -== HISTORY == +## History + Batcher was written by Shaun McCormick as a simple search Extra, and first released on June 2nd, 2010. It is now developed and maintained by Sterc at https://github.com/Sterc/Batcher -== BUGS AND FEATURE REQUESTS == +## Bugs and Feature Requests + We greatly value your feedback, feature requests and bug reports. Please issue them on GitHub (https://github.com/Sterc/Batcher/issues/new). \ No newline at end of file diff --git a/core/components/batcher/model/batcher/batcher.class.php b/core/components/batcher/model/batcher/batcher.class.php deleted file mode 100644 index f25f4ae..0000000 --- a/core/components/batcher/model/batcher/batcher.class.php +++ /dev/null @@ -1,120 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * @package batcher - */ -class Batcher { - - function __construct(modX &$modx,array $config = array()) { - $this->modx =& $modx; - $corePath = $modx->getOption('batcher.core_path',null,$modx->getOption('core_path').'components/batcher/'); - $assetsUrl = $modx->getOption('batcher.assets_url',null,$modx->getOption('assets_url').'components/batcher/'); - - $this->config = array_merge(array( - 'corePath' => $corePath, - 'chunksPath' => $corePath.'elements/chunks/', - 'modelPath' => $corePath.'model/', - 'processorsPath' => $corePath.'processors/', - 'templatesPath' => $corePath.'templates/', - - 'assetsUrl' => $assetsUrl, - 'connectorUrl' => $assetsUrl.'connector.php', - 'cssUrl' => $assetsUrl.'css/', - 'jsUrl' => $assetsUrl.'js/', - ),$config); - - $this->modx->addPackage('batcher',$this->config['modelPath']); - if ($this->modx->lexicon) { - $this->modx->lexicon->load('batcher:default'); - } - } - - /** - * Initializes Batcher based on a specific context. - * - * @access public - * @param string $ctx The context to initialize in. - * @return string The processed content. - */ - public function initialize($ctx = 'mgr') { - $output = ''; - switch ($ctx) { - case 'mgr': - if (!$this->modx->loadClass('batcher.request.BatcherControllerRequest',$this->config['modelPath'],true,true)) { - return 'Could not load controller request handler.'; - } - $this->request = new BatcherControllerRequest($this); - $output = $this->request->handleRequest(); - break; - } - return $output; - } - - /** - * Gets a Chunk and caches it; also falls back to file-based templates - * for easier debugging. - * - * @access public - * @param string $name The name of the Chunk - * @param array $properties The properties for the Chunk - * @return string The processed content of the Chunk - */ - public function getChunk($name,$properties = array()) { - $chunk = null; - if (!isset($this->chunks[$name])) { - $chunk = $this->_getTplChunk($name); - if (empty($chunk)) { - $chunk = $this->modx->getObject('modChunk',array('name' => $name),true); - if ($chunk == false) return false; - } - $this->chunks[$name] = $chunk->getContent(); - } else { - $o = $this->chunks[$name]; - $chunk = $this->modx->newObject('modChunk'); - $chunk->setContent($o); - } - $chunk->setCacheable(false); - return $chunk->process($properties); - } - - /** - * Returns a modChunk object from a template file. - * - * @access private - * @param string $name The name of the Chunk. Will parse to name.chunk.tpl - * @return modChunk/boolean Returns the modChunk object if found, otherwise - * false. - */ - private function _getTplChunk($name) { - $chunk = false; - $f = $this->config['chunksPath'].strtolower($name).'.chunk.tpl'; - if (file_exists($f)) { - $o = file_get_contents($f); - $chunk = $this->modx->newObject('modChunk'); - $chunk->set('name',$name); - $chunk->setContent($o); - } - return $chunk; - } -} diff --git a/core/components/batcher/model/batcher/metadata.mysql.php b/core/components/batcher/model/batcher/metadata.mysql.php deleted file mode 100644 index b3bd0e9..0000000 --- a/core/components/batcher/model/batcher/metadata.mysql.php +++ /dev/null @@ -1,4 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -require_once MODX_CORE_PATH . 'model/modx/modrequest.class.php'; -/** - * Encapsulates the interaction of MODx manager with an HTTP request. - * - * {@inheritdoc} - * - * @package batcher - * @extends modRequest - */ -class BatcherControllerRequest extends modRequest { - public $batcher = null; - public $actionVar = 'action'; - public $defaultAction = 'home'; - - function __construct(Batcher &$batcher) { - parent :: __construct($batcher->modx); - $this->batcher =& $batcher; - } - - /** - * Extends modRequest::handleRequest and loads the proper error handler and - * actionVar value. - * - * {@inheritdoc} - */ - public function handleRequest() { - $this->loadErrorHandler(); - - /* save page to manager object. allow custom actionVar choice for extending classes. */ - $this->action = isset($_REQUEST[$this->actionVar]) ? $_REQUEST[$this->actionVar] : $this->defaultAction; - - return $this->_respond(); - } - - /** - * Prepares the MODx response to a mgr request that is being handled. - * - * @access public - * @return boolean True if the response is properly prepared. - */ - private function _respond() { - $modx =& $this->modx; - $batcher =& $this->batcher; - $viewHeader = include $this->batcher->config['corePath'].'controllers/header.php'; - - $f = $this->batcher->config['corePath'].'controllers/'.$this->action.'.php'; - if (file_exists($f)) { - $viewOutput = include $f; - } else { - $viewOutput = 'Action not found: '.$f; - } - - return $viewHeader.$viewOutput; - } -} \ No newline at end of file diff --git a/core/components/batcher/model/schema/batcher.mysql.schema.xml b/core/components/batcher/model/schema/batcher.mysql.schema.xml deleted file mode 100644 index 91d946b..0000000 --- a/core/components/batcher/model/schema/batcher.mysql.schema.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/core/components/batcher/processors/mgr/element/changecategory.php b/core/components/batcher/processors/mgr/element/changecategory.php deleted file mode 100644 index 162277c..0000000 --- a/core/components/batcher/processors/mgr/element/changecategory.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * Change template for multiple elements - * - * @package batcher - * @subpackage processors - */ -if (!$modx->hasPermission('save_template')) { - return $modx->error->failure($modx->lexicon('access_denied')); -} - -if (empty($scriptProperties['element_ids'])) { - return $modx->error->failure($modx->lexicon('batcher.templates_err_ns')); -} - -/* Get the element type from request */ -$elementType = 'modTemplate'; -if (!empty($scriptProperties['element_type'])) { - $elementType = $scriptProperties['element_type']; -} -/* get parent */ -if (!empty($scriptProperties['category'])) { - $category = $modx->getObject('modCategory', $scriptProperties['category']); - if (empty($category)) { - return $modx->error->failure( - $modx->lexicon( - 'batcher.category_err_nf', - array('id' => $scriptProperties['category']) - ) - ); - } -} -/* iterate over resources */ -$elementIds = explode(',', $scriptProperties['element_ids']); -foreach ($elementIds as $elementId) { - $element = $modx->getObject($elementType, $elementId); - if ($element == null) { - continue; - } - $element->set('category', $scriptProperties['category']); - $element->save(); -} - -return $modx->error->success(); diff --git a/core/components/batcher/processors/mgr/element/changedefaulttvs.php b/core/components/batcher/processors/mgr/element/changedefaulttvs.php deleted file mode 100644 index 87c3744..0000000 --- a/core/components/batcher/processors/mgr/element/changedefaulttvs.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * Change template for multiple resources - * - * @package batcher - * @subpackage processors - */ -if (!$modx->hasPermission('save_template')) return $modx->error->failure($modx->lexicon('access_denied')); - - -if (empty($scriptProperties['template'])) return $modx->error->failure($modx->lexicon('batcher.template_err_ns')); -$template = $modx->getObject('modTemplate',$scriptProperties['template']); -if (empty($template)) return $modx->error->failure($modx->lexicon('batcher.template_err_nf')); - -if (empty($scriptProperties['tvs'])) return $modx->error->failure($modx->lexicon('batcher.tvs_err_ns')); - -$tvs = array(); -foreach ($scriptProperties as $key => $value) { - if (substr($key,0,2) != 'tv' || $key == 'tvs') continue; - $id = substr($key,2); - if (empty($scriptProperties['tv'.$id.'-checkbox'])) continue; - - $tv = $modx->getObject('modTemplateVar',$id); - if (!$tv) continue; - - switch ($tv->get('type')) { - case 'url': - if ($scriptProperties['tv'.$tv->get('id').'_prefix'] != '--') { - $value = str_replace(array('ftp://','http://'),'', $value); - $value = $scriptProperties['tv'.$tv->get('id').'_prefix'].$value; - } - break; - case 'date': - $value = empty($value) ? '' : strftime('%Y-%m-%d %H:%M:%S',strtotime($value)); - break; - default: - /* handles checkboxes & multiple selects elements */ - if (is_array($value)) { - $featureInsert = array(); - while (list($featureValue, $featureItem) = each($value)) { - $featureInsert[count($featureInsert)] = $featureItem; - } - $value = implode('||',$featureInsert); - } - break; - } - - $tv->set('default_text',$value); - $tv->save(); -} -return $modx->error->success(); \ No newline at end of file diff --git a/core/components/batcher/processors/mgr/element/changetvs.php b/core/components/batcher/processors/mgr/element/changetvs.php deleted file mode 100644 index 475e376..0000000 --- a/core/components/batcher/processors/mgr/element/changetvs.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * This file is part of Batcher, a batch resource editing Extra. - * - * Batcher 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. - * - * Batcher 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 - * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package batcher - */ -/** - * Change template for multiple resources - * - * @package batcher - * @subpackage processors - */ -if (!$modx->hasPermission('save_template')) return $modx->error->failure($modx->lexicon('access_denied')); - - -if (empty($scriptProperties['template'])) return $modx->error->failure($modx->lexicon('batcher.template_err_ns')); -$template = $modx->getObject('modTemplate',$scriptProperties['template']); -if (empty($template)) return $modx->error->failure($modx->lexicon('batcher.template_err_nf')); - -$resources = $template->getMany('Resources'); - -if (empty($scriptProperties['tvs'])) return $modx->error->failure($modx->lexicon('batcher.tvs_err_ns')); - -$tvs = array(); -foreach ($scriptProperties as $key => $value) { - if (substr($key,0,2) != 'tv' || $key == 'tvs') continue; - $id = (int)substr($key,2); - if (empty($scriptProperties['tv'.$id.'-checkbox'])) continue; - $tv = $modx->getObject('modTemplateVar',$id); - if (!$tv) continue; - - switch ($tv->get('type')) { - case 'url': - if ($scriptProperties['tv'.$tv->get('id').'_prefix'] != '--') { - $value = str_replace(array('ftp://','http://'),'', $value); - $value = $scriptProperties['tv'.$tv->get('id').'_prefix'].$value; - } - break; - case 'date': - $value = empty($value) ? '' : strftime('%Y-%m-%d %H:%M:%S',strtotime($value)); - break; - default: - /* handles checkboxes & multiple selects elements */ - if (is_array($value)) { - $featureInsert = array(); - while (list($featureValue, $featureItem) = each($value)) { - $featureInsert[count($featureInsert)] = $featureItem; - } - $value = implode('||',$featureInsert); - } - break; - } - - - /* change resource values */ - foreach ($resources as $resource) { - /* if different than default and set, set TVR record */ - if ($value != $tv->get('default_text')) { - - /* update the existing record */ - $tvc = $modx->getObject('modTemplateVarResource',array( - 'tmplvarid' => $tv->get('id'), - 'contentid' => $resource->get('id'), - )); - if ($tvc == null) { - /* add a new record */ - $tvc = $modx->newObject('modTemplateVarResource'); - $tvc->set('tmplvarid',$tv->get('id')); - $tvc->set('contentid',$resource->get('id')); - } - $tvc->set('value',$value); - $tvc->save(); - - /* if equal to default value, erase TVR record */ - } else { - $tvc = $modx->getObject('modTemplateVarResource',array( - 'tmplvarid' => $tv->get('id'), - 'contentid' => $resource->get('id'), - )); - if ($tvc != null) $tvc->remove(); - } - } - reset($resources); -} -return $modx->error->success(); \ No newline at end of file diff --git a/core/components/batcher/processors/mgr/loadtvs.php b/core/components/batcher/processors/mgr/loadtvs.php deleted file mode 100644 index 934f2c5..0000000 --- a/core/components/batcher/processors/mgr/loadtvs.php +++ /dev/null @@ -1,54 +0,0 @@ -getOption('manager_theme',null,'default'); -$templatePath = $modx->getOption('manager_path') . 'templates/' . $theme . '/'; -if (!file_exists($templatePath)) { /* fallback to default */ - $templatePath = $modx->getOption('manager_path') . 'templates/default/'; -} -$modx->getService('smarty', 'smarty.modSmarty', '', array( - 'template_dir' => $templatePath, -)); -$version = $modx->getVersionData(); -if (version_compare($version['full_version'],'2.2.0-dev','>=')) { - /** @var modSmarty $smarty */ - $smarty = $modx->getService('smarty', 'smarty.modSmarty', '', array( - 'template_dir' => $modx->getOption('manager_path') . 'templates/default/', - )); - $smarty->setTemplatePath($modx->getOption('manager_path') . 'templates/default/'); - - require_once $modx->getOption('core_path',null,MODX_CORE_PATH).'model/modx/modmanagercontroller.class.php'; - require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/default/resource/resource.class.php'; - class BatcherTVLoader extends ResourceManagerController { - public function process(array $scriptProperties = array()) {} - public function getPageTitle() { return ''; } - public function loadCustomCssJs() {} - public function getTemplateFile() { return ''; } - public function checkPermissions() { return true;} - } - $resource = $modx->newObject('modResource'); - $resource->set('template',$_REQUEST['template']); - - $tvLoader = new BatcherTVLoader($modx); - $modx->controller =& $tvLoader; - $tvLoader->resource =& $resource; - $o = $tvLoader->loadTVs(); -} else { - $resource = $modx->newObject('modResource'); - $resource->set('template',$_REQUEST['template']); - - $tvFile = $modx->getOption('manager_path').'controllers/'.$modx->getOption('manager_theme',null,'default').'/resource/tvs.php'; - if (!file_exists($tvFile)) { - $tvFile = $modx->getOption('manager_path').'controllers/default/resource/tvs.php'; - } - - $o = include $tvFile; -} -@session_write_close(); -//echo '
';echo htmlentities($o);
-echo $o;
-die();
\ No newline at end of file
diff --git a/core/components/batcher/processors/mgr/resource/batch.php b/core/components/batcher/processors/mgr/resource/batch.php
deleted file mode 100644
index af5d3d3..0000000
--- a/core/components/batcher/processors/mgr/resource/batch.php
+++ /dev/null
@@ -1,145 +0,0 @@
-
- *
- * This file is part of Batcher, a batch resource editing Extra.
- *
- * Batcher 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.
- *
- * Batcher 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
- * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package batcher
- */
-/**
- * Perform a batch action on multiple resources
- *
- * @package batcher
- * @subpackage processors
- */
-if (!$modx->hasPermission('save_document')) return $modx->error->failure($modx->lexicon('access_denied'));
-
-if (empty($scriptProperties['resources'])) {
-    return $modx->error->failure($modx->lexicon('batcher.resources_err_ns'));
-}
-$batch = $modx->getOption('batch',$scriptProperties,'');
-if (empty($batch)) return $modx->error->failure($modx->lexicon('batcher.action_err_ns'));
-
-$resourceIds = explode(',',$scriptProperties['resources']);
-
-foreach ($resourceIds as $resourceId) {
-    $resource = $modx->getObject('modResource',$resourceId);
-    if ($resource == null) continue;
-
-    switch ($batch) {
-        case 'publish':
-            if ($resource->get('published') == false) {
-                $resource->set('published',true);
-                $resource->set('publishedon',strftime('%Y-%m-%d %H:%M:%S'));
-                $resource->set('publishedby',$modx->user->get('id'));
-            } else {
-                continue;
-            }
-            break;
-        case 'unpublish':
-            if ($resource->get('published') == true) {
-                $resource->set('published',false);
-                $resource->set('publishedon',null);
-                $resource->set('publishedby',0);
-            } else {
-                continue;
-            }
-            break;
-        case 'hidemenu':
-            if ($resource->get('hidemenu') == false) {
-                $resource->set('hidemenu',true);
-            } else {
-                continue;
-            }
-            break;
-        case 'unhidemenu':
-            if ($resource->get('hidemenu') == true) {
-                $resource->set('hidemenu',false);
-            } else {
-                continue;
-            }
-            break;
-        case 'cacheable':
-            if ($resource->get('cacheable') == false) {
-                $resource->set('cacheable',true);
-            } else {
-                continue;
-            }
-            break;
-        case 'uncacheable':
-            if ($resource->get('cacheable') == true) {
-                $resource->set('cacheable',false);
-            } else {
-                continue;
-            }
-            break;
-        case 'searchable':
-            if ($resource->get('searchable') == false) {
-                $resource->set('searchable',true);
-            } else {
-                continue;
-            }
-            break;
-        case 'unsearchable':
-            if ($resource->get('searchable') == true) {
-                $resource->set('searchable',false);
-            } else {
-                continue;
-            }
-            break;
-        case 'richtext':
-            if ($resource->get('richtext') == false) {
-                $resource->set('richtext',true);
-            } else {
-                continue;
-            }
-            break;
-        case 'unrichtext':
-            if ($resource->get('richtext') == true) {
-                $resource->set('richtext',false);
-            } else {
-                continue;
-            }
-            break;
-        case 'delete':
-            if ($resource->get('deleted') == false) {
-                $resource->set('deleted',true);
-                $resource->set('deletedon',strftime('%Y-%m-%d %H:%M:%S'));
-                $resource->set('deletedby',$modx->user->get('id'));
-            } else {
-                continue;
-            }
-            break;
-        case 'undelete':
-            if ($resource->get('deleted') == true) {
-                $resource->set('deleted',false);
-                $resource->set('deletedon',null);
-                $resource->set('deletedby',0);
-            } else {
-                continue;
-            }
-            break;
-    }
-
-
-    if ($resource->save() === false) {
-
-    }
-}
-
-return $modx->error->success();
diff --git a/core/components/batcher/processors/mgr/resource/changeauthors.php b/core/components/batcher/processors/mgr/resource/changeauthors.php
deleted file mode 100644
index 3edc77f..0000000
--- a/core/components/batcher/processors/mgr/resource/changeauthors.php
+++ /dev/null
@@ -1,65 +0,0 @@
-
- *
- * This file is part of Batcher, a batch resource editing Extra.
- *
- * Batcher 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.
- *
- * Batcher 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
- * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package batcher
- */
-/**
- * Change authors for multiple resources
- *
- * @package batcher
- * @subpackage processors
- */
-if (!$modx->hasPermission('save_document')) return $modx->error->failure($modx->lexicon('access_denied'));
-
-if (empty($scriptProperties['resources'])) {
-    return $modx->error->failure($modx->lexicon('batcher.resources_err_ns'));
-}
-
-/* validated createdby */
-if (!empty($scriptProperties['createdby'])) {
-    $createdby = $modx->getObject('modUser',$scriptProperties['createdby']);
-    if (empty($createdby)) return $modx->error->failure($modx->lexicon('batcher.user_err_nf'));
-}
-if (!empty($scriptProperties['editedby'])) {
-    $editedby = $modx->getObject('modUser',$scriptProperties['createdby']);
-    if (empty($editedby)) return $modx->error->failure($modx->lexicon('batcher.user_err_nf'));
-}
-if (!empty($scriptProperties['publishedby'])) {
-    $publishedby= $modx->getObject('modUser',$scriptProperties['publishedby']);
-    if (empty($publishedby)) return $modx->error->failure($modx->lexicon('batcher.user_err_nf'));
-}
-
-/* iterate over resources */
-$resourceIds = explode(',',$scriptProperties['resources']);
-foreach ($resourceIds as $resourceId) {
-    $resource = $modx->getObject('modResource',$resourceId);
-    if ($resource == null) continue;
-
-    if (!empty($scriptProperties['createdby'])) $resource->set('createdby',$scriptProperties['createdby']);
-    if (!empty($scriptProperties['editedby'])) $resource->set('editedby',$scriptProperties['editedby']);
-    if (!empty($scriptProperties['publishedby'])) $resource->set('publishedby',$scriptProperties['publishedby']);
-    
-    if ($resource->save() === false) {
-        
-    }
-}
-
-return $modx->error->success();
diff --git a/core/components/batcher/processors/mgr/resource/changedates.php b/core/components/batcher/processors/mgr/resource/changedates.php
deleted file mode 100644
index d5a381f..0000000
--- a/core/components/batcher/processors/mgr/resource/changedates.php
+++ /dev/null
@@ -1,52 +0,0 @@
-
- *
- * This file is part of Batcher, a batch resource editing Extra.
- *
- * Batcher 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.
- *
- * Batcher 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
- * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package batcher
- */
-/**
- * Change dates for multiple resources
- *
- * @package batcher
- * @subpackage processors
- */
-if (!$modx->hasPermission('save_document')) return $modx->error->failure($modx->lexicon('access_denied'));
-
-if (empty($scriptProperties['resources'])) {
-    return $modx->error->failure($modx->lexicon('batcher.resources_err_ns'));
-}
-
-/* iterate over resources */
-$resourceIds = explode(',',$scriptProperties['resources']);
-foreach ($resourceIds as $resourceId) {
-    $resource = $modx->getObject('modResource',$resourceId);
-    if ($resource == null) continue;
-
-    if (!empty($scriptProperties['createdon'])) $resource->set('createdon',$scriptProperties['createdon']);
-    if (!empty($scriptProperties['editedon'])) $resource->set('editedon',$scriptProperties['editedon']);
-    if (!empty($scriptProperties['pub_date'])) $resource->set('pub_date',$scriptProperties['pub_date']);
-    if (!empty($scriptProperties['unpub_date'])) $resource->set('unpub_date',$scriptProperties['unpub_date']);
-
-    if ($resource->save() === false) {
-        
-    }
-}
-
-return $modx->error->success();
diff --git a/core/components/batcher/processors/mgr/resource/changeparent.php b/core/components/batcher/processors/mgr/resource/changeparent.php
deleted file mode 100644
index 662a71f..0000000
--- a/core/components/batcher/processors/mgr/resource/changeparent.php
+++ /dev/null
@@ -1,55 +0,0 @@
-
- *
- * This file is part of Batcher, a batch resource editing Extra.
- *
- * Batcher 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.
- *
- * Batcher 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
- * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package batcher
- */
-/**
- * Change parent for multiple resources
- *
- * @package batcher
- * @subpackage processors
- */
-if (!$modx->hasPermission('save_document')) return $modx->error->failure($modx->lexicon('access_denied'));
-
-if (empty($scriptProperties['resources'])) {
-    return $modx->error->failure($modx->lexicon('batcher.resources_err_ns'));
-}
-/* get parent */
-if (empty($scriptProperties['parent'])) {
-    return $modx->error->failure($modx->lexicon('batcher.parent_err_ns'));
-}
-$parentResource = $modx->getObject('modResource',$scriptProperties['parent']);
-if (empty($parentResource)) return $modx->error->failure($modx->lexicon('batcher.parent_err_nf'));
-
-/* iterate over resources */
-$resourceIds = explode(',',$scriptProperties['resources']);
-foreach ($resourceIds as $resourceId) {
-    $resource = $modx->getObject('modResource',$resourceId);
-    if ($resource == null) continue;
-
-    $resource->set('parent',$scriptProperties['parent']);
-
-    if ($resource->save() === false) {
-        
-    }
-}
-
-return $modx->error->success();
diff --git a/core/components/batcher/processors/mgr/resource/changetemplate.php b/core/components/batcher/processors/mgr/resource/changetemplate.php
deleted file mode 100644
index 1defdd4..0000000
--- a/core/components/batcher/processors/mgr/resource/changetemplate.php
+++ /dev/null
@@ -1,55 +0,0 @@
-
- *
- * This file is part of Batcher, a batch resource editing Extra.
- *
- * Batcher 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.
- *
- * Batcher 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
- * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package batcher
- */
-/**
- * Change template for multiple resources
- *
- * @package batcher
- * @subpackage processors
- */
-if (!$modx->hasPermission('save_document')) return $modx->error->failure($modx->lexicon('access_denied'));
-
-if (empty($scriptProperties['resources'])) {
-    return $modx->error->failure($modx->lexicon('batcher.resources_err_ns'));
-}
-/* get parent */
-if (empty($scriptProperties['template'])) {
-    return $modx->error->failure($modx->lexicon('batcher.template_err_ns'));
-}
-$template = $modx->getObject('modTemplate',$scriptProperties['template']);
-if (empty($template)) return $modx->error->failure($modx->lexicon('batcher.template_err_nf'));
-
-/* iterate over resources */
-$resourceIds = explode(',',$scriptProperties['resources']);
-foreach ($resourceIds as $resourceId) {
-    $resource = $modx->getObject('modResource',$resourceId);
-    if ($resource == null) continue;
-
-    $resource->set('template',$scriptProperties['template']);
-
-    if ($resource->save() === false) {
-        
-    }
-}
-
-return $modx->error->success();
diff --git a/core/components/batcher/processors/mgr/resource/remove.php b/core/components/batcher/src/Batcher.php
similarity index 52%
rename from core/components/batcher/processors/mgr/resource/remove.php
rename to core/components/batcher/src/Batcher.php
index 142e102..dca465e 100644
--- a/core/components/batcher/processors/mgr/resource/remove.php
+++ b/core/components/batcher/src/Batcher.php
@@ -21,21 +21,28 @@
  *
  * @package batcher
  */
-/**
- * Change dates for multiple resources
- *
- * @package batcher
- * @subpackage processors
- */
-if (!$modx->hasPermission('save_document')) return $modx->error->failure($modx->lexicon('access_denied'));
+namespace Batcher;
 
-if (empty($scriptProperties['resources'])) {
-    return $modx->error->failure($modx->lexicon('batcher.resources_err_ns'));
-}
+use MODX\Revolution\modX;
 
-$resourceIds = explode(',',$scriptProperties['resources']);
-if(is_array($resourceIds)){
-	$modx->removeCollection('modResource', array("id:IN" => array($scriptProperties['resources']) ));
-}
+class Batcher
+{
+    function __construct(modX &$modx, array $config = array())
+    {
+    	$this->modx =& $modx;
+        $corePath = $modx->getOption('batcher.core_path', null, $modx->getOption('core_path').'components/batcher/');
+        $assetsUrl = $modx->getOption('batcher.assets_url', null, $modx->getOption('assets_url').'components/batcher/');
 
-return $modx->error->success();
+        $this->config = array_merge(array(
+            'corePath' => $corePath,
+            'templatesPath' => $corePath.'templates/',
+            'assetsUrl' => $assetsUrl,
+            'cssUrl' => $assetsUrl.'css/',
+            'jsUrl' => $assetsUrl.'js/'
+        ), $config);
+
+        if ($this->modx->lexicon) {
+            $this->modx->lexicon->load('batcher:default');
+        }
+    }
+}
diff --git a/core/components/batcher/src/Processors/Element/ChangeCategory.php b/core/components/batcher/src/Processors/Element/ChangeCategory.php
new file mode 100644
index 0000000..2821ff8
--- /dev/null
+++ b/core/components/batcher/src/Processors/Element/ChangeCategory.php
@@ -0,0 +1,88 @@
+
+ *
+ * This file is part of Batcher, a batch resource editing Extra.
+ *
+ * Batcher 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.
+ *
+ * Batcher 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
+ * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package batcher
+ */
+/**
+ * Change template for multiple elements
+ *
+ * @package batcher
+ * @subpackage processors
+ */
+namespace Batcher\Processors\Element;
+
+use MODX\Revolution\Processors\Processor;
+use MODX\Revolution\modTemplate;
+use MODX\Revolution\modCategory;
+
+class ChangeCategory extends Processor
+{
+    public function process()
+    {
+        if (!$this->modx->hasPermission('save_template')) {
+            return $this->failure($this->modx->lexicon('access_denied'));
+        }
+
+        if (empty($this->properties['element_ids'])) {
+            return $this->failure($this->modx->lexicon('batcher.templates_err_ns'));
+        }
+
+        /* Get the element type from request */
+        $elementType = modTemplate::class;
+        if (!empty($this->properties['element_type'])) {
+            $elementType = $this->properties['element_type'];
+        }
+
+        if ($elementType === modCategory::class) {
+            return $this->failure();
+        }
+
+        /* get parent */
+        if (!empty($this->properties['category'])) {
+            $category = $this->modx->getObject(modCategory::class, $this->properties['category']);
+            if (empty($category)) {
+                return $this->failure(
+                    $this->modx->lexicon(
+                        'batcher.category_err_nf',
+                        array('id' => $this->properties['category'])
+                    )
+                );
+            }
+        }
+        /* iterate over resources */
+        $elementIds = explode(',', $this->properties['element_ids']);
+        foreach ($elementIds as $elementId) {
+            $element = $this->modx->getObject($elementType, $elementId);
+            if ($element == null) {
+                continue;
+            }
+            $element->set('category', $this->properties['category']);
+            $element->save();
+        }
+
+        return $this->success();
+    }
+
+    public function getLanguageTopics()
+    {
+        return ['batcher:default'];
+    }
+}
\ No newline at end of file
diff --git a/core/components/batcher/processors/mgr/element/getlist.class.php b/core/components/batcher/src/Processors/Element/GetList.php
similarity index 57%
rename from core/components/batcher/processors/mgr/element/getlist.class.php
rename to core/components/batcher/src/Processors/Element/GetList.php
index 94af7d4..99f1261 100644
--- a/core/components/batcher/processors/mgr/element/getlist.class.php
+++ b/core/components/batcher/src/Processors/Element/GetList.php
@@ -27,27 +27,47 @@
  * @package batcher
  * @subpackage processors
  */
-class BatcherTemplateGetListProcessor extends modObjectGetListProcessor {
-    public $classKey = 'modTemplate';
+namespace Batcher\Processors\Element;
+
+use MODX\Revolution\Processors\Model\GetListProcessor;
+use MODX\Revolution\modTemplate;
+use MODX\Revolution\modCategory;
+use xPDO\Om\xPDOQuery;
+use xPDO\Om\xPDOObject;
+
+class GetList extends GetListProcessor
+{
+    public $classKey = modTemplate::class;
     public $defaultSortField = 'id';
     public $defaultSortDirection = 'ASC';
     public $checkListPermission = true;
 
-    public function prepareQueryBeforeCount(xPDOQuery $c) {
-
+    public function prepareQueryBeforeCount(xPDOQuery $c)
+    {
         $search = $this->getProperty('search');
-        $type = $this->getProperty('element-type');
         if (!empty($search)) {
-            $c->where(array(
-                'name:LIKE' => '%'.$search.'%',
-                'OR:description:LIKE' => '%'.$search.'%',
-            ));
+            if ($this->classKey === modCategory::class) {
+                $c->where(array(
+                    'category:LIKE' => '%'.$search.'%'
+                ));
+            } else {
+                $nameField = 'name';
+                if ($this->classKey === modTemplate::class) {
+                    $nameField = 'templatename';
+                }
+
+                $c->where(array(
+                    $nameField.':LIKE' => '%'.$search.'%',
+                    'OR:description:LIKE' => '%'.$search.'%'
+                ));
+            }
         }
 
         return $c;
     }
 
-    public function getData() {
+    public function getData()
+    {
         $data = array();
         $limit = intval($this->getProperty('limit'));
         $start = intval($this->getProperty('start'));
@@ -59,13 +79,28 @@ public function getData() {
 
         $c = $this->modx->newQuery($this->classKey);
         $c = $this->prepareQueryBeforeCount($c);
-        $data['total'] = $this->modx->getCount($this->classKey,$c);
+        $data['total'] = $this->modx->getCount($this->classKey, $c);
         $c = $this->prepareQueryAfterCount($c);
 
         $sortClassKey = $this->getSortClassKey();
-        $sortKey = $this->modx->getSelectColumns($sortClassKey,$this->getProperty('sortAlias',$sortClassKey),'',array($this->getProperty('sort')));
+        $sortAlias = $this->modx->getAlias($sortClassKey);
+
+        $sort = $this->getProperty('sort');
+        if ($sort === 'category_name') {
+            $sort = 'category';
+        }
+        if ($sort === 'name') {
+            if ($sortClassKey === modTemplate::class) {
+                $sort = 'templatename';
+            }
+            if ($sortClassKey === modCategory::class) {
+                $sort = 'category';
+            }
+        }
+        $sortKey = $this->modx->getSelectColumns($sortClassKey, $this->getProperty('sortAlias', $sortAlias), '', [$sort]);
         if (empty($sortKey)) $sortKey = $this->getProperty('sort');
-        $c->sortby($sortKey,$this->getProperty('dir'));
+        $c->sortby($sortKey, $this->getProperty('dir'));
+
         if ($limit > 0) {
             $c->limit($limit,$start);
         }
@@ -78,21 +113,20 @@ public function prepareRow(xPDOObject $object)
     {
         $objectArray = $object->toArray();
         $objectArray['category_name'] = '-';
-        if ($this->classKey === 'modCategory') {
+        if ($this->classKey === modCategory::class) {
             $objectArray['name'] = $objectArray['category'];
             unset($objectArray['category']);
         } else {
             if ($objectArray['category']) {
-                $category = $this->modx->getObject('modCategory', $objectArray['category']);
+                $category = $this->modx->getObject(modCategory::class, $objectArray['category']);
                 if ($category) {
                     $objectArray['category_name'] = $category->get('category');
                 }
             }
         }
-        if ($this->classKey === 'modTemplate') {
+        if ($this->classKey === modTemplate::class) {
             $objectArray['name'] = $objectArray['templatename'];
         }
         return $objectArray;
     }
-}
-return 'BatcherTemplateGetListProcessor';
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/core/components/batcher/processors/mgr/filters/getlist.class.php b/core/components/batcher/src/Processors/Filters/GetList.php
similarity index 52%
rename from core/components/batcher/processors/mgr/filters/getlist.class.php
rename to core/components/batcher/src/Processors/Filters/GetList.php
index 0e70167..1026904 100644
--- a/core/components/batcher/processors/mgr/filters/getlist.class.php
+++ b/core/components/batcher/src/Processors/Filters/GetList.php
@@ -1,23 +1,29 @@
 modx->newObject('modResource');
+		$object = $this->modx->newObject(modResource::class);
         $object = $object->toArray();
 
         /*
          * Exclude fields from filter based on system setting.
          */
         $excludeFilters = $this->modx->getOption('batcher.excludefilters');
-        if($excludeFilters){
-        	$excludeArray = explode(',', $excludeFilters);	
+        $excludeArray = [];
+        if ($excludeFilters) {
+        	$excludeArray = explode(',', $excludeFilters);
         }
 
-
         foreach($object as $key => $val){
-        	if($excludeArray && in_array($key, $excludeArray)){
+        	if ($excludeArray && in_array($key, $excludeArray)){
         		continue;
         	}
 
@@ -28,14 +34,12 @@ public function getFilters(){
         }
 
 		return $filters;
-	}	
-
+	}
 
-    public function process() {
+    public function process()
+    {
         $filters = $this->getFilters();
-       
+
         return $this->outputArray($filters);
     }
-
-}
-return 'BatcherFilterGetListProcessor';
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/core/components/batcher/src/Processors/Resource/Batch.php b/core/components/batcher/src/Processors/Resource/Batch.php
new file mode 100644
index 0000000..3c5758b
--- /dev/null
+++ b/core/components/batcher/src/Processors/Resource/Batch.php
@@ -0,0 +1,164 @@
+
+ *
+ * This file is part of Batcher, a batch resource editing Extra.
+ *
+ * Batcher 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.
+ *
+ * Batcher 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
+ * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package batcher
+ */
+/**
+ * Perform a batch action on multiple resources
+ *
+ * @package batcher
+ * @subpackage processors
+ */
+namespace Batcher\Processors\Resource;
+
+use MODX\Revolution\Processors\Processor;
+use MODX\Revolution\modResource;
+
+class Batch extends Processor
+{
+    public function process()
+    {
+        if (!$this->modx->hasPermission('save_document')) {
+            return $this->failure($this->modx->lexicon('access_denied'));
+        }
+
+        if (empty($this->properties['resources'])) {
+            return $this->failure($this->modx->lexicon('batcher.resources_err_ns'));
+        }
+        $batch = $this->modx->getOption('batch', $this->properties, '');
+        if (empty($batch)) {
+            return $this->failure($this->modx->lexicon('batcher.action_err_ns'));
+        }
+
+        $resourceIds = explode(',', $this->properties['resources']);
+
+        foreach ($resourceIds as $resourceId) {
+            $resource = $this->modx->getObject(modResource::class, $resourceId);
+            if ($resource == null) continue;
+
+            switch ($batch) {
+                case 'publish':
+                    if ($resource->get('published') == false) {
+                        $resource->set('published', true);
+                        $resource->set('publishedon', strftime('%Y-%m-%d %H:%M:%S'));
+                        $resource->set('publishedby', $this->modx->user->get('id'));
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'unpublish':
+                    if ($resource->get('published') == true) {
+                        $resource->set('published', false);
+                        $resource->set('publishedon', 0);
+                        $resource->set('publishedby', 0);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'hidemenu':
+                    if ($resource->get('hidemenu') == false) {
+                        $resource->set('hidemenu', true);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'unhidemenu':
+                    if ($resource->get('hidemenu') == true) {
+                        $resource->set('hidemenu', false);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'cacheable':
+                    if ($resource->get('cacheable') == false) {
+                        $resource->set('cacheable', true);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'uncacheable':
+                    if ($resource->get('cacheable') == true) {
+                        $resource->set('cacheable', false);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'searchable':
+                    if ($resource->get('searchable') == false) {
+                        $resource->set('searchable', true);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'unsearchable':
+                    if ($resource->get('searchable') == true) {
+                        $resource->set('searchable', false);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'richtext':
+                    if ($resource->get('richtext') == false) {
+                        $resource->set('richtext', true);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'unrichtext':
+                    if ($resource->get('richtext') == true) {
+                        $resource->set('richtext', false);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'delete':
+                    if ($resource->get('deleted') == false) {
+                        $resource->set('deleted', true);
+                        $resource->set('deletedon', strftime('%Y-%m-%d %H:%M:%S'));
+                        $resource->set('deletedby', $this->modx->user->get('id'));
+                    } else {
+                        continue 2;
+                    }
+                    break;
+                case 'undelete':
+                    if ($resource->get('deleted') == true) {
+                        $resource->set('deleted', false);
+                        $resource->set('deletedon', 0);
+                        $resource->set('deletedby', 0);
+                    } else {
+                        continue 2;
+                    }
+                    break;
+            }
+
+            if ($resource->save() === false) {
+
+            }
+        }
+
+        return $this->success();
+    }
+
+    public function getLanguageTopics()
+    {
+        return ['batcher:default'];
+    }
+}
\ No newline at end of file
diff --git a/core/components/batcher/src/Processors/Resource/ChangeAuthors.php b/core/components/batcher/src/Processors/Resource/ChangeAuthors.php
new file mode 100644
index 0000000..6a25142
--- /dev/null
+++ b/core/components/batcher/src/Processors/Resource/ChangeAuthors.php
@@ -0,0 +1,84 @@
+
+ *
+ * This file is part of Batcher, a batch resource editing Extra.
+ *
+ * Batcher 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.
+ *
+ * Batcher 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
+ * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package batcher
+ */
+/**
+ * Change authors for multiple resources
+ *
+ * @package batcher
+ * @subpackage processors
+ */
+namespace Batcher\Processors\Resource;
+
+use MODX\Revolution\Processors\Processor;
+use MODX\Revolution\modResource;
+use MODX\Revolution\modUser;
+
+class ChangeAuthors extends Processor
+{
+    public function process()
+    {
+        if (!$this->modx->hasPermission('save_document')) {
+            return $this->failure($this->modx->lexicon('access_denied'));
+        }
+
+        if (empty($this->properties['resources'])) {
+            return $this->failure($this->modx->lexicon('batcher.resources_err_ns'));
+        }
+
+        /* validated createdby */
+        if (!empty($this->properties['createdby'])) {
+            $createdby = $this->modx->getObject(modUser::class, $this->properties['createdby']);
+            if (empty($createdby)) return $this->failure($this->modx->lexicon('batcher.user_err_nf'));
+        }
+        if (!empty($this->properties['editedby'])) {
+            $editedby = $this->modx->getObject(modUser::class, $this->properties['editedby']);
+            if (empty($editedby)) return $this->failure($this->modx->lexicon('batcher.user_err_nf'));
+        }
+        if (!empty($this->properties['publishedby'])) {
+            $publishedby = $this->modx->getObject(modUser::class, $this->properties['publishedby']);
+            if (empty($publishedby)) return $this->failure($this->modx->lexicon('batcher.user_err_nf'));
+        }
+
+        /* iterate over resources */
+        $resourceIds = explode(',', $this->properties['resources']);
+        foreach ($resourceIds as $resourceId) {
+            $resource = $this->modx->getObject(modResource::class, $resourceId);
+            if ($resource == null) continue;
+
+            if (!empty($this->properties['createdby'])) $resource->set('createdby', $this->properties['createdby']);
+            if (!empty($this->properties['editedby'])) $resource->set('editedby', $this->properties['editedby']);
+            if (!empty($this->properties['publishedby'])) $resource->set('publishedby', $this->properties['publishedby']);
+
+            if ($resource->save() === false) {
+
+            }
+        }
+
+        return $this->success();
+    }
+
+    public function getLanguageTopics()
+    {
+        return ['batcher:default'];
+    }
+}
\ No newline at end of file
diff --git a/core/components/batcher/src/Processors/Resource/ChangeDates.php b/core/components/batcher/src/Processors/Resource/ChangeDates.php
new file mode 100644
index 0000000..1e64437
--- /dev/null
+++ b/core/components/batcher/src/Processors/Resource/ChangeDates.php
@@ -0,0 +1,70 @@
+
+ *
+ * This file is part of Batcher, a batch resource editing Extra.
+ *
+ * Batcher 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.
+ *
+ * Batcher 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
+ * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package batcher
+ */
+/**
+ * Change dates for multiple resources
+ *
+ * @package batcher
+ * @subpackage processors
+ */
+namespace Batcher\Processors\Resource;
+
+use MODX\Revolution\Processors\Processor;
+use MODX\Revolution\modResource;
+
+class ChangeDates extends Processor
+{
+    public function process()
+    {
+        if (!$this->modx->hasPermission('save_document')) {
+            return $this->failure($this->modx->lexicon('access_denied'));
+        }
+
+        if (empty($this->properties['resources'])) {
+            return $this->failure($this->modx->lexicon('batcher.resources_err_ns'));
+        }
+
+        /* iterate over resources */
+        $resourceIds = explode(',', $this->properties['resources']);
+        foreach ($resourceIds as $resourceId) {
+            $resource = $this->modx->getObject(modResource::class, $resourceId);
+            if ($resource == null) continue;
+
+            if (!empty($this->properties['createdon'])) $resource->set('createdon',$this->properties['createdon']);
+            if (!empty($this->properties['editedon'])) $resource->set('editedon',$this->properties['editedon']);
+            if (!empty($this->properties['pub_date'])) $resource->set('pub_date',$this->properties['pub_date']);
+            if (!empty($this->properties['unpub_date'])) $resource->set('unpub_date',$this->properties['unpub_date']);
+
+            if ($resource->save() === false) {
+
+            }
+        }
+
+        return $this->success();
+    }
+
+    public function getLanguageTopics()
+    {
+        return ['batcher:default'];
+    }
+}
\ No newline at end of file
diff --git a/core/components/batcher/src/Processors/Resource/ChangeParent.php b/core/components/batcher/src/Processors/Resource/ChangeParent.php
new file mode 100644
index 0000000..c8cd27c
--- /dev/null
+++ b/core/components/batcher/src/Processors/Resource/ChangeParent.php
@@ -0,0 +1,75 @@
+
+ *
+ * This file is part of Batcher, a batch resource editing Extra.
+ *
+ * Batcher 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.
+ *
+ * Batcher 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
+ * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package batcher
+ */
+/**
+ * Change parent for multiple resources
+ *
+ * @package batcher
+ * @subpackage processors
+ */
+namespace Batcher\Processors\Resource;
+
+use MODX\Revolution\Processors\Processor;
+use MODX\Revolution\modResource;
+
+class ChangeParent extends Processor
+{
+    public function process()
+    {
+        if (!$this->modx->hasPermission('save_document')) {
+            return $this->failure($this->modx->lexicon('access_denied'));
+        }
+
+        if (empty($this->properties['resources'])) {
+            return $this->failure($this->modx->lexicon('batcher.resources_err_ns'));
+        }
+        /* get parent */
+        if (empty($this->properties['parent'])) {
+            return $this->failure($this->modx->lexicon('batcher.parent_err_ns'));
+        }
+        $parentResource = $this->modx->getObject(modResource::class, $this->properties['parent']);
+        if (empty($parentResource)) {
+            return $this->failure($this->modx->lexicon('batcher.parent_err_nf'));
+        }
+
+        /* iterate over resources */
+        $resourceIds = explode(',', $this->properties['resources']);
+        foreach ($resourceIds as $resourceId) {
+            $resource = $this->modx->getObject(modResource::class, $resourceId);
+            if ($resource == null) continue;
+
+            $resource->set('parent', $this->properties['parent']);
+
+            if ($resource->save() === false) {
+
+            }
+        }
+
+        return $this->success();
+    }
+
+    public function getLanguageTopics()
+    {
+        return ['batcher:default'];
+    }
+}
\ No newline at end of file
diff --git a/core/components/batcher/src/Processors/Resource/ChangeTemplate.php b/core/components/batcher/src/Processors/Resource/ChangeTemplate.php
new file mode 100644
index 0000000..32cfb29
--- /dev/null
+++ b/core/components/batcher/src/Processors/Resource/ChangeTemplate.php
@@ -0,0 +1,76 @@
+
+ *
+ * This file is part of Batcher, a batch resource editing Extra.
+ *
+ * Batcher 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.
+ *
+ * Batcher 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
+ * Batcher; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package batcher
+ */
+/**
+ * Change template for multiple resources
+ *
+ * @package batcher
+ * @subpackage processors
+ */
+namespace Batcher\Processors\Resource;
+
+use MODX\Revolution\Processors\Processor;
+use MODX\Revolution\modResource;
+use MODX\Revolution\modTemplate;
+
+class ChangeTemplate extends Processor
+{
+    public function process()
+    {
+        if (!$this->modx->hasPermission('save_document')) {
+            return $this->failure($this->modx->lexicon('access_denied'));
+        }
+
+        if (empty($this->properties['resources'])) {
+            return $this->failure($this->modx->lexicon('batcher.resources_err_ns'));
+        }
+        /* get parent */
+        if (empty($this->properties['template'])) {
+            return $this->failure($this->modx->lexicon('batcher.template_err_ns'));
+        }
+        $template = $this->modx->getObject(modTemplate::class, $this->properties['template']);
+        if (empty($template)) {
+            return $this->failure($this->modx->lexicon('batcher.template_err_nf'));
+        }
+
+        /* iterate over resources */
+        $resourceIds = explode(',', $this->properties['resources']);
+        foreach ($resourceIds as $resourceId) {
+            $resource = $this->modx->getObject(modResource::class, $resourceId);
+            if ($resource == null) continue;
+
+            $resource->set('template', $this->properties['template']);
+
+            if ($resource->save() === false) {
+
+            }
+        }
+
+        return $this->success();
+    }
+
+    public function getLanguageTopics()
+    {
+        return ['batcher:default'];
+    }
+}
\ No newline at end of file
diff --git a/core/components/batcher/processors/mgr/resource/getlist.class.php b/core/components/batcher/src/Processors/Resource/GetList.php
similarity index 92%
rename from core/components/batcher/processors/mgr/resource/getlist.class.php
rename to core/components/batcher/src/Processors/Resource/GetList.php
index c224cb5..5fa9970 100644
--- a/core/components/batcher/processors/mgr/resource/getlist.class.php
+++ b/core/components/batcher/src/Processors/Resource/GetList.php
@@ -27,10 +27,17 @@
  * @package batcher
  * @subpackage processors
  */
+namespace Batcher\Processors\Resource;
 
-class BatcherResourceGetListProcessor extends modObjectGetListProcessor
+use MODX\Revolution\Processors\Model\GetListProcessor;
+use MODX\Revolution\modResource;
+use MODX\Revolution\modTemplate;
+use xPDO\Om\xPDOQuery;
+use xPDO\Om\xPDOObject;
+
+class GetList extends GetListProcessor
 {
-    public $classKey = 'modResource';
+    public $classKey = modResource::class;
     public $objectType = 'resource';
     public $defaultSortField = 'pagetitle';
     public $defaultSortDirection = 'ASC';
@@ -47,7 +54,7 @@ public function prepareQueryBeforeCount(xPDOQuery $c)
         $filterType  = $this->getProperty('filter_type');
         $filterValue = $this->getProperty('filter_value');
 
-        $c->leftJoin('modTemplate', 'Template');
+        $c->leftJoin(modTemplate::class, 'Template');
 
         if ($filterField) {
             switch ($filterType) {
@@ -133,6 +140,4 @@ public function prepareRow(xPDOObject $object)
 
         return $objectArray;
     }
-}
-
-return 'BatcherResourceGetListProcessor';
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/core/components/batcher/index.class.php b/core/components/batcher/src/Processors/Resource/Remove.php
similarity index 53%
rename from core/components/batcher/index.class.php
rename to core/components/batcher/src/Processors/Resource/Remove.php
index ab6e875..9ccc135 100644
--- a/core/components/batcher/index.class.php
+++ b/core/components/batcher/src/Processors/Resource/Remove.php
@@ -22,34 +22,38 @@
  * @package batcher
  */
 /**
+ * Delete multiple resources
+ *
  * @package batcher
- * @subpackage controllers
+ * @subpackage processors
  */
-require_once __DIR__ . '/model/batcher/batcher.class.php';
+namespace Batcher\Processors\Resource;
+
+use MODX\Revolution\Processors\Processor;
+use MODX\Revolution\modResource;
 
-abstract class BatcherBaseManagerController extends modExtraManagerController
+class Remove extends Processor
 {
-    /** @var Batcher $batcher */
-    public $batcher;
-    public function initialize()
+    public function process()
     {
-        $this->batcher = new Batcher($this->modx);
+        if (!$this->modx->hasPermission('save_document')) {
+            return $this->failure($this->modx->lexicon('access_denied'));
+        }
+
+        if (empty($this->properties['resources'])) {
+            return $this->failure($this->modx->lexicon('batcher.resources_err_ns'));
+        }
+
+        $resourceIds = explode(',', $this->properties['resources']);
+        if(is_array($resourceIds)){
+            $this->modx->removeCollection(modResource::class, array("id:IN" => array($this->properties['resources']) ));
+        }
 
-        $this->addCss($this->batcher->config['cssUrl'].'mgr.css');
-        $this->addJavascript($this->batcher->config['jsUrl'].'batcher.js');
-        $this->addHtml('');
+        return $this->success();
     }
+
     public function getLanguageTopics()
     {
-        return array('batcher:default');
-    }
-    public function checkPermissions()
-    {
-        return true;
+        return ['batcher:default'];
     }
-}
+}
\ No newline at end of file
diff --git a/core/components/batcher/templates/template/tvdefaults.tpl b/core/components/batcher/templates/template/tvdefaults.tpl
deleted file mode 100644
index 56ec820..0000000
--- a/core/components/batcher/templates/template/tvdefaults.tpl
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file diff --git a/core/components/batcher/templates/template/tvs.tpl b/core/components/batcher/templates/template/tvs.tpl deleted file mode 100644 index 56ec820..0000000 --- a/core/components/batcher/templates/template/tvs.tpl +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file