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...DNN Platform (o...DNN Platform (o...Where does the code exist for deleting a module from a page?Where does the code exist for deleting a module from a page?
Previous
 
Next
New Post
2/17/2009 4:36 AM
 

Hi,

    I couldn't find the code for deleting a module from a page through the drop down menu in the module layout. Is that managed through javascript(dnn.controls.dnnmenu.js)? please explain in detail.

Thanks in advance.

Jerald Silvester

 
New Post
2/17/2009 7:17 AM
 

It's kind of in 2 parts - the relevant ascx(s) inherit from portalmodulebase , which is our base object for portal functionality. Within that you can see a check for the necessary permissions, and code such as

_actions.Add(GetNextActionID, Localization.GetString(ModuleActionType.DeleteModule, Localization.GlobalResourceFile), ModuleActionType.DeleteModule, ModuleConfiguration.ModuleID.ToString,

"action_delete.gif", "", "confirm('" + DotNetNuke.UI.Utilities.ClientAPI.GetSafeJSString(Localization.GetString("DeleteModule.Confirm")) + "')", False, SecurityAccessLevel.Admin, True, False)

This is picked up in \Library\Components\Skins\ActionBase.vb

Case

Delete(action)

ModuleActionType.DeleteModule

However, this code only marks the module as being sent to the recycle bin (i.e. a "soft" delete). The actual code to delete a module looks like this:

\Website\admin\Tabs\RecycleBin.ascx.vb

 

 

Dim objEventLog As New Services.Log.EventLog.EventLogController' delete module

 

 

 

Dim objModules As New ModuleControllerDim objModule As ModuleInfo = objModules.GetModule(intModuleId, Null.NullInteger)If Not objModule Is Nothing Then

objModules.DeleteModule(objModule.ModuleID)

objEventLog.AddLog(objModule, PortalSettings, UserId,

 

"", Services.Log.EventLog.EventLogController.EventLogType.MODULE_DELETED)End If

 


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

Hi,

Thanks for the reply.

I need to perform some operations while deleting/removing a module from a page.

How to add/call custom code or method while deleting a module through the drop-down 'delete' option in the module block?

- Jerald Silvester

 
New Post
2/18/2009 12:26 PM
 

you can either use the code I showed in the first snippet or else (more conventionally) add it as part of the ascx.vb/ascx.cs i.e. if you page is called "mypage" , then alter it's class definition to inherit from portalmodulebase (so it can leverage dotnetnuke security, positioning etc.) and implments the optional IActionable interface - this will allow you to add custom actions , the parser will automatically look for a ModuleActions property e.g.

 

Partial Class MypageInherits Entities.Modules.PortalModuleBaseImplements Entities.Modules.IActionable

 

 

 

Public ReadOnly Property ModuleActions() As Entities.Modules.Actions.ModuleActionCollection Implements Entities.Modules.IActionable.ModuleActionsGet

 

Actions.Add(GetNextActionID, Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent, LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent,

 

 

Dim Actions As New Entities.Modules.Actions.ModuleActionCollection"", "", EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)Return ActionsEnd Get

 

End Property

 

 

 


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Where does the code exist for deleting a module from a page?Where does the code exist for deleting a module from a page?


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