Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonathan Roberts 409 posts 1063 karma points
    Oct 31, 2016 @ 17:16
    Jonathan Roberts
    0

    Show previous version of a page

    hi,

    is it possible to show the HTML page of a previous version of a page in Umbraco?

    Thanks Jon

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Nov 01, 2016 @ 07:06
    Dave Woestenborghs
    0

    Hi Jon,

    What are you trying to do ? In the backoffice there is the rollback function where you can get the previous version of a document,

    Dave

  • Jonathan Roberts 409 posts 1063 karma points
    Nov 01, 2016 @ 08:26
    Jonathan Roberts
    0

    Hi,

    I have used Episerver in the past in version 6 R2 they have a really helpful Version Comparison feature where the user can view the current version with a past version of the page. The view is of the actual page and not the markup or JSON/XML. It is nice and clear and highlights the differences between the two versions. Normally used by non-technical users or people who translate the pages and need to quickly see what the text changes are.

    I was hoping I could create something similar for our project as this would be incredibly helpful and hoped there was a way I could do this.

    Thanks

    Jon

  • Paul de Quant 403 posts 1521 karma points
    Nov 01, 2016 @ 09:29
    Paul de Quant
    0

    I agree, I've checked in the DLL to see how a preview page is generated.

    public class Preview : UmbracoEnsuredPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Document documentObject = new Document(base.Request.GetItemAs<int>("id"));
            PreviewContent content = new PreviewContent(base.UmbracoUser, Guid.NewGuid(), false);
            content.PrepareDocument(base.UmbracoUser, documentObject, true);
            content.SavePreviewSet();
            this.docLit.Text = documentObject.Text;
            this.changeSetUrl.Text = content.PreviewsetPath;
            content.ActivatePreviewCookie();
            base.Response.Redirect("../../" + documentObject.Id.ToString(CultureInfo.InvariantCulture) + ".aspx", true);
        }
    }
    

    From what I gather this create a new entry in the previewXml table and redirects you to the page with it's template.

    If instead of using SavePreviewSet could we not load LoadPreviewSet and pass in the Guid of the previous version?

    Can anyone clarify how this works?

    Thanks

    Paul

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies