Skip to content

Commit

Permalink
Fix print container action (#3027)
Browse files Browse the repository at this point in the history
The print container action stopped working because it wasn't finding the print action.
  • Loading branch information
bdukes authored and david-poindexter committed Sep 25, 2019
1 parent 3b2a5d0 commit 3f8469a
Showing 1 changed file with 40 additions and 30 deletions.
70 changes: 40 additions & 30 deletions Website/admin/Containers/PrintModule.ascx.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#region Copyright
//
// DotNetNuke® - http://www.dotnetnuke.com
// DotNetNuke® - http://www.dotnetnuke.com
// Copyright (c) 2002-2018
// by DotNetNuke Corporation
//
Expand Down Expand Up @@ -62,34 +62,7 @@ protected override void OnLoad(EventArgs e)
{
foreach (ModuleAction action in Actions)
{
if (action.CommandName == ModuleActionType.PrintModule)
{
if (action.Visible)
{
if ((PortalSettings.UserMode == PortalSettings.Mode.Edit) || (action.Secure == SecurityAccessLevel.Anonymous || action.Secure == SecurityAccessLevel.View))
{
if (ModuleContext.Configuration.DisplayPrint)
{
var ModuleActionIcon = new ImageButton();
if (!String.IsNullOrEmpty(PrintIcon))
{
ModuleActionIcon.ImageUrl = ModuleContext.Configuration.ContainerPath.Substring(0, ModuleContext.Configuration.ContainerPath.LastIndexOf("/") + 1) + PrintIcon;
}
else
{
ModuleActionIcon.ImageUrl = "~/images/" + action.Icon;
}
ModuleActionIcon.ToolTip = action.Title;
ModuleActionIcon.ID = "ico" + action.ID;
ModuleActionIcon.CausesValidation = false;

ModuleActionIcon.Click += IconAction_Click;

Controls.Add(ModuleActionIcon);
}
}
}
}
DisplayAction(action);
}

//set visibility
Expand All @@ -107,6 +80,43 @@ protected override void OnLoad(EventArgs e)
Exceptions.ProcessModuleLoadException(this, exc);
}
}

private void DisplayAction(ModuleAction action)
{
if (action.CommandName == ModuleActionType.PrintModule)
{
if (action.Visible)
{
if ((PortalSettings.UserMode == PortalSettings.Mode.Edit) || (action.Secure == SecurityAccessLevel.Anonymous || action.Secure == SecurityAccessLevel.View))
{
if (ModuleContext.Configuration.DisplayPrint)
{
var ModuleActionIcon = new ImageButton();
if (!String.IsNullOrEmpty(PrintIcon))
{
ModuleActionIcon.ImageUrl = ModuleContext.Configuration.ContainerPath.Substring(0, ModuleContext.Configuration.ContainerPath.LastIndexOf("/") + 1) + PrintIcon;
}
else
{
ModuleActionIcon.ImageUrl = "~/images/" + action.Icon;
}
ModuleActionIcon.ToolTip = action.Title;
ModuleActionIcon.ID = "ico" + action.ID;
ModuleActionIcon.CausesValidation = false;

ModuleActionIcon.Click += IconAction_Click;

Controls.Add(ModuleActionIcon);
}
}
}
}

foreach (ModuleAction subAction in action.Actions)
{
DisplayAction(subAction);
}
}

private void IconAction_Click(object sender, ImageClickEventArgs e)
{
Expand All @@ -122,4 +132,4 @@ private void IconAction_Click(object sender, ImageClickEventArgs e)

#endregion
}
}
}

0 comments on commit 3f8469a

Please sign in to comment.