forked from ventrian/News-Articles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewsSearchOptions.ascx.vb
executable file
·109 lines (79 loc) · 4.74 KB
/
NewsSearchOptions.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
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Tabs
Imports DotNetNuke.Security
Imports DotNetNuke.Services.Exceptions
Namespace Ventrian.NewsArticles
Partial Public Class NewsSearchOptions
Inherits ModuleSettingsBase
#Region " Private Methods "
Private Sub BindModules()
Dim objDesktopModuleController As New DesktopModuleController
Dim objDesktopModuleInfo As DesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName("DnnForge - NewsArticles")
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 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 " Base Method Implementations "
Public Overrides Sub LoadSettings()
Try
If (Page.IsPostBack = False) Then
BindModules()
If (Settings.Contains(ArticleConstants.NEWS_SEARCH_MODULE_ID) And Settings.Contains(ArticleConstants.NEWS_SEARCH_TAB_ID)) Then
If Not (drpModuleID.Items.FindByValue(Settings(ArticleConstants.NEWS_SEARCH_TAB_ID).ToString() & "-" & Settings(ArticleConstants.NEWS_SEARCH_MODULE_ID).ToString()) Is Nothing) Then
drpModuleID.SelectedValue = Settings(ArticleConstants.NEWS_SEARCH_TAB_ID).ToString() & "-" & Settings(ArticleConstants.NEWS_SEARCH_MODULE_ID).ToString()
End If
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 ModuleController
If (drpModuleID.Items.Count > 0) Then
Dim values As String() = drpModuleID.SelectedValue.Split(Convert.ToChar("-"))
If (values.Length = 2) Then
objModules.UpdateTabModuleSetting(Me.TabModuleId, ArticleConstants.NEWS_SEARCH_TAB_ID, values(0))
objModules.UpdateTabModuleSetting(Me.TabModuleId, ArticleConstants.NEWS_SEARCH_MODULE_ID, values(1))
End If
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
End Class
End Namespace