Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.


Updating the Contest Module for 6.0

Contest_120The past couple of months I have spent a decent amount of time working on DotNetNuke 6.0. To be a little more specific, I (and several others) have been focusing on updating the user interface. If you have seen CTP 3, or read Joe’s blog post, you have already been introduced to some of the user interface changes we have going on. Although it may not seem like it, there was a lot of work and planning that went into overhauling the user interface in 6.0. 

A few of the changes:

  • jQuery UI inclusion w/ 6.0 core framework
  • DotNetNuke client-side plugins that utilize jQuery UI
  • Partial rendering support enabled for all module controls (where it made sense)
  • A Module Actions update
  • A common form pattern used across all core admin & host modules
  • A control panel update
  • New Icons & API
  • Additional Telerik Control Wrappers (Should be all as of latest release)

Because I recently finished up converting some admin and host modules, I thought now would be a good time to look at implementing the form pattern in a custom module I wrote. The remainder of this post is my account of that process along w/ downloadable examples. You can also find some good examples in the core admin modules in 6.0 (like site settings) which take advantage of the new client-side plugins. Please note, this is meant to serve as a quick example.

jQuery & jQuery UI (ViewEntries.ascx)

To get started, I simply installed the source view of my Contest module into a DotNetNuke 6.0 I already had locally (you could use CTP 3 or wait for the upcoming Beta – the beta date is still TBD but should be within the next week).

After installing and placing the module on a new page, I realized I already had a problem. My module actions menu (which is now a DDR menu) and the control panel’s mega menu (also DDR) were no longer functioning. This was because I was loading a specific version of jQuery UI (which resulted in 2 versions of jQuery UI being loaded on the same page). To correct this, I utilized the new core method: jQuery.RequestUIRegistration in my module’s OnInit method. This also allowed me to remove jQuery.RequestRegistration (which registers jQuery itself) because this new method will handle that for me. I removed my previous way of registering jQuery UI and after a recompile my module was working as expected and the initial view loaded fine.

Before moving on… what you register in your module, if anything, depends solely on what controls/javascript/plugins you are using in your module. If you need only jQuery, call the jQuery.RequestRegistration (server side) method. If you need jQuery UI, call the jQuery.RequestUIRegistration method. If you want to utilize any of the jQuery UI controls used in the admin & host interfaces like module settings (client-side dnn plugins), use jQuery.RequestDnnPluginsRegistration. Each method will register jQuery, and then jQuery UI if applicable. In the next screenshot (which was taken from Host Settings), you can see the jQuery and jQuery UI integration options that are part of DotNetNuke 6.0.

image

Now, with my module working as it was before and an explanation of the jQuery updates out of the way, it is time to move on. (If you are curious, this control is used to display a list of the contest entries, and a user can vote from this screen.)

Basic Form Pattern (Settings.ascx)

To view the Settings.ascx control in the Contest module, you simply need to select the ‘Settings’ module action. As with previous versions of DotNetNuke, module developers can have a control of their own loaded into the module settings. Below is a screenshot of the module settings control w/ the Contest module’s Settings.ascx shown as-is in 6.0.

image

If you haven’t already noticed, the module settings area is now divided into tabs. The custom module control loaded here (in this case, Contest Settings) will always be the last tab on the right. If you can’t tell from the screenshot, this is a simple form with some checkboxes, a few Telerik controls and some dnn labels.

Previously, the module was basically using a div for each item, and I used Css to create ‘two columns’ (one left, one right). Now, by applying some of the new classes that are used in 6’s default.css (dnnForm, dnnFormItem) I was able to consolidate it down into a div for every row (instead of 2), removed NormalTextBox and SubHead classes on all form input areas and labels (textboxes, drop downs, labels, etc.). I was also able to remove 2 classes from my module.css (for left/right placement). I removed any hard coded width assignment, if possible, and the end result of this can be seen below.

image

If you are not familiar with 6.0 yet, the module settings screen (shown above) looks very much like any other ‘form pattern’ based control in 6. In general, forms that follow this pattern (like the Contest module’s Settings.ascx now does) are going to output pretty clean HTML. Below is the source view of HTML from the control.

image

If you wish to compare or view the changes discussed so far, you can use this link to see the changes them at CodePlex.

Telerik Controls & User Actions (ManageEntries.asx)

This control in the Contest module is used to manage a collection of contest entries (associated by ModuleID). It contains some Telerik controls and it already had partial rendering enabled, therefore the changes required were minimal. To access this control, simply select the “Manage Entries” module action of the module. Here is a look at the control in 6 before any changes were done.

image

To get started on this control, I removed the extra Ajax panels and converted the Telerik controls to their properly wrapped DotNetNuke counterparts. I also made sure I wrapped the entire ‘form’ in a single div w/ a class set that is custom to my module.css. Next, I changed my cancel button to a hyperlink (instead of a link button) and set it’s URL to my module’s home page (ie. NavigateURL()). I then removed the module action I was rendering (which was to add an entry) and made it a new hyperlink (and placed it by the cancel hyperlink).

Then, I updated the css class assigned to the buttons (made the ‘add’ link use dnnPrimaryAction, because it is the primary action the user will take on this page, and made the cancel link use dnnSecondaryAction). I also created an unordered list, assigned the “dnnActions” css class to the ul and then put my links inside of it as list items. Please note, the primary action should always be the one on the left.

Finally, I added a ‘No Records’ template to the DnnGrid and styled and localized it’s value. The end result of which can be seen in the next screenshot. If you would like to view the code/HTML changes for this section, you can do so here.

image

More Form Pattern & Plugins (EditEntry.ascx)

This control is used to edit existing contest entries as well as create new ones. You can get to this view by clicking the “Add Entry” button shown in the last section. Once there, you should see something that looks similar to the screenshot below.

image

Although not absolutely necessary, I decided (for the sake of an example) to divide this page into smaller sections that should be easier to work with for end users of the module (In general, I prefer to limit the amount of ‘stuff’ in front of the user at any given time). Based on what is available in 6.0, I had a couple of options for doing this. I could use either tabs or panels (both of which utilize jQuery and our plugins).

To get started with this control, I applied the normal form pattern updates (discussed in the previous 3 sections) and left the rest of the module unchanged. I compiled it and this is what I ended up with (You can view the changes discussed in this section so far here).

image

Now, to utilize the panels I am going to need to break the fields up into logical groups. For this module, it seemed like a good fit to have 3 sections. Because I have 3 sections, it was a perfect fit for the panels (In general, 3 or more logical groupings are recommended). Luckily, the dnn client-side plugins make integration into my module easy. I don’t want to get too far into the details in this blog, you can view the examples to see more. Also worth noting, if you review the example, is that I used the dnnConfirm client-side plugin for delete confirmation in the module. This utilizes jQuery UI.

After I finished rearranging the control, I also added some validation and made the Entry Name field required (if viewing source, notice the updated fields and Css class addition). A sample of the module in it’s current (and for now, final) state can be seen below.

image

There are a few more things I could do with the module at this point, but for now I think it looks consistent with the 6.0 administrator and host modules (which is what I set out to do). When a beta of 6.0 comes out, I will compile a Beta release version of the contest module and post it for download.

Comments

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out