In the current version of Orchard, when you add or edit a page (or any routable content item for that matter) you can preview the unpublished edited version.
But you can only preview it "stand-alone". Not as part of projections etc. And you cannot preview widget changes, or layer changes, site settings changes, or anything else.
It would be extremely helpful for editors and administrators alike to be able to preview
changes in Orchard, not just individual routable content items. I'm not sure if there are already discussions ongoing in the team about more robust previewing capabilities, maybe even implementation work underway, but in case there's not..
So when thinking about this in the car this morning, an idea sprung to mind. What if the Orchard database schema was extended with a version concept for everything, such that when you make any change, all affected database rows are simply added with a higher
version number, alongside the previous rows.
The site would have a notion of the "currently published version" and all DB queries for frontend viewing would include this version nr (unless overridden by a query string parameter) so that only rows for the currently published version are returned
from all queries. Conversely, all DB queries from backend editing would include one version number above the currently published version, so that all backend editing is done against the unpublished version.
By DB queries I mean all DB queries that deal with something versioned, regardless of whether it's for site settings, content items, layers, layer rules, widgets. In this way, an editor or admin could make multiple edits and configuration changes to the site,
and have them all go into a new version, that's one number higher than the current one.
There would be an admin page where you can do things like:
- review all the unpublished changes
- rollback the unpublished changes (drop all rows with a version nr higher than the currently published)
- publish the unpublished changes (i.e. increase the currently published version number)
- schedule the unpublished changes for later publishing
- rollback the site to a previous version (i.e. decrease the currently published version number) in case some mistake is revealed after publishing
- view the site change history
- purge old site versions that will no longer be needed
There would also of course be the ability preview any arbitrary version number of the whole site, possibly by appending a query string parameter like so:
(The currently published version being nr 2 probably.)
This would really add a level of robust versioning and previewing functionality that goes above and beyond. It would allow editors to make changes much more freely. If they fuck it up, they can just roll back (delete all rows with higher version nr than the
currently published). If, after previewing and editing for a while, they ultimately determine the changes look good, they can just publish them.
The thought also occurred to me that maybe this whole thing could even be implemented as a module, if there's an extensibility point that lets you intercept and modify database queries (I'm no Orchard expert so I have no idea if there is).