Professional DotNetNuke 4: Open Source Web Application Framework for ASP.NET 2.0 (Programmer to Programmer)
User Content Modules
Now that you are familiar with the concepts surrounding modules, this section examines the 16 user content modules that are bundled with DotNetNuke. Another five "internal" modules exist that are not really content modules, so this section does not discuss them.
Here's the complete list of modules:
-
Account Login (internal)
-
Announcements
-
Banners (internal)
-
Contacts
-
Discussions
-
Documents
-
Events
-
FAQs
-
Feedback
-
IFrame
-
Image
-
Links
-
News Feeds (RSS)
-
Search Input (internal)
-
Search Results (internal)
-
Survey
-
Text/HTML
-
User Account (internal)
-
User Defined Table
-
Users Online
-
XML/XSL
The Core Team's policy on bundled modules is not to include every new module within the core, but to provide an extensible and rich platform that enables third parties to build on the functionality in the bundled modules. Still, the bundled modules are designed to meet the majority of needs.
To meet the growing needs of the community, a number of subprojects have been formed to further extend the initial modules bundled within DotNetNuke. These projects are managed separately from the core project and are typically released in shorter timeframes. Popular subprojects include the following:
-
Blog
-
Firebird Database Provider
-
Forum
-
Gallery
-
Help
-
Repository
-
Store
-
Wiki
You can download these modules or find out more information about them at www.dotnetnuke.com/DotNetNukeProjects/tabid/824/Default.aspx.
Announcements Module
The Announcements module enables you to create short articles for your visitors and even to expire the older articles as the content becomes obsolete. This module provides an easy-to-use interface for keeping your content fresh and rotated. You can use the module to display news releases or a collection of related articles, or merely as a teaser to other content in your portal.
You'll now add an Announcements module to your base installation and see exactly how this module works. Start by opening your web browser to the application and logging in with the administrator account to add the module to your page. Then you will add some content to your module instance.
Note | You do not have to be the administrator to accomplish this task. You could set up a role with edit permission to your page and offload this task to another individual in your organization. This is made possible by the roles-based security the application employs to control access to content and administration. |
First, use the Add Module function, as shown in Figure 6-4, to add the module to your page.
Note | This process is the same for every type of module you add. For clarity, these are the exact steps for adding the Announcements module, but as other modules are discussed, just the specifics related to the particular module will be discussed. |
When you log in to your portal and navigate to a page where you have edit privileges, you see the Control Panel shown in Figure 6-4. In Chapter 4, you used this interface to add a new page to your portal using the Page Functions section. You are now going to use the module section of this interface to add an Announcements module. Remember that this is the interface you use to add any module to your portal pages. As in the Page Functions section, the titles of the available functions are self-documenting. The Module drop-down control lists all of the types of modules you have installed in your DotNetNuke instance, and you can select any available module type from the list. If you select the Add Existing Module radio button, the content of the Module drop-down list changes to reflect instances of other modules you have already added elsewhere in your portal instance. Assume you have a navigation module you need to show only on certain pages to enable navigation to deeper content areas of your site, but you do not want to show on all pages of the portal. This function enables you to easily duplicate your navigation for only the pages for which you need the functionality to be available. The Module control enables you to specify the pane where you want the module to appear and how you need the module aligned inside that pane, with the Pane and Align drop-down list controls, respectively. Notice that you can also specify the title for the module instance as you add the instance.
Note | The preceding directions apply to any module you add to a page. |
Now that you understand all available functions, take a look at Figure 6-5. Add the Announcements module, and define the settings of your module instance by choosing Settings from the Module menu.
You've now added your announcements instance and navigated to the settings for your module. Notice that the Module Settings control looks similar to the Page Settings control used in Chapter 4. This is by design because it decreases the learning curve associated with managing the application. Notice that this control uses the same type of field-level help available in the Page Settings control, which enables you to get a description of the type of content the application expects for this module instance. Table 6-1 describes these associated settings.
Option | Description |
---|---|
Module Title | The module's title. |
Permissions | Set which roles will have access to edit the content in your module. Several options are available for controlling the security of the module's content. A special option is the Inherit View Permissions from Page check box, which allows the security settings specified at the page level to secure your module. |
Display Module On All Pages | Define a module that will appear on all pages within your portal. This can be useful when you're defining advertising or navigation-type modules that you need to display to your users regardless of the page they are visiting. |
Header | Define content to display above your module's content. |
Footer | Define content to display under your module's content. |
Start Date | The date you want the content to start displaying to your users. This can be useful for planning content that you want to appear only after a certain date. |
End Date | Specify when outdated content should expire. |
These options are virtually concurrent across all instances of the various modules. Figure 6-6 shows the panel for the Page Settings of the module. Although this may appear exactly like the Page Settings covered in Chapter 3, these settings have some unique options just for the current module instance. Figure 6-6 illustrates page settings you will see in the base modules throughout the application.
Table 6-2 lists each of the settings. You will encounter this section throughout the modules in the application.
Option | Description |
---|---|
Icon | Enhance the display of your module by adding an image to the left of the title. The file you use must reside in one of the areas defined in your File Manager area. |
Alignment | Specify the alignment of your module in the pane. |
Color | Specify the background color of the content that appears in this module. |
Border | Specify a border width for your content in the module. |
Visibility | DotNetNuke exposes methods to allow your users to expand and collapse content to save real estate. The Visibility options enable you to define the default behavior of the module and whether you want users to be able to hide or display the module's content. |
Display Title | Display or hide the module's title. |
Allow Print | Enables you to expose the print module action, which displays a print icon users can select to print the module's content in a print-friendly format. |
Allow Syndicate | Enables you to expose your module's content in an XML format, which allows other web authors to consume and display your content on another web site. |
Module Container | Set the container to use for the module's display in the portal. |
Cache Time | DotNetNuke uses caching to increase the performance of the application. This setting enables you to set the number of seconds the module should remain cached in memory. |
Set As Default Settings | Use this module's settings as the default for all the modules you add to your portal. |
Apply To All Modules | This is a time-saver if you decide you want the default behavior of all modules to be different from your original settings. You can apply the settings to one module and push those settings to all instances of modules in the portal. |
Move To Page | Enables you to move this module instance to another page in the portal. |
The settings listed in this section are implemented from the base module settings class, so this information is pertinent to all modules that inherit the classes, and it is a programming requirement that modules inherit the class. This means that you will have the preceding functionality no matter which module you are working with, whether it's a base module or another third-party module.
Now that you have updated your module settings, you can add a couple of announcements for your users. Figure 6-7 illustrates how the Announcements module shows the results of your changes to the settings.
Assuming you set up your module to Allow Print and Allow Syndicate, the XML and Print icons appear in the module instance. If you have not enabled these options, those icons are not available. Click the Add New Announcement command link to navigate to the Edit control for your Announcements module. The Edit Announcements page (see Figure 6-8) opens, and you can define your announcement.
Like the other areas of the portal, the names are self-explanatory, but Table 6-3 describes each option.
Option | Description |
---|---|
Title | The title that describes the individual announcement. By default, the date the announcement is created is appended to the title you define here. If you do not want this date to appear to your users, uncheck the Add Date check box. |
Description | The content for your announcement. This module uses the FreeTextBox (FTB) control to make it easier for users to format the display of the text. If this particular announcement does not require rich text formatting functionality, you can use the text box option, which dynamically removes the instance of FTB and enables you to use only a text box for this function. |
Link | Specify a location where users can obtain more information about the announcement. Enabling this option creates a link at the end of your announcement that, when clicked by the user, allows navigation to the link you define. The default option is to not provide a link (None). If you select the URL option, the location control changes to a text box, allowing you to specify an external URL. If you select the Page or File option, the Location control changes to a drop-down list, which enables you to select the page or file where the additional information resides. Additional options allow you to further customize the link to capture the number of times an article is clicked, who clicked it, and a choice to open it in a new window. |
Expires | Set a date when the content should expire and no longer be viewable by your users. |
View Order | By default, announcements are displayed in ascending order according to their creation date. The View Order option enables you to define the order in which you want announcements to appear. |
You now have all the knowledge necessary to create and maintain announcements for your portal. The other base portal modules follow similar methods for creating content. Because many of these modules use the same methods for the common functions, these methods are not covered in detail in the later module descriptions, but the differences are emphasized. One thing to keep in mind if you have aspirations of creating your own modules to extend DotNetNuke is that the code contained in the Announcements module is a good head start for creating the layout of your own modules. For more on developing your own modules, refer to Chapters 12–15.
Banner Module
The Banner module provides a method of offering advertisements in the DotNetNuke application. Administering this module is a little different from any of the other base modules because this module works in conjunction with the Vendors module, which is an administrator-only module. Banners can be controlled from the Host level or Portal level, and the Host or SuperUser account controls this behavior.
Probably the first thing you will notice when you add this module to a page is that you see only a Banner Options action and not an Add New Action option, like the other modules display. This is because the banners will need to be added from either the Admin Vendors page or from the Host Vendors page. This is one of the functions that makes DotNetNuke a viable host platform, because you can offer free or inexpensive portals for your users and then recuperate your hosting costs by offering advertising on the individual portals in your DotNetNuke installation.
The previous two chapters discussed the Host and Admin functions and covered exactly how to add them. For now, assume you have already added a vendor and are ready to display a banner advertisement for that vendor. After you add the module to a page, click the Banner Options action. You are presented with the Edit Banner window, as shown in Figure 6-9.
As you can see, there is no option to add a banner to this control. That action is handled in the respective Vendors module by the Host or Portal Administrator, and this module is the mechanism you use to display those settings to the user. For a full description of managing the Vendor functions in DotNetNuke, refer to Chapters 4 and 5. Table 6-4 describes the Edit Banner options.
Option | Description |
---|---|
Banner Source | Selecting one of these radio buttons enables you to specify whether the vendor banners shown in this module should originate from the host or from the portal. |
Banner Type | The type of banner that should be shown in this module. Banner types include Banner, MicroButton, Button, Block, Skyscraper, Text, and Script. Selecting a specific type means the vendor must have that type assigned to its account or the module won't show that vendor's advertisements. |
Banner Group | Enables you to associate a group of banners in the administrator vendor's module, such as the Site Banner group. Entering the banner group here enables you to group the same types of banners. |
Banner Count | Defines the number of times a banner will display to the users. |
Orientation | Enables you to display the banner either vertically or horizontally. The type of banner you chose usually dictates which option you should select. |
Border Width | Defines the width of the border. |
Border Color | Sets the border color. |
Row Height | Sets a row height for your banner. |
Row Width | Sets a row width for your banner. |
After you have set up your vendor accounts on the vendor pages, you will be able to earn revenue from your DotNetNuke installation. As you saw, there is really no direct editing of content from this module. This is a design decision, so you can let other roles in your installation handle these remedial types of tasks while you control your revenue generation from the higher accounts. You will still need to set up the module settings for this module, but because this module contains the same functions as the Announcements module, those settings will not be covered again here.
Contacts Module
Almost every web site, regardless of content area, needs a method to provide information to contact the site's owners and employees. This is the purpose of the Contacts module. You can add your contact information and provide an easy-to-use interface for updating it to maintain current information. You can create an entire company directory from this module or display contact information for only a few individuals. The types of information you can display include the name, employee role, e-mail address, and telephone numbers for the individuals listed. Figure 6-10 shows the options for adding a Contacts module to your test portal.
Here you can enter the information for each contact you want to display and the module will show the information to the roles you approve. When the module information is entered, the e-mail will be formatted as a mailto link that your users can use to send e-mail to the contact via their default mail client.
Discussions Module
The Discussions module is a lightweight forum module your users can use to share information. It isn't designed to be a full-fledged forum platform, but it will work for light forum activities you may need to offer on your web site. This module uses the same settings as the previous modules have used, so there's no need to cover those activities again. Figure 6-11 shows the interface for creating new threads in the module.
As you can see, this is the simplest interface you've encountered so far. This module is easy to use — just enter a title and write your message. To reply to your thread, users must click the thread and click Reply. Try out this module to see if it meets your need to provide the functionality to your users.
Note | Several other full-fledged forum modules are available for DotNetNuke. Some of these are free and some require a small license fee. Refer to the DotNetNuke web site if you require a more robust forum system for your portal. |
Documents Module
The Documents module enables you to upload files to your portal and offer those files to your users for download. This is a fairly useful module because you will likely need to offer examples or additional information in the form of Word documents or other types of files to your users. The types of files you can use with this module are controlled by the file type settings under the Host Settings page. By default, DotNetNuke allows the following extensions:
.jpg .png .txt .jpeg .doc .xml .jpe .xls .xsl .gif .ppt .css .bmp .pdf .zip
If you require additional file types not allowed by default, you will need to add the extension under the Host Settings page in the File Upload Extensions field. If you are going to allow your users to upload files, you should be careful as to the types of files allowed because users may introduce viruses or other undesirable files into your portal file system. The application offers no default protection in this area, so diligence is needed to protect the integrity of the system.
Figure 6-12 shows the interface you use to add new documents to this module. As in other areas of the application, the files you make available through this module will reside in your portal's default file directory.
Enter the title, link, and category for your module. You may notice that the Link section appears similar to the Link control in the Announcements module. This is another example of the object-oriented nature of DotNetNuke, which reuses code wherever possible to enable a simpler user interface and to promote best programming practices. The only difference between the two is that the Announcements module enables you to select a page in your portal as one of the links. Because it should never be necessary to offer a page for download, this option is not included in the Documents module. Like the Announcements module, the Documents module enables you to track your users' actions to determine the content they are most interested in receiving. The Category field offers you the ability to group the files in the module logically. This category will be displayed as part of the Documents module so that users understand the type of file they are about to download or view.
Events Module
The Events module enables you to announce upcoming events to your users. Although this module has some additional settings that control the display of the module, the rest of the module settings are the same as the ones already discussed; so, this section looks only at the settings that are unique to this module.
As you can see from Figure 6-13, you can display the Events module in either a List or Calendar format. The options for setting the cell width and height are pertinent only if you select the Calendar option. Selecting the List option will format the information you enter into the module as a sequential list of upcoming events.
After you've decided on the view for the events, you can add the event, as shown in Figure 6-14. Table 6-5 explores the available options.
Option | Description |
---|---|
Title | The title of your individual event. |
Description | Describe your event to provide users with detailed information that is not included elsewhere in the module. |
Image | Select an image to be associated with your event. This is usually used to easily convey more information about your event to your users. |
Alternate Text | Text describing your image. This is important for meeting web accessibility for users who may access your site using screen readers. |
Occurs Every | How often this event will occur. Options are to set the event to occur periodically based on the day, week, month, or year. This is a time-saver because if you have recurring events to announce, you only need to set the event once and the module takes care of the rest. |
Start Date | The first date your event will occur. Unlike the Announcements module, your content is visible before the date you enter here. This date signifies the start of your event. |
Time | Time of day your event will occur. |
Expiry Date | The last day of your event. This is useful when you are using the Occurs Every function and no longer need to show the event but would like to keep earlier events of this type for reference. |
Note | When using the Calendar view, keep the amount of text in the description minimal because the available space is limited. If your events need a longer description, use the List view instead. |
FAQs Module
You can use the FAQs (Frequently Asked Questions) module to answer questions users may have about your web site or products. It is one of the simpler modules in DotNetNuke, but it's also one of the more powerful ones because it can save you many hours of replying to e-mails. The interface for adding a new FAQ is quite simple and warrants little discussion. Basically, you enter a question you want to provide an answer for and then enter the answer. The module enables you to use the Rich Text editor to format your questions and answers in a way that is easy for your users to understand and to convey the intended message. Figure 6-15 shows the interface for the FAQ's module's Edit functions.
Feedback Module
The Feedback module offers you a mechanism for allowing users to contact you without exposing your e-mail address to the many spam bots that regularly scan the Internet. The module does not have an Add function like the other modules because the purpose of the module does not require that functionality. Basically, users are adding feedback when they send you e-mails. The module contains some settings to control its display to users and to specify the address to which the e-mails are sent. Prior to version 3 of the portal, the only option was to send these requests to the administrator account. Now you can change this behavior. One thing to be aware of is that this module relies on the mail server settings on the Host Settings page to function properly. Ensure that you have successfully added your mail server and tested the settings before attempting to utilize this module's functionality. You also have the option of setting the width and rows of the Feedback module to control its display (see Figure 6-16).
IFrame Module
The IFrame module enables you to display web pages from other web sites in your portal. When you set the page, the module should display and add an IFrame tag to your page and load the remote site into the frame. One of the main uses for this module mentioned in the DotNetNuke forums is to utilize legacy applications that were created with ASP or some other dynamic language that must still be used for some functionality. This enables companies to take advantage of the benefits of DotNetNuke while still using other functionality of previous applications. This usually is a short-term fix — as companies become more familiar with DotNetNuke module development, they can convert their legacy applications to fully compliant DotNetNuke modules to take advantage of full integration with DotNetNuke roles and user control functions. Figure 6-17 illustrates the Edit control for the IFrame module, and Table 6-6 describes the options available.
Option | Description |
---|---|
Source | The location of the web page you want to display in your module. |
Width and Height | Determines the size of the IFrame and should be adjusted to fit the page you need to display. The fields can be entered either as pixels or as a percentage, depending on your needs. |
Title | This field is somewhat misleading because it neither refers to the module's title nor will it be shown in the web browser. The title, for which you should enter a descriptive value, is required to comply with Section 508 of the Rehabilitation Act. |
Scrolling | Determines whether the IFrame adds scrollbars for the frame. This is important if the target web page is larger than you can show in your portal without impeding the display or omitting certain content of the target page. The auto setting usually is the best choice because the module will determine whether the bars are needed based on the dimensions of the target page. |
Border | Defines whether a border will appear around the target page. |
Image Module
As its name suggests, the Image module offers an easy way to add images to your portal. The module enables you to add an image to a page where it would not make sense to have a skin element and you do not require the capability to link to another site from the image. The image you display can reside either in your portal file system or on an external resource. Figure 6-18 shows the options available for adding a link.
Notice the familiar file picker interface you have seen in other modules. Selecting the URL option for the Link Type produces a postback and presents you with a text box to enter in the path to the remote image. If you want to use an image that resides in your portal directories, simply select the image from the drop-down lists. This interface also enables you to enter alternate text for the image and to specify the image's width and height. Leaving the proportion text boxes blank causes the image to be displayed in its actual size.
Links Module
The Links module is likely one of the most used modules in DotNetNuke installations — it probably is only used less than the Text/HTML and Announcements modules. As its name suggests, this module enables you to add links to enable users to navigate to other areas of your site or to remote web sites. There are a few unique settings with which you need to be familiar. Figure 6-19 shows the Module Settings pane for the Links Settings.
You have several options for controlling the behavior and view of the Links module. The Control Type radio buttons enable you to define whether the link list displays as a drop-down list or a normal, databound list. You also have the option of controlling the orientation of the list with the List Display Format option. The last option, Display Info Link, enables you to show users a short description of the web page to which the link navigates, which is useful because it allows some additional keywords to be associated with the link. For this example, just accept the defaults in the Link Settings and move on to adding your link, as shown in Figure 6-20.
The text you enter in the Title field is what users will see as the link. As with other modules, the Link Settings offer options for linking to an external resource, a page on your site, or an internal file in your module, and the audit controls let you track your visitors' behavior. The Description field contains the text you would enter if you selected the Display Info Link option in Figure 6-19. The View Order option enables you to specify the order in which your links are displayed.
News Feeds (RSS) Module
The News Feeds (RSS) module enables you to consume RSS content from another resource and display it to your users. Many web sites offer syndicated feeds that you can consume and display relevant content for your portal, some of which are free and some of which require a fee to consume. With the News Feeds (RSS) module, you can use both types of feeds and display the information according to your feed style sheet, as shown in Figure 6-21.
The News Feed Source is the location of the source you want to consume. You also have the option of specifying the style sheet to use with the feed. Most news feeds provide a style sheet designed specifically for their feed, or you can specify your own style sheet. In addition, some feeds require you to present credentials authorizing access to their content before you can consume a feed. The Domain\username and Password text boxes are where you enter this type of authentication information.
Text/HTML Module
The Text/HTML module — "HTML mod" for short — is probably one of the most-used DotNetNuke modules. It enables you to format your content with the easy-to-use FreeTextBox editor and also allows a large amount of content to be displayed. This module also fits with what most webmasters need for their content display. You have the option of using the editor or, if you're a hard-core HTML programmer, you can type in your HTML directly without relying on the controls rendering your markup. The Text/HTML module's interface is straightforward and includes only two controls, as shown in Figure 6-22.
The first option is where you will enter your content to be displayed in the module, and the second is a search summary. The DotNetNuke search functions are capable of indexing all the content in this module. The type of content entered in this module may become quite large, so the Core Team felt it would be pertinent to allow a mechanism for the module administrator to add a summary of the content for the search engine to use. This accomplishes two functions. First, it enables you to provide the gist of the content that will be displayed to users when they search for similar content and, second, it helps with the performance of the search engine because there is no need to index all the content that may appear in this type of module.
Alternate editors with extended functionality can also be plugged into DotNetNuke via the Provider Model. A subproject for an alternate editor (FCKEditor) can be found at www.dotnetnuke.com/Default.aspx?tabid=934.
User Defined Table Module
The User Defined Table is a catch-all type of module that enables you to define your own data type and display that information to users in an organized manner. The easiest way to understand the use of this module is through an example. Suppose you need an additional field for your portal's contacts. You could open the Contacts project, modify the code to add your field, and then recompile, but you could also use the User Defined Table module to accomplish the same task. First, add the module to your page and open the Manage User Defined Table action item; then click the Add New Column link. The Manage User Defined Table dialog opens, as shown in Figure 6-23.
For simplicity, assume you need to display only the person's name, title, and birthday in your Contacts module. So, you add fields of these types and now have your fields defined, as shown in Figure 6-24.
You not only can add your own unique fields, but you also have the ability to specify the data type. Data type options for this module include Text, Integer, Decimal, Date, and Boolean. Figure 6-25 shows the finished table. To add a new item to the module, select the Add New Row action from the module menu.
As you can see, you can display information in a manner that was previously not available with the portal, and you have accomplished your goal with just a few clicks and without ever opening an IDE to display your data. Spend some time exploring this module to see what other functions it may enable you to perform.
A subproject exists for the User Defined Module and includes an improved version. You can find out more at the official subproject page, www.dotnetnuke.com/Default.aspx?tabid=877.
XML/XSL Module
The XML/XSL module enables you to display XML data from an external data source in your portal according to the accompanying XSL transformation file. It further increases the type of data you can display in your portal and is limited only by the XML technology and your imagination. Figure 6-26 shows the module's Edit settings.
The module uses the file picker controls available in other modules to enable you to select the source of your XML data and the transformation file you will use to describe that data. It enables DotNetNuke to consume data from a wide variety of sources because most modern data sources enable a method for exporting data to the XML format.
Категории