Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » autoSave before page duplicate

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1727 Views
  • xmedeko
    Avatar
    Community Member
    94 Posts

    autoSave before page duplicate Link to this post

    Hi,

    when I make a change in a page in CMS and then duplicate this page (right mouse click in the tree -> Duplicate), then the page is duplicated first and then original one is saved. The original is saved, because the selection in the page tree is changed. The new page does not contain the last change, so the pages differ.

    I wanted just to add autoSave(true) in the

    CMSMain_left.js -> TreeContextMenu -> 'Duplicate this page' : function()

    , but it didn't work, so I made two changes. First, in the CMSMain_left.js:

    'Duplicate this page' : function(treeNode) {
    autoSave(true, treeNode.duplicatePage.bind(treeNode));
    },

    and the second in the LeftAndMain_left.js:

    TreeNodeAPI.prototype = {
    duplicatePage : function() {
    new Ajax.Request(baseHref() + 'admin/duplicate/' + this.getIdx() + '?ajax=1', {
    method : 'get',
    onSuccess : Ajax.Evaluator,
    onFailure : function(response) {
    errorMessage('Error: ', response);
    }
    });
    },

    Now, the page is first saved, and then duplicated.

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: autoSave before page duplicate Link to this post

    one of the GSOCers wish to add this to the GSOC branch? [attribute ondra]

  • elijahlofgren
    Avatar
    Google Summer of Code Hacker
    222 Posts

    Re: autoSave before page duplicate Link to this post

    I've tentatively put this on my list: Ticket #41 Apply xmedeko's "autoSave before page duplicate" fixes to gsoc branch but if anyone else would like to do this, feel free to reassign to yourself. ;)

    Thanks for this xmedeko,

    Elijah

  • Markus
    Avatar
    Google Summer of Code Hacker
    152 Posts

    Re: autoSave before page duplicate Link to this post

    I tried to apply the patch, but it doesn't seem to work with the GSoC branch.. maybe I missed something or it works only with the latest build..

    I'm working on something else at the moment, will look at that later..

    I added the patched files to the ticket, but I didn't commit them yet.

  • elijahlofgren
    Avatar
    Google Summer of Code Hacker
    222 Posts

    Re: autoSave before page duplicate Link to this post

    I've applied these changes to the gsoc branch: Apply-xmedekos-autoSave-before-page-duplicate-fixes-cms-gsoc-r38532.patch

    ------------------------------------------------------------------------
    r38532 | elofgren | 2007-07-12 15:02:36 -0500 (Thu, 12 Jul 2007) | 1 line

    When 'Duplicate this page' is clicked, first silently (without confirmation) save the page, then duplicate it so the new page is identical to the other page. Closes gsoc Ticket #41: Apply xmedeko's "autoSave before page duplicate" fixes to gsoc branch. Adapted from code posted here: http://www.silverstripe.com/contributions/flat/2073 Thanks Ondra\!
    ------------------------------------------------------------------------

    Thanks to Ondra for finding a solution and to everyone who looked into this,

    Elijah

    1727 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.