-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathViewOptions.ascx.vb
executable file
·273 lines (199 loc) · 11.2 KB
/
ViewOptions.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
'
' Child Links for DotNetNuke - http://www.dotnetnuke.com
' Copyright (c) 2002-2005
' by Scott McCulloch ( smcculloch@iinet.net.au ) ( http://www.smcculloch.net )
'
Imports System.Web.UI.WebControls
Imports DotNetNuke.Common
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Tabs
Imports DotNetNuke.Security
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Imports DnnForge.ChildLinks.Common
Imports DnnForge.ChildLinks.Entities
Namespace DnnForge.ChildLinks
Public MustInherit Class ViewOptions
Inherits ModuleSettingsBase
#Region " Controls "
Protected WithEvents lblViewOptionsHelp As System.Web.UI.WebControls.Label
Protected WithEvents txtHtmlHeader As System.Web.UI.WebControls.TextBox
Protected WithEvents txtHtmlBody As System.Web.UI.WebControls.TextBox
Protected WithEvents txtHtmlFooter As System.Web.UI.WebControls.TextBox
Protected WithEvents txtHtmlEmpty As System.Web.UI.WebControls.TextBox
Protected WithEvents pnlViewOptions As System.Web.UI.WebControls.Panel
Protected WithEvents cmdUpdate As System.Web.UI.WebControls.LinkButton
Protected WithEvents tblViewOptions As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents tblTemplateHelp As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents lblTemplateHelp As System.Web.UI.WebControls.Label
Protected WithEvents lblLink As System.Web.UI.WebControls.Label
Protected WithEvents lblName As System.Web.UI.WebControls.Label
Protected WithEvents lblDescription As System.Web.UI.WebControls.Label
Protected WithEvents cmdCancel As System.Web.UI.WebControls.LinkButton
Protected WithEvents txtHtmlSeparator As System.Web.UI.WebControls.TextBox
Protected WithEvents lstMode As System.Web.UI.WebControls.RadioButtonList
Protected WithEvents drpTab As System.Web.UI.WebControls.DropDownList
Protected WithEvents chkShowDisabledPages As System.Web.UI.WebControls.CheckBox
Protected WithEvents lblHeaderFooter As System.Web.UI.WebControls.Label
Protected WithEvents lblParentLink As System.Web.UI.WebControls.Label
Protected WithEvents lblParentName As System.Web.UI.WebControls.Label
Protected WithEvents lblBody As System.Web.UI.WebControls.Label
Protected WithEvents lblIcon As System.Web.UI.WebControls.Label
Protected WithEvents lblTitle As System.Web.UI.WebControls.Label
Protected WithEvents lblTabID As System.Web.UI.WebControls.Label
Protected WithEvents lblTitle2 As System.Web.UI.WebControls.Label
Protected WithEvents lblIsCurrent As System.Web.UI.WebControls.Label
Protected WithEvents lblIsNotCurrent As System.Web.UI.WebControls.Label
Protected WithEvents lstDisplay As System.Web.UI.WebControls.RadioButtonList
Protected WithEvents lblNameXXX As System.Web.UI.WebControls.Label
Protected WithEvents lblDescriptionXXX As System.Web.UI.WebControls.Label
Protected WithEvents trHtmlHeader As System.Web.UI.HtmlControls.HtmlTableRow
Protected WithEvents trHtmlBody As System.Web.UI.HtmlControls.HtmlTableRow
Protected WithEvents trHtmlSeparator As System.Web.UI.HtmlControls.HtmlTableRow
Protected WithEvents trHtmlFooter As System.Web.UI.HtmlControls.HtmlTableRow
Protected WithEvents trHtmlEmpty As System.Web.UI.HtmlControls.HtmlTableRow
Protected WithEvents chkShowHiddenPages As System.Web.UI.WebControls.CheckBox
#End Region
#Region " Private Methods "
Private Sub BindDisplay()
For Each value As Integer In System.Enum.GetValues(GetType(DisplayType))
Dim li As New ListItem
li.Value = value.ToString
li.Text = Localization.GetString(System.Enum.GetName(GetType(DisplayType), value), Me.LocalResourceFile)
lstDisplay.Items.Add(li)
Next
End Sub
Private Sub BindMode()
For Each value As Integer In System.Enum.GetValues(GetType(ModeType))
Dim li As New ListItem
li.Value = value.ToString
li.Text = Localization.GetString(System.Enum.GetName(GetType(ModeType), value), Me.LocalResourceFile)
lstMode.Items.Add(li)
Next
End Sub
Private Sub BindTabs()
drpTab.DataSource = TabController.GetPortalTabs(PortalId, -1, True, "None", True, False, True, True, False)
'drpTab.DataSource = GetPortalTabs(PortalSettings.DesktopTabs, -1, True, True, False, True, True)
drpTab.DataBind()
End Sub
Private Sub BindSettings()
Dim objSettingController As New SettingController
chkShowHiddenPages.Checked = Convert.ToBoolean(SettingController.ShowHiddenPages(Me.Settings))
chkShowDisabledPages.Checked = Convert.ToBoolean(SettingController.ShowDisabledPages(Me.Settings))
lstMode.SelectedValue = SettingController.Mode(Me.Settings)
If (lstMode.SelectedValue = "2") Then
drpTab.Visible = True
Else
drpTab.Visible = False
End If
lstDisplay.SelectedValue = SettingController.Display(Me.Settings)
If (lstDisplay.SelectedValue = "1") Then
trHtmlBody.Visible = False
trHtmlFooter.Visible = False
trHtmlHeader.Visible = False
trHtmlSeparator.Visible = False
trHtmlEmpty.Visible = False
Else
trHtmlBody.Visible = True
trHtmlFooter.Visible = True
trHtmlHeader.Visible = True
trHtmlSeparator.Visible = True
trHtmlEmpty.Visible = True
End If
txtHtmlHeader.Text = objSettingController.GetSetting(Constants.SETTING_HTML_HEADER, Me.Settings)
txtHtmlBody.Text = objSettingController.GetSetting(Constants.SETTING_HTML_BODY, Me.Settings)
txtHtmlSeparator.Text = objSettingController.GetSetting(Constants.SETTING_HTML_SEPARATOR, Me.Settings)
txtHtmlFooter.Text = objSettingController.GetSetting(Constants.SETTING_HTML_FOOTER, Me.Settings)
txtHtmlEmpty.Text = objSettingController.GetSetting(Constants.SETTING_HTML_EMPTY, Me.Settings)
If Not (drpTab.Items.FindByValue(objSettingController.GetSetting(Constants.SETTING_ANOTHER_PAGE, Me.Settings)) Is Nothing) Then
drpTab.SelectedValue = objSettingController.GetSetting(Constants.SETTING_ANOTHER_PAGE, Me.Settings)
End If
End Sub
Private Sub SaveSettings()
Dim objModuleController As New ModuleController
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_HIDDEN_PAGES, chkShowHiddenPages.Checked)
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_DISABLED_PAGES, chkShowDisabledPages.Checked)
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_MODE, lstMode.SelectedValue)
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_DISPLAY, lstDisplay.SelectedValue)
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_ANOTHER_PAGE, drpTab.SelectedValue)
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_HTML_HEADER, txtHtmlHeader.Text)
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_HTML_BODY, txtHtmlBody.Text)
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_HTML_SEPARATOR, txtHtmlSeparator.Text)
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_HTML_FOOTER, txtHtmlFooter.Text)
objModuleController.UpdateModuleSetting(Me.ModuleId, Constants.SETTING_HTML_EMPTY, txtHtmlEmpty.Text)
End Sub
#End Region
#Region " Event Handlers "
Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
Try
Response.Redirect(NavigateURL(), True)
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub lstMode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstMode.SelectedIndexChanged
Try
If (lstMode.SelectedValue = "2") Then
drpTab.Visible = True
Else
drpTab.Visible = False
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub lstDisplay_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstDisplay.SelectedIndexChanged
Try
If (lstDisplay.SelectedValue = "1" Or lstDisplay.SelectedValue = "2") Then
trHtmlBody.Visible = False
trHtmlFooter.Visible = False
trHtmlHeader.Visible = False
trHtmlSeparator.Visible = False
trHtmlEmpty.Visible = False
Else
trHtmlBody.Visible = True
trHtmlFooter.Visible = True
trHtmlHeader.Visible = True
trHtmlSeparator.Visible = True
trHtmlEmpty.Visible = True
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
#Region " Base Method Implementations "
Public Overrides Sub LoadSettings()
Try
If (Page.IsPostBack = False) Then
BindMode()
BindDisplay()
BindTabs()
BindSettings()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Public Overrides Sub UpdateSettings()
Try
If (Page.IsValid) Then
SaveSettings()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
End Class
End Namespace