forked from OPSI-srl/UManage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.ascx.cs
74 lines (56 loc) · 2.64 KB
/
Main.ascx.cs
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
68
69
70
71
72
73
74
using System;
using System.Web.UI.WebControls;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Entities.Modules;
using System.Web.UI;
using DotNetNuke.Entities.Users;
namespace OPSI.UManage.Pages
{
public partial class Main : PortalModuleBase
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
System.Web.UI.ScriptManager.GetCurrent(this.Page).EnablePageMethods = true;
//Check that in any case this module cannot be accessed by anounymous users
//set the session variable that will stop auto-loading from launcher
if (UserInfo.UserID <= 0)
{
Session["UManage_StopAutoLauncher"] = 1;
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
}
DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxScriptSupport();
if (this.IsPostBack == false)
{
VAR_PageBase.Text = DotNetNuke.Common.Globals.NavigateURL();
VAR_ModulePath.Text = this.ControlPath;
VAR_ProfilePicBasePath.Text = Page.ResolveUrl("~/profilepic.ashx?userid=");
VAR_CurrentLanguage.Text = (System.Threading.Thread.CurrentThread.CurrentCulture.Name).Split('-')[0].ToString();
VAR_PortalID.Text = PortalId.ToString();
var moduleController = new ModuleController();
var adminUserModule = moduleController.GetModuleByDefinition(PortalId, "User Accounts");
var url = DotNetNuke.Common.Globals.NavigateURL(adminUserModule.TabID, "Edit", "mid=" + adminUserModule.ModuleID, "userId={{userid}}", "popUp=true");
VAR_FullEditPath.Text = url;
//set the session variable that will stop auto-loading from launcher
Session["UManage_StopAutoLauncher"] = 1;
if (UserInfo.IsInRole(PortalSettings.AdministratorRoleName))
{
this.VAR_IsAdmin.Text = "1";
}
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
protected string CloseModule_URL()
{
return DotNetNuke.Common.Globals.NavigateURL();
}
}
}