forked from ventrian/News-Articles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NewsSearch.ascx.vb
executable file
·104 lines (70 loc) · 3.07 KB
/
NewsSearch.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
'
' News Articles for DotNetNuke - http://www.dotnetnuke.com
' Copyright (c) 2002-2009
' by Ventrian ( [email protected] ) ( http://www.ventrian.com )
'
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Services.Exceptions
Imports Ventrian.NewsArticles.Base
Namespace Ventrian.NewsArticles
Partial Public Class NewsSearch
Inherits NewsArticleModuleBase
#Region " Constants "
Private Const PARAM_SEARCH_ID As String = "Search"
#End Region
#Region " Private Members "
Private _articleTabID As Integer = Null.NullInteger
Private _articleModuleID As Integer = Null.NullInteger
#End Region
#Region " Private Methods "
Private Function FindSettings() As Boolean
If (Settings.Contains(ArticleConstants.NEWS_SEARCH_TAB_ID)) Then
If (IsNumeric(Settings(ArticleConstants.NEWS_SEARCH_TAB_ID).ToString())) Then
_articleTabID = Convert.ToInt32(Settings(ArticleConstants.NEWS_SEARCH_TAB_ID).ToString())
End If
End If
If (Settings.Contains(ArticleConstants.NEWS_SEARCH_MODULE_ID)) Then
If (IsNumeric(Settings(ArticleConstants.NEWS_SEARCH_MODULE_ID).ToString())) Then
_articleModuleID = Convert.ToInt32(Settings(ArticleConstants.NEWS_SEARCH_MODULE_ID).ToString())
If (_articleModuleID <> Null.NullInteger) Then
Return True
End If
End If
End If
Return False
End Function
Private Sub ReadQueryString()
If (Request(PARAM_SEARCH_ID) <> "") Then
txtSearch.Text = Server.UrlDecode(Request(PARAM_SEARCH_ID))
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
Try
If (IsPostBack = False) Then
ReadQueryString()
End If
If (FindSettings()) Then
phSearchForm.Visible = True
lblNotConfigured.Visible = False
Else
lblNotConfigured.Visible = True
phSearchForm.Visible = False
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click
Try
If (txtSearch.Text.Trim() <> "") Then
Response.Redirect(Common.GetModuleLink(_articleTabID, _articleModuleID, "Search", ArticleSettings, "Search=" & Server.UrlEncode(txtSearch.Text)), True)
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
End Class
End Namespace