+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Custom Module and ContentVersionView

Custom Module and ContentVersionView

12 posts, 0 answered
  1. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    04 Aug 2010
    Link to this post
    I created a pluggable custom module.  I have everything working compiled into a single dll except for the ContentVersionView page.  I understand that you can't compile a web page into a dll but is there a different way to get the "view" link working on the item history page that doesn't require placing a .aspx page into the main sitefinity project?  I would like my entire module isolated to a single dll.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    09 Aug 2010
    Link to this post
    Hello Shawn,

    Thank you for using our services.

    The particular item version view/edit/history page is composed of three different controls with control templates. Those controls all inherig from ContentItemEdit, ContentItemHistory, and ContentItemPreview controls. You can create your own and pack them into your dll. More information about this can be found in this blog post: Reusing views.

    All the best,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    09 Aug 2010
    Link to this post
    Thank you for the info but I'm not referring to the ContentItemEdit, ContentItemHistory, or ContentItemPreview views.  I have all 3 of those items embedded in my dll.  I am referring to the "view" link on the ContentItemHistory control.  Currently, it calls a javascript function which pops up a window linking to "/Sitefinity/Admin/ControlTemplates/[Module]/ContentVersionView.aspx".  See attached screenshot for more info. 

    Is there a way to get the ContentVersionView embedded into a dll? 

    Or do I have to modify the markup of the ContentItemHistory control so it doesn't call the javascript function and invoke a custom view?  Is there a preferred method for doing this?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    09 Aug 2010
    Link to this post
    Hi Shawn,

    There is a property contentVersionViewUrl="~/test/abc.aspx" that you can set for your provider, but the value will accept relative path and will not allow you to use an embedde resource. You can override OnPreRender of VersionList class and set the path to an embedded resource. Then replace the default VersionView inside your VersionView template with the custom one.

    sample

    protected override void OnPreRender(EventArgs e) 
        
            base.OnPreRender(e); 
            if (this.Page != null && !String.IsNullOrEmpty(this.PreviewUrl)) 
            
                this.Page.ClientScript.RegisterClientScriptResource(this.GetType(), "Telerik.Versioning.Resources.versioning.js"); 
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "create" 
                    , String.Format("SfVersion.Create(\"{0}\",\"{1}\");", this.PreviewUrl 
                    , this.itemId.ToString()), true); 
            
        }


    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    09 Aug 2010
    Link to this post
    I'm not completely following you on your description.  Can you clarify the statement "You can override OnPreRender of VersionList class and set the path to an embedded resource."  What path do I set (and what do I set it to)?  Will this require me to add a page in the main sitefinity project?

    The VersionView class does expose many methods to override.  The module that I created has complex types...more than simple key value pairs.  I need to get at the underlying content data so I can bind to a datagrid.  When I inherit from Snippet ContentItemPreview I have access to the underlying content data by overriding methods such as Snippet ShowMetaData() and Snippet GetMetaKeysHashTable().  VersionView doesn't expose similar methods.  Any suggestions?


  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    10 Aug 2010
    Link to this post
    Hello Shawn,

    If you create a custom class that inherits from VersionView you are able to override OnPreRender

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    10 Aug 2010
    Link to this post
    Thanks for the reply but that's not exactly what I was asking.  I can create my own control and inherit from the VersionView class but I will still have to create a .aspx page in main sitefinity project to host my custom control.  What did you mean by "set the path to an embedded resource"?  What path do I set?  I your code sample I don't see where you are setting the path to an embedded resource...except with the javascript file. 

    Maybe there is some confusion here...

    All modules have a ContentVersionView.aspx page located at ~/Sitefinity/Admin/ControlTemplates/[Module]/ContentVersionView.aspx.  I don't want to have to add a new page in the main sitefinity project for every module that I build.  I want my module to be completely isolated to a single dll, but it appears that the version view was designed differently than all of the other module views since it appears in a popup. 

    I was hoping that I could point the contentVersionView url in my web.config to some base sitefinity page that would load in the proper version view control.  For example, the url would be ~/Sitefinity/Admin/ControlTemplates/Pages/VersionView.aspx?module=MyModule.  The page would then load up the correct view based on the module and registered version view.  In my opinion, this makes sense because the behavior would be identical as all of the other module views.  My only criticism is that the ContentVersionView works differently than all of the other module views.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    10 Aug 2010
    Link to this post
    Hi Shawn,

    this.PreviewUrl is a property of VersionView and this is where you should set the path to your template.
    The path of ContentVersionView template is set through the js code as shown above.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    10 Aug 2010
    Link to this post
    I'm missing something.  The PreviewUrl is a url that is set in the popup window when "view" is clicked in the grid. I can set the url to an embedded html page by using  Snippet Page.ClientScript.GetWebResourceUrl() but I can't embed .aspx files. Actually, I can embed them but they don't go through the page processing pipeline.  Basically, I can get it to spit out static html but I can't get it to process an .aspx page.
  10. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Aug 2010
    Link to this post
    Hello Shawn,

    Unfortunately .aspx pages cannot be embedded as they will not be processed by the parser. You can only embed .ascx files which will be in turn processed by our template parser.

    All the best,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    11 Aug 2010
    Link to this post
    So there is no way to create a fully pluggable module?  I'll always have to have the ContentVersionView.aspx page in the main sitefinity project?
  12. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Aug 2010
    Link to this post
    Hi Shawn,

    Unfortunately this is the case. If you take a look at the ~/Sitefinity folder structure you will see that we have the .aspx pages which cannot be built into assemblies added there. In Sitefinity 4.0 on the other hand we are taking a different approach - backend pages are all dynamic just as front end pages - they are all stored in database and constructed on the fly.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
12 posts, 0 answered