Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUpgradeModule Not FiringUpgradeModule Not Firing
Previous
 
Next
New Post
2/15/2012 11:37 AM
 

I am trying to add custom permissions to my module. I tested my code within a page's Load() event, and the code adds the permissions perfectly, so I know that isn't my problem. It just seems that I can't get the UpgradeModule() event to fire. Can anyone help me figure out why I can't get my code to fire on an initial module install? I have the following code/settings:

SQLDataProvider Filename: 01.00.00.SqlDataProvider
DNN File:
     <package name="MyModule" type="Module" version="01.00.00">
     <script type="Install">
         <path>Providers\DataProviders\SqlDataProvider</path>
         <name>01.00.00.SqlDataProvider</name>
         <version>01.00.00</version>
     </script>
     <script type="UnInstall">
         <path>Providers\DataProviders\SqlDataProvider</path>
         <name>Uninstall.SqlDataProvider</name>
         <version>01.00.00</version>
     </script>
AssemblyInfo File:
     <Assembly: AssemblyVersion("01.00.00.*")>
     <Assembly: AssemblyFileVersion("01.00.00.*")>

Public Function UpgradeModule(ByVal Version As String) As String Implements DotNetNuke.Entities.Modules.IUpgradeable.UpgradeModule
    '***************************************
    ' Perform Operation Based On Version Number
    '***************************************
    Select Case Version
        Case "01.00.00"
            '***************************************
            ' Initial Install...
            '    Create Custom Module Permissions
            '***************************************
            Me.InitializeModulePermissions()
    End Select

    '***************************************
    ' Return Version Number
    '***************************************
    Return Version
End Function


Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
New Post
2/16/2012 5:46 PM
 
I dont see a businesscontroller class definition so thats probably the issue -however there is a much easier way to do this by adding custom permissions in the module definition - http://www.dotnetnuke.com/Resources/Wiki/Page/Manifest-Module-Component.aspx

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
2/17/2012 10:41 AM
 

Cathal,

I actually did have a businessControllerClass definition inside the DNN file, the default that was defined when the project was created. However, looking at your link, I didn't have the supportedFeatures section defined.  Not sure if that was the problem, I am going to rework my source to the method in the link you provided and post my results.

However, even though it is much simpler to add the custom permissions into the DNN file directly (which I am in the process of doing), when the Module first installs, I need it to define some default module settings. If I can get UpgradeModule() to fire as it's supposed to, I'd be able to write my code there.  But the problem I am having is that I can't get a reference to the current Module's ID within the FeatureController class. Is there a way within this class to get the ModuleID, that way I can then use the UpdateModuleSettings() found within the ModuleController class.

Thanks!


Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
New Post
2/17/2012 8:56 PM
 

Ben,

In addition to having a <businessControllerClass> node in your manifest, have you included the necessary <upgradeVersionsList> node with a comma separated list of version(s) for which IUpgradable.UpgradeModule is to be called?

Please see this Wiki entry for more information on the <eventMessage> section of the manifest:
http://www.dotnetnuke.com/Resources/W...

and this blog post for more information on the <upgradeVersiionsList> node in particular:
http://www.dotnetnuke.com/Resources/W...

In regards to defining default module settings you cannot do so in an implementation of UpgradeModule in your business controller class. At the time of installing or upgrading a module there is no ModuleID as one does not exist until a module is added to a page. Instead when your module loads you can check if any module setting or tabmodule settings have been set and save (using UpdateModuleSettings or UpdateTabModuleSettings) the default values. Alternatively when your module needs a particular setting value you can check if the settings key exists in the Settings hashtable. If it does exist then return the previously saved value - if it does not exist return a default value. In modules which have more than a few settings I always prefer to create a Configuration class which when instantiated in the module's Init or Load event handlers loads all of the module settings into strongly typed properties and either handles the settings pre-configuration when the module is first placed on a page or provides defaults for settings not previously saved.

Take a look at most of the more involved "core" modules to see how that is done. I know that some of the project's I've created or contributed to in the Extensions Forge take this approach: Gallery, Feedback, ContentDejour for example.

 


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
2/24/2012 12:41 PM
 

 

William,

Thanks for the information, although the two links you posted were to the same page, I am assuming that was a typo?

Ok, I have moved all my current items to other areas and have them working.  HOWEVER...I still need to understand how to implement the UPGRADEMODULE process for future reference. I have the following DNN entries:

<package name="ModuleName" type="Module" version="01.00.02">
.
.
.
<businessControllerClass>MyCompany.Modules.ModuleName.Components.FeatureController</businessControllerClass>
<supportedFeatures>
   <supportedFeature type="Upgradeable" />
</supportedFeatures>
.
.
.
<eventMessage>
   <processorType>DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke</processorType>
   <processorCommand>UpgradeModule</processorCommand>
   <attributes>
      <businessControllerClass>MyCompany.Modules.ModuleName.Components.FeatureController</businessControllerClass>
      <desktopModuleID>[DESKTOPMODULEID]</desktopModuleID>
      <upgradeVersionsList>01.00.02</upgradeVersionsList>
   </attributes>
</eventMessage>
.
.
.

In my FeatureController class I have the UpgradeModule() function. Inside it I have the following code:

'***************************************
' Perform Operation Based On Version Number
'***************************************
Select Case Version
   Case "01.00.02"
      '***************************************
      ' DRIVER: Test Code
      '***************************************
      StringToFile("Upgrade Successful", "C:\DNNUpgradeText.txt")
End Select

'***************************************
' Return Version Number
'***************************************
Return Version

But after I install the new module...the text file I expect to see on the server's C:\ is not there...
Any ideas????

Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUpgradeModule Not FiringUpgradeModule Not Firing


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out