Copied to clipboard

Flag this post as spam?

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


  • Scott 14 posts 35 karma points
    Feb 26, 2010 @ 13:07
    Scott
    0

    Version history

    Hi guys,

    Is it possibe to allow users to view page history?

    I was thinking maybe a list of links pointing to older versions of a page?

    Any help would be much appreciated.

    Thanks

    Scott

  • Douglas Robar 3565 posts 4640 karma points MVP 6x admin c-trib
    Feb 26, 2010 @ 13:45
    Douglas Robar
    3

    You can always use the 'Rollback' feature to compare the current version to previous versions of pages. The user could either cancel the window or select a previous version if a rollback is needed.

    Simply right-click on a page and select the 'Rollback' menu item.

    cheers,
    doug.

  • Scott 14 posts 35 karma points
    Feb 26, 2010 @ 17:32
    Scott
    1

    What I actually mean is show different version of the page to the public - is this possible?

    Cheers

    Scott

  • Douglas Robar 3565 posts 4640 karma points MVP 6x admin c-trib
    Feb 26, 2010 @ 18:05
    Douglas Robar
    0

    In umbraco, every time you make changes to a page and save it, that is a "version".

    For example, imagine the 'About Us' page... You have some fantastic text that explains everything there is to know about your company. That's a "version" of your page. Then you hire a new CEO and you update the page in umbraco, save and publish it. You now have two "versions" of your page.

    Do you really want to allow outsiders to see the old version as well? Usually not. If you did, you'd need to write a little .net macro that would get the old version(s) from the database and display them. This can be done through the umbraco api.

    On the other hand, if you mean you want to show the same 'About Us' page content but in different ways, such as the web version, an RSS version, and an iPhone version... that's not what umbraco calls a "version" but simply an "alternate template". If this is what you want to do look through the forum and wiki for "Alternate Template" or "altTemplate" and you'll get lots of info.

    cheers,
    doug.

  • Scott 14 posts 35 karma points
    Mar 02, 2010 @ 11:11
    Scott
    0

    Thanks Doug - fantastic reply :)

     

    "Do you really want to allow outsiders to see the old version as well? Usually not. If you did, you'd need to write a little .net macro that would get the old version(s) from the database and display them. This can be done through the umbraco api." - this is exactly what my client wants.

    Thanks for the help mate.

     

    Scott

  • Bex 443 posts 554 karma points
    Aug 19, 2014 @ 16:29
    Bex
    0

    Is anyone still looking at this very old post?

    I have been searching and searching how to get at the history of my document as I need to compare the content of different versions! It mentions here that it can be done through the umbraco API.. but How???

    I am using 6.1.6 can anyone help?

  • Bex 443 posts 554 karma points
    Aug 19, 2014 @ 16:48
    Bex
    0

    For anyone else who is looking:

    http://our.umbraco.org/documentation/Reference/management/Documents/

    Get Document by version

    All documents in umbraco is versioned. So everytime a document is changed, a new version is stored seperately. All versions get a unique Id assigned. The document returned will reflect the state of the document data in that specific version.

    Document d = new Document(1234 versionGuid);
    

    Good ol' google search!

  • Jonathan Roberts 328 posts 930 karma points
    Oct 31, 2016 @ 17:29
    Jonathan Roberts
    1

    Is it possible to create the page in HTML for this Document d?

  • Lee Hojin 1 post 71 karma points
    May 16, 2017 @ 07:00
    Lee Hojin
    0

    I created function like below to see old version in html

    public HttpResponseMessage ViewVersion(int nodeId, string guid)
            {
                UmbracoContext.Application.ApplicationCache.RuntimeCache.ClearAllCache();
                umbraco.library.RefreshContent();
                UmbracoContext.InPreviewMode = true;
    
                Guid version = new Guid(guid);
    
                var auth = new HttpContextWrapper(HttpContext.Current).GetUmbracoAuthTicket();
                IUser curruser = null;
                if (auth != null)
                {
                    curruser = ApplicationContext.Services.UserService.GetByUsername(auth.Name);
                }
    
                umbraco.BusinessLogic.User user = new umbraco.BusinessLogic.User(curruser.Id);
                var d = new Document(nodeId, version);
                var pc = new PreviewContent(user, Guid.NewGuid(), false);
                pc.PrepareDocument(user, d, true);
                pc.SavePreviewSet();
                pc.ActivatePreviewCookie();
    
                var UmbracoHelper = new Umbraco.Web.UmbracoHelper(UmbracoContext);
    
                string result = UmbracoHelper.RenderTemplate(nodeId).ToHtmlString();
    
                return new HttpResponseMessage() { Content = new StringContent(result, System.Text.Encoding.UTF8, "text/html") };
            }
    
Please Sign in or register to post replies

Write your reply to:

Draft