-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDispatch.ascx.cs
More file actions
67 lines (57 loc) · 1.92 KB
/
Dispatch.ascx.cs
File metadata and controls
67 lines (57 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.IO;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Services.Exceptions;
namespace GravityWorks.GenericHtmlRenderer
{
public partial class Dispatch : PortalModuleBase, IActionable
{
#region Properties
protected string RequestedView
{
get { return Request.QueryString["view"] ?? ""; }
}
#endregion
#region IActionable Members
public ModuleActionCollection ModuleActions
{
get
{
var moduleActions = new ModuleActionCollection();
//moduleActions.Add(GetNextActionID(), "Administration", ModuleActionType.EditContent, "", "", UrlHelper.ViewUrl(ViewNames.AdminDefault), false, SecurityAccessLevel.Edit, true, false);
return moduleActions;
}
}
#endregion
protected string GetCustomControlToLoad()
{
return String.IsNullOrEmpty(RequestedView)
? "Views/Default.ascx"
: String.Format("Views/{0}.ascx", RequestedView);
}
protected new void Page_Init(Object sender, EventArgs e)
{
try
{
string control = GetCustomControlToLoad();
LoadCustomControl(control);
}
catch (Exception ex)
{
Exceptions.LogException(ex);
}
}
private void LoadCustomControl(string controlPath)
{
var module = (PortalModuleBase)LoadControl(controlPath);
if (module != null)
{
// load the control into the placeholder
module.ModuleConfiguration = ModuleConfiguration;
module.ID = Path.GetFileNameWithoutExtension(controlPath);
plhControl.Controls.Add(module);
}
}
}
}