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 ExtensionsModulesModulesModule Manifest - REMOVE a controlModule Manifest - REMOVE a control
Previous
 
Next
New Post
10/18/2011 12:18 PM
 
Is there any way in the module manifest to remove a control? I've been through: http://www.dotnetnuke.com/Resources/W... - and I know I can add/remove items from the web.config - but what about the Module controls themselves?


Andrew Walker

Learn to make your own beer and wine at homeIf you enjoy making your own beer and/or wine - be sure to check out http://www.ForemostBrewing.com
 
New Post
10/18/2011 4:42 PM
 
You can use the cleanup component (the “version” is the module version it runs in or up to)

< component type="Cleanup" version="05.00.00" >
< files >
< basePath >DesktopModules\MyModule< /basePath >
< file >
< name >MyControl.aspx < /name >
< /file >
< /files >
< /component >


Robert Harriman
WEBMAZING.NET
AutoWebSuite / BrokerWebSuite

DNN Modules for Auto Dealers and Real Estate Professionals.

 
New Post
10/18/2011 5:35 PM
 
Thanks for the reply Robert!

That will remove the file - but I don't think it's gonna remove the  module control itself.  I may need to expand a little more.

Let's say I have a module and one of my module controls is setup as:
Control: Categories  (to access via Globals.NavigateUrl(TabId, "Categories");)
Source: DesktopModules/MyCompany/MyModule/Categories.ascx

Now - as my module grows and simplifies - I no longer need the Categories module control.  Running the cleanup should remove the ascx file itself - but I still have the entry for the control "Categories" under Module Controls.

I just don't want to have to go in to the Module itself and delete the Module Control from the definition - as this module is used on many dnn installs.


Andrew Walker

Learn to make your own beer and wine at homeIf you enjoy making your own beer and/or wine - be sure to check out http://www.ForemostBrewing.com
 
New Post
10/18/2011 9:41 PM
 
I’m not aware of DNN supporting the option of unregistering a control in the install manifest; this certainty would be nice to have.

This doesn’t answer your question, but if you use the same control name, DNN will update the title and source path of a control already registered.


Robert Harriman
WEBMAZING.NET
AutoWebSuite / BrokerWebSuite

DNN Modules for Auto Dealers and Real Estate Professionals.

 
New Post
10/19/2011 5:23 PM
 
Andrew,

This is best handled in a module's implemention of the IUpgradable interface as there is currently no capability in the manifest file to remove or better stated to "unregister" a module control. Here's a link to the DotNetNuke Wiki for IUpgradable: http://www.dotnetnuke.com/Resources/W...

I recall that several admin modules included in the DotNetNuke framework had to remove or rename one or more of their module controls either during the upgrade from 4.x to 5.x but can't recall which ones. Another module which may have removed a control during its upgrade is Form and LIst. You might take a look at their source code to see how it was done.

Basically in your implementation of IUpgradable you would do something like the following given that you know the desktopModuleName and the control's controlKey:

publlic void RemoveModuleControl (string desktopModuleName, string controlKey)
{
    // get desktop module from DesktopModuleName
    var dmi = DesktopModuleController.GetDesktopModuleByModuleName(desktopModuleName, -1);
    if (dmi != null)
    {
      // get module definition
     var mdi = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleDefinitionName, dmi.DesktopModuleID);
      if (mdi != null)
      {
         // get Module Control
         var mc = ModuleControlController.GetModuleControlByControlKey(controlKey, mdi.moduleDefId);
         if (mc != null)
         {
          ModuleControlController.DeleteModuleControl(mc.ModuleControlID);
          }
       }
    }
}

Please note that I have not tested the above code and that you may want to log or otherwise handle the various potential errors should the DesktopModule, the ModuleDefinition or the ModuleControl not exist.






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
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesModule Manifest - REMOVE a controlModule Manifest - REMOVE a control


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