This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ToggleViewOptions.ascx.vb
106 lines (85 loc) · 3.48 KB
/
ToggleViewOptions.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
Imports System
Imports DotNetNuke
Imports DotNetNuke.Common
Imports DotNetNuke.Services.Exceptions
Namespace DNNStuff.Favorites
Partial Class ToggleViewOptions
Inherits Entities.Modules.PortalModuleBase
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
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
#Region " Page Level"
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
If DNNUtilities.SafeDNNVersion().Major = 5 Then
DNNUtilities.InjectCSS(Me.Page, ResolveUrl("Resources/Support/edit_5.css"))
Else
DNNUtilities.InjectCSS(Me.Page, ResolveUrl("Resources/Support/edit.css"))
End If
Page.ClientScript.RegisterClientScriptInclude(Me.GetType, "yeti", ResolveUrl("resources/support/yetii-min.js"))
If Page.IsPostBack = False Then
LoadSettings()
End If
Catch ex As Exception 'Module failed to load
ProcessModuleLoadException(Me, ex)
End Try
End Sub
Private Sub cmdCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdCancel.Click
Try
ReturnToPage()
Catch ex As Exception 'Module failed to load
ProcessModuleLoadException(Me, ex)
End Try
End Sub
Private Sub cmdUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
Try
UpdateSettings()
ReturnToPage()
Catch ex As Exception 'Module failed to load
ProcessModuleLoadException(Me, ex)
End Try
End Sub
Private Sub ReturnToPage()
' synchronize
Entities.Modules.ModuleController.SynchronizeModule(ModuleId)
' Redirect back to the portal home page
Response.Redirect(NavigateURL(), True)
End Sub
#End Region
#Region " Settings"
Public Sub LoadSettings()
Try
If Not Page.IsPostBack Then
Dim options As New ToggleSettings(ModuleId)
txtAddMessage.Text = options.AddMessage
txtRemoveMessage.Text = options.RemoveMessage
End If
Catch exc As Exception
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Public Sub UpdateSettings()
Try
Dim options As New ToggleSettings(ModuleId)
' update options
With options
.AddMessage = txtAddMessage.Text
.RemoveMessage = txtRemoveMessage.Text
End With
Catch exc As Exception
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
End Class
End Namespace