-
Notifications
You must be signed in to change notification settings - Fork 0
/
LatestOptions.ascx.vb
executable file
·168 lines (123 loc) · 8.43 KB
/
LatestOptions.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Security
Imports DotNetNuke.Entities.Tabs
Imports DotNetNuke.Services.Exceptions
Namespace Ventrian.FeedbackCenter
Partial Public Class LatestOptions
Inherits ModuleSettingsBase
#Region " Private Methods "
Private Sub BindModules()
Dim objDesktopModuleController As New DesktopModuleController
Dim objDesktopModuleInfo As DesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName("FeedbackCenter")
If Not (objDesktopModuleInfo Is Nothing) Then
Dim objTabController As New TabController()
Dim objTabs As ArrayList = objTabController.GetTabs(PortalId)
For Each objTab As DotNetNuke.Entities.Tabs.TabInfo In objTabs
If Not (objTab Is Nothing) Then
If (objTab.IsDeleted = False) Then
Dim objModules As New ModuleController
For Each pair As KeyValuePair(Of Integer, ModuleInfo) In objModules.GetTabModules(objTab.TabID)
Dim objModule As ModuleInfo = pair.Value
If (objModule.IsDeleted = False) Then
If (objModule.DesktopModuleID = objDesktopModuleInfo.DesktopModuleID) Then
If PortalSecurity.IsInRoles(objModule.AuthorizedEditRoles) = True And objModule.IsDeleted = False Then
Dim strPath As String = objTab.TabName
Dim objTabSelected As DotNetNuke.Entities.Tabs.TabInfo = objTab
While objTabSelected.ParentId <> Null.NullInteger
objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, False)
If (objTabSelected Is Nothing) Then
Exit While
End If
strPath = objTabSelected.TabName & " -> " & strPath
End While
Dim objListItem As New ListItem
objListItem.Value = objModule.TabID.ToString() & "-" & objModule.ModuleID.ToString()
objListItem.Text = strPath & " -> " & objModule.ModuleTitle
drpModuleID.Items.Add(objListItem)
End If
End If
End If
Next
End If
End If
Next
End If
End Sub
#End Region
#Region " Event Handlers "
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
#End Region
#Region " Base Method Implementations "
Public Overrides Sub LoadSettings()
If (IsPostBack = False) Then
BindModules()
If (Settings.Contains(Entities.Constants.FEEDBACK_LATEST_MODULE_ID) And Settings.Contains(Entities.Constants.FEEDBACK_LATEST_TAB_ID)) Then
If Not (drpModuleID.Items.FindByValue(Settings(Entities.Constants.FEEDBACK_LATEST_TAB_ID).ToString() & "-" & Settings(Entities.Constants.FEEDBACK_LATEST_MODULE_ID).ToString()) Is Nothing) Then
drpModuleID.SelectedValue = Settings(Entities.Constants.FEEDBACK_LATEST_TAB_ID).ToString() & "-" & Settings(Entities.Constants.FEEDBACK_LATEST_MODULE_ID).ToString()
End If
End If
If (Settings.Contains(Entities.Constants.FEEDBACK_LATEST_HTML_HEADER)) Then
txtHtmlHeader.Text = Settings(Entities.Constants.FEEDBACK_LATEST_HTML_HEADER).ToString()
Else
txtHtmlHeader.Text = Entities.Constants.FEEDBACK_LATEST_HTML_HEADER_DEFAULT
End If
If (Settings.Contains(Entities.Constants.FEEDBACK_LATEST_HTML_BODY)) Then
txtHtmlBody.Text = Settings(Entities.Constants.FEEDBACK_LATEST_HTML_BODY).ToString()
Else
txtHtmlBody.Text = Entities.Constants.FEEDBACK_LATEST_HTML_BODY_DEFAULT
End If
If (Settings.Contains(Entities.Constants.FEEDBACK_LATEST_HTML_FOOTER)) Then
txtHtmlFooter.Text = Settings(Entities.Constants.FEEDBACK_LATEST_HTML_FOOTER).ToString()
Else
txtHtmlFooter.Text = Entities.Constants.FEEDBACK_LATEST_HTML_FOOTER_DEFAULT
End If
If (Settings.Contains(Entities.Constants.FEEDBACK_LATEST_HTML_NO_FEEDBACK)) Then
txtHtmlNoFeedback.Text = Settings(Entities.Constants.FEEDBACK_LATEST_HTML_NO_FEEDBACK).ToString()
Else
txtHtmlNoFeedback.Text = Entities.Constants.FEEDBACK_LATEST_HTML_NO_FEEDBACK_DEFAULT
End If
If (Settings.Contains(Entities.Constants.FEEDBACK_LATEST_MAX_COUNT)) Then
txtFeedbackCount.Text = Settings(Entities.Constants.FEEDBACK_LATEST_MAX_COUNT).ToString()
Else
txtFeedbackCount.Text = Entities.Constants.FEEDBACK_LATEST_MAX_COUNT_DEFAULT.ToString()
End If
If (Settings.Contains(Entities.Constants.FEEDBACK_LATEST_USER_ID_FILTER)) Then
chkQueryStringFilter.Checked = Convert.ToBoolean(Settings(Entities.Constants.FEEDBACK_LATEST_USER_ID_FILTER).ToString())
Else
chkQueryStringFilter.Checked = Entities.Constants.FEEDBACK_LATEST_USER_ID_FILTER_DEFAULT
End If
If (Settings.Contains(Entities.Constants.FEEDBACK_LATEST_USER_ID_PARAM)) Then
txtQueryStringParam.Text = Settings(Entities.Constants.FEEDBACK_LATEST_USER_ID_PARAM).ToString()
Else
txtQueryStringParam.Text = Entities.Constants.FEEDBACK_LATEST_USER_ID_PARAM_DEFAULT
End If
End If
End Sub
Public Overrides Sub UpdateSettings()
Try
Dim objModuleController As New ModuleController
If (drpModuleID.Items.Count > 0) Then
Dim values As String() = drpModuleID.SelectedValue.Split(Convert.ToChar("-"))
If (values.Length = 2) Then
objModuleController.UpdateTabModuleSetting(Me.TabModuleId, Entities.Constants.FEEDBACK_LATEST_TAB_ID, values(0))
objModuleController.UpdateTabModuleSetting(Me.TabModuleId, Entities.Constants.FEEDBACK_LATEST_MODULE_ID, values(1))
End If
objModuleController.UpdateTabModuleSetting(Me.TabModuleId, Entities.Constants.FEEDBACK_LATEST_HTML_HEADER, txtHtmlHeader.Text)
objModuleController.UpdateTabModuleSetting(Me.TabModuleId, Entities.Constants.FEEDBACK_LATEST_HTML_BODY, txtHtmlBody.Text)
objModuleController.UpdateTabModuleSetting(Me.TabModuleId, Entities.Constants.FEEDBACK_LATEST_HTML_FOOTER, txtHtmlFooter.Text)
objModuleController.UpdateTabModuleSetting(Me.TabModuleId, Entities.Constants.FEEDBACK_LATEST_HTML_NO_FEEDBACK, txtHtmlNoFeedback.Text)
If (Convert.ToInt32(txtFeedbackCount.Text) > 0) Then
objModuleController.UpdateTabModuleSetting(Me.TabModuleId, Entities.Constants.FEEDBACK_LATEST_MAX_COUNT, txtFeedbackCount.Text)
End If
objModuleController.UpdateTabModuleSetting(Me.TabModuleId, Entities.Constants.FEEDBACK_LATEST_USER_ID_FILTER, chkQueryStringFilter.Checked.ToString())
objModuleController.UpdateTabModuleSetting(Me.TabModuleId, Entities.Constants.FEEDBACK_LATEST_USER_ID_PARAM, txtQueryStringParam.Text)
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
End Class
End Namespace