Coder Social home page Coder Social logo

modmore / versionx Goto Github PK

View Code? Open in Web Editor NEW
40.0 11.0 20.0 5.11 MB

Resource & Element Versioning Extra for MODX Revolution (supports 2.2 and up). Extends the core in a future-proof manner to keep copies of every change to resources, templates, template variables, chunks, snippets and plugins.

Home Page: https://modmore.com/extras/versionx/

PHP 84.36% JavaScript 11.36% Smarty 0.79% CSS 3.49%

versionx's Introduction

VersionX 3

If you're looking for the previous version of VersionX, see the v2 branch.

VersionX is a versioning system for the MODX content management system. It keeps track of changes to your resources, templates, template variables, chunks, snippets, plugins, and now in v3 custom objects too! You can view historic changes and revert changes from a simple dashboard.

VersionX Screenshot

v3.0 is a complete rewrite and is not compatible with v2. There is, however, a migration utility included that will assist with moving your old data to the new tables.

Funding Goal Reached

VersionX 3.0 was made possible by community funding. Special thanks to:

Requirements

  • MODX 2.6.5+
  • PHP 7.4+

Installation

VersionX can be installed from either the modmore package provider, or the MODX package provider.

New UI

The UI in VersionX 3.0 has been overhauled and simplified.

Manager Page

The VersionX manager page is availble at Extras -> VersionX in the MODX manager. Here you'll find the main objects grid that lists all objects that have at least one version stored. They are sorted by the latest update, and can be filtered by the package they belong to, the type of object (Resource, Template, Chunk, Snippet, TV, Plugin, or custom), the user who made the update and the date.

By default, only core object types are displayed. If you would like to include custom objects, please refer to the sections Object Types and Versioning Custom Objects below.

To view the stored versions for an object, right-click on it and select View Details. A window will open with a list of deltas for that object. Each delta represents a grouping of all the fields that changed at a particular point in time. Inside each delta you'll see a list of rendereded diffs for each field name showing the before and after values.]

Versions Tab

On each Resource and Element manager page, you'll see an extra "Versions" tab that's been added by VersionX. Switching to this tab will display the same list of deltas as when opening the detail window on the VersionX manager page.

Reverting Changes

Reverting changes is performed either on the versions tab of the manager Resource/Element form, or via the main VersionX manager page.

Look through the list of deltas, and find the one you want to revert to. There are three buttons available for reverting.

  • Undo: On the right-hand side of every diff, you'll see undo buttons for each field listed. Clicking undo will revert the change for that field only, ignoring all the other fields within that delta.
  • Revert these changes: In the top-right corner of each delta, you'll see the Revert these changes button. This will revert all fields within that delta, but no others.
  • Revert all fields to this point in time: This button sits between deltas, and reverts ALL fields regardless of which delta they are in, to that point in time. (This point in time refers to the "end time" of the delta just below it).

Fields

Different field types in v3 allow for unique behavior when creating, reverting, or rendering deltas. In addition to the standard Text field, the Properties field is now available.

Properties fields are defined for an object in the type class (see Object Types section below) and are typically used for fields that contain more than one value, such as a serialized value. The properties field breaks the value apart recursively and versions each item as its own field when stored in a delta. This provides more granular control over what can be reverted, compared to a normal Text field where all values must be reverted at once. An example of the Properties field being defined for a Resource can be found here.

An Image field is also planned that would allow rendering of the before and after images within the diff.

Object Types

Objects may be expected to behave differently from one another. We expect when saving a resource, it should also remember the TV values on that resource, whereas when saving a chunk, we don't need to worry about that.

To handle these different behaviours, VersionX uses configuration classes that extend the \modmore\VersionX\Types\Type class.

Here's the object Type class for versioning chunks (modChunk):

<?php

namespace modmore\VersionX\Types;

class Chunk extends Type
{
    // The class to be versioned
    protected string $class = \modChunk::class;
    
    // The id of the HTML element where the "Versions" tab will be added.
    protected string $tabId = 'modx-chunk-tabs';
    
    // The id of the ExtJS panel where versions will be rendered
    protected string $panelId = 'modx-panel-chunk';
    
    // Package name. If you're versioning a custom object, change this from core.
    protected string $package = 'core';
    
    // The primary field name for this object (for a resource it might be pagetitle)
    protected string $nameField = 'name';
    
    // List the field names to appear at the top when displaying diffs.
    protected array $fieldOrder = [
        'name',
        'description',
        'content',
    ];
    
    // List field names that should not be versioned
    protected array $excludedFields = [
        'id',
        'snippet',
    ];
}

VersionX will check these values when performing actions.

Versioning Custom Objects

In addition to resources and elements, VersionX can work with custom objects. The only requirement is that it must be a derivative of xPDOObject.

Example custom Type class for a Commerce product:

<?php

namespace MyModuleNamespace;

use modmore\VersionX\Fields\Image;
use modmore\VersionX\Fields\Properties;
use modmore\VersionX\Types\Type;

class MyProduct extends Type {
    protected string $class = \comProduct::class;
    protected string $package = 'commerce';
    protected string $nameField = 'name';
    protected array $excludedFields = [
        'id',
    ];
    protected array $fieldOrder = [
        'name',
        'description',
        'pricing',
        'sku',
    ];
    protected array $fieldClassMap = [
        'properties' => Properties::class,
        'image' => Image::class,
    ];
    
    /**
     * Here we are loading the Commerce package via it's service class. This is required in order to have 
     * custom objects show up in the main VersionX objects grid.
     */
    public static function loadCustomPackage(\modX $modx): bool
    {
        // While we're using $modx->getService() here, depending on your package/objects you might use
        // $modx->loadClass(), or $modx->addPackage() instead.
        if (!$modx->getService('commerce', 'Commerce', MODX_CORE_PATH . 'components/commerce/model/commerce/')) {
            // Return false if it failed
            return false;
        }
        
        return true;
    }
}

Create versions of a custom object

Here's an example of how to create a delta of an object using the MyProduct type class above:

$path = $modx->getOption('versionx.core_path', null, MODX_CORE_PATH . 'components/versionx/');
require $path . 'vendor/autoload.php';

$versionX = new \modmore\VersionX\VersionX($modx);

$type = new \MyModuleNamespace\MyProduct($versionX);
$result = $versionX->deltas()->createDelta($id, $type);

Here we are getting the VersionX autoloader (so PHP knows where the VersionX classes are), then instantiating VersionX, instantiating our own custom type class, then calling createDelta() and passing our custom type class $type and the $id of the object we want to version.

You can see an example of this in the VersionX plugin, where we are creating a new delta of a resource when saved. The Object Type in this case is \modmore\VersionX\Types\Resource.

$type = new \modmore\VersionX\Types\Resource($versionX);
$result = $versionX->deltas()->createDelta($id, $type);

Now what happens if you want to include extra data in the delta that's not a field of your object? Saving TV values along with resources are an excellent example of this. In your extended custom type class, you can use the includeFieldsOnCreate() method to add extra data to the version. An example of this can be found in the Resource type class.

When reverting to a previous version of an object, you're going to want to revert the values of those extra fields to the values from the previous version. To do this use the afterRevert() method in your extended Type class. See the example reverting TV values in the Resource class.

Display the custom object versions in the VersionX grid

The most important part for custom objects is the loadCustomPackage() method, as seen in the example above. This will allow the main VersionX objects grid to display your custom object versions in addition to the regular core objects. This method should be used to load the xPDO objects. Different packages may need to be loaded in different ways; for example in the example above the Commerce package is loaded by using the $modx->getService() method. For other packages, it might be more appropriate to use $modx->loadClass(), $modx->addPackage(), or the MODX 3+ bootstrap.php file.

Your custom type class could be located anywhere, so we need to let VersionX know where to find it. For this the versionx.custom_type_classes system setting exists. The class name and the file location of each custom package should be added in JSON format to the system setting. e.g.

[{
  "class": "\\MyModuleNamespace\\MyProduct",
  "path": "{core_path}components/commerce_mymodule/src/MyModuleNamespace/MyProduct.php"
},{
  "class": "\\AnotherNamespace\\AnotherClass",
  "path": "{core_path}components/packagename/src/AnotherNamespace/AnotherClass.php"
}]

VersionX will check this system setting when loading the main objects grid, and then run the loadCustomPackage() method for each class listed there.

You can then see your custom object versions in the VersionX grid. Note the object with the name MyProduct and the class comProduct listed in the screenshot below:

Custom Object in Grid

Merging Deltas

Previously, VersionX stored the entire object each save. This, as you can imagine, caused the database tables to grow rather quickly. As of v3, each version only contains the fields that have changed within a delta.

Merging deltas are a key function of VersionX, designed to keep storage space to a minimum. Merging deltas is intended to be handled by a nightly cronjob, though it can also be triggered manually by the Optimise Storage button at the top of the VersionX manager page.

The script to run for the cron is located at core/components/versionx/cron.php

So to run it every midnight, in your crontab you might put:

0 0 * * * php /var/www/public/core/components/versionx/cron.php > /dev/null 2>&1

VersionX will look at how old deltas are and merge then depending on the timeframe.

  • 1 week ago - Deltas older than a week will be merged to a single delta for a given hour. This leaves at most 168 unique deltas per object per week, or 8736 per year.
  • 1 month ago - Deltas older than a month will be merged to a single delta for a given day. This leaves at most 7 unique deltas per object per week, or 364 per year
  • 3 months ago - Deltas older than 3 months will be merged to a single delta for a given week. This leaves at most 1 unique delta per object per week, or 52 per year.
  • 18 months ago - Deltas older than 18 months will be merged to a single delta for a given month. This leaves at most 1 unique delta per object per month, or 12 per year.
  • 5 years ago - Deltas older than 5 years will be merged to a single delta for a given year.

The initial delta on each object, plus any delta marked as a milestone will not be merged.

Milestones

Within the delta grid UI, you can set a milestone tag (e.g. "Client Review" or "Went Live!") on a delta by clicking the flag icon. A milestone represents an important version that should be preserved as is, and as such is never merged. Click the milestone tag again to remove it if you no longer wish to keep it separate.

Migrating from 2.x

A separate script has been included to migrate version data from the VersionX 2.x database tabled.

After upgrading to version 3, run the following from the command line:

php /your/path/core/components/versionx/migrate.php

Contributions

VersionX is open source, and free to use. If you would like to support further development, feel free to contribute with either code (in the form of a PR on this repo) or monetary contributions. Hit the link to donate: https://modmore.com/extras/versionx/donate/

versionx's People

Contributors

adamlundrigan avatar alroniks avatar exside avatar fi1osof avatar hansek avatar jako avatar mark-h avatar muzzwood avatar rtripault avatar sebastian-marinescu avatar snowcreative avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

versionx's Issues

Mark versions as not published

It would be great if it was possible to mark a version as not published for public.

What I want to say:

  • You have a version, which is public to everyone
  • Now you want to edit this version, but the changes are big and need several iterations, which shall not be visible to the public, but only admins/moderators
  • So you edit the resource (or chunk or whatever) ans make a tick for "not public" (or similar)
  • As admin, you can now preview this version online and edit it, until you are satisfied. When done, you remove the tick "not public", so this version will be visible to everyone.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Resource Details page does not work in Google Chrome

Javascript error:

Uncaught TypeError: Cannot call method 'addClass' of null

Stack trace from Chrome (using debug ExtJS w/ comments)

Ext.Panel.Ext.extend.onRender           ext-all.js:27231
Ext.FormPanel.Ext.extend.onRender           ext-all.js:67046
Ext.extend.render           ext-all.js:17182
Ext.layout.ContainerLayout.Ext.extend.renderItem            ext-all.js:21057
Ext.layout.FormLayout.Ext.extend.renderItem         ext-all.js:23313
Ext.layout.ContainerLayout.Ext.extend.renderAll         ext-all.js:21041
Ext.layout.ContainerLayout.Ext.extend.onLayout          ext-all.js:21027
Ext.layout.AnchorLayout.Ext.extend.onLayout         ext-all.js:21576
Ext.layout.ContainerLayout.Ext.extend.layout            ext-all.js:21021
Ext.Container.Ext.extend.doLayout           ext-all.js:20746
Ext.layout.AutoLayout.Ext.extend.onLayout           ext-all.js:21256
Ext.layout.ContainerLayout.Ext.extend.layout            ext-all.js:21021
Ext.layout.ContainerLayout.Ext.extend.runLayout         ext-all.js:21140
Ext.layout.ContainerLayout.Ext.extend.onResize          ext-all.js:21134
EXTUTIL.Event.fire          ext-all.js:518
EXTUTIL.Observable.fireEvent            ext-all.js:159
Ext.Panel.Ext.extend.onBodyResize           ext-all.js:27797
Ext.Panel.Ext.extend.onResize           ext-all.js:27788
Ext.BoxComponent.Ext.extend.setSize         ext-all.js:19242
Ext.BoxComponent.Ext.extend.afterRender         ext-all.js:19443
Ext.Container.Ext.extend.afterRender            ext-all.js:20410
Ext.Panel.Ext.extend.afterRender            ext-all.js:27517
Ext.extend.render           ext-all.js:17221
Ext.layout.ContainerLayout.Ext.extend.renderItem            ext-all.js:21057
Ext.layout.CardLayout.Ext.extend.renderAll          ext-all.js:21448
Ext.layout.ContainerLayout.Ext.extend.onLayout          ext-all.js:21027
Ext.layout.FitLayout.Ext.extend.onLayout            ext-all.js:21301
Ext.layout.ContainerLayout.Ext.extend.layout            ext-all.js:21021
Ext.layout.CardLayout.Ext.extend.setActiveItem          ext-all.js:21436
Ext.TabPanel.Ext.extend.setActiveTab            ext-all.js:48356
Ext.TabPanel.Ext.extend.afterRender         ext-all.js:47952
Ext.extend.render           ext-all.js:17221
Ext.layout.ContainerLayout.Ext.extend.renderItem            ext-all.js:21057
Ext.layout.ContainerLayout.Ext.extend.renderAll         ext-all.js:21041
Ext.layout.ContainerLayout.Ext.extend.onLayout          ext-all.js:21027
Ext.layout.AutoLayout.Ext.extend.onLayout           ext-all.js:21250
Ext.layout.ContainerLayout.Ext.extend.layout            ext-all.js:21021
Ext.Container.Ext.extend.doLayout           ext-all.js:20746
Ext.extend._loadComponents          modx.component.js:74
MODx.Component          modx.component.js:10
VersionX.page.Resource          action.resource.js:85
create          ext-all.js:16159
Ext.extend.load         modx.js:72
VersionX.page.Resource          action.resource.js:3
EXTUTIL.Event.name          ext-all.js:398
call            ext-all.js:2179

It appears to have something to do with the fact that versionx-panel-resourcesdetail extends MODx.FormPanel. If I change that to MODx.Panel it renders properly (minus the resource data being populated, of course, as the call to VersionX.panel.ResourcesDetail.getForm() from action.resource.js fails)

Additional Notes:

Warning: htmlentities : charset `utf8' not supported, assuming iso-8859-1

Hi,

When I want to see the details of one of the stored version, I have this error on the top of the manager :

Warning: htmlentities() [function.htmlentities]: charset `utf8' not supported, assuming iso-8859-1 in /var/www/virtual/spheerys.fr/gravillas/htdocs/core/components/versionx/model/versionx.class.php on line 727

All my website is set on utf8, and I'm using the last version of MODx (2.2.5) and VersionX (2.0.0)

Allow versions to be deletable

This is a feature request. It would be great if it was possible for the user to be able to delete versions that are no longer required, not only would this help keep the database small but would also assist in the management of the versions.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Versions for Files?

Would be great to have versioning for files updated via manager as well. Not sure if there is a system event for this - but the action is logged in manager actions report.
We have a couple of projects which would benefit from this, because the LESS files (and sometimes SVG) are edited directly via the manager UI.

multi-byte character contained in a resource is displayed as "empty"

Hi mark.

Thank you for the wonderful plug-in.

this is Improvemen request.

when multi-byte character(I tested japanese) contained in a resource , it is always displayed as "empty" in Details view content tab. (same chunk,sinppet )

because encoding is not set to the all htmlentities function in versionx.class.php.

I'm not good at English sorry.

exsample change code versionx.class.php: 387

$useMultibyte=$this->modx->getOption('use_multibyte',null,false);

if ($useMultibyte){

   $encoding = $this->modx->getOption('modx_charset',null,'ISO-8859-1');

   //htmlentities the default value for encoding argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.  
   $vArray['content'] = nl2br(htmlentities($vArray['content'],ENT_COMPAT | ENT_HTML401,$encoding));

}else{

   $vArray['content'] = nl2br(htmlentities($vArray['content']));

}

Content in version comparison is sometimes cut off

As can be seen in the following screenshot, some of the text (seems to primarily affect long paragraphs with no linebreaks in it) in the comparison window is cut of at the right, seems to be some css/overflow issue.

Screenshot

the other thing with the special characters not displaying right should be fixed in the upcoming 2.1.1 version as mark told me.

Content not showing up

Not sure if this is a problem in the MODX API or what but I can not get the content to show up on my test page.

Here is where I was able to do a temp fix in versionx/model/versionx.class.php on line 387:

$vArray['content'] = nl2br(htmlentities($vArray['content'])); // this seems to become null after the tojson() 
$vArray['content'] = $vArray['content']; // this worked

This is the content of the resource:

<p>This is just a test page</p>
<div>[<!-- [!testmail] -->]</div>
<hr />
[[!FormIt?
  &hooks=`email`
  &emailLog=`1`
  &emailTpl=`MyEmailChunk`
  &emailSubject=`From the Bethel Website`
  &emailTo=`bethelcollege.edu`
  &validate=`name:required, email:required, details:required:stripTags`
  &emailFrom=`bethelcollege.edu`
  &redirectTo=`17`
  &logCategory=`Contact From`
  &successMessage=`1`
  &successMessagePlaceholder=`mymessage`
]]
[[!+fi.error_message:notempty=`
<p>[[!+fi.error_message]]</p>
<p>`]] 
[[!+mymessage]] [[!+fi.mymessage]]</p>

<form action="[[~[[*id]]]]" method="post">
<h3>Send an e–mail message</h3>
<fieldset><legend><label for="txt">Enter in your question/comment.</label></legend> <textarea id="text" title="Enter in your question/comment." tabindex="1" name="details"></textarea></fieldset><fieldset id="about_you"><legend>About you</legend>
<ul class="text_input">
<li><label for="txt1">Name (first name and last name)</label> <input id="txt1" title="Enter in first &amp; last name." tabindex="2" type="text" name="name" value="[[!+fi.name]]" maxlength="64" /></li>
<li><label for="txt2">Bethel ID</label> <input id="txt2" title="Enter in your Bethel ID." tabindex="3" type="text" name="bethel_id" value="[[!+fi.bethel_id]]" maxlength="16" /></li>
<li><label for="phone">Phone (add area code)</label> <input id="phone" title="Enter in a phone number where you can be reached." tabindex="4" type="text" name="phone" value="[[!+fi.phone]]" maxlength="16" /></li>
<li><label for="txt4">Office/Residence Hall</label> <input id="txt4" title="Enter in your office/residence hall location." tabindex="5" type="text" name="office" value="[[!+fi.office]]" maxlength="128" /></li>
<li><label for="txt5">Address</label> <input id="txt5" title="Enter in your street address." tabindex="6" type="text" name="address" value="[[!+fi.address]]" maxlength="128" /></li>
<li class="city"><label for="txt6">City</label> <input id="txt6" title="Enter in your city." tabindex="7" type="text" name="city" value="[[!+fi.city]]" maxlength="64" /></li>
<li class="state"><label for="txt7">State</label> <input id="txt7" title="Enter in your state." tabindex="8" type="text" name="state" value="[[!+fi.state]]" maxlength="64" /></li>
<li class="zip"><label for="txt8">Zip</label> <input id="txt8" title="Enter in your zip code." tabindex="9" type="text" name="zip" value="[[!+fi.zip]]" maxlength="32" /></li>
<li><label for="txt9">Primary or Bethel e-mail address</label> <input id="txt9" title="Enter in the your Primary or Bethel e-mail address" tabindex="10" type="text" name="email" value="[[!+fi.email]]" maxlength="128" /></li>
<li><label for="txt10">Alternative e-mail address</label> <input id="txt10" title="Enter in an alternative e-mail address" tabindex="11" type="text" name="alternative_email" value="[[!+fi.alternative_email]]" maxlength="128" /></li>
</ul>
</fieldset>
<p class="clear"><input class="submit" title="Submit your Question or Comment" tabindex="12" type="submit" name="submit" value=" Submit Question/Comment " /> <input type="hidden" name="refererURL" value="http://www.bethelcollege.edu/about/map/" /></p>
</form>

Problems uninstalling VersionX

Now why on earth would someone want to do that..... :P

Issue seems to be in resolvers executing on uninstall that shouldn't.

(Email from Tim B, 29/5)

Reverting a resource > need to clear cache

Just installed VersionX 2.0.0rc1 for the first time and played a bit around with it, I love it =)...a big thing modx was lacking of was versioning, with your work this hole has been filled very nicely, thanks for this extra (should be in the core I think)!

What I noticed when testing it (with destroying a resources content =D) was, that the reverting action didn't seem to clear the cache of the resource, I had to do it manually (insert a space, delete it, save button gets active, click it)...is this a problem at my side (revo 2.2.1pl) or an issue of versionx?

keep up the great work!

Unknown column 'name' in 'order clause'

on save a resource I always get this error in error log (only in MODX 2.3.2! no problem at MODX 2.3.1 and early):
(ERROR @ /connectors/index.php) Error 42S22 executing statement:
Array
(
[0] => 42S22
[1] => 1054
[2] => Unknown column 'name' in 'order clause'
)

OnSave Resoure Type is required but empty

Just updated to latest version, 2.1.1 on 2.3.3pl. After opening a Resource and editing it then click on Save the Resource Type field is empty and it is required. Select the correct option Save and refresh the page and the same error happens again. I assume that this is for filtering data not saving and the required option could be removed.

versionx-save-error

Thanks for reviewing!

Setup Dialog (Snapshot) misplaced

When I install VersionX v2.0rc2 on my 11" MacbookAir, the dialog popup which asks to make snapshots of what is cut off at the bottom (where the OK Button is), I have to manually drag it up a bit to reach the OK button.

This is a detail for sure, just wanted to get it out of my head =)


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Versioning CSS files etc...

It would be great if VersionX can also keep track of files contained in the media/assets folder. (Where I keep my CSS and other files.)

Install on MSSQL failed - Broke installation and no way to reverse?

Howdy :)

Doing an install on a Apache/MSSQL setup, and the install failed (see dump below)

Since then, the extra shows as not installed in package manager, but the interface is present in the manager. Nothing will save anymore and I can't see how to go back.

ERROR DUMP BELOW:

Error 42000 executing statement: INSERT INTO [modx_actions]([namespace], [controller], [haslayout], [lang_topics], [assets], [help_url]) VALUES ('versionx', 'controllers/index', 1, 'versionx:default', '', '') Array ( [0] => 42000 [1] => 545 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Explicit value must be specified for identity column in table 'modx_actions' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column. )
Error saving vehicle object of class modAction; criteria: Array ( [namespace] => versionx [controller] => controllers/index )
Could not install related objects with foreign owned keys for vehicle object of class modMenu; criteria: Array ( [text] => versionx )
Attempting to preserve files at C:/wamp/xxxx/www/core/components/versionx into archive C:/wamp/Sandvine2013/www/core/packages/versionx-2.1.0-pl/modCategory/552331055ceb4df9b2c2c4ae997faf2b.0.preserved.zip
Attempting to preserve files at C:/wamp/xxxx/www/assets/components/versionx into archive C:/wamp/xxxx/www/core/packages/versionx-2.1.0-pl/modCategory/552331055ceb4df9b2c2c4ae997faf2b.1.preserved.zip
Could not load package metadata for package versionx.
Could not load class: vxResource from sqlsrv.vxresource.
Could not load class: vxTemplate from sqlsrv.vxtemplate.
Could not load class: vxSnippet from sqlsrv.vxsnippet.
Could not load class: vxChunk from sqlsrv.vxchunk.
Could not load class: vxPlugin from sqlsrv.vxplugin.
Could not load class: vxTemplateVar from sqlsrv.vxtemplatevar.
Starting snapshot process for selected objects...
Iterating over Resources and storing snapshots..
Could not load class: vxResource from sqlsrv.vxresource.

Update Lexicons for revert actions

English & Dutch have been updated.

The new entires are:

$_lang['versionx.templates.revert'] = 'Revert Template to Version #[[+id]]';
$_lang['versionx.templates.revert.options'] = 'Revert Template';
$_lang['versionx.templates.revert.confirm'] = 'Are you sure?';
$_lang['versionx.templates.revert.confirm.text'] = 'Are you sure you want to revert to Version #[[+id]]? This will overwrite the content and other metadata currently set for the Template and replace them with the ones in the version you selected.';
$_lang['versionx.templates.reverted'] = 'Template has been successfully reverted!';
$_lang['versionx.templatevars.revert'] = 'Revert Template to Version #[[+id]]';
$_lang['versionx.templatevars.revert.options'] = 'Revert Template Variable';
$_lang['versionx.templatevars.revert.confirm'] = 'Are you sure?';
$_lang['versionx.templatevars.revert.confirm.text'] = 'Are you sure you want to revert to Version #[[+id]]? This will overwrite the content and other metadata currently set for the Template Variable and replace them with the ones in the version you selected.';
$_lang['versionx.templatevars.reverted'] = 'Template Variable has been successfully reverted!';
$_lang['versionx.chunks.revert'] = 'Revert Chunk to Version #[[+id]]';
$_lang['versionx.chunks.revert.options'] = 'Revert Chunk';
$_lang['versionx.chunks.revert.confirm'] = 'Are you sure?';
$_lang['versionx.chunks.revert.confirm.text'] = 'Are you sure you want to revert to Version #[[+id]]? This will overwrite the content and other metadata currently set for the Chunk and replace them with the ones in the version you selected.';
$_lang['versionx.chunks.reverted'] = 'Chunk has been successfully reverted!';
$_lang['versionx.snippets.revert'] = 'Revert Snippet to Version #[[+id]]';
$_lang['versionx.snippets.revert.options'] = 'Revert Snippet';
$_lang['versionx.snippets.revert.confirm'] = 'Are you sure?';
$_lang['versionx.snippets.revert.confirm.text'] = 'Are you sure you want to revert to Version #[[+id]]? This will overwrite the content and other metadata currently set for the Snippet and replace them with the ones in the version you selected.';
$_lang['versionx.snippets.reverted'] = 'Snippet has been successfully reverted!';
$_lang['versionx.plugins.revert'] = 'Revert Plugin to Version #[[+id]]';
$_lang['versionx.plugins.revert.options'] = 'Revert Plugin';
$_lang['versionx.plugins.revert.confirm'] = 'Are you sure?';
$_lang['versionx.plugins.revert.confirm.text'] = 'Are you sure you want to revert to Version #[[+id]]? This will overwrite the content and other metadata currently set for the Plugin and replace them with the ones in the version you selected.';
$_lang['versionx.plugins.reverted'] = 'Plugin has been successfully reverted!';

All of them belong in the default.inc.php lexicon file.

Revert a resource within the Versions tab

This is a feature request:

Add the ability to revert a a resource within the Versions tab of that resource. This would be in addition to the current method of using the VersionX component's revert button.

Resource form returns to Document tab on save.

Hi,

I've noticed that after installing VersionX that when saving a Document the page returns to the Document tab. Without VersionX installed the user is not move from the tab they're currently on (for example the Template Variable tab). This is just a slight annoyance but it would be good to fix if possible.

I've tested this on a fresh install of MODX and the latest VersionX from the package manager.

thanks,
Liam

Reload resource after revert

Hi Mark!
I'm having the following issue (checked it in several browsers - so I hope it isn't just me): When reverting to a previous version the resource isn't reloaded in manager so all fields have still the values from before the revert (though the revert was saved in background).
If the user now clicks on the save button (which gets also enabled after the revert) the old data (from before the revert) is saved again.

Im using Revo 2.2.8 btw - not sure whether this is relevant for this issue.
Cheers,


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Error popup on save for non-admins

Hi,

New to VersionX and rather new to ModX. Using version 2.3.3 and VersionX-2.1.
I believe I found an issue when a user with the role "contributor" (default Modx ACL setup) is saving a resource. First save is ok, then every next save with changes, that create a version, a popup is raised, see attached.
Save and version looks to be ok but this popup is a bit of anoying for users.

Not noticed when using the admin user and desapear when desinstalling VersionX.

Regards,

Edit: sorry unable to attach image!

The popup content is:
Code 200: OK
{"success":false,"message":"Autorisation refus\u00e9e !","total":0,"data":[],"object":[]}

Revo 2.3 - Display Tweaks

The CMP could use some minor corrections to better fit with the 2.3 styling, along with a few other nitpicks.

  • Add padding to top of CMP
  • Remove white background around main content (behind unselected tabs)
  • Add padding between filter fields
  • Tables scroll horizontally despite sufficient space for non-scrolling
  • Tables don't reflow to fit the browser window (refresh required)

One general item, if you hide a column that should be preserved between visits to the CMP. I couldn't find any functional issues in my review of the extra 👍

Internal error after install

Hello,

After a versionx's install on a OVH shared server, I have a internal error who appear on the manager. The error log is :
[Tue Mar 04 10:24:55 2014] [error] [client xx.xx.xx.xx] [host www.mydomaine.fr] Premature end of script headers: connector.php, referer: http://www.mydomaine.fr/manager/?a=30&id=1

Someone have an idea/solution ?

View content WYSIWYG?

Hey there Mark,

Great extra, just installed it for the first time, wish I have found it ages ago.

Without having delved into versionX too much I wonder how useful content versions are for our clients when the content for comparing versions is shown as HTML. Can it be displayed formatted? Or maybe an option for one view or the other (since the change may be just a DIV ID, or something within a tag)?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

VersionX doesn't handle static resources well

Becomes apparent during either individual saves or the import during setup, which has a pretty nasty silent failure as result.

Basically it seems to be dump the resource content into the processor, which corrupts the process.

Installation Freezing

Thanks for writing this addon. It's a feature I needed.

However, while installing it keeps freezing at this:

(I checked for all snapshots.)

Console running...
Attempting to install package with signature: versionx-2.0.0-rc1
Package found...now preparing to install.
Grabbing package workspace...
Workspace environment initiated, now installing package...
Retrieving all resources...
Collection retrieved. Iterating over resources and storing snapshots..

After waiting 15 minutes I canceled and logged back in and tried installing just resources and got the same situation. Then I tried just templates and it worked!

Funny thing is that my Resources ARE backed up and everything seems to work. But I'm thinking- could be an issue when parsing Resources? I have 15 Resources and each resource is about the size of an average blog post.

Note: I recreated the specific test case above by deleting all instances of VersionX from the filesystem/SQL after installation failed the first time. Also, the uninstall failed but that could be because the installation wasn't clean.

Server Info: Relatively fresh MODx 2.2.1-pl running on a basic LAMP stack on Ubuntu 12.04 x64.
Installed Addons: getResources and CodeMirror.

Hiding the version tab for users?

I'm sure this is just a lack of knowledge on my side, but how (other than with form customization, where I couldn't find any added options) can I hide the "Version" tab when editing a resource from a specific user group? I want just the admin (me =D) to have the possibility to restore something...

E_NOTICE Array to String conversion in VersionX.checkLastVersion

! ) Notice: Array to string conversion in C:\wamp\www\release-2.2\core\components\versionx\model\versionx.class.php on line 550
Call Stack
. Time Memory Function Location
1 0.0002 682960 {main}( ) ..\packages.php:0
2 0.0641 9944408 modConnectorRequest->handleRequest( ) ..\packages.php:3
3 0.0659 10191544 modConnectorRequest->prepareResponse( ) ..\modconnectorrequest.class.php:66
4 0.0670 10434256 modConnectorResponse->outputContent( ) ..\modconnectorrequest.class.php:79
5 0.0670 10435904 modX->runProcessor( ) ..\modconnectorresponse.class.php:131
6 0.0794 11135720 modProcessor->run( ) ..\modx.class.php:1586
7 0.0896 11867712 modPackageInstallProcessor->process( ) ..\modprocessor.class.php:173
8 0.1025 11867712 modTransportPackage->install( ) ..\install.class.php:42
9 0.1178 12440424 xPDOTransport->install( ) ..\modtransportpackage.class.php:226
10 0.7009 13734688 xPDOObjectVehicle->install( ) ..\xpdotransport.class.php:269
11 0.7009 13734784 xPDOObjectVehicle->_installObject( ) ..\xpdoobjectvehicle.class.php:88
12 0.7067 13992880 xPDOVehicle->resolve( ) ..\xpdoobjectvehicle.class.php:207
13 1.7977 15209832 include( 'C:\wamp\www\release-2.2\core\packages\versionx-2.0.0-rc3.dev1\modCategory\abcae0898742b9347680ef989348704c.setupoptions.resolver.resolver' ) ..\xpdovehicle.class.php:226
14 2.1792 20685624 VersionX->newSnippetVersion( ) ..\abcae0898742b9347680ef989348704c.setupoptions.resolver.resolver:78
15 2.2424 20938960 VersionX->checkLastVersion( ) ..\versionx.class.php:315
16 2.2630 21198576 implode ( ) ..\versionx.class.php:550

Looks like we've got some arrays in arrays in arrays (arrayception).

When E_NOTICE errors are set to dump to the screen, this error prevents finishing the installation process while it was indeed properly installed.

Ability to restore to an earlier Version

Updated 24/1: only going to do a complete version restore.

Thanks for the thought Anselm!

It could be good to restore per field if you only want to restore the content, but not unset the title that may have changed too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.