├── .gitignore
├── _bootstrap
└── index.php
├── _build
├── build.schema.php
├── build.transport.php
├── createtables.php
├── data
│ ├── settings.php
│ ├── transport.dashboardwidgets.php
│ ├── transport.menus.php
│ ├── transport.plugins.php
│ ├── transport.settings.php
│ └── transport.snippets.php
├── events
│ └── events.versionx.php
├── resolvers
│ ├── cleanup.resolver.php
│ ├── composer.resolver.php
│ ├── setupoptions.resolver.php
│ └── tables.resolver.php
├── schema
│ └── versionx.mysql.schema.xml
├── setup.options.php
└── validators
│ └── requirements.script.php
├── _packages
├── versionx-2.4.0-pl.transport.zip
├── versionx-3.0.0-beta1.transport.zip
├── versionx-3.0.0-beta2.transport.zip
├── versionx-3.1.1-pl.transport.zip
└── versionx-3.1.2-pl.transport.zip
├── assets
└── components
│ └── versionx
│ ├── connector.php
│ ├── css
│ └── mgr
│ │ └── mgr.css
│ └── js
│ └── mgr
│ ├── grid.deltas.js
│ ├── grid.objects.js
│ ├── index.js
│ ├── versionx.class.js
│ ├── widgets
│ └── resources.widget.js
│ ├── window.deltas.js
│ └── window.milestone.js
├── config.core.sample.php
├── core
└── components
│ └── versionx
│ ├── composer.json
│ ├── composer.lock
│ ├── composer.phar
│ ├── controllers
│ └── index.class.php
│ ├── cron.php
│ ├── docs
│ ├── changelog.txt
│ ├── license.txt
│ ├── readme.txt
│ └── version.inc.php
│ ├── elements
│ ├── plugins
│ │ └── versionx.plugin.php
│ └── widgets
│ │ └── resources.dashboardwidget.php
│ ├── lexicon
│ ├── cs
│ │ └── default.inc.php
│ ├── da
│ │ └── default.inc.php
│ ├── de
│ │ └── default.inc.php
│ ├── en
│ │ └── default.inc.php
│ ├── fr
│ │ └── default.inc.php
│ ├── nl
│ │ └── default.inc.php
│ ├── ru
│ │ └── default.inc.php
│ └── sv
│ │ └── default.inc.php
│ ├── migrate.php
│ ├── model
│ ├── versionx.class.php
│ └── versionx
│ │ ├── metadata.mysql.php
│ │ ├── mysql
│ │ ├── vxchunk.class.php
│ │ ├── vxchunk.map.inc.php
│ │ ├── vxdelta.class.php
│ │ ├── vxdelta.map.inc.php
│ │ ├── vxdeltaeditor.class.php
│ │ ├── vxdeltaeditor.map.inc.php
│ │ ├── vxdeltafield.class.php
│ │ ├── vxdeltafield.map.inc.php
│ │ ├── vxplugin.class.php
│ │ ├── vxplugin.map.inc.php
│ │ ├── vxresource.class.php
│ │ ├── vxresource.map.inc.php
│ │ ├── vxsnippet.class.php
│ │ ├── vxsnippet.map.inc.php
│ │ ├── vxtemplate.class.php
│ │ ├── vxtemplate.map.inc.php
│ │ ├── vxtemplatevar.class.php
│ │ └── vxtemplatevar.map.inc.php
│ │ ├── vxchunk.class.php
│ │ ├── vxdelta.class.php
│ │ ├── vxdeltaeditor.class.php
│ │ ├── vxdeltafield.class.php
│ │ ├── vxplugin.class.php
│ │ ├── vxresource.class.php
│ │ ├── vxsnippet.class.php
│ │ ├── vxtemplate.class.php
│ │ └── vxtemplatevar.class.php
│ ├── processors
│ └── mgr
│ │ ├── deltas
│ │ ├── getlist.class.php
│ │ ├── milestone.class.php
│ │ ├── optimize.class.php
│ │ ├── preview.class.php
│ │ └── revert.class.php
│ │ ├── filters
│ │ ├── classes.class.php
│ │ ├── editors.class.php
│ │ └── packages.class.php
│ │ └── objects
│ │ └── getlist.class.php
│ ├── src
│ ├── DeltaManager.php
│ ├── DeltaMerger.php
│ ├── Enums
│ │ └── RevertAction.php
│ ├── Fields
│ │ ├── Field.php
│ │ ├── Image.php
│ │ ├── Properties.php
│ │ └── Text.php
│ ├── Types
│ │ ├── Chunk.php
│ │ ├── Plugin.php
│ │ ├── Resource.php
│ │ ├── ResourcePreview.php
│ │ ├── Snippet.php
│ │ ├── TV.php
│ │ ├── Template.php
│ │ └── Type.php
│ ├── Utils.php
│ └── VersionX.php
│ └── templates
│ └── mgr
│ ├── diff.tpl
│ ├── fields
│ └── image.tpl
│ ├── tab.tpl
│ └── versionx.tpl
└── readme.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | config.core.php
3 | _packages/*/
4 | core/components/versionx/vendor
5 | assets/components/versionx/node_modules
6 |
--------------------------------------------------------------------------------
/_build/build.schema.php:
--------------------------------------------------------------------------------
1 |
6 | *
7 | * This file is part of VersionX, a real estate property listings component
8 | * for MODX Revolution.
9 | *
10 | * VersionX is free software; you can redistribute it and/or modify it under
11 | * the terms of the GNU General Public License as published by the Free Software
12 | * Foundation; either version 2 of the License, or (at your option) any later
13 | * version.
14 | *
15 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY
16 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU General Public License along with
20 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 | * Suite 330, Boston, MA 02111-1307 USA
22 | *
23 | */
24 | $mtime = microtime();
25 | $mtime = explode(" ", $mtime);
26 | $mtime = $mtime[1] + $mtime[0];
27 | $tstart = $mtime;
28 | set_time_limit(0);
29 |
30 | require_once dirname(dirname(__FILE__)) . '/config.core.php';
31 | include_once MODX_CORE_PATH . 'model/modx/modx.class.php';
32 | $modx= new modX();
33 | $modx->initialize('mgr');
34 | $modx->loadClass('transport.modPackageBuilder','',false, true);
35 | $modx->setLogLevel(modX::LOG_LEVEL_INFO);
36 | $modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
37 |
38 | $root = dirname(dirname(__FILE__)).'/';
39 | $sources = array(
40 | 'root' => $root,
41 | 'core' => $root.'core/components/versionx/',
42 | 'model' => $root.'core/components/versionx/model/',
43 | 'assets' => $root.'assets/components/versionx/',
44 | 'schema' => $root.'_build/schema/',
45 | );
46 | $manager= $modx->getManager();
47 | $generator= $manager->getGenerator();
48 | $generator->classTemplate= << Resource and element versioning for MODX Migrating from version 2.x VersionX 3 is a complete rewrite from version 2 and a command line migration script is included to migrate your data to the new version. After installing, from the command line, run: VersionX
33 |
37 | php core/components/versionx/migrate.php
If you already have resources and elements in place, you can let the setup process create a snapshot of them to the VersionX tables, providing you with a baseline to start comparing from. The system will check for existing versions and only create a snapshot when needed.
41 |Note: depending on the amount of resources and elements you currently have in place as well as your server's configuration, this process can take quite some time.
43 |Choose what to create snapshots for:
45 |If you found VersionX useful, please consider making a donation to support its development. Thank you!
61 | 62 | HTML; 63 | break; 64 | default: 65 | case xPDOTransport::ACTION_UNINSTALL: 66 | $output = ''; 67 | break; 68 | } 69 | 70 | return $output; 71 | -------------------------------------------------------------------------------- /_build/validators/requirements.script.php: -------------------------------------------------------------------------------- 1 | xpdo; 4 | 5 | if (!function_exists('checkVersion')) { 6 | /** 7 | * @param string $description 8 | * @param string $current 9 | * @param array $definition 10 | * @param modX $modx 11 | * @return bool 12 | */ 13 | function checkVersion($description, $current, array $definition, $modx) 14 | { 15 | $pass = true; 16 | $passGlyph = '✔'; 17 | $failGlyph = '×'; 18 | $warnGlyph = '⚠'; 19 | 20 | // Determine the minimum version (the one that we require today) and the recommended version (the version we'll 21 | // start requiring in 9 months from now). 22 | $realMinimum = false; 23 | $recommended = false; 24 | $recommendedDate = false; 25 | foreach ($definition as $date => $minVersion) { 26 | $date = strtotime($date); 27 | if ($date <= time()) { 28 | $realMinimum = $minVersion; 29 | } 30 | if ($date <= time() + (60 * 60 * 24 * 270)) { 31 | $recommended = $minVersion; 32 | $recommendedDate = $date; 33 | } 34 | } 35 | 36 | if ($realMinimum) { 37 | $level = xPDO::LOG_LEVEL_INFO; 38 | $glyph = $passGlyph; 39 | $checkMinimumVersion = $realMinimum; 40 | if (substr_count($realMinimum, '.') < 2) { 41 | $checkMinimumVersion .= '.0-dev'; 42 | } 43 | if (version_compare($current, $checkMinimumVersion) <= 0) { 44 | $level = xPDO::LOG_LEVEL_ERROR; 45 | $pass = false; 46 | $glyph = $failGlyph; 47 | } 48 | $modx->log($level, "- {$description} {$realMinimum}+ (minimum): {$glyph} {$current}"); 49 | } 50 | if ($pass && $recommended && $recommended !== $realMinimum) { 51 | $level = xPDO::LOG_LEVEL_INFO; 52 | $glyph = $passGlyph; 53 | $checkRecommendedVersion = $recommended; 54 | if (substr_count($realMinimum, '.') < 2) { 55 | $checkRecommendedVersion .= '.0-dev'; 56 | } 57 | if (version_compare($current, $checkRecommendedVersion) <= 0) { 58 | $level = xPDO::LOG_LEVEL_WARN; 59 | $glyph = $warnGlyph; 60 | } 61 | $recommendedDateFormatted = date('Y-m-d', $recommendedDate); 62 | $modx->log($level, "- {$description} {$recommended}+ (minimum per {$recommendedDateFormatted}): {$glyph} {$current}"); 63 | } 64 | 65 | return $pass; 66 | } 67 | } 68 | $success = false; 69 | switch($options[xPDOTransport::PACKAGE_ACTION]) { 70 | case xPDOTransport::ACTION_INSTALL: 71 | case xPDOTransport::ACTION_UPGRADE: 72 | $success = true; 73 | $modx->log(xPDO::LOG_LEVEL_INFO, 'Checking if the minimum requirements are met...'); 74 | 75 | $modxVersion = $modx->getVersionData(); 76 | if (!checkVersion('MODX', $modxVersion['full_version'], [ 77 | '2019-11-27 12:00:00' => '2.7', 78 | ], $modx)) { 79 | $success = false; 80 | } 81 | 82 | if (!checkVersion('PHP', PHP_VERSION, [ 83 | '2022-12-06 12:00:00' => '7.4', 84 | ], $modx)) { 85 | $success = false; 86 | } 87 | 88 | if ($success) { 89 | $modx->log(xPDO::LOG_LEVEL_INFO, 'Minimum requirements look good!'); 90 | 91 | // Check for EOL PHP versions 92 | $modx->log(xPDO::LOG_LEVEL_INFO, 'Checking (optional) recommended versions...'); 93 | checkVersion('PHP', PHP_VERSION, [ 94 | '2022-12-06 12:00:00' => '8.0', 95 | '2023-12-06 12:00:00' => '8.1', 96 | '2024-12-06 12:00:00' => '8.2', 97 | ], $modx); 98 | } 99 | else { 100 | $modx->log(xPDO::LOG_LEVEL_ERROR, 'Your server or MODX installation does not meet the minimum requirements for this extra. Installation cannot continue.'); 101 | } 102 | 103 | break; 104 | case xPDOTransport::ACTION_UNINSTALL: 105 | $success = true; 106 | break; 107 | } 108 | return $success; -------------------------------------------------------------------------------- /_packages/versionx-2.4.0-pl.transport.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmore/VersionX/dbba7be991a8c61b66a1052f3ecd5ded05eafb5c/_packages/versionx-2.4.0-pl.transport.zip -------------------------------------------------------------------------------- /_packages/versionx-3.0.0-beta1.transport.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmore/VersionX/dbba7be991a8c61b66a1052f3ecd5ded05eafb5c/_packages/versionx-3.0.0-beta1.transport.zip -------------------------------------------------------------------------------- /_packages/versionx-3.0.0-beta2.transport.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmore/VersionX/dbba7be991a8c61b66a1052f3ecd5ded05eafb5c/_packages/versionx-3.0.0-beta2.transport.zip -------------------------------------------------------------------------------- /_packages/versionx-3.1.1-pl.transport.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmore/VersionX/dbba7be991a8c61b66a1052f3ecd5ded05eafb5c/_packages/versionx-3.1.1-pl.transport.zip -------------------------------------------------------------------------------- /_packages/versionx-3.1.2-pl.transport.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmore/VersionX/dbba7be991a8c61b66a1052f3ecd5ded05eafb5c/_packages/versionx-3.1.2-pl.transport.zip -------------------------------------------------------------------------------- /assets/components/versionx/connector.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * VersionX is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package versionx 21 | */ 22 | 23 | require_once dirname(dirname(dirname(__DIR__))).'/config.core.php'; 24 | require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php'; 25 | require_once MODX_CONNECTORS_PATH.'index.php'; 26 | 27 | $corePath = $modx->getOption('versionx.core_path',null,$modx->getOption('core_path').'components/versionx/'); 28 | require_once $corePath.'model/versionx.class.php'; 29 | $modx->versionx = new VersionX($modx); 30 | 31 | $modx->lexicon->load('versionx:default'); 32 | 33 | /* handle request */ 34 | $path = $modx->getOption('processorsPath',$modx->versionx->config,$corePath.'processors/'); 35 | $modx->request->handleRequest(array( 36 | 'processors_path' => $path, 37 | 'location' => '', 38 | )); -------------------------------------------------------------------------------- /assets/components/versionx/js/mgr/grid.objects.js: -------------------------------------------------------------------------------- 1 | VersionX.grid.Objects = function(config) { 2 | config = config || {}; 3 | Ext.applyIf(config,{ 4 | url: VersionX.config.connector_url, 5 | id: 'versionx-grid-objects', 6 | cls: 'versionx-grid-objects', 7 | bodyCssClass: 'versionx-grid-objects-body', 8 | baseParams: { 9 | action: 'mgr/objects/getlist', 10 | }, 11 | fields: [ 12 | {name: 'id', type: 'int'}, 13 | {name: 'principal_package', type: 'string'}, 14 | {name: 'principal_class', type: 'string'}, 15 | {name: 'principal', type: 'int'}, 16 | {name: 'type', type: 'string'}, 17 | {name: 'time_start', type: 'string'}, 18 | {name: 'time_end', type: 'string'}, 19 | {name: 'user_id', type: 'int'}, 20 | {name: 'username', type: 'string'}, 21 | {name: 'name', type: 'string'}, 22 | ], 23 | paging: true, 24 | pageSize: 20, 25 | remoteSort: true, 26 | actionsColumnWidth: 5, 27 | filters: ['query', 'date_from', 'date_to', 'class', 'editor', 'package'], 28 | columns: this.getColumns(), 29 | tbar: [{ 30 | xtype: 'versionx-field-search', 31 | emptyText: _('versionx.filters.search_by_name'), 32 | grid: this, 33 | },'->',{ 34 | xtype: 'versionx-combo-classes', 35 | showClearFilter: true, 36 | width: 110, 37 | listeners: { 38 | select: { 39 | fn: this.filter, 40 | scope: this 41 | }, 42 | }, 43 | },{ 44 | xtype: 'versionx-combo-editors', 45 | showClearFilter: true, 46 | width: 110, 47 | listeners: { 48 | select: { 49 | fn: this.filter, 50 | scope: this 51 | }, 52 | }, 53 | },{ 54 | xtype: 'versionx-combo-packages', 55 | showClearFilter: true, 56 | width: 110, 57 | listeners: { 58 | select: { 59 | fn: this.filter, 60 | scope: this 61 | }, 62 | }, 63 | },{ 64 | xtype: 'datefield', 65 | name: 'date_from', 66 | emptyText: _('versionx.filters.date_from'), 67 | format: 'Y-m-d', 68 | width: 120, 69 | listeners: { 70 | select: { 71 | fn: this.filter, 72 | scope: this 73 | }, 74 | }, 75 | },{ 76 | xtype: 'datefield', 77 | name: 'date_to', 78 | emptyText: _('versionx.filters.date_to'), 79 | format: 'Y-m-d', 80 | width: 120, 81 | listeners: { 82 | select: { 83 | fn: this.filter, 84 | scope: this 85 | }, 86 | }, 87 | },{ 88 | text: '', 89 | handler: this.clearFilters, 90 | }] 91 | }); 92 | VersionX.grid.Objects.superclass.constructor.call(this,config); 93 | this.config = config; 94 | this.getView().getRowClass = function(record, index, rowParams, store) { 95 | return 'versionx-row'; 96 | }; 97 | }; 98 | Ext.extend(VersionX.grid.Objects, MODx.grid.Grid, { 99 | getColumns: function() { 100 | return [{ 101 | header: _('versionx.objects.delta'), 102 | dataIndex: 'id', 103 | hidden: true 104 | },{ 105 | header: _('versionx.objects.when'), 106 | dataIndex: 'time_end', 107 | width: 15, 108 | sortable: true, 109 | renderer: this.renderWhen 110 | },{ 111 | header: _('versionx.objects.name'), 112 | dataIndex: 'name', 113 | width: 20, 114 | sortable: true, 115 | renderer: this.renderName 116 | },{ 117 | header: _('versionx.objects.class'), 118 | dataIndex: 'principal_class', 119 | width: 20, 120 | sortable: true, 121 | },{ 122 | header: _('versionx.objects.id'), 123 | dataIndex: 'principal', 124 | width: 10, 125 | sortable: true, 126 | },{ 127 | header: _('versionx.objects.package'), 128 | dataIndex: 'principal_package', 129 | width: 10, 130 | sortable: true, 131 | },{ 132 | header: _('versionx.objects.editor'), 133 | dataIndex: 'username', 134 | width: 20, 135 | sortable: true, 136 | }]; 137 | }, 138 | filter: function (tf, nv, ov) { 139 | var value = tf.getValue(); 140 | if (tf.xtype === 'datefield' && typeof value === 'object') { 141 | value = Ext.util.Format.date(value, 'Y-m-d'); 142 | } 143 | this.getStore().baseParams[tf.name] = value; 144 | this.getBottomToolbar().changePage(1); 145 | }, 146 | clearFilters: function() { 147 | var grid = this, 148 | s = this.getStore(); 149 | this.config.filters.forEach(function(filter) { 150 | grid.getTopToolbar().find('name', filter)[0].reset(); 151 | s.baseParams[filter] = ''; 152 | }); 153 | this.getBottomToolbar().changePage(1); 154 | }, 155 | getMenu: function() { 156 | var m = []; 157 | m.push({ 158 | text: _('versionx.objects.view_details'), 159 | handler: this.viewDetails 160 | }); 161 | return m; 162 | }, 163 | viewDetails: function(v, e) { 164 | if (this.viewDetailsWindow) { 165 | this.viewDetailsWindow.destroy(); 166 | } 167 | 168 | this.viewDetailsWindow = MODx.load({ 169 | xtype: 'versionx-window-deltas', 170 | record: this.menu.record, 171 | listeners: { 172 | 'success': {fn: this.refresh, scope: this} 173 | } 174 | }); 175 | this.viewDetailsWindow.show(e.target); 176 | }, 177 | renderWhen: function(v, m, r) { 178 | let bits = v.split(' '); 179 | return `${_('versionx.description')}
20 | `, 21 | cls: 'modx-page-header', 22 | },{ 23 | xtype: 'versionx-grid-objects', 24 | cls: 'main-wrapper', 25 | }] 26 | }); 27 | VersionX.panel.Home.superclass.constructor.call(this, config); 28 | }; 29 | Ext.extend(VersionX.panel.Home, MODx.Panel); 30 | Ext.reg('versionx-panel-home', VersionX.panel.Home); 31 | 32 | VersionX.page.Home = function(config) { 33 | config = config || {}; 34 | Ext.applyIf(config,{ 35 | border: false, 36 | id : 'versionx-page-wrapper', 37 | components: [{ 38 | cls: 'container', 39 | xtype: 'versionx-panel-home' 40 | }], 41 | buttons: this.getButtons(config) 42 | }); 43 | VersionX.page.Home.superclass.constructor.call(this,config); 44 | }; 45 | Ext.extend(VersionX.page.Home, MODx.Component,{ 46 | getButtons: function() { 47 | var buttons = [{ 48 | text: ` ${_('versionx.optimize_storage')}`, 49 | handler: this.optimizeStorage, 50 | cls: 'primary-button', 51 | scope: this, 52 | },{ 53 | text: _('help_ex'), 54 | handler: this.loadHelpPane, 55 | scope: this, 56 | id: 'modx-abtn-help' 57 | }]; 58 | 59 | if (!VersionX.config.has_donated) { 60 | buttons.push([{ 61 | text: _('versionx.donate'), 62 | handler: this.donate, 63 | scope: this 64 | }]); 65 | } 66 | 67 | return buttons; 68 | }, 69 | 70 | loadHelpPane: function() { 71 | MODx.config.help_url = 'https://docs.modx.com/3.x/en/extras/versionx/index#usage-features?embed=1'; 72 | MODx.loadHelpPane(); 73 | }, 74 | 75 | donate: function() { 76 | window.open('https://modmore.com/extras/versionx/donate/'); 77 | }, 78 | 79 | optimizeStorage: function(btn, e) { 80 | MODx.msg.confirm({ 81 | title: ` ${_('versionx.optimize_storage')}`, 82 | text: `${_('versionx.optimize_storage.confirm_text')}
84 | ${_('versionx.optimize_storage.confirm_text2')} 85 |
`, 86 | url: VersionX.config.connector_url, 87 | params: { 88 | action: 'mgr/deltas/optimize', 89 | }, 90 | listeners: { 91 | 'success': {fn: function(r) { 92 | MODx.msg.status({ 93 | title: _('success') 94 | ,message: r.message || _('versionx.optimize_storage.successful') 95 | }); 96 | }, scope:this} 97 | }, 98 | }); 99 | } 100 | }); 101 | Ext.reg('versionx-page-home', VersionX.page.Home); -------------------------------------------------------------------------------- /assets/components/versionx/js/mgr/versionx.class.js: -------------------------------------------------------------------------------- 1 | var VersionX = function (config) { 2 | config = config || {}; 3 | VersionX.superclass.constructor.call(this, config); 4 | }; 5 | Ext.extend(VersionX, Ext.Component, { 6 | page: {}, 7 | window: {}, 8 | grid: {}, 9 | tree: {}, 10 | panel: {}, 11 | combo: {}, 12 | field: {}, 13 | config: {}, 14 | stats: {}, 15 | inVersion: false, 16 | }); 17 | Ext.reg('versionx', VersionX); 18 | VersionX = new VersionX(); 19 | 20 | VersionX.panel.VersionHeader = function (config) { 21 | config = config || {}; 22 | config.title = config.title || 'New Section'; 23 | Ext.apply(config, { 24 | border: false, 25 | forceLayout: true, 26 | items: [{ 27 | html: 'Are you sure you want to revert all fields to this point in time? [[+time]]
"; 24 | $_lang['versionx.deltas.milestone'] = 'milestone'; 25 | $_lang['versionx.deltas.milestone_remove'] = 'Remove milestone status from delta'; 26 | $_lang['versionx.deltas.milestone_make'] = 'Make this delta a milestone'; 27 | $_lang['versionx.deltas.preview'] = 'Preview'; 28 | $_lang['versionx.deltas.revert_these_changes'] = 'Revert these changes'; 29 | 30 | // Grid filters 31 | $_lang['versionx.filters.clear_filter'] = '( Clear filter )'; 32 | $_lang['versionx.filters.class'] = 'Class...'; 33 | $_lang['versionx.filters.date_from'] = 'Date from...'; 34 | $_lang['versionx.filters.date_to'] = 'Date to...'; 35 | $_lang['versionx.filters.editor'] = 'Editor...'; 36 | $_lang['versionx.filters.package'] = 'Package...'; 37 | $_lang['versionx.filters.search'] = 'Search...'; 38 | $_lang['versionx.filters.search_by_field'] = 'Search by field...'; 39 | $_lang['versionx.filters.search_by_name'] = 'Search by name...'; 40 | 41 | // Versioned objects grid 42 | $_lang['versionx.objects.class'] = 'Class'; 43 | $_lang['versionx.objects.delta'] = 'Delta'; 44 | $_lang['versionx.objects.editor'] = 'Editor'; 45 | $_lang['versionx.objects.id'] = 'ID'; 46 | $_lang['versionx.objects.name'] = 'Name'; 47 | $_lang['versionx.objects.package'] = 'Package'; 48 | $_lang['versionx.objects.when'] = 'When'; 49 | $_lang['versionx.objects.view_details'] = 'View Details'; 50 | $_lang['versionx.objects.viewing_object_details'] = '[[+name]] • [[+class]] (id: [[+id]]) • [[+time_end]]'; 51 | 52 | // Optimize storage 53 | $_lang['versionx.optimize_storage'] = 'Optimize Storage'; 54 | $_lang['versionx.optimize_storage.confirm_text'] = 'Optimizing storage will merge older deltas, and typically runs each night, potentially reducing the size of the database.'; 55 | $_lang['versionx.optimize_storage.confirm_text2'] = 'Are you sure you want to run it manually now?'; 56 | $_lang['versionx.optimize_storage.successful'] = 'Optimization successful'; 57 | 58 | // Dashboard widgets 59 | $_lang['versionx.widget.resources'] = 'Recent Resource Changes'; 60 | $_lang['versionx.widget.resources.desc'] = '[VersionX] Shows a grid with the most recent resource changes for all users.'; 61 | $_lang['versionx.widget.resources.update'] = 'Update Resource'; -------------------------------------------------------------------------------- /core/components/versionx/lexicon/da/default.inc.php: -------------------------------------------------------------------------------- 1 |Are you sure you want to revert all fields to this point in time? [[+time]]
"; 24 | $_lang['versionx.deltas.milestone'] = 'milestone'; 25 | $_lang['versionx.deltas.milestone_remove'] = 'Remove milestone status from delta'; 26 | $_lang['versionx.deltas.milestone_make'] = 'Make this delta a milestone'; 27 | $_lang['versionx.deltas.preview'] = 'Preview'; 28 | $_lang['versionx.deltas.revert_these_changes'] = 'Revert these changes'; 29 | 30 | // Grid filters 31 | $_lang['versionx.filters.clear_filter'] = '( Clear filter )'; 32 | $_lang['versionx.filters.class'] = 'Class...'; 33 | $_lang['versionx.filters.date_from'] = 'Date from...'; 34 | $_lang['versionx.filters.date_to'] = 'Date to...'; 35 | $_lang['versionx.filters.editor'] = 'Editor...'; 36 | $_lang['versionx.filters.package'] = 'Package...'; 37 | $_lang['versionx.filters.search'] = 'Search...'; 38 | $_lang['versionx.filters.search_by_field'] = 'Search by field...'; 39 | $_lang['versionx.filters.search_by_name'] = 'Search by name...'; 40 | 41 | // Versioned objects grid 42 | $_lang['versionx.objects.class'] = 'Class'; 43 | $_lang['versionx.objects.delta'] = 'Delta'; 44 | $_lang['versionx.objects.editor'] = 'Editor'; 45 | $_lang['versionx.objects.id'] = 'ID'; 46 | $_lang['versionx.objects.name'] = 'Name'; 47 | $_lang['versionx.objects.package'] = 'Package'; 48 | $_lang['versionx.objects.when'] = 'When'; 49 | $_lang['versionx.objects.view_details'] = 'View Details'; 50 | $_lang['versionx.objects.viewing_object_details'] = '[[+name]] • [[+class]] (id: [[+id]]) • [[+time_end]]'; 51 | 52 | // Optimize storage 53 | $_lang['versionx.optimize_storage'] = 'Optimize Storage'; 54 | $_lang['versionx.optimize_storage.confirm_text'] = 'Optimizing storage will merge older deltas, and typically runs each night, potentially reducing the size of the database.'; 55 | $_lang['versionx.optimize_storage.confirm_text2'] = 'Are you sure you want to run it manually now?'; 56 | $_lang['versionx.optimize_storage.successful'] = 'Optimization successful'; 57 | 58 | // Dashboard widgets 59 | $_lang['versionx.widget.resources'] = 'Recent Resource Changes'; 60 | $_lang['versionx.widget.resources.desc'] = '[VersionX] Shows a grid with the most recent resource changes for all users.'; 61 | $_lang['versionx.widget.resources.update'] = 'Update Resource'; -------------------------------------------------------------------------------- /core/components/versionx/lexicon/de/default.inc.php: -------------------------------------------------------------------------------- 1 |Are you sure you want to revert all fields to this point in time? [[+time]]
"; 27 | $_lang['versionx.deltas.milestone'] = 'milestone'; 28 | $_lang['versionx.deltas.milestone_remove'] = 'Remove milestone status from delta'; 29 | $_lang['versionx.deltas.milestone_make'] = 'Make this delta a milestone'; 30 | $_lang['versionx.deltas.preview'] = 'Preview'; 31 | $_lang['versionx.deltas.revert_these_changes'] = 'Revert these changes'; 32 | 33 | // Grid filters 34 | $_lang['versionx.filters.clear_filter'] = '( Clear filter )'; 35 | $_lang['versionx.filters.class'] = 'Class...'; 36 | $_lang['versionx.filters.date_from'] = 'Date from...'; 37 | $_lang['versionx.filters.date_to'] = 'Date to...'; 38 | $_lang['versionx.filters.editor'] = 'Editor...'; 39 | $_lang['versionx.filters.package'] = 'Package...'; 40 | $_lang['versionx.filters.search'] = 'Suche ...'; 41 | $_lang['versionx.filters.search_by_field'] = 'Suche nach Feld ...'; 42 | $_lang['versionx.filters.search_by_name'] = 'Suche nach Name ...'; 43 | 44 | // Versioned objects grid 45 | $_lang['versionx.objects.class'] = 'Class'; 46 | $_lang['versionx.objects.delta'] = 'Delta'; 47 | $_lang['versionx.objects.editor'] = 'Editor'; 48 | $_lang['versionx.objects.id'] = 'ID'; 49 | $_lang['versionx.objects.name'] = 'Name'; 50 | $_lang['versionx.objects.package'] = 'Package'; 51 | $_lang['versionx.objects.when'] = 'When'; 52 | $_lang['versionx.objects.view_details'] = 'View Details'; 53 | $_lang['versionx.objects.viewing_object_details'] = '[[+name]] • [[+class]] (id: [[+id]]) • [[+time_end]]'; 54 | 55 | // Optimize storage 56 | $_lang['versionx.optimize_storage'] = 'Optimieren der Speicherung'; 57 | $_lang['versionx.optimize_storage.confirm_text'] = 'Optimizing storage will merge older deltas, and typically runs each night, potentially reducing the size of the database.'; 58 | $_lang['versionx.optimize_storage.confirm_text2'] = 'Are you sure you want to run it manually now?'; 59 | $_lang['versionx.optimize_storage.successful'] = 'Optimization successful'; 60 | 61 | // Dashboard widgets 62 | $_lang['versionx.widget.resources'] = 'Recent Resource Changes'; 63 | $_lang['versionx.widget.resources.desc'] = '[VersionX] Shows a grid with the most recent resource changes for all users.'; 64 | $_lang['versionx.widget.resources.update'] = 'Update Resource'; -------------------------------------------------------------------------------- /core/components/versionx/lexicon/en/default.inc.php: -------------------------------------------------------------------------------- 1 |Are you sure you want to revert all fields to this point in time? [[+time]]
"; 27 | $_lang['versionx.deltas.milestone'] = 'milestone'; 28 | $_lang['versionx.deltas.milestone_remove'] = 'Remove milestone status from delta'; 29 | $_lang['versionx.deltas.milestone_make'] = 'Make this delta a milestone'; 30 | $_lang['versionx.deltas.preview'] = 'Preview'; 31 | $_lang['versionx.deltas.revert_these_changes'] = 'Revert these changes'; 32 | 33 | // Grid filters 34 | $_lang['versionx.filters.clear_filter'] = '( Clear filter )'; 35 | $_lang['versionx.filters.class'] = 'Class...'; 36 | $_lang['versionx.filters.date_from'] = 'Date from...'; 37 | $_lang['versionx.filters.date_to'] = 'Date to...'; 38 | $_lang['versionx.filters.editor'] = 'Editor...'; 39 | $_lang['versionx.filters.package'] = 'Package...'; 40 | $_lang['versionx.filters.search'] = 'Search...'; 41 | $_lang['versionx.filters.search_by_field'] = 'Search by field...'; 42 | $_lang['versionx.filters.search_by_name'] = 'Search by name...'; 43 | 44 | // Versioned objects grid 45 | $_lang['versionx.objects.class'] = 'Class'; 46 | $_lang['versionx.objects.delta'] = 'Delta'; 47 | $_lang['versionx.objects.editor'] = 'Editor'; 48 | $_lang['versionx.objects.id'] = 'ID'; 49 | $_lang['versionx.objects.name'] = 'Name'; 50 | $_lang['versionx.objects.package'] = 'Package'; 51 | $_lang['versionx.objects.when'] = 'When'; 52 | $_lang['versionx.objects.view_details'] = 'View Details'; 53 | $_lang['versionx.objects.viewing_object_details'] = '[[+name]] • [[+class]] (id: [[+id]]) • [[+time_end]]'; 54 | 55 | // Optimize storage 56 | $_lang['versionx.optimize_storage'] = 'Optimize Storage'; 57 | $_lang['versionx.optimize_storage.confirm_text'] = 'Optimizing storage will merge older deltas, and typically runs each night, potentially reducing the size of the database.'; 58 | $_lang['versionx.optimize_storage.confirm_text2'] = 'Are you sure you want to run it manually now?'; 59 | $_lang['versionx.optimize_storage.successful'] = 'Optimization successful'; 60 | 61 | // Dashboard widgets 62 | $_lang['versionx.widget.resources'] = 'Recent Resource Changes'; 63 | $_lang['versionx.widget.resources.desc'] = '[VersionX] Shows a grid with the most recent resource changes for all users.'; 64 | $_lang['versionx.widget.resources.update'] = 'Update Resource'; -------------------------------------------------------------------------------- /core/components/versionx/lexicon/fr/default.inc.php: -------------------------------------------------------------------------------- 1 |Are you sure you want to revert all fields to this point in time? [[+time]]
"; 24 | $_lang['versionx.deltas.milestone'] = 'milestone'; 25 | $_lang['versionx.deltas.milestone_remove'] = 'Remove milestone status from delta'; 26 | $_lang['versionx.deltas.milestone_make'] = 'Make this delta a milestone'; 27 | $_lang['versionx.deltas.preview'] = 'Preview'; 28 | $_lang['versionx.deltas.revert_these_changes'] = 'Revert these changes'; 29 | 30 | // Grid filters 31 | $_lang['versionx.filters.clear_filter'] = '( Clear filter )'; 32 | $_lang['versionx.filters.class'] = 'Class...'; 33 | $_lang['versionx.filters.date_from'] = 'Date from...'; 34 | $_lang['versionx.filters.date_to'] = 'Date to...'; 35 | $_lang['versionx.filters.editor'] = 'Editor...'; 36 | $_lang['versionx.filters.package'] = 'Package...'; 37 | $_lang['versionx.filters.search'] = 'Search...'; 38 | $_lang['versionx.filters.search_by_field'] = 'Search by field...'; 39 | $_lang['versionx.filters.search_by_name'] = 'Search by name...'; 40 | 41 | // Versioned objects grid 42 | $_lang['versionx.objects.class'] = 'Class'; 43 | $_lang['versionx.objects.delta'] = 'Delta'; 44 | $_lang['versionx.objects.editor'] = 'Editor'; 45 | $_lang['versionx.objects.id'] = 'ID'; 46 | $_lang['versionx.objects.name'] = 'Name'; 47 | $_lang['versionx.objects.package'] = 'Package'; 48 | $_lang['versionx.objects.when'] = 'When'; 49 | $_lang['versionx.objects.view_details'] = 'View Details'; 50 | $_lang['versionx.objects.viewing_object_details'] = '[[+name]] • [[+class]] (id: [[+id]]) • [[+time_end]]'; 51 | 52 | // Optimize storage 53 | $_lang['versionx.optimize_storage'] = 'Optimize Storage'; 54 | $_lang['versionx.optimize_storage.confirm_text'] = 'Optimizing storage will merge older deltas, and typically runs each night, potentially reducing the size of the database.'; 55 | $_lang['versionx.optimize_storage.confirm_text2'] = 'Are you sure you want to run it manually now?'; 56 | $_lang['versionx.optimize_storage.successful'] = 'Optimization successful'; 57 | 58 | // Dashboard widgets 59 | $_lang['versionx.widget.resources'] = 'Recent Resource Changes'; 60 | $_lang['versionx.widget.resources.desc'] = '[VersionX] Shows a grid with the most recent resource changes for all users.'; 61 | $_lang['versionx.widget.resources.update'] = 'Update Resource'; -------------------------------------------------------------------------------- /core/components/versionx/lexicon/nl/default.inc.php: -------------------------------------------------------------------------------- 1 |Are you sure you want to revert all fields to this point in time? [[+time]]
"; 24 | $_lang['versionx.deltas.milestone'] = 'milestone'; 25 | $_lang['versionx.deltas.milestone_remove'] = 'Remove milestone status from delta'; 26 | $_lang['versionx.deltas.milestone_make'] = 'Make this delta a milestone'; 27 | $_lang['versionx.deltas.preview'] = 'Preview'; 28 | $_lang['versionx.deltas.revert_these_changes'] = 'Revert these changes'; 29 | 30 | // Grid filters 31 | $_lang['versionx.filters.clear_filter'] = '( Clear filter )'; 32 | $_lang['versionx.filters.class'] = 'Class...'; 33 | $_lang['versionx.filters.date_from'] = 'Date from...'; 34 | $_lang['versionx.filters.date_to'] = 'Date to...'; 35 | $_lang['versionx.filters.editor'] = 'Editor...'; 36 | $_lang['versionx.filters.package'] = 'Package...'; 37 | $_lang['versionx.filters.search'] = 'Search...'; 38 | $_lang['versionx.filters.search_by_field'] = 'Search by field...'; 39 | $_lang['versionx.filters.search_by_name'] = 'Search by name...'; 40 | 41 | // Versioned objects grid 42 | $_lang['versionx.objects.class'] = 'Class'; 43 | $_lang['versionx.objects.delta'] = 'Delta'; 44 | $_lang['versionx.objects.editor'] = 'Editor'; 45 | $_lang['versionx.objects.id'] = 'ID'; 46 | $_lang['versionx.objects.name'] = 'Name'; 47 | $_lang['versionx.objects.package'] = 'Package'; 48 | $_lang['versionx.objects.when'] = 'When'; 49 | $_lang['versionx.objects.view_details'] = 'View Details'; 50 | $_lang['versionx.objects.viewing_object_details'] = '[[+name]] • [[+class]] (id: [[+id]]) • [[+time_end]]'; 51 | 52 | // Optimize storage 53 | $_lang['versionx.optimize_storage'] = 'Optimize Storage'; 54 | $_lang['versionx.optimize_storage.confirm_text'] = 'Optimizing storage will merge older deltas, and typically runs each night, potentially reducing the size of the database.'; 55 | $_lang['versionx.optimize_storage.confirm_text2'] = 'Are you sure you want to run it manually now?'; 56 | $_lang['versionx.optimize_storage.successful'] = 'Optimization successful'; 57 | 58 | // Dashboard widgets 59 | $_lang['versionx.widget.resources'] = 'Recent Resource Changes'; 60 | $_lang['versionx.widget.resources.desc'] = '[VersionX] Shows a grid with the most recent resource changes for all users.'; 61 | $_lang['versionx.widget.resources.update'] = 'Update Resource'; -------------------------------------------------------------------------------- /core/components/versionx/lexicon/ru/default.inc.php: -------------------------------------------------------------------------------- 1 |Are you sure you want to revert all fields to this point in time? [[+time]]
"; 24 | $_lang['versionx.deltas.milestone'] = 'milestone'; 25 | $_lang['versionx.deltas.milestone_remove'] = 'Remove milestone status from delta'; 26 | $_lang['versionx.deltas.milestone_make'] = 'Make this delta a milestone'; 27 | $_lang['versionx.deltas.preview'] = 'Preview'; 28 | $_lang['versionx.deltas.revert_these_changes'] = 'Revert these changes'; 29 | 30 | // Grid filters 31 | $_lang['versionx.filters.clear_filter'] = '( Clear filter )'; 32 | $_lang['versionx.filters.class'] = 'Class...'; 33 | $_lang['versionx.filters.date_from'] = 'Date from...'; 34 | $_lang['versionx.filters.date_to'] = 'Date to...'; 35 | $_lang['versionx.filters.editor'] = 'Editor...'; 36 | $_lang['versionx.filters.package'] = 'Package...'; 37 | $_lang['versionx.filters.search'] = 'Search...'; 38 | $_lang['versionx.filters.search_by_field'] = 'Search by field...'; 39 | $_lang['versionx.filters.search_by_name'] = 'Search by name...'; 40 | 41 | // Versioned objects grid 42 | $_lang['versionx.objects.class'] = 'Class'; 43 | $_lang['versionx.objects.delta'] = 'Delta'; 44 | $_lang['versionx.objects.editor'] = 'Editor'; 45 | $_lang['versionx.objects.id'] = 'ID'; 46 | $_lang['versionx.objects.name'] = 'Name'; 47 | $_lang['versionx.objects.package'] = 'Package'; 48 | $_lang['versionx.objects.when'] = 'When'; 49 | $_lang['versionx.objects.view_details'] = 'View Details'; 50 | $_lang['versionx.objects.viewing_object_details'] = '[[+name]] • [[+class]] (id: [[+id]]) • [[+time_end]]'; 51 | 52 | // Optimize storage 53 | $_lang['versionx.optimize_storage'] = 'Optimize Storage'; 54 | $_lang['versionx.optimize_storage.confirm_text'] = 'Optimizing storage will merge older deltas, and typically runs each night, potentially reducing the size of the database.'; 55 | $_lang['versionx.optimize_storage.confirm_text2'] = 'Are you sure you want to run it manually now?'; 56 | $_lang['versionx.optimize_storage.successful'] = 'Optimization successful'; 57 | 58 | // Dashboard widgets 59 | $_lang['versionx.widget.resources'] = 'Recent Resource Changes'; 60 | $_lang['versionx.widget.resources.desc'] = '[VersionX] Shows a grid with the most recent resource changes for all users.'; 61 | $_lang['versionx.widget.resources.update'] = 'Update Resource'; -------------------------------------------------------------------------------- /core/components/versionx/lexicon/sv/default.inc.php: -------------------------------------------------------------------------------- 1 |Are you sure you want to revert all fields to this point in time? [[+time]]
"; 24 | $_lang['versionx.deltas.milestone'] = 'milestone'; 25 | $_lang['versionx.deltas.milestone_remove'] = 'Remove milestone status from delta'; 26 | $_lang['versionx.deltas.milestone_make'] = 'Make this delta a milestone'; 27 | $_lang['versionx.deltas.preview'] = 'Preview'; 28 | $_lang['versionx.deltas.revert_these_changes'] = 'Revert these changes'; 29 | 30 | // Grid filters 31 | $_lang['versionx.filters.clear_filter'] = '( Clear filter )'; 32 | $_lang['versionx.filters.class'] = 'Class...'; 33 | $_lang['versionx.filters.date_from'] = 'Date from...'; 34 | $_lang['versionx.filters.date_to'] = 'Date to...'; 35 | $_lang['versionx.filters.editor'] = 'Editor...'; 36 | $_lang['versionx.filters.package'] = 'Package...'; 37 | $_lang['versionx.filters.search'] = 'Search...'; 38 | $_lang['versionx.filters.search_by_field'] = 'Search by field...'; 39 | $_lang['versionx.filters.search_by_name'] = 'Search by name...'; 40 | 41 | // Versioned objects grid 42 | $_lang['versionx.objects.class'] = 'Class'; 43 | $_lang['versionx.objects.delta'] = 'Delta'; 44 | $_lang['versionx.objects.editor'] = 'Editor'; 45 | $_lang['versionx.objects.id'] = 'ID'; 46 | $_lang['versionx.objects.name'] = 'Name'; 47 | $_lang['versionx.objects.package'] = 'Package'; 48 | $_lang['versionx.objects.when'] = 'When'; 49 | $_lang['versionx.objects.view_details'] = 'View Details'; 50 | $_lang['versionx.objects.viewing_object_details'] = '[[+name]] • [[+class]] (id: [[+id]]) • [[+time_end]]'; 51 | 52 | // Optimize storage 53 | $_lang['versionx.optimize_storage'] = 'Optimize Storage'; 54 | $_lang['versionx.optimize_storage.confirm_text'] = 'Optimizing storage will merge older deltas, and typically runs each night, potentially reducing the size of the database.'; 55 | $_lang['versionx.optimize_storage.confirm_text2'] = 'Are you sure you want to run it manually now?'; 56 | $_lang['versionx.optimize_storage.successful'] = 'Optimization successful'; 57 | 58 | // Dashboard widgets 59 | $_lang['versionx.widget.resources'] = 'Recent Resource Changes'; 60 | $_lang['versionx.widget.resources.desc'] = '[VersionX] Shows a grid with the most recent resource changes for all users.'; 61 | $_lang['versionx.widget.resources.update'] = 'Update Resource'; -------------------------------------------------------------------------------- /core/components/versionx/model/versionx.class.php: -------------------------------------------------------------------------------- 1 | 5 | array ( 6 | 0 => 'vxDelta', 7 | 1 => 'vxDeltaEditor', 8 | 2 => 'vxDeltaField', 9 | ), 10 | 'xPDOObject' => 11 | array ( 12 | 0 => 'vxResource', 13 | 1 => 'vxTemplate', 14 | 2 => 'vxChunk', 15 | 3 => 'vxSnippet', 16 | 4 => 'vxPlugin', 17 | 5 => 'vxTemplateVar', 18 | ), 19 | ); -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxchunk.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/vxchunk.class.php'); 24 | class vxChunk_mysql extends vxChunk {} 25 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxchunk.map.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | $xpdo_meta_map['vxChunk']= array ( 24 | 'package' => 'versionx', 25 | 'version' => '1.1', 26 | 'table' => 'versionx_chunk', 27 | 'extends' => 'xPDOObject', 28 | 'tableMeta' => 29 | array ( 30 | 'engine' => 'InnoDB', 31 | ), 32 | 'fields' => 33 | array ( 34 | 'version_id' => NULL, 35 | 'content_id' => NULL, 36 | 'saved' => 'CURRENT_TIMESTAMP', 37 | 'user' => 0, 38 | 'mode' => 'update', 39 | 'marked' => 0, 40 | 'name' => '', 41 | 'description' => 'Chunk', 42 | 'category' => 0, 43 | 'snippet' => NULL, 44 | 'locked' => 0, 45 | 'properties' => NULL, 46 | ), 47 | 'fieldMeta' => 48 | array ( 49 | 'version_id' => 50 | array ( 51 | 'dbtype' => 'int', 52 | 'precision' => '11', 53 | 'phptype' => 'integer', 54 | 'null' => false, 55 | 'index' => 'pk', 56 | 'generated' => 'native', 57 | 'attributes' => 'unsigned', 58 | ), 59 | 'content_id' => 60 | array ( 61 | 'dbtype' => 'int', 62 | 'precision' => '11', 63 | 'phptype' => 'integer', 64 | 'null' => false, 65 | 'index' => 'fk', 66 | 'attributes' => 'unsigned', 67 | ), 68 | 'saved' => 69 | array ( 70 | 'dbtype' => 'timestamp', 71 | 'phptype' => 'timestamp', 72 | 'null' => false, 73 | 'default' => 'CURRENT_TIMESTAMP', 74 | ), 75 | 'user' => 76 | array ( 77 | 'dbtype' => 'int', 78 | 'precision' => '11', 79 | 'phptype' => 'integer', 80 | 'null' => false, 81 | 'default' => 0, 82 | 'index' => 'fk', 83 | ), 84 | 'mode' => 85 | array ( 86 | 'dbtype' => 'varchar', 87 | 'precision' => '24', 88 | 'phptype' => 'string', 89 | 'null' => false, 90 | 'default' => 'update', 91 | ), 92 | 'marked' => 93 | array ( 94 | 'dbtype' => 'tinyint', 95 | 'precision' => '1', 96 | 'phptype' => 'boolean', 97 | 'default' => 0, 98 | ), 99 | 'name' => 100 | array ( 101 | 'dbtype' => 'varchar', 102 | 'precision' => '50', 103 | 'phptype' => 'string', 104 | 'null' => false, 105 | 'default' => '', 106 | ), 107 | 'description' => 108 | array ( 109 | 'dbtype' => 'varchar', 110 | 'precision' => '255', 111 | 'phptype' => 'string', 112 | 'null' => false, 113 | 'default' => 'Chunk', 114 | ), 115 | 'category' => 116 | array ( 117 | 'dbtype' => 'int', 118 | 'precision' => '11', 119 | 'phptype' => 'integer', 120 | 'null' => false, 121 | 'default' => 0, 122 | 'index' => 'fk', 123 | ), 124 | 'snippet' => 125 | array ( 126 | 'dbtype' => 'mediumtext', 127 | 'phptype' => 'string', 128 | ), 129 | 'locked' => 130 | array ( 131 | 'dbtype' => 'tinyint', 132 | 'precision' => '1', 133 | 'attributes' => 'unsigned', 134 | 'phptype' => 'boolean', 135 | 'null' => false, 136 | 'default' => 0, 137 | ), 138 | 'properties' => 139 | array ( 140 | 'dbtype' => 'mediumtext', 141 | 'phptype' => 'array', 142 | 'null' => true, 143 | ), 144 | ), 145 | 'indexes' => 146 | array ( 147 | 'PRIMARY' => 148 | array ( 149 | 'alias' => 'PRIMARY', 150 | 'primary' => true, 151 | 'unique' => true, 152 | 'type' => 'BTREE', 153 | 'columns' => 154 | array ( 155 | 'version_id' => 156 | array ( 157 | 'length' => '', 158 | 'collation' => 'A', 159 | 'null' => false, 160 | ), 161 | ), 162 | ), 163 | 'content_id' => 164 | array ( 165 | 'alias' => 'content_id', 166 | 'primary' => false, 167 | 'unique' => false, 168 | 'type' => 'BTREE', 169 | 'columns' => 170 | array ( 171 | 'content_id' => 172 | array ( 173 | 'length' => '', 174 | 'collation' => 'A', 175 | 'null' => false, 176 | ), 177 | ), 178 | ), 179 | ), 180 | 'aggregates' => 181 | array ( 182 | 'User' => 183 | array ( 184 | 'class' => 'modUser', 185 | 'local' => 'user', 186 | 'foreign' => 'id', 187 | 'owner' => 'foreign', 188 | 'cardinality' => 'one', 189 | ), 190 | 'Chunk' => 191 | array ( 192 | 'class' => 'modChunk', 193 | 'local' => 'content_id', 194 | 'foreign' => 'id', 195 | 'owner' => 'foreign', 196 | 'cardinality' => 'one', 197 | ), 198 | ), 199 | ); 200 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxdelta.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/vxdelta.class.php'); 24 | class vxDelta_mysql extends vxDelta {} 25 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxdelta.map.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | $xpdo_meta_map['vxDelta']= array ( 24 | 'package' => 'versionx', 25 | 'version' => '1.1', 26 | 'table' => 'versionx_delta', 27 | 'extends' => 'xPDOSimpleObject', 28 | 'tableMeta' => 29 | array ( 30 | 'engine' => 'InnoDB', 31 | ), 32 | 'fields' => 33 | array ( 34 | 'principal_package' => 'core', 35 | 'principal_class' => NULL, 36 | 'principal' => 0, 37 | 'type_class' => NULL, 38 | 'milestone' => '', 39 | 'time_start' => 'CURRENT_TIMESTAMP', 40 | 'time_end' => 'CURRENT_TIMESTAMP', 41 | ), 42 | 'fieldMeta' => 43 | array ( 44 | 'principal_package' => 45 | array ( 46 | 'dbtype' => 'varchar', 47 | 'precision' => '128', 48 | 'phptype' => 'string', 49 | 'null' => false, 50 | 'default' => 'core', 51 | ), 52 | 'principal_class' => 53 | array ( 54 | 'dbtype' => 'varchar', 55 | 'precision' => '128', 56 | 'phptype' => 'string', 57 | 'null' => false, 58 | ), 59 | 'principal' => 60 | array ( 61 | 'dbtype' => 'int', 62 | 'precision' => '10', 63 | 'attributes' => 'unsigned', 64 | 'phptype' => 'integer', 65 | 'null' => false, 66 | 'default' => 0, 67 | ), 68 | 'type_class' => 69 | array ( 70 | 'dbtype' => 'varchar', 71 | 'precision' => '128', 72 | 'phptype' => 'string', 73 | 'null' => false, 74 | ), 75 | 'milestone' => 76 | array ( 77 | 'dbtype' => 'varchar', 78 | 'precision' => '128', 79 | 'phptype' => 'string', 80 | 'null' => false, 81 | 'default' => '', 82 | ), 83 | 'time_start' => 84 | array ( 85 | 'dbtype' => 'timestamp', 86 | 'phptype' => 'timestamp', 87 | 'null' => false, 88 | 'default' => 'CURRENT_TIMESTAMP', 89 | ), 90 | 'time_end' => 91 | array ( 92 | 'dbtype' => 'timestamp', 93 | 'phptype' => 'timestamp', 94 | 'null' => false, 95 | 'default' => 'CURRENT_TIMESTAMP', 96 | ), 97 | ), 98 | 'indexes' => 99 | array ( 100 | 'principal_class' => 101 | array ( 102 | 'alias' => 'principal_class', 103 | 'primary' => false, 104 | 'unique' => false, 105 | 'type' => 'BTREE', 106 | 'columns' => 107 | array ( 108 | 'principal_class' => 109 | array ( 110 | 'length' => '', 111 | 'collation' => 'A', 112 | 'null' => false, 113 | ), 114 | ), 115 | ), 116 | 'principal' => 117 | array ( 118 | 'alias' => 'principal', 119 | 'primary' => false, 120 | 'unique' => false, 121 | 'type' => 'BTREE', 122 | 'columns' => 123 | array ( 124 | 'principal' => 125 | array ( 126 | 'length' => '', 127 | 'collation' => 'A', 128 | 'null' => false, 129 | ), 130 | ), 131 | ), 132 | 'time_start' => 133 | array ( 134 | 'alias' => 'time_start', 135 | 'primary' => false, 136 | 'unique' => false, 137 | 'type' => 'BTREE', 138 | 'columns' => 139 | array ( 140 | 'time_start' => 141 | array ( 142 | 'length' => '', 143 | 'collation' => 'A', 144 | 'null' => false, 145 | ), 146 | ), 147 | ), 148 | 'time_end' => 149 | array ( 150 | 'alias' => 'time_end', 151 | 'primary' => false, 152 | 'unique' => false, 153 | 'type' => 'BTREE', 154 | 'columns' => 155 | array ( 156 | 'time_end' => 157 | array ( 158 | 'length' => '', 159 | 'collation' => 'A', 160 | 'null' => false, 161 | ), 162 | ), 163 | ), 164 | ), 165 | ); 166 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxdeltaeditor.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/vxdeltaeditor.class.php'); 24 | class vxDeltaEditor_mysql extends vxDeltaEditor {} 25 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxdeltaeditor.map.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | $xpdo_meta_map['vxDeltaEditor']= array ( 24 | 'package' => 'versionx', 25 | 'version' => '1.1', 26 | 'table' => 'versionx_delta_editor', 27 | 'extends' => 'xPDOSimpleObject', 28 | 'tableMeta' => 29 | array ( 30 | 'engine' => 'InnoDB', 31 | ), 32 | 'fields' => 33 | array ( 34 | 'delta' => 0, 35 | 'user' => 0, 36 | ), 37 | 'fieldMeta' => 38 | array ( 39 | 'delta' => 40 | array ( 41 | 'dbtype' => 'int', 42 | 'precision' => '10', 43 | 'attributes' => 'unsigned', 44 | 'phptype' => 'integer', 45 | 'null' => false, 46 | 'default' => 0, 47 | ), 48 | 'user' => 49 | array ( 50 | 'dbtype' => 'int', 51 | 'precision' => '10', 52 | 'attributes' => 'unsigned', 53 | 'phptype' => 'integer', 54 | 'null' => false, 55 | 'default' => 0, 56 | ), 57 | ), 58 | 'indexes' => 59 | array ( 60 | 'delta' => 61 | array ( 62 | 'alias' => 'delta', 63 | 'primary' => false, 64 | 'unique' => false, 65 | 'type' => 'BTREE', 66 | 'columns' => 67 | array ( 68 | 'delta' => 69 | array ( 70 | 'length' => '', 71 | 'collation' => 'A', 72 | 'null' => false, 73 | ), 74 | ), 75 | ), 76 | 'user' => 77 | array ( 78 | 'alias' => 'user', 79 | 'primary' => false, 80 | 'unique' => false, 81 | 'type' => 'BTREE', 82 | 'columns' => 83 | array ( 84 | 'user' => 85 | array ( 86 | 'length' => '', 87 | 'collation' => 'A', 88 | 'null' => false, 89 | ), 90 | ), 91 | ), 92 | ), 93 | ); 94 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxdeltafield.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/vxdeltafield.class.php'); 24 | class vxDeltaField_mysql extends vxDeltaField {} 25 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxdeltafield.map.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | $xpdo_meta_map['vxDeltaField']= array ( 24 | 'package' => 'versionx', 25 | 'version' => '1.1', 26 | 'table' => 'versionx_delta_field', 27 | 'extends' => 'xPDOSimpleObject', 28 | 'tableMeta' => 29 | array ( 30 | 'engine' => 'InnoDB', 31 | ), 32 | 'fields' => 33 | array ( 34 | 'delta' => 0, 35 | 'field' => NULL, 36 | 'field_type' => 'text', 37 | 'before_type' => '', 38 | 'after_type' => '', 39 | 'before' => '', 40 | 'after' => '', 41 | ), 42 | 'fieldMeta' => 43 | array ( 44 | 'delta' => 45 | array ( 46 | 'dbtype' => 'int', 47 | 'precision' => '10', 48 | 'attributes' => 'unsigned', 49 | 'phptype' => 'integer', 50 | 'null' => false, 51 | 'default' => 0, 52 | ), 53 | 'field' => 54 | array ( 55 | 'dbtype' => 'varchar', 56 | 'precision' => '128', 57 | 'phptype' => 'string', 58 | 'null' => false, 59 | ), 60 | 'field_type' => 61 | array ( 62 | 'dbtype' => 'varchar', 63 | 'precision' => '128', 64 | 'phptype' => 'string', 65 | 'null' => false, 66 | 'default' => 'text', 67 | ), 68 | 'before_type' => 69 | array ( 70 | 'dbtype' => 'varchar', 71 | 'precision' => '7', 72 | 'phptype' => 'string', 73 | 'null' => false, 74 | 'default' => '', 75 | ), 76 | 'after_type' => 77 | array ( 78 | 'dbtype' => 'varchar', 79 | 'precision' => '7', 80 | 'phptype' => 'string', 81 | 'null' => false, 82 | 'default' => '', 83 | ), 84 | 'before' => 85 | array ( 86 | 'dbtype' => 'mediumtext', 87 | 'phptype' => 'string', 88 | 'null' => false, 89 | 'default' => '', 90 | ), 91 | 'after' => 92 | array ( 93 | 'dbtype' => 'mediumtext', 94 | 'phptype' => 'string', 95 | 'null' => false, 96 | 'default' => '', 97 | ), 98 | ), 99 | 'indexes' => 100 | array ( 101 | 'delta' => 102 | array ( 103 | 'alias' => 'delta', 104 | 'primary' => false, 105 | 'unique' => false, 106 | 'type' => 'BTREE', 107 | 'columns' => 108 | array ( 109 | 'delta' => 110 | array ( 111 | 'length' => '', 112 | 'collation' => 'A', 113 | 'null' => false, 114 | ), 115 | ), 116 | ), 117 | 'field' => 118 | array ( 119 | 'alias' => 'field', 120 | 'primary' => false, 121 | 'unique' => false, 122 | 'type' => 'BTREE', 123 | 'columns' => 124 | array ( 125 | 'field' => 126 | array ( 127 | 'length' => '', 128 | 'collation' => 'A', 129 | 'null' => false, 130 | ), 131 | ), 132 | ), 133 | ), 134 | ); 135 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxplugin.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/vxplugin.class.php'); 24 | class vxPlugin_mysql extends vxPlugin {} 25 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxplugin.map.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | $xpdo_meta_map['vxPlugin']= array ( 24 | 'package' => 'versionx', 25 | 'version' => '1.1', 26 | 'table' => 'versionx_plugin', 27 | 'extends' => 'xPDOObject', 28 | 'tableMeta' => 29 | array ( 30 | 'engine' => 'InnoDB', 31 | ), 32 | 'fields' => 33 | array ( 34 | 'version_id' => NULL, 35 | 'content_id' => NULL, 36 | 'saved' => 'CURRENT_TIMESTAMP', 37 | 'user' => 0, 38 | 'mode' => 'update', 39 | 'marked' => 0, 40 | 'name' => '', 41 | 'description' => 'Chunk', 42 | 'category' => 0, 43 | 'plugincode' => '', 44 | 'locked' => 0, 45 | 'properties' => NULL, 46 | 'disabled' => 0, 47 | ), 48 | 'fieldMeta' => 49 | array ( 50 | 'version_id' => 51 | array ( 52 | 'dbtype' => 'int', 53 | 'precision' => '11', 54 | 'phptype' => 'integer', 55 | 'null' => false, 56 | 'index' => 'pk', 57 | 'generated' => 'native', 58 | 'attributes' => 'unsigned', 59 | ), 60 | 'content_id' => 61 | array ( 62 | 'dbtype' => 'int', 63 | 'precision' => '11', 64 | 'phptype' => 'integer', 65 | 'null' => false, 66 | 'index' => 'fk', 67 | 'attributes' => 'unsigned', 68 | ), 69 | 'saved' => 70 | array ( 71 | 'dbtype' => 'timestamp', 72 | 'phptype' => 'timestamp', 73 | 'null' => false, 74 | 'default' => 'CURRENT_TIMESTAMP', 75 | ), 76 | 'user' => 77 | array ( 78 | 'dbtype' => 'int', 79 | 'precision' => '11', 80 | 'phptype' => 'integer', 81 | 'null' => false, 82 | 'default' => 0, 83 | 'index' => 'fk', 84 | ), 85 | 'mode' => 86 | array ( 87 | 'dbtype' => 'varchar', 88 | 'precision' => '24', 89 | 'phptype' => 'string', 90 | 'null' => false, 91 | 'default' => 'update', 92 | ), 93 | 'marked' => 94 | array ( 95 | 'dbtype' => 'tinyint', 96 | 'precision' => '1', 97 | 'phptype' => 'boolean', 98 | 'default' => 0, 99 | ), 100 | 'name' => 101 | array ( 102 | 'dbtype' => 'varchar', 103 | 'precision' => '50', 104 | 'phptype' => 'string', 105 | 'null' => false, 106 | 'default' => '', 107 | ), 108 | 'description' => 109 | array ( 110 | 'dbtype' => 'varchar', 111 | 'precision' => '255', 112 | 'phptype' => 'string', 113 | 'null' => false, 114 | 'default' => 'Chunk', 115 | ), 116 | 'category' => 117 | array ( 118 | 'dbtype' => 'int', 119 | 'precision' => '11', 120 | 'phptype' => 'integer', 121 | 'null' => false, 122 | 'default' => 0, 123 | 'index' => 'fk', 124 | ), 125 | 'plugincode' => 126 | array ( 127 | 'dbtype' => 'mediumtext', 128 | 'phptype' => 'string', 129 | 'null' => false, 130 | 'default' => '', 131 | ), 132 | 'locked' => 133 | array ( 134 | 'dbtype' => 'tinyint', 135 | 'precision' => '1', 136 | 'attributes' => 'unsigned', 137 | 'phptype' => 'boolean', 138 | 'null' => false, 139 | 'default' => 0, 140 | ), 141 | 'properties' => 142 | array ( 143 | 'dbtype' => 'mediumtext', 144 | 'phptype' => 'array', 145 | 'null' => true, 146 | ), 147 | 'disabled' => 148 | array ( 149 | 'dbtype' => 'tinyint', 150 | 'precision' => '1', 151 | 'attributes' => 'unsigned', 152 | 'phptype' => 'boolean', 153 | 'null' => false, 154 | 'default' => 0, 155 | ), 156 | ), 157 | 'indexes' => 158 | array ( 159 | 'PRIMARY' => 160 | array ( 161 | 'alias' => 'PRIMARY', 162 | 'primary' => true, 163 | 'unique' => true, 164 | 'type' => 'BTREE', 165 | 'columns' => 166 | array ( 167 | 'version_id' => 168 | array ( 169 | 'length' => '', 170 | 'collation' => 'A', 171 | 'null' => false, 172 | ), 173 | ), 174 | ), 175 | 'content_id' => 176 | array ( 177 | 'alias' => 'content_id', 178 | 'primary' => false, 179 | 'unique' => false, 180 | 'type' => 'BTREE', 181 | 'columns' => 182 | array ( 183 | 'content_id' => 184 | array ( 185 | 'length' => '', 186 | 'collation' => 'A', 187 | 'null' => false, 188 | ), 189 | ), 190 | ), 191 | ), 192 | 'aggregates' => 193 | array ( 194 | 'User' => 195 | array ( 196 | 'class' => 'modUser', 197 | 'local' => 'user', 198 | 'foreign' => 'id', 199 | 'owner' => 'foreign', 200 | 'cardinality' => 'one', 201 | ), 202 | 'Plugin' => 203 | array ( 204 | 'class' => 'modPlugin', 205 | 'local' => 'content_id', 206 | 'foreign' => 'id', 207 | 'owner' => 'foreign', 208 | 'cardinality' => 'one', 209 | ), 210 | ), 211 | ); 212 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxresource.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/vxresource.class.php'); 24 | class vxResource_mysql extends vxResource {} 25 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxresource.map.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | $xpdo_meta_map['vxResource']= array ( 24 | 'package' => 'versionx', 25 | 'version' => '1.1', 26 | 'table' => 'versionx_resource', 27 | 'extends' => 'xPDOObject', 28 | 'tableMeta' => 29 | array ( 30 | 'engine' => 'InnoDB', 31 | ), 32 | 'fields' => 33 | array ( 34 | 'version_id' => NULL, 35 | 'content_id' => NULL, 36 | 'saved' => 'CURRENT_TIMESTAMP', 37 | 'user' => 0, 38 | 'mode' => 'update', 39 | 'marked' => 0, 40 | 'title' => 'Unnamed', 41 | 'context_key' => 'web', 42 | 'class' => 'modDocument', 43 | 'content' => NULL, 44 | 'fields' => NULL, 45 | 'tvs' => NULL, 46 | ), 47 | 'fieldMeta' => 48 | array ( 49 | 'version_id' => 50 | array ( 51 | 'dbtype' => 'int', 52 | 'precision' => '11', 53 | 'phptype' => 'integer', 54 | 'null' => false, 55 | 'index' => 'pk', 56 | 'generated' => 'native', 57 | 'attributes' => 'unsigned', 58 | ), 59 | 'content_id' => 60 | array ( 61 | 'dbtype' => 'int', 62 | 'precision' => '11', 63 | 'phptype' => 'integer', 64 | 'null' => false, 65 | 'index' => 'fk', 66 | 'attributes' => 'unsigned', 67 | ), 68 | 'saved' => 69 | array ( 70 | 'dbtype' => 'timestamp', 71 | 'phptype' => 'timestamp', 72 | 'null' => false, 73 | 'default' => 'CURRENT_TIMESTAMP', 74 | ), 75 | 'user' => 76 | array ( 77 | 'dbtype' => 'int', 78 | 'precision' => '11', 79 | 'phptype' => 'integer', 80 | 'null' => false, 81 | 'default' => 0, 82 | 'index' => 'fk', 83 | ), 84 | 'mode' => 85 | array ( 86 | 'dbtype' => 'varchar', 87 | 'precision' => '24', 88 | 'phptype' => 'string', 89 | 'null' => false, 90 | 'default' => 'update', 91 | ), 92 | 'marked' => 93 | array ( 94 | 'dbtype' => 'tinyint', 95 | 'precision' => '1', 96 | 'phptype' => 'boolean', 97 | 'default' => 0, 98 | ), 99 | 'title' => 100 | array ( 101 | 'dbtype' => 'varchar', 102 | 'precision' => '255', 103 | 'phptype' => 'string', 104 | 'null' => false, 105 | 'default' => 'Unnamed', 106 | ), 107 | 'context_key' => 108 | array ( 109 | 'dbtype' => 'varchar', 110 | 'precision' => '255', 111 | 'phptype' => 'string', 112 | 'null' => false, 113 | 'default' => 'web', 114 | ), 115 | 'class' => 116 | array ( 117 | 'dbtype' => 'varchar', 118 | 'precision' => '255', 119 | 'phptype' => 'string', 120 | 'null' => false, 121 | 'default' => 'modDocument', 122 | ), 123 | 'content' => 124 | array ( 125 | 'dbtype' => 'mediumtext', 126 | 'phptype' => 'string', 127 | 'null' => false, 128 | ), 129 | 'fields' => 130 | array ( 131 | 'dbtype' => 'mediumtext', 132 | 'phptype' => 'array', 133 | 'null' => false, 134 | ), 135 | 'tvs' => 136 | array ( 137 | 'dbtype' => 'mediumtext', 138 | 'phptype' => 'array', 139 | 'null' => false, 140 | ), 141 | ), 142 | 'indexes' => 143 | array ( 144 | 'PRIMARY' => 145 | array ( 146 | 'alias' => 'PRIMARY', 147 | 'primary' => true, 148 | 'unique' => true, 149 | 'type' => 'BTREE', 150 | 'columns' => 151 | array ( 152 | 'version_id' => 153 | array ( 154 | 'length' => '', 155 | 'collation' => 'A', 156 | 'null' => false, 157 | ), 158 | ), 159 | ), 160 | 'content_id' => 161 | array ( 162 | 'alias' => 'content_id', 163 | 'primary' => false, 164 | 'unique' => false, 165 | 'type' => 'BTREE', 166 | 'columns' => 167 | array ( 168 | 'content_id' => 169 | array ( 170 | 'length' => '', 171 | 'collation' => 'A', 172 | 'null' => false, 173 | ), 174 | ), 175 | ), 176 | ), 177 | 'aggregates' => 178 | array ( 179 | 'User' => 180 | array ( 181 | 'class' => 'modUser', 182 | 'local' => 'user', 183 | 'foreign' => 'id', 184 | 'owner' => 'foreign', 185 | 'cardinality' => 'one', 186 | ), 187 | 'Resource' => 188 | array ( 189 | 'class' => 'modResource', 190 | 'local' => 'content_id', 191 | 'foreign' => 'id', 192 | 'owner' => 'foreign', 193 | 'cardinality' => 'one', 194 | ), 195 | ), 196 | ); 197 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxsnippet.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/vxsnippet.class.php'); 24 | class vxSnippet_mysql extends vxSnippet {} 25 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxsnippet.map.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | $xpdo_meta_map['vxSnippet']= array ( 24 | 'package' => 'versionx', 25 | 'version' => '1.1', 26 | 'table' => 'versionx_snippet', 27 | 'extends' => 'xPDOObject', 28 | 'tableMeta' => 29 | array ( 30 | 'engine' => 'InnoDB', 31 | ), 32 | 'fields' => 33 | array ( 34 | 'version_id' => NULL, 35 | 'content_id' => NULL, 36 | 'saved' => 'CURRENT_TIMESTAMP', 37 | 'user' => 0, 38 | 'mode' => 'update', 39 | 'marked' => 0, 40 | 'name' => '', 41 | 'description' => 'Chunk', 42 | 'category' => 0, 43 | 'snippet' => NULL, 44 | 'locked' => 0, 45 | 'properties' => NULL, 46 | ), 47 | 'fieldMeta' => 48 | array ( 49 | 'version_id' => 50 | array ( 51 | 'dbtype' => 'int', 52 | 'precision' => '11', 53 | 'phptype' => 'integer', 54 | 'null' => false, 55 | 'index' => 'pk', 56 | 'generated' => 'native', 57 | 'attributes' => 'unsigned', 58 | ), 59 | 'content_id' => 60 | array ( 61 | 'dbtype' => 'int', 62 | 'precision' => '11', 63 | 'phptype' => 'integer', 64 | 'null' => false, 65 | 'index' => 'fk', 66 | 'attributes' => 'unsigned', 67 | ), 68 | 'saved' => 69 | array ( 70 | 'dbtype' => 'timestamp', 71 | 'phptype' => 'timestamp', 72 | 'null' => false, 73 | 'default' => 'CURRENT_TIMESTAMP', 74 | ), 75 | 'user' => 76 | array ( 77 | 'dbtype' => 'int', 78 | 'precision' => '11', 79 | 'phptype' => 'integer', 80 | 'null' => false, 81 | 'default' => 0, 82 | 'index' => 'fk', 83 | ), 84 | 'mode' => 85 | array ( 86 | 'dbtype' => 'varchar', 87 | 'precision' => '24', 88 | 'phptype' => 'string', 89 | 'null' => false, 90 | 'default' => 'update', 91 | ), 92 | 'marked' => 93 | array ( 94 | 'dbtype' => 'tinyint', 95 | 'precision' => '1', 96 | 'phptype' => 'boolean', 97 | 'default' => 0, 98 | ), 99 | 'name' => 100 | array ( 101 | 'dbtype' => 'varchar', 102 | 'precision' => '50', 103 | 'phptype' => 'string', 104 | 'null' => false, 105 | 'default' => '', 106 | ), 107 | 'description' => 108 | array ( 109 | 'dbtype' => 'varchar', 110 | 'precision' => '255', 111 | 'phptype' => 'string', 112 | 'null' => false, 113 | 'default' => 'Chunk', 114 | ), 115 | 'category' => 116 | array ( 117 | 'dbtype' => 'int', 118 | 'precision' => '11', 119 | 'phptype' => 'integer', 120 | 'null' => false, 121 | 'default' => 0, 122 | 'index' => 'fk', 123 | ), 124 | 'snippet' => 125 | array ( 126 | 'dbtype' => 'mediumtext', 127 | 'phptype' => 'string', 128 | ), 129 | 'locked' => 130 | array ( 131 | 'dbtype' => 'tinyint', 132 | 'precision' => '1', 133 | 'attributes' => 'unsigned', 134 | 'phptype' => 'boolean', 135 | 'null' => false, 136 | 'default' => 0, 137 | ), 138 | 'properties' => 139 | array ( 140 | 'dbtype' => 'mediumtext', 141 | 'phptype' => 'array', 142 | 'null' => true, 143 | ), 144 | ), 145 | 'indexes' => 146 | array ( 147 | 'PRIMARY' => 148 | array ( 149 | 'alias' => 'PRIMARY', 150 | 'primary' => true, 151 | 'unique' => true, 152 | 'type' => 'BTREE', 153 | 'columns' => 154 | array ( 155 | 'version_id' => 156 | array ( 157 | 'length' => '', 158 | 'collation' => 'A', 159 | 'null' => false, 160 | ), 161 | ), 162 | ), 163 | 'content_id' => 164 | array ( 165 | 'alias' => 'content_id', 166 | 'primary' => false, 167 | 'unique' => false, 168 | 'type' => 'BTREE', 169 | 'columns' => 170 | array ( 171 | 'content_id' => 172 | array ( 173 | 'length' => '', 174 | 'collation' => 'A', 175 | 'null' => false, 176 | ), 177 | ), 178 | ), 179 | ), 180 | 'aggregates' => 181 | array ( 182 | 'User' => 183 | array ( 184 | 'class' => 'modUser', 185 | 'local' => 'user', 186 | 'foreign' => 'id', 187 | 'owner' => 'foreign', 188 | 'cardinality' => 'one', 189 | ), 190 | 'Snippet' => 191 | array ( 192 | 'class' => 'modSnippet', 193 | 'local' => 'content_id', 194 | 'foreign' => 'id', 195 | 'owner' => 'foreign', 196 | 'cardinality' => 'one', 197 | ), 198 | ), 199 | ); 200 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxtemplate.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/vxtemplate.class.php'); 24 | class vxTemplate_mysql extends vxTemplate {} 25 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxtemplate.map.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | $xpdo_meta_map['vxTemplate']= array ( 24 | 'package' => 'versionx', 25 | 'version' => '1.1', 26 | 'table' => 'versionx_template', 27 | 'extends' => 'xPDOObject', 28 | 'tableMeta' => 29 | array ( 30 | 'engine' => 'InnoDB', 31 | ), 32 | 'fields' => 33 | array ( 34 | 'version_id' => NULL, 35 | 'content_id' => NULL, 36 | 'saved' => 'CURRENT_TIMESTAMP', 37 | 'user' => 0, 38 | 'mode' => 'update', 39 | 'marked' => 0, 40 | 'templatename' => NULL, 41 | 'description' => 'Template', 42 | 'category' => 0, 43 | 'content' => '', 44 | 'locked' => 0, 45 | 'properties' => NULL, 46 | ), 47 | 'fieldMeta' => 48 | array ( 49 | 'version_id' => 50 | array ( 51 | 'dbtype' => 'int', 52 | 'precision' => '11', 53 | 'phptype' => 'integer', 54 | 'null' => false, 55 | 'index' => 'pk', 56 | 'generated' => 'native', 57 | 'attributes' => 'unsigned', 58 | ), 59 | 'content_id' => 60 | array ( 61 | 'dbtype' => 'int', 62 | 'precision' => '11', 63 | 'phptype' => 'integer', 64 | 'null' => false, 65 | 'index' => 'fk', 66 | 'attributes' => 'unsigned', 67 | ), 68 | 'saved' => 69 | array ( 70 | 'dbtype' => 'timestamp', 71 | 'phptype' => 'timestamp', 72 | 'null' => false, 73 | 'default' => 'CURRENT_TIMESTAMP', 74 | ), 75 | 'user' => 76 | array ( 77 | 'dbtype' => 'int', 78 | 'precision' => '11', 79 | 'phptype' => 'integer', 80 | 'null' => false, 81 | 'default' => 0, 82 | 'index' => 'fk', 83 | ), 84 | 'mode' => 85 | array ( 86 | 'dbtype' => 'varchar', 87 | 'precision' => '24', 88 | 'phptype' => 'string', 89 | 'null' => false, 90 | 'default' => 'update', 91 | ), 92 | 'marked' => 93 | array ( 94 | 'dbtype' => 'tinyint', 95 | 'precision' => '1', 96 | 'phptype' => 'boolean', 97 | 'default' => 0, 98 | ), 99 | 'templatename' => 100 | array ( 101 | 'dbtype' => 'varchar', 102 | 'precision' => '50', 103 | 'phptype' => 'string', 104 | 'null' => false, 105 | ), 106 | 'description' => 107 | array ( 108 | 'dbtype' => 'varchar', 109 | 'precision' => '255', 110 | 'phptype' => 'string', 111 | 'default' => 'Template', 112 | ), 113 | 'category' => 114 | array ( 115 | 'dbtype' => 'int', 116 | 'precision' => '11', 117 | 'phptype' => 'integer', 118 | 'null' => false, 119 | 'default' => 0, 120 | 'index' => 'fk', 121 | ), 122 | 'content' => 123 | array ( 124 | 'dbtype' => 'mediumtext', 125 | 'phptype' => 'string', 126 | 'null' => false, 127 | 'default' => '', 128 | ), 129 | 'locked' => 130 | array ( 131 | 'dbtype' => 'tinyint', 132 | 'precision' => '1', 133 | 'attributes' => 'unsigned', 134 | 'phptype' => 'boolean', 135 | 'null' => false, 136 | 'default' => 0, 137 | ), 138 | 'properties' => 139 | array ( 140 | 'dbtype' => 'mediumtext', 141 | 'phptype' => 'array', 142 | 'null' => true, 143 | ), 144 | ), 145 | 'indexes' => 146 | array ( 147 | 'PRIMARY' => 148 | array ( 149 | 'alias' => 'PRIMARY', 150 | 'primary' => true, 151 | 'unique' => true, 152 | 'type' => 'BTREE', 153 | 'columns' => 154 | array ( 155 | 'version_id' => 156 | array ( 157 | 'length' => '', 158 | 'collation' => 'A', 159 | 'null' => false, 160 | ), 161 | ), 162 | ), 163 | 'content_id' => 164 | array ( 165 | 'alias' => 'content_id', 166 | 'primary' => false, 167 | 'unique' => false, 168 | 'type' => 'BTREE', 169 | 'columns' => 170 | array ( 171 | 'content_id' => 172 | array ( 173 | 'length' => '', 174 | 'collation' => 'A', 175 | 'null' => false, 176 | ), 177 | ), 178 | ), 179 | ), 180 | 'aggregates' => 181 | array ( 182 | 'User' => 183 | array ( 184 | 'class' => 'modUser', 185 | 'local' => 'user', 186 | 'foreign' => 'id', 187 | 'owner' => 'foreign', 188 | 'cardinality' => 'one', 189 | ), 190 | 'Template' => 191 | array ( 192 | 'class' => 'modTemplate', 193 | 'local' => 'content_id', 194 | 'foreign' => 'id', 195 | 'owner' => 'foreign', 196 | 'cardinality' => 'one', 197 | ), 198 | ), 199 | ); 200 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxtemplatevar.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/vxtemplatevar.class.php'); 24 | class vxTemplateVar_mysql extends vxTemplateVar {} 25 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/mysql/vxtemplatevar.map.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | $xpdo_meta_map['vxTemplateVar']= array ( 24 | 'package' => 'versionx', 25 | 'version' => '1.1', 26 | 'table' => 'versionx_templatevar', 27 | 'extends' => 'xPDOObject', 28 | 'tableMeta' => 29 | array ( 30 | 'engine' => 'InnoDB', 31 | ), 32 | 'fields' => 33 | array ( 34 | 'version_id' => NULL, 35 | 'content_id' => NULL, 36 | 'saved' => 'CURRENT_TIMESTAMP', 37 | 'user' => 0, 38 | 'mode' => 'update', 39 | 'marked' => 0, 40 | 'type' => '', 41 | 'name' => '', 42 | 'caption' => '', 43 | 'description' => '', 44 | 'category' => 0, 45 | 'locked' => 0, 46 | 'rank' => 0, 47 | 'display' => '', 48 | 'default_text' => NULL, 49 | 'properties' => NULL, 50 | 'input_properties' => NULL, 51 | 'output_properties' => NULL, 52 | ), 53 | 'fieldMeta' => 54 | array ( 55 | 'version_id' => 56 | array ( 57 | 'dbtype' => 'int', 58 | 'precision' => '11', 59 | 'phptype' => 'integer', 60 | 'null' => false, 61 | 'index' => 'pk', 62 | 'generated' => 'native', 63 | 'attributes' => 'unsigned', 64 | ), 65 | 'content_id' => 66 | array ( 67 | 'dbtype' => 'int', 68 | 'precision' => '11', 69 | 'phptype' => 'integer', 70 | 'null' => false, 71 | 'index' => 'fk', 72 | 'attributes' => 'unsigned', 73 | ), 74 | 'saved' => 75 | array ( 76 | 'dbtype' => 'timestamp', 77 | 'phptype' => 'timestamp', 78 | 'null' => false, 79 | 'default' => 'CURRENT_TIMESTAMP', 80 | ), 81 | 'user' => 82 | array ( 83 | 'dbtype' => 'int', 84 | 'precision' => '11', 85 | 'phptype' => 'integer', 86 | 'null' => false, 87 | 'default' => 0, 88 | 'index' => 'fk', 89 | ), 90 | 'mode' => 91 | array ( 92 | 'dbtype' => 'varchar', 93 | 'precision' => '24', 94 | 'phptype' => 'string', 95 | 'null' => false, 96 | 'default' => 'update', 97 | ), 98 | 'marked' => 99 | array ( 100 | 'dbtype' => 'tinyint', 101 | 'precision' => '1', 102 | 'phptype' => 'boolean', 103 | 'default' => 0, 104 | ), 105 | 'type' => 106 | array ( 107 | 'dbtype' => 'varchar', 108 | 'precision' => '20', 109 | 'phptype' => 'string', 110 | 'null' => false, 111 | 'default' => '', 112 | ), 113 | 'name' => 114 | array ( 115 | 'dbtype' => 'varchar', 116 | 'precision' => '50', 117 | 'phptype' => 'string', 118 | 'null' => false, 119 | 'default' => '', 120 | ), 121 | 'caption' => 122 | array ( 123 | 'dbtype' => 'varchar', 124 | 'precision' => '80', 125 | 'phptype' => 'string', 126 | 'null' => false, 127 | 'default' => '', 128 | ), 129 | 'description' => 130 | array ( 131 | 'dbtype' => 'varchar', 132 | 'precision' => '255', 133 | 'phptype' => 'string', 134 | 'null' => false, 135 | 'default' => '', 136 | ), 137 | 'category' => 138 | array ( 139 | 'dbtype' => 'int', 140 | 'precision' => '11', 141 | 'phptype' => 'integer', 142 | 'null' => false, 143 | 'default' => 0, 144 | ), 145 | 'locked' => 146 | array ( 147 | 'dbtype' => 'tinyint', 148 | 'precision' => '1', 149 | 'attributes' => 'unsigned', 150 | 'phptype' => 'boolean', 151 | 'null' => false, 152 | 'default' => 0, 153 | ), 154 | 'rank' => 155 | array ( 156 | 'dbtype' => 'int', 157 | 'precision' => '11', 158 | 'phptype' => 'integer', 159 | 'null' => false, 160 | 'default' => 0, 161 | ), 162 | 'display' => 163 | array ( 164 | 'dbtype' => 'varchar', 165 | 'precision' => '20', 166 | 'phptype' => 'string', 167 | 'null' => false, 168 | 'default' => '', 169 | ), 170 | 'default_text' => 171 | array ( 172 | 'dbtype' => 'varchar', 173 | 'precision' => '2000', 174 | 'phptype' => 'string', 175 | ), 176 | 'properties' => 177 | array ( 178 | 'dbtype' => 'mediumtext', 179 | 'phptype' => 'array', 180 | 'null' => true, 181 | ), 182 | 'input_properties' => 183 | array ( 184 | 'dbtype' => 'mediumtext', 185 | 'phptype' => 'array', 186 | 'null' => true, 187 | ), 188 | 'output_properties' => 189 | array ( 190 | 'dbtype' => 'mediumtext', 191 | 'phptype' => 'array', 192 | 'null' => true, 193 | ), 194 | ), 195 | 'indexes' => 196 | array ( 197 | 'PRIMARY' => 198 | array ( 199 | 'alias' => 'PRIMARY', 200 | 'primary' => true, 201 | 'unique' => true, 202 | 'type' => 'BTREE', 203 | 'columns' => 204 | array ( 205 | 'version_id' => 206 | array ( 207 | 'length' => '', 208 | 'collation' => 'A', 209 | 'null' => false, 210 | ), 211 | ), 212 | ), 213 | 'content_id' => 214 | array ( 215 | 'alias' => 'content_id', 216 | 'primary' => false, 217 | 'unique' => false, 218 | 'type' => 'BTREE', 219 | 'columns' => 220 | array ( 221 | 'content_id' => 222 | array ( 223 | 'length' => '', 224 | 'collation' => 'A', 225 | 'null' => false, 226 | ), 227 | ), 228 | ), 229 | ), 230 | 'aggregates' => 231 | array ( 232 | 'User' => 233 | array ( 234 | 'class' => 'modUser', 235 | 'local' => 'user', 236 | 'foreign' => 'id', 237 | 'owner' => 'foreign', 238 | 'cardinality' => 'one', 239 | ), 240 | 'TemplateVar' => 241 | array ( 242 | 'class' => 'modTemplateVar', 243 | 'local' => 'content_id', 244 | 'foreign' => 'id', 245 | 'owner' => 'foreign', 246 | 'cardinality' => 'one', 247 | ), 248 | ), 249 | ); 250 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/vxchunk.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * @deprecated 23 | */ 24 | class vxChunk extends xPDOObject { 25 | public static $excludeFields = array( 26 | 'version_id', 27 | 'saved', 28 | 'user', 29 | 'mode', 30 | 'marked', 31 | ); 32 | 33 | public static $tabJavascript = array( 34 | 'chunks/panel.chunks.js', 35 | 'chunks/grid.chunks.js', 36 | ); 37 | 38 | public static $tabTpl = 'mgr/tabs/chunks'; 39 | 40 | /** 41 | * Gets the excluded fields. 42 | * @static 43 | * @return array 44 | */ 45 | public static function getExcludeFields () { 46 | return self::$excludeFields; 47 | } 48 | 49 | /** 50 | * @static 51 | * @return array 52 | */ 53 | public static function getTabJavascript() { 54 | return self::$tabJavascript; 55 | } 56 | 57 | /** 58 | * Gets the tab template file name. 59 | * @static 60 | * @return string 61 | */ 62 | public static function getTabTpl() { 63 | return self::$tabTpl; 64 | } 65 | 66 | /** 67 | * Reverts a chunk to the selected version. 68 | * @param array $options 69 | * 70 | * @return bool 71 | */ 72 | public function revert(array $options = array()) { 73 | if (!$this->get('content_id')) { 74 | return false; 75 | } 76 | 77 | /* @var modChunk $chunk */ 78 | $chunk = $this->xpdo->getObject('modChunk',$this->get('content_id')); 79 | if (!($chunk instanceof modChunk)) { 80 | /* Could not find the chunk, so we'll assume it was deleted. We'll create a new chunk and force that ID. */ 81 | $chunk = $this->xpdo->newObject('modChunk'); 82 | $chunk->set('id', $this->get('content_id')); 83 | } 84 | 85 | $chunk->fromArray(array( 86 | 'name' => $this->get('name'), 87 | 'description' => $this->get('description'), 88 | 'category' => ($this->xpdo->getCount('modCategory',array('id' => $this->get('category'))) > 0) ? $this->get('category') : 0, 89 | 'snippet' => $this->get('snippet'), 90 | 'locked' => $this->get('locked'), 91 | ), '', true); 92 | 93 | 94 | return $chunk->save(); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/vxdelta.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | class vxDelta extends xPDOSimpleObject {} 24 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/vxdeltaeditor.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | class vxDeltaEditor extends xPDOSimpleObject {} 24 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/vxdeltafield.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | */ 23 | class vxDeltaField extends xPDOSimpleObject {} 24 | ?> -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/vxplugin.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * @deprecated 23 | */ 24 | class vxPlugin extends xPDOObject { 25 | public static $excludeFields = array( 26 | 'version_id', 27 | 'saved', 28 | 'user', 29 | 'mode', 30 | 'marked', 31 | ); 32 | 33 | public static $tabJavascript = array( 34 | 'plugins/panel.plugins.js', 35 | 'plugins/grid.plugins.js', 36 | ); 37 | 38 | public static $tabTpl = 'mgr/tabs/plugins'; 39 | /** 40 | * Gets the excluded fields. 41 | * @static 42 | * @return array 43 | */ 44 | public static function getExcludeFields () { 45 | return self::$excludeFields; 46 | } 47 | /** 48 | * @static 49 | * @return array 50 | */ 51 | public static function getTabJavascript() { 52 | return self::$tabJavascript; 53 | } 54 | 55 | /** 56 | * Gets the tab template file name. 57 | * @static 58 | * @return string 59 | */ 60 | public static function getTabTpl() { 61 | return self::$tabTpl; 62 | } 63 | 64 | /** 65 | * Reverts a snippet to the selected version. 66 | * @param array $options 67 | * 68 | * @return bool 69 | */ 70 | public function revert(array $options = array()) { 71 | if (!$this->get('content_id')) { 72 | return false; 73 | } 74 | 75 | /* @var modPlugin $object */ 76 | $object = $this->xpdo->getObject('modPlugin',$this->get('content_id')); 77 | if (!($object instanceof modPlugin)) { 78 | /* Could not find the snippet, so we'll assume it was deleted. We'll create a new one and force that ID. */ 79 | $object = $this->xpdo->newObject('modPlugin'); 80 | $object->set('id', $this->get('content_id')); 81 | } 82 | 83 | $object->fromArray(array( 84 | 'name' => $this->get('name'), 85 | 'description' => $this->get('description'), 86 | 'category' => ($this->xpdo->getCount('modCategory',array('id' => $this->get('category'))) > 0) ? $this->get('category') : 0, 87 | 'plugincode' => $this->get('plugincode'), 88 | 'locked' => $this->get('locked'), 89 | 'disabled' => $this->get('disabled'), 90 | ), '', true); 91 | 92 | return $object->save(); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/vxresource.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * @deprecated 23 | */ 24 | class vxResource extends xPDOObject { 25 | public static $excludeFields = array( 26 | 'version_id', 27 | 'saved', 28 | 'user', 29 | 'mode', 30 | 'marked', 31 | 32 | 'fields' => array( 33 | 'createdon', 34 | 'createdby', 35 | 'editedon', 36 | 'editedby', 37 | ) 38 | ); 39 | 40 | public static $tabJavascript = array( 41 | 'resources/panel.resources.js', 42 | 'resources/grid.resources.js', 43 | ); 44 | 45 | public static $tabTpl = 'mgr/tabs/resources'; 46 | 47 | /** 48 | * Gets the excluded fields. 49 | * @static 50 | * @return array 51 | */ 52 | public static function getExcludeFields () { 53 | return self::$excludeFields; 54 | } 55 | 56 | /** 57 | * Gets the Javascript filenames that are required for tabs. 58 | * @static 59 | * @return array 60 | */ 61 | public static function getTabJavascript() { 62 | return self::$tabJavascript; 63 | } 64 | 65 | /** 66 | * Gets the tab template file name. 67 | * @static 68 | * @return string 69 | */ 70 | public static function getTabTpl() { 71 | return self::$tabTpl; 72 | } 73 | 74 | /** 75 | * Reverts a resource to the selected version. 76 | * @param array $options 77 | * 78 | * @return bool 79 | */ 80 | public function revert(array $options = array()) { 81 | if (!$this->get('content_id')) { 82 | return false; 83 | } 84 | 85 | /* @var modResource $resource */ 86 | $resource = $this->xpdo->getObject('modResource',$this->get('content_id')); 87 | if (!($resource instanceof modResource)) { 88 | /* Could not find the resource, so we'll assume it was deleted. We'll create a new resource and force that ID. */ 89 | $resource = $this->xpdo->newObject($this->get('class')); 90 | $resource->set('id', $this->get('content_id')); 91 | } 92 | 93 | $content = $this->get('content'); 94 | $fields = $this->get('fields'); 95 | $tvs = $this->get('tvs'); 96 | 97 | $resource->setContent($content); 98 | foreach ($fields as $key => $value) { 99 | if (in_array($key, array('id', 'type'))) { continue; } 100 | $resource->set($key, $value); 101 | } 102 | 103 | foreach ($tvs as $tv) { 104 | if (!$resource->setTVValue($tv['id'], $tv['value'])) { 105 | $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, '[VersionX:vxResource/revert] Resource: ' . $this->get('content_id') . ' | Unable of setting TV ' . $tv['id'] . ' to ' . $tv['value']); 106 | return false; 107 | } 108 | } 109 | 110 | return $resource->save(); 111 | } 112 | } 113 | 114 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/vxsnippet.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * @deprecated 23 | */ 24 | class vxSnippet extends xPDOObject { 25 | public static $excludeFields = array( 26 | 'version_id', 27 | 'saved', 28 | 'user', 29 | 'mode', 30 | 'marked', 31 | ); 32 | 33 | public static $tabJavascript = array( 34 | 'snippets/panel.snippets.js', 35 | 'snippets/grid.snippets.js', 36 | ); 37 | 38 | public static $tabTpl = 'mgr/tabs/snippets'; 39 | /** 40 | * Gets the excluded fields. 41 | * @static 42 | * @return array 43 | */ 44 | public static function getExcludeFields () { 45 | return self::$excludeFields; 46 | } 47 | /** 48 | * @static 49 | * @return array 50 | */ 51 | public static function getTabJavascript() { 52 | return self::$tabJavascript; 53 | } 54 | 55 | /** 56 | * Gets the tab template file name. 57 | * @static 58 | * @return string 59 | */ 60 | public static function getTabTpl() { 61 | return self::$tabTpl; 62 | } 63 | 64 | /** 65 | * Reverts a snippet to the selected version. 66 | * @param array $options 67 | * 68 | * @return bool 69 | */ 70 | public function revert(array $options = array()) { 71 | if (!$this->get('content_id')) { 72 | return false; 73 | } 74 | 75 | /* @var modSnippet $object */ 76 | $object = $this->xpdo->getObject('modSnippet',$this->get('content_id')); 77 | if (!($object instanceof modSnippet)) { 78 | /* Could not find the snippet, so we'll assume it was deleted. We'll create a new one and force that ID. */ 79 | $object = $this->xpdo->newObject('modSnippet'); 80 | $object->set('id', $this->get('content_id')); 81 | } 82 | 83 | $object->fromArray(array( 84 | 'name' => $this->get('name'), 85 | 'description' => $this->get('description'), 86 | 'category' => ($this->xpdo->getCount('modCategory',array('id' => $this->get('category'))) > 0) ? $this->get('category') : 0, 87 | 'snippet' => $this->get('snippet'), 88 | 'locked' => $this->get('locked'), 89 | ), '', true); 90 | 91 | return $object->save(); 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/vxtemplate.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * @deprecated 23 | */ 24 | class vxTemplate extends xPDOObject { 25 | public static $excludeFields = array( 26 | 'version_id', 27 | 'saved', 28 | 'user', 29 | 'mode', 30 | 'marked', 31 | ); 32 | 33 | public static $tabJavascript = array( 34 | 'templates/panel.templates.js', 35 | 'templates/grid.templates.js', 36 | ); 37 | 38 | public static $tabTpl = 'mgr/tabs/templates'; 39 | 40 | /** 41 | * Gets the excluded fields. 42 | * @static 43 | * @return array 44 | */ 45 | public static function getExcludeFields () { 46 | return self::$excludeFields; 47 | } 48 | 49 | /** 50 | * Gets the Javascript filenames that are required for tabs. 51 | * @static 52 | * @return array 53 | */ 54 | public static function getTabJavascript() { 55 | return self::$tabJavascript; 56 | } 57 | 58 | /** 59 | * Gets the tab template file name. 60 | * @static 61 | * @return string 62 | */ 63 | public static function getTabTpl() { 64 | return self::$tabTpl; 65 | } 66 | 67 | 68 | /** 69 | * Reverts a template to the selected version. 70 | * @param array $options 71 | * 72 | * @return bool 73 | */ 74 | public function revert(array $options = array()) { 75 | if (!$this->get('content_id')) { 76 | return false; 77 | } 78 | 79 | /* @var modTemplate $template */ 80 | $template = $this->xpdo->getObject('modTemplate',$this->get('content_id')); 81 | if (!($template instanceof modTemplate)) { 82 | /* Could not find the template, so we'll assume it was deleted. We'll create a new one and force that ID. */ 83 | $template = $this->xpdo->newObject('modTemplate'); 84 | $template->set('id', $this->get('content_id')); 85 | } 86 | 87 | $template->fromArray(array( 88 | 'templatename' => $this->get('templatename'), 89 | 'description' => $this->get('description'), 90 | 'category' => ($this->xpdo->getCount('modCategory',array('id' => $this->get('category'))) > 0) ? $this->get('category') : 0, 91 | 'content' => $this->get('content'), 92 | 'locked' => $this->get('locked'), 93 | ), '', true); 94 | 95 | return $template->save(); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /core/components/versionx/model/versionx/vxtemplatevar.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * This file is part of VersionX, a versioning solution for MODX Revolution 8 | * 9 | * VersionX is free software; you can redistribute it and/or modify it under 10 | * the terms of the GNU General Public License as published by the Free Software 11 | * Foundation; either version 2 of the License, or (at your option) any later 12 | * version. 13 | * 14 | * VersionX is distributed in the hope that it will be useful, but WITHOUT ANY 15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 16 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License along with 19 | * VersionX; if not, write to the Free Software Foundation, Inc., 59 Temple Place, 20 | * Suite 330, Boston, MA 02111-1307 USA 21 | * 22 | * @deprecated 23 | */ 24 | class vxTemplateVar extends xPDOObject { 25 | public static $excludeFields = array( 26 | 'version_id', 27 | 'saved', 28 | 'user', 29 | 'mode', 30 | 'marked', 31 | ); 32 | 33 | public static $tabJavascript = array( 34 | 'templatevars/panel.templatevars.js', 35 | 'templatevars/grid.templatevars.js', 36 | ); 37 | 38 | public static $tabTpl = 'mgr/tabs/templatevars'; 39 | /** 40 | * Gets the Javascript filenames that are required for tabs. 41 | * @static 42 | * @return array 43 | */ 44 | 45 | /** 46 | * Gets the excluded fields. 47 | * @static 48 | * @return array 49 | */ 50 | public static function getExcludeFields () { 51 | return self::$excludeFields; 52 | } 53 | 54 | public static function getTabJavascript() { 55 | return self::$tabJavascript; 56 | } 57 | 58 | /** 59 | * Gets the tab template file name. 60 | * @static 61 | * @return string 62 | */ 63 | public static function getTabTpl() { 64 | return self::$tabTpl; 65 | } 66 | 67 | /** 68 | * Reverts a snippet to the selected version. 69 | * @param array $options 70 | * 71 | * @return bool 72 | */ 73 | public function revert(array $options = array()) { 74 | if (!$this->get('content_id')) { 75 | return false; 76 | } 77 | 78 | /* @var modTemplateVar $object */ 79 | $object = $this->xpdo->getObject('modTemplateVar',$this->get('content_id')); 80 | if (!($object instanceof modTemplateVar)) { 81 | /* Could not find the TV, so we'll assume it was deleted. We'll create a new one and force that ID. */ 82 | $object = $this->xpdo->newObject('modTemplateVar'); 83 | $object->set('id', $this->get('content_id')); 84 | } 85 | 86 | $object->fromArray(array( 87 | 'name' => $this->get('name'), 88 | 'caption' => $this->get('caption'), 89 | 'description' => $this->get('description'), 90 | 'category' => ($this->xpdo->getCount('modCategory',array('id' => $this->get('category'))) > 0) ? $this->get('category') : 0, 91 | 'rank' => $this->get('rank'), 92 | 'display' => $this->get('display'), 93 | 'default_text' => $this->get('default_text'), 94 | 'properties' => $this->get('properties'), 95 | 'input_properties' => $this->get('input_properties'), 96 | 'output_properties' => $this->get('output_properties'), 97 | ), '', true); 98 | 99 | return $object->save(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /core/components/versionx/processors/mgr/deltas/getlist.class.php: -------------------------------------------------------------------------------- 1 | versionX = new VersionX($this->modx); 21 | if (!in_array($this->getProperty('type'), VersionX::CORE_TYPES)) { 22 | $this->versionX->loadCustomClasses(); 23 | } 24 | 25 | $typeClass = '\\' . $this->getProperty('type'); 26 | $this->type = new $typeClass($this->versionX); 27 | 28 | $this->modx->getService('smarty', 'smarty.modSmarty', '', [ 29 | 'template_dir' => $this->versionX->config['templates_path'], 30 | ]); 31 | 32 | $this->magicPreviewLoaded = $this->versionX->magicPreviewLoaded(); 33 | 34 | return $init; 35 | } 36 | 37 | public function prepareQueryBeforeCount(xPDOQuery $c): xPDOQuery 38 | { 39 | $c->leftJoin('vxDeltaEditor', 'Editor', [ 40 | 'Editor.delta = vxDelta.id', 41 | ]); 42 | $c->leftJoin('modUser', 'User', [ 43 | 'User.id = Editor.user' 44 | ]); 45 | $c->leftJoin('modUserProfile', 'Profile', ['Profile.internalKey = User.id']); 46 | 47 | $c->where([ 48 | 'vxDelta.principal' => $this->getProperty('principal'), 49 | 'vxDelta.principal_class' => $this->getProperty('principal_class'), 50 | 'vxDelta.principal_package' => $this->getProperty('principal_package'), 51 | ]); 52 | 53 | // Search filter 54 | $query = $this->getProperty('query', ''); 55 | if (!empty($query)) { 56 | // Allow searching by field name 57 | $c->where([ 58 | "EXISTS ( 59 | SELECT DeltaField.field 60 | FROM {$this->modx->getTableName(vxDeltaField::class)} DeltaField 61 | WHERE DeltaField.delta = vxDelta.id AND 62 | DeltaField.field LIKE '%{$query}%' 63 | )", 64 | ]); 65 | } 66 | 67 | // Date from filter 68 | $dateFrom = $this->getProperty('date_from'); 69 | if (!empty($dateFrom)) { 70 | $c->where([ 71 | 'time_start:>=' => $dateFrom, 72 | 'OR:time_end:>=' => $dateFrom, 73 | ]); 74 | } 75 | 76 | // Date to filter 77 | $dateTo = $this->getProperty('date_to'); 78 | if (!empty($dateTo)) { 79 | $c->where([ 80 | 'time_start:<=' => $dateTo, 81 | 'OR:time_end:<=' => $dateTo, 82 | ]); 83 | } 84 | 85 | // Editor filter 86 | $editor = $this->getProperty('editor'); 87 | if (!empty($editor)) { 88 | $c->where([ 89 | 'User.username' => $editor, 90 | ]); 91 | } 92 | 93 | $c->select([ 94 | 'vxDelta.*', 95 | 'user_id' => 'User.id', 96 | 'User.username', 97 | ]); 98 | 99 | // $c->prepare(); 100 | // $this->modx->log(1, $c->toSQL()); 101 | 102 | return $c; 103 | } 104 | 105 | public function prepareRow(xPDOObject $object): array 106 | { 107 | // TODO: Maybe getting the fields like this isn't the most efficient 108 | $fields = $this->modx->getCollection(vxDeltaField::class, [ 109 | 'delta' => $object->get('id'), 110 | ]); 111 | 112 | // Sort fields as per the Type::getFieldOrder(); 113 | $order = $this->type->getFieldOrder(); 114 | $sorted = []; 115 | foreach ($order as $position) { 116 | foreach ($fields as $field) { 117 | if ($field->get('field') === $position) { 118 | $sorted[] = $field; 119 | } 120 | } 121 | } 122 | // Merge removing duplicates 123 | $fields = array_unique(array_merge($sorted, $fields), SORT_REGULAR); 124 | 125 | $row = $object->toArray(); 126 | 127 | // Flag if MagicPreview is loaded so preview buttons can be used 128 | $row['show_previews'] = $this->magicPreviewLoaded; 129 | 130 | $diffFile = $this->versionX->config['templates_path'] . 'mgr/diff.tpl'; 131 | if (!file_exists($diffFile)) { 132 | return []; 133 | } 134 | 135 | $row['diffs'] = ''; 136 | foreach($fields as $field) { 137 | // Attempt to get diff from cache 138 | $key = "{$object->get('principal_package')}" 139 | . "/{$object->get('principal_class')}" 140 | . "/{$object->get('principal')}" 141 | . "/{$object->get('id')}" 142 | . "/{$field->get('id')}"; 143 | 144 | // Use cached render if available 145 | if (!$renderedDiff = $this->modx->cacheManager->get($key, VersionX::CACHE_OPT)) { 146 | // Otherwise calculate diff 147 | $fieldType = $this->type->getFieldClass($field->get('field')); 148 | $fieldTypeObj = new $fieldType($field->get('after')); 149 | $renderedDiff = $fieldTypeObj->render($field->get('before'), $field->get('after')); 150 | 151 | // Save in cache 152 | if ($renderedDiff) { 153 | $this->modx->cacheManager->set($key, $renderedDiff, 7200, VersionX::CACHE_OPT); 154 | } 155 | } 156 | 157 | $this->modx->smarty->assign([ 158 | 'name' => $field->get('field'), 159 | 'diff' => $renderedDiff, 160 | 'field_id' => $field->get('id'), 161 | 'delta_id' => $field->get('delta'), 162 | 'initial' => $object->get('milestone') === '_initial_', 163 | 'undo' => $this->modx->lexicon('versionx.deltas.undo'), 164 | ]); 165 | $row['diffs'] .= $this->modx->smarty->fetch($diffFile); 166 | } 167 | 168 | return $row; 169 | } 170 | } 171 | 172 | return VersionXDeltasGetlistProcessor::class; 173 | -------------------------------------------------------------------------------- /core/components/versionx/processors/mgr/deltas/milestone.class.php: -------------------------------------------------------------------------------- 1 | versionX = new VersionX($this->modx); 14 | 15 | $deltaId = $this->getProperty('delta_id'); 16 | if (empty($deltaId)) { 17 | $this->modx->log(modX::LOG_LEVEL_ERROR, '[VersionX] Delta id not sent to milestone processor!'); 18 | return 'Delta id not found.'; 19 | } 20 | $this->deltaId = $this->getProperty('delta_id'); 21 | 22 | if ($this->getProperty('what') === 'add') { 23 | $milestone = $this->getProperty('milestone'); 24 | 25 | if (empty($milestone)) { 26 | $this->modx->log(modX::LOG_LEVEL_ERROR, '[VersionX] Milestone tag not sent to milestone processor!'); 27 | return 'Milestone tag missing'; 28 | } 29 | $this->milestone = $this->getProperty('milestone'); 30 | } 31 | 32 | return $init; 33 | } 34 | 35 | public function process() 36 | { 37 | switch ($this->getProperty('what')) { 38 | case 'remove': 39 | // Remove milestone name from delta 40 | if ($this->versionX->deltas()->removeMilestone($this->deltaId)) { 41 | return $this->success('Success'); 42 | } 43 | 44 | break; 45 | 46 | case 'add': 47 | // Add milestone name to delta 48 | if ($this->versionX->deltas()->addMilestone($this->deltaId, $this->milestone)) { 49 | return $this->success('Success'); 50 | } 51 | break; 52 | } 53 | 54 | return $this->failure(); 55 | } 56 | } 57 | return 'VersionXDeltaMilestoneProcessor'; -------------------------------------------------------------------------------- /core/components/versionx/processors/mgr/deltas/optimize.class.php: -------------------------------------------------------------------------------- 1 | versionX = new VersionX($this->modx); 16 | $this->versionX->loadCustomClasses(); 17 | 18 | return $init; 19 | } 20 | 21 | public function process() 22 | { 23 | 24 | $this->versionX->deltas()->optimizeDeltas(); 25 | return $this->success('Success'); 26 | } 27 | } 28 | return 'VersionXOptimizeDeltasProcessor'; -------------------------------------------------------------------------------- /core/components/versionx/processors/mgr/deltas/preview.class.php: -------------------------------------------------------------------------------- 1 | modx->getOption( 12 | 'magicpreview.core_path', 13 | null, 14 | $this->modx->getOption('core_path') . 'components/magicpreview/' 15 | ); 16 | $this->magicPreview ??= $this->modx->getService( 17 | 'magicpreview', 18 | 'MagicPreview', 19 | $path . '/model/magicpreview/' 20 | ); 21 | 22 | return $init; 23 | } 24 | 25 | public function process() 26 | { 27 | $resource = $this->modx->getObject(modResource::class, ['id' => $this->getProperty('id')]); 28 | if (!$resource) { 29 | return $this->failure('Resource not found'); 30 | } 31 | 32 | $properties = array_merge($this->properties, $resource->toArray()); 33 | /** @var modProcessorResponse $response */ 34 | $response = $this->modx->runProcessor('resource/preview', $properties, [ 35 | 'processors_path' => $this->magicPreview->config['processorsPath'], 36 | ]); 37 | 38 | return $this->success('', $response->getResponse()['object']); 39 | } 40 | } 41 | return 'VersionXRevertPreviewProcessor'; -------------------------------------------------------------------------------- /core/components/versionx/processors/mgr/deltas/revert.class.php: -------------------------------------------------------------------------------- 1 | versionX = new VersionX($this->modx); 16 | 17 | $typeClass = '\\' . $this->getProperty('type'); 18 | $this->type = new $typeClass($this->versionX); 19 | 20 | $objectId = $this->getProperty('principal'); 21 | if (empty($objectId)) { 22 | $this->modx->log(modX::LOG_LEVEL_ERROR, '[VersionX] Principal id not sent to revert processor!'); 23 | return 'Principal object id not found.'; 24 | } 25 | 26 | $deltaId = $this->getProperty('delta_id'); 27 | if (empty($deltaId)) { 28 | $this->modx->log(modX::LOG_LEVEL_ERROR, '[VersionX] Delta id not sent to revert processor!'); 29 | return 'Delta id not found.'; 30 | } 31 | 32 | $this->objectId = $this->getProperty('principal'); 33 | $this->deltaId = $this->getProperty('delta_id'); 34 | $this->fieldId = $this->getProperty('field_id'); 35 | 36 | $this->versionX->loadCustomClasses(); 37 | 38 | return $init; 39 | } 40 | 41 | public function process() 42 | { 43 | switch ($this->getProperty('what')) { 44 | case 'revert_field': 45 | // Reverts a single field change on the object 46 | $this->versionX->deltas()->revertObject($this->deltaId, $this->objectId, $this->type, $this->fieldId); 47 | break; 48 | 49 | case 'revert_delta': 50 | // Reverts all field changes on the object that are related to the delta 51 | $this->versionX->deltas()->revertObject($this->deltaId, $this->objectId, $this->type); 52 | break; 53 | 54 | case 'revert_all': 55 | // Reverts all fields on the object to the end_time on the delta 56 | $this->versionX->deltas()->revertToPointInTime($this->deltaId, $this->objectId, $this->type); 57 | break; 58 | } 59 | 60 | return $this->success('Success'); 61 | } 62 | } 63 | return 'VersionXObjectRevertProcessor'; -------------------------------------------------------------------------------- /core/components/versionx/processors/mgr/filters/classes.class.php: -------------------------------------------------------------------------------- 1 | get('principal_class'); 16 | return [ 17 | 'id' => $name, 18 | 'name' => $name, 19 | ]; 20 | } 21 | } 22 | return 'VersionXClassFilterProcessor'; 23 | -------------------------------------------------------------------------------- /core/components/versionx/processors/mgr/filters/editors.class.php: -------------------------------------------------------------------------------- 1 | innerJoin(modUser::class, 'User', [ 16 | 'vxDeltaEditor.user = User.id', 17 | ]); 18 | 19 | $c->select([ 20 | 'id' => 'MIN(vxDeltaEditor.id)', 21 | 'username' => 'User.username', 22 | ]); 23 | 24 | $query = trim($this->getProperty('query')); 25 | if ($query) { 26 | $c->where(['User.username:LIKE' => '%'.$query.'%']); 27 | } 28 | 29 | $c->groupBy('User.username'); 30 | 31 | return $c; 32 | } 33 | 34 | /** 35 | * @param xPDOObject $object 36 | * @return array 37 | */ 38 | public function prepareRow(xPDOObject $object): array 39 | { 40 | $name = $object->get('username'); 41 | return [ 42 | 'id' => $name, 43 | 'name' => $name, 44 | ]; 45 | } 46 | } 47 | return 'VersionXEditorsFilterProcessor'; 48 | -------------------------------------------------------------------------------- /core/components/versionx/processors/mgr/filters/packages.class.php: -------------------------------------------------------------------------------- 1 | get('principal_package'); 16 | return [ 17 | 'id' => $name, 18 | 'name' => $name, 19 | ]; 20 | } 21 | } 22 | return 'VersionXPackagesFilterProcessor'; 23 | -------------------------------------------------------------------------------- /core/components/versionx/src/Enums/RevertAction.php: -------------------------------------------------------------------------------- 1 | value) { 30 | $this->value = $value; 31 | } 32 | 33 | $this->fieldName = $name; 34 | $this->options = $options; 35 | $this->parse(); 36 | } 37 | 38 | /** 39 | * Runs when the Field is created 40 | * Override in derivatives if the value needs to be manipulated 41 | * @return void 42 | */ 43 | protected function parse() 44 | {} 45 | 46 | /** 47 | * @return mixed 48 | */ 49 | public function getValue($options = []) 50 | { 51 | return $this->value; 52 | } 53 | 54 | public function getName() 55 | { 56 | return $this->fieldName; 57 | } 58 | 59 | /** 60 | * @return string 61 | */ 62 | public function getTpl(): string 63 | { 64 | return $this->tpl; 65 | } 66 | 67 | public function render(string $prevValue, string $newValue, array $options = []): string 68 | { 69 | return DeltaManager::calculateDiff($prevValue, $newValue); 70 | } 71 | } -------------------------------------------------------------------------------- /core/components/versionx/src/Fields/Image.php: -------------------------------------------------------------------------------- 1 | value)) { 10 | $this->value = self::splitPropertyValues($this->value, $this->fieldName); 11 | } 12 | } 13 | 14 | /** 15 | * 16 | * @param array $arrayField 17 | * @param string $name 18 | * @param array $fields 19 | * @return array 20 | */ 21 | public static function splitPropertyValues(array $arrayField, string $name = '', array &$fields = []): array 22 | { 23 | $arrays = []; 24 | foreach ($arrayField as $field => $value) { 25 | if (empty($name)) { 26 | $fields[$field] = $value; 27 | continue; 28 | } 29 | if (is_numeric($field)) { 30 | $fields[$name][$field] = $value; 31 | continue; 32 | } 33 | if (!is_array($value)) { 34 | $fields["{$name}.{$field}"] = $value; 35 | continue; 36 | } 37 | 38 | $arrays[$field] = $value; 39 | } 40 | 41 | foreach ($arrays as $field => $value) { 42 | self::splitPropertyValues($value, "{$name}.{$field}", $fields); 43 | } 44 | 45 | return $fields; 46 | } 47 | 48 | /** 49 | * @param \vxDeltaField $field 50 | * @param mixed $data 51 | * @return mixed 52 | */ 53 | public static function revertPropertyValue(\vxDeltaField $field, &$data) 54 | { 55 | if (!is_array($data)) { 56 | return $data; 57 | } 58 | 59 | $pieces = explode('.', $field->get('field')); 60 | $last = end($pieces); 61 | foreach ($pieces as $piece) { 62 | if (!array_key_exists($piece, $data)) { 63 | continue; 64 | } 65 | 66 | // The last 'piece' will be the key we're after. 67 | if ($piece === $last) { 68 | $beforeValue = $field->get('before'); 69 | $beforeType = $field->get('before_type'); 70 | 71 | if (in_array($beforeType, ['array', 'object'])) { 72 | // Decode if it's meant to be an array/object 73 | $decoded = json_decode($beforeValue, true); 74 | $data[$piece] = $decoded ?: $field->get('before'); 75 | } 76 | else if (in_array(strtolower($beforeType), self::ACCEPTED_VALUE_TYPES)) { 77 | // Cast as the set type 78 | $data[$piece] = settype($beforeValue, $beforeType); 79 | } 80 | else { 81 | // If we're here treat as a string 82 | $data[$piece] = $field->get('before'); 83 | } 84 | 85 | } 86 | else { 87 | $data = &$data[$piece]; 88 | } 89 | } 90 | 91 | return $data; 92 | } 93 | 94 | } -------------------------------------------------------------------------------- /core/components/versionx/src/Fields/Text.php: -------------------------------------------------------------------------------- 1 | Properties::class, 34 | ]; 35 | protected array $tvTypes = [ 36 | Image::class => [ 37 | 'image', 38 | ], 39 | ]; 40 | 41 | /** 42 | * Opportunity to add additional \vxDeltaField objects to the array. For example, adding TV values when saving 43 | * a resource. 44 | * @param \vxDeltaField[] $fields - Array of fields to save in the new delta 45 | * @param array $prevFields - Array of fields from the previous delta 46 | * @param \xPDOObject $object - The object being versioned 47 | * @return \vxDeltaField[] - The list of fields to be saved in the new delta. 48 | */ 49 | public function includeFieldsOnCreate(array $fields, array $prevFields, \xPDOObject $object): array 50 | { 51 | // Determine what TV values currently exist for this resource. 52 | /** @var \modResource $object */ 53 | $tvs = $object->getTemplateVars(); 54 | $tvNames = []; 55 | foreach ($tvs as $tv) { 56 | $tvNames[] = $tv->get('name'); 57 | } 58 | 59 | // Grab the most recent TV value fields 60 | $prevFields = $this->versionX->deltas()->getClosestDeltaFields($this, $object, $tvNames); 61 | 62 | // Loop through TVs matching previous delta fields by TV name 63 | /* @var \MODX\Revolution\modTemplateVar|\modTemplateVar $tv */ 64 | foreach ($tvs as $tv) { 65 | $prevValue = ''; 66 | foreach ($prevFields as $prevField) { 67 | if ($prevField->get('field') === $tv->get('name')) { 68 | $prevValue = $prevField->get('after'); 69 | break; 70 | } 71 | } 72 | 73 | // If a TV passes a null value (e.g. an empty Image TV), set it as an empty string so it can be compared 74 | $tvValue = $tv->get('value'); 75 | if ($tvValue === null) { 76 | $tvValue = ''; 77 | } 78 | 79 | // Check if TV type is assigned to a VersionX field type 80 | $fieldObj = null; 81 | foreach ($this->tvTypes as $class => $types) { 82 | if (in_array($tv->get('type'), $types)) { 83 | // If found, include the TV and resource id as config options to assist with rendering 84 | $fieldObj = new $class($tvValue, $tv->get('name')); 85 | } 86 | } 87 | 88 | // Default Text if no VersionX field types matched 89 | if (!isset($fieldObj)) { 90 | $fieldObj = new Text($tvValue); 91 | } 92 | 93 | $field = $this->modx->newObject(\vxDeltaField::class, [ 94 | 'field' => $tv->get('name'), 95 | 'field_type' => get_class($fieldObj), 96 | 'before' => $prevValue, 97 | 'after' => $tvValue, 98 | 'diff' => $fieldObj->render($prevValue, $fieldObj->getValue()), 99 | ]); 100 | 101 | $fields[] = $field; 102 | } 103 | 104 | return $fields; 105 | } 106 | 107 | 108 | /** 109 | * Runs before object being reverted is saved. 110 | * @param string $action - 'all', 'delta', or 'single' 111 | * @param array $fields - the delta fields that are being saved to the object 112 | * @param \xPDOObject $object - the object being reverted 113 | * @param string $now 114 | * @param string|null $deltaTimestamp 115 | * @return \xPDOObject 116 | */ 117 | public function afterRevert(string $action, array $fields, \xPDOObject $object, string $now, string $deltaTimestamp = null): \xPDOObject 118 | { 119 | // Be sure to call the parent method, so we get common field processing 120 | $object = parent::afterRevert($action, $fields, $object, $now, $deltaTimestamp); 121 | 122 | $object->set('editedby', $this->modx->user->get('id')); 123 | $object->set('editedon', $now); 124 | 125 | // Get any TVs attached to this resource 126 | $tvs = $object->getMany('TemplateVars'); 127 | 128 | // Get TVs not included in selected delta if RevertAction::ALL 129 | if ($action === RevertAction::ALL) { 130 | $tvNames = []; 131 | foreach ($tvs as $tv) { 132 | $tvNames[] = $tv->get('name'); 133 | } 134 | 135 | // Grab the most recent TV value fields 136 | $fields = array_merge( 137 | $fields, 138 | $this->versionX->deltas()->getClosestDeltaFields($this, $object, $tvNames, $deltaTimestamp) 139 | ); 140 | } 141 | 142 | foreach ($fields as $field) { 143 | $this->revertTVValues($field, $object, $tvs); 144 | } 145 | 146 | // Skip saving if not allowed e.g. in ResourcePreview 147 | if ($this->persistChanges && !$object->save(true)) { 148 | $this->modx->log(MODX_LOG_LEVEL_ERROR, 149 | '[VersionX] Error saving ' . get_class($object) . ' with id: ' . $object->get('id')); 150 | } 151 | 152 | return $object; 153 | } 154 | 155 | /** 156 | * Match field and TV names, updating TVs with delta field values. 157 | * @param \vxDeltaField $field 158 | * @param \xPDOObject $object 159 | * @param array $tvs 160 | * @return void 161 | */ 162 | protected function revertTVValues(\vxDeltaField $field, \xPDOObject $object, array $tvs) 163 | { 164 | // TODO: consider recreating a TV if it has since been deleted... but may not be possible. 165 | foreach ($tvs as $tv) { 166 | if ($tv->get('name') === $field->get('field')) { 167 | // Get actual TV object to save, now that we have the id. 168 | $tvObj = $this->modx->getObject(\modTemplateVarResource::class, [ 169 | 'tmplvarid' => $tv->get('id'), 170 | 'contentid' => $object->get('id'), 171 | ]); 172 | 173 | $tvObj->set('value', $field->get('before')); 174 | 175 | // Skip saving if not allowed e.g. in ResourcePreview 176 | if ($this->persistChanges) { 177 | $tvObj->save(); 178 | } 179 | } 180 | } 181 | } 182 | } -------------------------------------------------------------------------------- /core/components/versionx/src/Types/ResourcePreview.php: -------------------------------------------------------------------------------- 1 | $value) { 21 | if (is_array($value)) { 22 | $value = '{' . self::flattenArray($value) .'}'; 23 | } 24 | if (!empty($value)) { 25 | $string[] = $key . ':' . $value; 26 | } 27 | } 28 | return implode(',', $string); 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /core/components/versionx/templates/mgr/diff.tpl: -------------------------------------------------------------------------------- 1 |