Creating A PA Module From OWS Configuration


November 26, 2008

For some reason, doing this with ListX or OWS has always seemed like a daunting task but after learning how to do it, it's really pretty easy. Included in this post are the step by step instructions and the files you can use as a template to get you started.

1. To create a module you require the following files(where MyModule is your module name): MyModule.ASCX MyModule.ASCX.RESX MyModule.DNN

2. If you are going to need to create or update and SQL tables: 01.01.01.SqlDataProvider - where 01.01.01 is the version number you set for the module Uninstall.SqlDataProvider - to remove any tables when the module is uninstalled.

3. If you want to have a section for configuration in the Settings option of the module menu MyModuleSettings.ASCX MyModuleSettings.ASCX.RESX







For this example, I'm going to turn the configuration in my blog post "A Very Basic OpenWeb Studio Module" into an installable PA module for DNN and I'm going to call my module "Basic User Edit". First I'm going to replace "MyModule" in all the file names with BasicUserEdit, the name of my module. Next, set up BasicUserEdit.ASCX. Here there is really nothing much to do. Just make sure you have a ASCX text file that reads exactly as follows:

<%@ Control Language="vb" AutoEventWireup="false" Inherits="r2i.OWS.Wrapper.DNN.Module" TargetSchema="" %>
<%@ Register Assembly="r2i.OWS.Wrapper.DotNetNuke" Namespace="r2i.OWS.Wrapper.DNN" TagPrefix="cc1" %>

<cc1:OpenControl id="ows" resourcekey="Module.Text" runat="server">


For testing and modifying a live PA Module by adjusting its configuration within the site, you can change the Open Control definition to use the ConfigurationID rather than the ResourceKey. To do that, first ensure that the configuration has been published within your CMS, then change the ASCX to read this way (changing the configurationID obviously):

<%@ Control Language="vb" AutoEventWireup="false" Inherits="r2i.OWS.Wrapper.DNN.Module" TargetSchema="" %>
<%@ Register Assembly="r2i.OWS.Wrapper.DotNetNuke" Namespace="r2i.OWS.Wrapper.DNN" TagPrefix="cc1" %>

<cc1:OpenControl id="ows" ConfigurationID="12191580-9578-5a83-6be1-b133324625c6" runat="server">

Next, let's set up the RESX file. If you do not have Visual Studio, you may need to get a program like Resx Editor to create your RESX or just Google for one. I rename the existing RESX file in my sample download package to BasicUserEdit.RESX. Next I go into the OWS Administration and open the Config. Then, click on Export from the Home tab, select all the module code(CTRL+A) and copy to your clipboard(CTRL+C).










Now go to Visual Studio and select File>Open>File and select your RESX file. Delete the row or existing content in the grid. In a new row add the name field exactly as Module.Text then paste your config in the Value field. Save the file and exit Visual Studio.








Then, in the BasicUserEdit.DNN file, replace:

  1. All occurances of MyModule with your module name.
  2. Enter your version number for the module where appropriate
  3. In the module node, verify the section to determine the path in the DNN app you want to install the module to.
<dotnetnuke version="3.0" type="Module">
            <description>Description Of BasicUserEdit</description>
            <!-- <businesscontrollerclass>r2i.OWS.Wrapper.DNN.Interface.iSearchable, r2i.OWS.Wrapper.DotNetNuke.Interface</businesscontrollerclass> -->

NOTE** - you still want to add an additional Control node section AND 2 File node sections in your Files node for your DNN file, if you include Module Settings. Then follow the existing syntax for the Files Node in the DNN file above for adding the additional RESX and ASCX sections for the Module Settings. The Control node for Settings will look something like the following where the type node has Edit as a value:


    <title>BasicUserEdit Settings</title>


To add or change table schemas in the DNN database you add a *SqlDataProvider file that is prefixed with the SAME version number that exists in your DNN file. The contents of the file are pure SQL with no special formatting other than the following:

  • EVERY database object name must be prefixed with {databaseOwner}{objectQualifier} so that the SQL objects will be created with the DNN database owner as the object owners and to be compatible with DNN object qualifier method
  • It's recommended that you "alias" your table names so you don't have to prefix everything with {databaseOwner}{objectQualifier} in your SQL. "Select username from users" becomes "Select u.username from {databaseOwner}{objectQualifier}users u"

Follow the same rules in the Uninstall.SqlDataProvider file to delete the database objects you create in your SqlDataProvider install files, when the user uninstalls your module. To set up a unique section in Module Settings for your OWS PA modules, as mentioned earlier you need a MyModuleSettings.ASCX and MyModuleSettings.ASCX.RESX. Follow the exact same instructions above for creating these files, then follow this example to create the OWS configuration that will be your Module Settings that you save in the Setting's RESX file.








NOTE** - the section in cyan is what will display in the actual section for your module in Module Settings. The yellow section MUST be configured as displayed EVERY TIME in your config that will become your Settings.RESX file as it specifically listens for the UPDATE link the user clicks when saving module settings.

Packaging your module is very simple.

  1. If you have no settings files or sql to execute on module install, just add the ASCX, RESX and DNN file to a ZIP file
  2. Add the 2 SqlDataProvider files to the zip if you need to execute SQL
  3. Add the ASCX and RESX Settings files to the zip if you have included Module Settings

That's it...... Upload your module and test. Don't forget to increment the version numbers in the SqlDataProvider and DNN files for each revision of your module.

Installable BasicUserEdit Module

MyModule Template Files To Create Your Own Installable DNN Module



Average (2 Ratings):
Want to help out?

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA •

Bookmark & Share Bookmark and Share