More in this section

Forums / Developing with Sitefinity / VersionManager in custom modules

VersionManager in custom modules

2 posts, 0 answered
  1. Christian
    Christian avatar
    20 posts
    Registered:
    12 Mar 2008
    24 Aug 2009
    Link to this post
    Hi,

    do you provide a sample module or documentation with enabled versioning? I try to develop a new intra site module and I have to use versioning.

    Questions I have: What about my custom data model? Do I have to implement versioning tables for my module? Or do you provide a generic versioning container? Do I have to implement my own custom Provider?

    It would be very cool to get an sample module.

    Thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    24 Aug 2009
    Link to this post
    Hi Christian,

    If you have a GenericContent based module and a view that inherits from ContentItemHistory you will be able to use all available methods that this class exposes.

    Below is a sample implementation:

    namespace Telerik.Samples.Products.WebControls.Admin.Products 
        /// <summary> 
        /// History view for the products module 
        /// </summary> 
        public class ProductHistoryView : ContentItemHistory<ProductsView> 
        { 
            #region Properties 
     
            /// <summary> 
            /// Gets or sets the path to a custom layout template for the control. 
            /// </summary> 
            /// <value></value> 
            [WebSysTemplate(ProductHistoryView.ItemHistoryTemplateName, "ItemHistory_Desc""/News"false"2009-01-28")] 
            public override string LayoutTemplatePath 
            { 
                get 
                { 
                    return base.LayoutTemplatePath; 
                } 
                set 
                { 
                    base.LayoutTemplatePath = value; 
                } 
            } 
     
            /// <summary> 
            /// Gets the name of the embedded layout template. 
            /// </summary> 
            /// <value></value> 
            protected override string LayoutTemplateName 
            { 
                get 
                { 
                    return ProductHistoryView.ItemHistoryTemplateName; 
                } 
            } 
            #endregion 
            #region Overriden methods 
     
            /// <summary> 
            /// Gets the edit command. 
            /// </summary> 
            /// <param name="itemId">The item id.</param> 
            /// <returns></returns> 
            protected override string GetEditCommand(Guid itemId) 
            { 
                return CreateHostViewCommand<ProductEditView>(itemId.ToString()); 
            } 
     
            /// <summary> 
            /// Gets the history command. 
            /// </summary> 
            /// <param name="itemId">The item id.</param> 
            /// <returns></returns> 
            protected override string GetHistoryCommand(Guid itemId) 
            { 
                return CreateHostViewCommand<ProductHistoryView>(itemId.ToString()); 
            } 
     
            /// <summary> 
            /// Gets the list command. 
            /// </summary> 
            /// <returns></returns> 
            protected override string GetListCommand() 
            { 
                return CreateHostViewCommand<ProductsItemListView>(); 
            } 
     
            /// <summary> 
            /// Gets the preview command. 
            /// </summary> 
            /// <param name="itemId">The item id.</param> 
            /// <returns></returns> 
            protected override string GetPreviewCommand(Guid itemId) 
            { 
                return CreateHostViewCommand<ProductPreviewView>(itemId.ToString()); 
            } 
            #endregion 
            #region Constants 
     
            private const string ItemHistoryTemplateName = "Telerik.Samples.Products.Resources.ControlTemplates.Backend.ProductHistoryView.ascx"
            #endregion 
        } 

    You can take a look at the following post where you will find our TOC documentation with Sample modules section which was migrated to chm version of Sitefinity's developers manual. If your view does not inherit form ContentItemHistory class you should implement the whole versioning logic.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered