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 ExtensionsModulesModulesHow to load moudle settings page programaticallyHow to load moudle settings page programatically
Previous
 
Next
New Post
8/22/2010 5:14 AM
 
I have a module that requires settings to be added berfore use.
To prevent the user from just using the module immediately, I want load the module settings on form_load if settings have not been set yet.
So I try to access module settings; if they do not yet exist I load the Module Settings form.
If I use the stadard GetEditURL, with the "Settings" key word, I get the settings page but I can't save the settings due to my implementation of handling settings with a base class... 

How do I load the module settings page programatically the "dnn way"?
Thanks

 
New Post
8/22/2010 10:46 AM
 
Richard,

I have the same sort of requirement for my modules -- I need the user to populate the module with "settings" prior to use.  Here is what I do -- may not be the "dnn" way:

1) On page load I check to see if an expected module setting exists in the module setting collection.  If not the I declare the module as "new'
2) If a new module then I post a message requesting the user to go to the module settings page and complete the information.
3) On the settings page, if this is a new module (checked again a page load), I populate my settings with defaults then render the settings page.
4) Once the settings are updated, the expected module settings are placed into the module settings table.
5) When control return to the module, the expected module settings exist and the module is allowed to operate based on those settings.

I use my own settings page -- I typically do not use the integrated module setting that is part of the "Settings" on the module menu.  This means I must add an action item for my own setting page, plus create a explicit page in the module configuration with a value other than "Settings" -- I use "EditSettings"  for a key to my Settings page.

I create a Settings Class that contains all of the values placed in the Module Settings. I also have a Settings Controller that will read or persist the my settings.  One of the controller's properties is "IsNew" and in this property I will check for a Setting Value(s) and if the value is not found will return true.   If the IsNew method returned true, I can apply the default values to the module.

Hope this help
Paul. 
 
New Post
8/22/2010 11:20 AM
 
Thanks,
I've solved this by doing basically the same things... 
I modified my settings page so it doesn't use DNN's settings table but my own;
On module load, when I load the module settings, if the query returns nothing then I launch the settings form like this:

Dim objCtl As New UCanUse.Core.Business.SettingController

Dim settings As IDictionary = objCtl.GetModuleSettingKeysValuesbyModuleIDModuleContextContextID(ModuleId, ModuleContext, ContextID)

If Settings Is Nothing OrElse Settings.Count = 0 Then

'redirect to the Settings Page

Dim strCID As String = "&cid=" & Convert.ToString(ContextID)

Dim strParams() As String = strCID.Split(" "c)

Response.Redirect(EditUrl("ctx", Convert.ToString(ModuleContext), "ModuleSettings", strParams))

Exit Sub

End If

... rest of module settings load code which is executed if settings are found.


This way, the user doesn't have to do anything but fill out the settings form, and if he/she doesn't, it will just keep launching until they do every time they visit the module.

It's an old construct, does anyone know if there is a newer construct that allows passing multiple variables to lauch a control?  GetEditURL only allows for one paramter.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesHow to load moudle settings page programaticallyHow to load moudle settings page programatically


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