Edit Specific Page Version?

Permalink 1 user found helpful
I've encountered a scenario I haven't before, but it seems like it might not be all that uncommon. A client is working on a version of a page, so it remains in edit mode as they fiddle around (which could be days as they make changes and get feedback on the unpublished page from other staff).

Meanwhile, someone notices that something needs to be tweaked on the published version of that page. It could be major or something as simple as correcting a spelling error.

The question is, how do they "get at" the currently published page to edit it? Is it even possible?

-Steve

Shotster
 
ChrisWatterston replied on at Permalink Reply
ChrisWatterston
Erm, opps :)
Shotster replied on at Permalink Reply
Shotster
It also seems likely that someone might want to use a prior version of a page as the starting point for a new version, so the ability to duplicate any version of a page would be quite handy it seems. That would also solve the problem above.

-Steve
sdjmchattie replied on at Permalink Reply
Perhaps you could copy the page to another location in the site and set it to not show in the nav. Then you could delete the edits to the actual page back to the version that's live and make the necessary changes. If there are loads of edits to be done before going live, it might be a good idea to make a separate copy of the page first anyway ... that way you can just copy it into the correct location after the edits are approved.
bagonyi replied on at Permalink Reply
I came up with an idea, but I'm stuck with the last step. I created a tool which takes the cID and cvID given in the URL, duplicates the page under /temp page, deletes all of the version which is not needed (so it keeps only the one you want to edit), then you can make the changes to that version. What I was thinking about is somehow deleting the version from the original page, and copy the newly duplicated page last version to its place, but as the new page has new cID, and everything related to the page has been duplicated with the new cID, I dont know what to do after I change the cID, and cvID of the newly created version to the old one, because all the edited blocks and etc. will live with the new cID in the database. Maybe I could loop through all of the tables in the database and search for the new cID and replace with the old cID but somehow its feel like an overkill for me. Do you have any other ideas? Here is the tool:

<?php 
    defined('C5_EXECUTE') or die("Access Denied.");
    $cID = $_REQUEST['cID'];
    $cvID = $_REQUEST['cvID'];
    $urlHelper = Loader::helper('url');
    $urlsHelper = Loader::helper('concrete/urls');
    $oldPage = Page::getByID($cID, $cvID);
    $newPage = $oldPage->duplicate(Page::getByPath('/temp'));
    // We need this line, because of a bug (I beleive) in C5. When you duplicating
    // a page that has a page template from a package, the pkgID is not saved 
    // during duplicating, so an update is needed
    $newPage->update(array('ctID' => $oldPage->getCollectionTypeID()));
    $db = Loader::db();
    $collectionVersions = $db->query('SELECT cvID FROM CollectionVersions WHERE cID = ?', array($newPage->getCollectionID()));
    foreach ($collectionVersions as $row) {


Clicking on save my changes would open an another tool which takes the old_cID, the old_cvID, and the new_cID. So that tool would be responsible for merging the collections together.
bagonyi replied on at Permalink Reply
Anyone?
codingpenguins replied on at Permalink Reply
Could not really say if there is another way, but your tool seems to be going in the right direction. This will not be pretty at all because the way the database uses all the versions. This seems like a lot of work. Also when they make changes to the previous version, you would have to move up all the blocks as you were mentioning.

I would go in the direction you are going. I would add a new field in the pages table like "cEditIsCheckedOut" to know if there is a new "Production" block in edit. Then I would on every edit of that page do a check to see if the "cEditIsCheckedOut" for that page and if it is update the block as well in that page. (This could cause overriding issues - as a page in production changes a content block and then a person comes afterward and changes a misspelled word in that block on a previous version, then all the content of that block would be gone). If you do not want this to happen you would have to create a new database to keep track of changed blocks and maybe create something to display the changes to a person when they visit the production page.

I am just throwing some ideas or issues out there. As you can tell this would not be easy at all, but I do not see any way around it. This could be an interesting project tho. You might want to ask a C5 developer as Frz or Andrew and see what they would suggest.