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

Forums / Developing with Sitefinity / Creating a Pluggable Generic Content Based Module

Creating a Pluggable Generic Content Based Module

10 posts, 1 answered
  1. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    23 Jun 2010
    Link to this post
    I'm looking for a complete working sample for building a pluggable generic content based module.  I've worked through the Products Module but there are some parts missing...http://www.sitefinity.com/help/developer-manual/products-module-overview.html.  I would really like to see the "Products Module - Full Fledged Version".

    The module that I want to build would consist of a Title, Body, Image Gallery, and Links.  I would like to leverage as much of the built-in Sitefinity functionality as possible.  I've dug through the documentation, watched webinars, and googled but I haven't had much luck in finding a complete working example.  Any help is appreciated.
  2. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    23 Jun 2010
    Link to this post
    I just downloaded the .CHM version of the documentation and it's quite a bit different from the online version.  It has the info I was looking for plus a link to the complete products sample project.  Is there a reason that the two differ?
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Jun 2010
    Link to this post
    Hi Shawn,

    I agree that this is a bit confusing. The online manual refers to the old backend architecture. The CHM includes the data valid for Sitefintiy since 3.6 version. There is a TOC created here which is also migrated to the CHM.  We started working on a new dev manual and user manuals and decided to release just a CHM version of the updated help.

    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
  4. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    29 Jun 2010
    Link to this post
    Hi Shawn,

    I'm curious about if you already build this module?
    I'm looking for basically the same functionality:

    I like to create projects in sitefinity. Each project should have a title, description and an Image Gallery associated with it.

    Any success with your module?

    Thanks,
    Daniel
  5. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    29 Jun 2010
    Link to this post
    I'm still working on it.  I have a pretty good understanding of what I need to do. I hope to have something working by Friday.   Once complete, I'll post my code. 

    Good Luck,

    Shawn
  6. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    29 Jun 2010
    Link to this post
    Okay, cool.
    Would be nice to have a look at it.

    Regards,
    Daniel
  7. Shawn
    Shawn avatar
    79 posts
    Registered:
    26 Sep 2012
    13 Jul 2010
    Link to this post
    I just finished up my pluggable article module.  It's definitely not polished.  I just built it to see what I could do with Sitefinity. You can download the module from http://cid-58d3693d3681e653.office.live.com/self.aspx/Public/ArticlesModule.zip.  You'll have delete the broken Telerik references and add them back pointing to your dlls. 

    Building a complete pluggable module from scratch is a lot of work.  You can get a generic content based module running very quickly by using the existing templates but if you want to customize and isolate your module (ie.  pluggable module) the learning curve is pretty steep.  I spent a lot of time in reflector figuring out how sitefinity works. I analyzed the existing modules (Blogs, News, and a couple of the modules in the marketplace).  I think I have a pretty thorough understanding how modules work in sitefinity.  I like the product and I'm excited for Sitefinity 4.

    One of the challenges that I ran into was figuring out what controls I can re-use in sitefinity and how to use them.  There are a lot of controls hiding in the various Sitefinity assemblies that you can utilize.  It would be nice if they were listed somewhere along with documentation how to use them.  I know I ran across a blog post describing how to re-use 1 or 2 controls...but nothing complete.

    For my demo, an article consists of a title, content, and an array of sections.  Each section can contain a title, content, image, and link.  It should at least point you in the direction of how to build pluggable modules. 

    I also modified ButtonSelector.ascx in the main Sitefinity project (~/Sitefinity/Admin/ControlTemplates/Libraries/Dialogs/ButtonSelector.ascx).  I modified the OnClientClose function.  It wasn't setting a few of the properties that I needed it to.  If you copy the code below you should be good to go.

    function OnClientClose(sender, eventArgs) {
            if (sender.argument) {
                var title = '';
                var altText = '';
                var src = '';
                var width;
                var height;
                var unresolved;
      
                if (sender.argument.title)
                    title = sender.argument.title;
                if (sender.argument.altText)
                    altText = sender.argument.alt;
                if (sender.argument.src)
                    src = sender.argument.src;
                if (sender.argument.width && sender.argument.height) {
                    width = sender.argument.width;
                    height = sender.argument.height;
                }
                if (sender.argument.unresolved)
                    unresolved = sender.argument.unresolved;
      
                selectedItem = new SelectedItem(src, altText, title, width, height, unresolved);
      
                if (typeof (sfUseResolvedUrl) == 'undefined') {
                    sfUseResolvedUrl = true;
                }
      
                for (i = 0; i < assignedControls.length; i++) {
                    if (assignedControls[i] != '') {
                        var element = document.getElementById(assignedControls[i]);
                        if (element.src)
                            if (!(/selectedImage/.test(element.id)) && !(/uploadedImage/.test(element.id))) {
                                element.src = sender.argument.src;
                                element.alt = sender.argument.alt;
                            }
                            else {
                                element.src = sender.argument.src + '?width=300&height=300&decreaseOnly=true';
                                element.alt = sender.argument.alt;
                            }
                        else if (typeof (element.value) != 'undefined' && element.value != null) {
                            if (!sfUseResolvedUrl && (/selectedValue/.test(element.id))) {
                                element.value = unresolved;
                            }
                            else {
                                element.value = sender.argument.src;
                            }
                        }
                        else if (typeof (element.href) != 'undefined') {
                            element.href = sender.argument.href;
                            element.innerHTML = sender.argument.text;
                            element.title = sender.argument.title;
                        }
                        else if (typeof (element.innerHTML) != 'undefined')
                            element.innerHTML = sender.argument.src;
                    }
                }
            }
        }

  8. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    14 Jul 2010
    Link to this post
    Thanks Shawn! Very nice.

    I've started to reuse the Generic Content modules and so far I'm very pleased with it. Just for some basic functionality of my websites.

    I've also tried to build a Pluggable Module, but for simple things it such a work to built. I like the architecture, but some things are not documented or put far away, so it slows down my development.

    Could you take a look at this forum post and see if you know how I could solve my problem? Maybe it is something you already did?

    http://www.sitefinity.com/devnet/forums/sitefinity-3-x/developing-with-sitefinity/event-detail-link.aspx

    Thanks,
    Daniel
  9. Thavarajah
    Thavarajah avatar
    48 posts
    Registered:
    15 Oct 2010
    15 Oct 2010
    Link to this post
    Hi Shawn,

    May I get some help from you,

    I actually need to build a pluggable module and deploy it to my sitefinity site. how I can do it? I have your project but I dnt knw hw I cn deploy it to sitefinity. at least tell me the way how to deploy it.

    I can study your code and do my own in my own.

    if you can please help me out.

    Thanks in advance.
  10. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    15 Oct 2010
    Link to this post
    Hello Thavarajah,

    You can find information on how to plug in custom Generic Content based modules here: Sample Generic Content based module: Products module. For modules that are not based on Generic Content the procedure is described here: Sample pluggable module: Contacts pluggable module.

    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
    Answered
Register for webinar
10 posts, 1 answered