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

Forums / Developing with Sitefinity / Should a form builder module inherit from the GenericContentModule

Should a form builder module inherit from the GenericContentModule

6 posts, 0 answered
  1. Shane
    Shane avatar
    28 posts
    Registered:
    27 Jul 2008
    23 Apr 2009
    Link to this post
    Hi Guys,

    I have been asked to design a simple form builder module for our sitefinity web sites.

    My team lead has asked me to see if it is possible to create a module that leverages the generic content module - so we can use workflow, permissions etc without writing extra code.

    I have looked at your poll module (correct me if I am wrong) - there isn't workflow and it appears it doesn't leverage the generic module?

    Also, I know you are releasing a form builder in version 4.0 - is that going to have workflow etc, and will it leverage the generic content module?

    My feeling is that I could get it to fit the generic module approach but it would require some interesting approaches? What do you think? Can this be done, or should it be approached like that. At the end of the day all modules could be viewed as content? (Thats my team leads thought process)

    Any advice is appreciated,

    Shane

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

    All modules from version 4.0 will be based on GenericContent. As for developing module with workflow you could download the following sample and check how we have created PermissionsView

    Sample Generic Content based module: Products module

    You may also find the following articles useful
    http://blogs.sitefinity.com/Ivan/Posts/09-03-22/Products_module_Implementing_permissions.aspx

    All the best,
    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.
  3. Shane
    Shane avatar
    28 posts
    Registered:
    27 Jul 2008
    27 Apr 2009
    Link to this post
     Can you please give me an example on how to customise the add/edit UI.

    Our module would have a far richer experience (drag and drop) to manipulate form elements when creating forms. 

    It seems that all your modules that use the generic content module as a base have the same UI for adding or editing a new piece of content. By this I mean a bunch of controls for meta data and one control (Rad Editor) for the content.

    I need to have a custom UI that will save content (Xml) that represents how a form is to be rendered on a page.

    How would I do that?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Apr 2009
    Link to this post
    Hello Shane,

    Generally you can create your views that does not inherit from generic content

    namespace Telerik.Samples.SwitchViewsModule.WebControls.Admin 
     
        public class SwitchViewModuleControlPanel : ProviderControlPanel<SwitchViewModuleControlPanel>, Telerik.Cms.Engine.WebControls.Admin.IGenericContentHost 
        { 
     
            public SwitchViewModuleControlPanel(bool autoGenerateCommands) : 
                base (false
            { 
            } 
     
            public override string ProviderSelectorPanelTitle 
            { 
                get 
                { 
                    return "Explore"
                } 
                set 
                { 
                    base.ProviderSelectorPanelTitle = value; 
                } 
            } 
     
            /// <summary> 
            /// Loads configured views. 
            /// </summary> 
            protected override void CreateViews() 
            { 
                AddView<SwitchViewsModuleCategoriesView>(null"SwitchViewsModuleCategoriesView_Title""SwitchViewsModuleCategoriesView_Description""all"null); 
                AddView<SwitchViewsModuleTagsView>(null"SwitchViewsModuleTagsView_Title""SwitchViewsModuleTagsView_Description""all"null); 
            } 


    Then your views should inherit from ViewModeControl which is the base class for the views and specify the THost.

    Example:

      public class SwitchViewsModuleView : ViewModeControl<SwitchViewModuleControlPanel> 


    Let us know if there is anything else that we can do for your or your approach is different.

    Regards,
    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.
  5. Shane
    Shane avatar
    28 posts
    Registered:
    27 Jul 2008
    28 Apr 2009
    Link to this post
    Ok, if I don't use a view that in based on the generic module what do I have to do when saving new or editing existing records/content.

    I want to take advantage of your built in workflow and versions etc. Is there an event or method to pass the data into so sitefinity will take it and all the functionality of a generic content based module will be there?

    I hope that makes sense.

    Basically I want a module with a custom view and pass the responsibility of saving deleting etc to the existing sitefinity infrastructure?

    Cheers,

    Shane
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    29 Apr 2009
    Link to this post
    Hello Shane,

    The things that you should do are:

    1. In your module manager you are getting the manager that is responsible for working with your content items.

    private ContentManager contentManager; 
    private readonly GenericContentElement settingsElement; 
     
      public ContentManager Content 
            { 
                get 
                { 
                    if (this.contentManager == null
                        this.contentManager = new ContentManager(this.settingsElement.ProviderName); 
                    return this.contentManager; 
                } 
            } 

    You should create a class GenericContentElement  that inherits ConfigurationElement and will read the web.config properties where you need to declare the providerName

     public string ProviderName 
            { 
                get 
                { 
                    return (string)this["providerName"]; 
                } 
                set 
                { 
                    this["providerName"] = value; 
                } 
            } 

    For more information you can check our sample modules.

    Regards,
    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.
Register for webinar
6 posts, 0 answered