This repository has been archived by the owner on Feb 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Settings.ascx.vb
109 lines (81 loc) · 5.65 KB
/
Settings.ascx.vb
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Imports DotNetNuke
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Entities.Users
Namespace Connect.Modules.UserManagement.AccountUpdate
Partial Class Settings
Inherits Entities.Modules.ModuleSettingsBase
#Region "Base Method Implementations"
Public Overrides Sub LoadSettings()
Try
If (Page.IsPostBack = False) Then
BindPages()
BindRoles()
If (Settings.Contains("ExternalInterface")) Then txtInterface.Text = Settings("ExternalInterface").ToString()
If (Settings.Contains("ShowUserName")) Then drpUsernameMode.SelectedValue = Settings("ShowUserName").ToString()
If (Settings.Contains("ShowDisplayName")) Then drpDisplaynameMode.SelectedValue = Settings("ShowDisplayName").ToString()
If (Settings.Contains("RedirectAfterSubmit")) Then drpRedirectAfterSubmit.SelectedValue = Settings("RedirectAfterSubmit").ToString()
If (Settings.Contains("UsermanagementTab")) Then drpUserManagementTab.SelectedValue = Settings("UsermanagementTab").ToString()
If (Settings.Contains("AddToRoleOnSubmit")) Then drpAddToRole.SelectedValue = Settings("AddToRoleOnSubmit").ToString()
If (Settings.Contains("RemoveFromRoleOnSubmit")) Then drpRemoveFromRole.SelectedValue = Settings("RemoveFromRoleOnSubmit").ToString()
If (Settings.Contains("NotifyRole")) Then drpNotifyRole.Items.FindByText(Settings("NotifyRole").ToString()).Selected = True
If (Settings.Contains("NotifyUser")) Then chkNotifyUser.Checked = CType(Settings("NotifyUser"), Boolean)
If (Settings.Contains("AddToRoleStatus")) Then drpRoleStatus.SelectedValue = CType(Settings("AddToRoleStatus"), String)
If (Settings.Contains("CompareFirstNameLastName")) Then chkCompareFirstNameLastName.Checked = CType(Settings("CompareFirstNameLastName"), Boolean)
If (Settings.Contains("ValidateEmailThroughRegex")) Then chkValidateEmailThroughRegex.Checked = CType(Settings("ValidateEmailThroughRegex"), Boolean)
If Settings.Contains("EmailRegex") Then
txtEmailRegex.Text = CType(Settings("EmailRegex"), String)
Else
Try
txtEmailRegex.Text = UserController.GetUserSettings(PortalId)("Security_EmailValidation")
Catch
End Try
End If
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Public Overrides Sub UpdateSettings()
Try
Dim objModules As New Entities.Modules.ModuleController
objModules.UpdateTabModuleSetting(TabModuleId, "ExternalInterface", txtInterface.Text)
objModules.UpdateTabModuleSetting(TabModuleId, "ShowUserName", drpUsernameMode.SelectedValue)
objModules.UpdateTabModuleSetting(TabModuleId, "ShowDisplayName", drpDisplaynameMode.SelectedValue)
objModules.UpdateTabModuleSetting(TabModuleId, "RedirectAfterSubmit", drpRedirectAfterSubmit.SelectedValue)
objModules.UpdateTabModuleSetting(TabModuleId, "UsermanagementTab", drpUserManagementTab.SelectedValue)
objModules.UpdateTabModuleSetting(TabModuleId, "AddToRoleOnSubmit", drpAddToRole.SelectedValue)
objModules.UpdateTabModuleSetting(TabModuleId, "RemoveFromRoleOnSubmit", drpRemoveFromRole.SelectedValue)
'we need the rolename for sending mails to users, therefor store here the rolename rather than the id!
objModules.UpdateTabModuleSetting(TabModuleId, "NotifyRole", drpNotifyRole.SelectedItem.Text)
objModules.UpdateTabModuleSetting(TabModuleId, "NotifyUser", chkNotifyUser.Checked.ToString)
objModules.UpdateTabModuleSetting(TabModuleId, "AddToRoleStatus", drpRoleStatus.SelectedValue)
objModules.UpdateTabModuleSetting(TabModuleId, "CompareFirstNameLastName", chkCompareFirstNameLastName.Checked.ToString)
objModules.UpdateTabModuleSetting(TabModuleId, "ValidateEmailThroughRegex", chkValidateEmailThroughRegex.Checked.ToString)
objModules.UpdateTabModuleSetting(TabModuleId, "EmailRegex", txtEmailRegex.Text)
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub BindPages()
Dim tabs As System.Collections.Generic.List(Of Entities.Tabs.TabInfo) = TabController.GetPortalTabs(PortalId, Null.NullInteger, True, True, False, False)
drpRedirectAfterSubmit.DataSource = tabs
drpRedirectAfterSubmit.DataBind()
drpUserManagementTab.DataSource = tabs
drpUserManagementTab.DataBind()
End Sub
Private Sub BindRoles()
Dim rc As New Security.Roles.RoleController
Dim roles As ArrayList = rc.GetPortalRoles(PortalId)
drpAddToRole.DataSource = roles
drpAddToRole.DataBind()
drpAddToRole.Items.Insert(0, New ListItem("---", "-1"))
drpRemoveFromRole.DataSource = roles
drpRemoveFromRole.DataBind()
drpRemoveFromRole.Items.Insert(0, New ListItem("---", "-1"))
drpNotifyRole.DataSource = roles
drpNotifyRole.DataBind()
drpNotifyRole.Items.Insert(0, New ListItem("---", "-1"))
End Sub
#End Region
End Class
End Namespace