-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathRss.ascx.vb
executable file
·184 lines (138 loc) · 6.85 KB
/
Rss.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
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Security
Imports System.IO
Namespace Ventrian.PropertyAgent
Partial Public Class Rss
Inherits PropertyAgentBase
#Region " Private Members "
Private _agentType As String = Null.NullString
Private _propertyTypeID As Integer = Null.NullInteger
Private _propertyAgentID As Integer = Null.NullInteger
Private _propertyBrokerID As Integer = Null.NullInteger
Private _totalRecords As Integer = 0
Private _customFieldIDs As String = Null.NullString
Private _searchValues As String = Null.NullString
Private _sortBy As String = ""
Private _sortDirection As String = ""
#End Region
#Region " Private Properties "
Private ReadOnly Property SortBy() As SortByType
Get
If (_sortBy <> "") Then
If (_sortBy.StartsWith("cf")) Then
Return SortByType.CustomField
Else
Return CType(System.Enum.Parse(GetType(SortByType), _sortBy, True), SortByType)
End If
Else
Return Me.PropertySettings.ListingSortBy
End If
End Get
End Property
Private ReadOnly Property SortByCustomField() As Integer
Get
If (_sortBy <> "") Then
If (_sortBy.StartsWith("cf")) Then
Return Convert.ToInt32(_sortBy.Replace("cf", ""))
Else
Return Null.NullInteger
End If
Else
Return Me.PropertySettings.ListingSortByCustomField
End If
End Get
End Property
Private ReadOnly Property SortDirection() As SortDirectionType
Get
If (_sortDirection <> "") Then
Return CType(System.Enum.Parse(GetType(SortDirectionType), _sortDirection, True), SortDirectionType)
Else
Return Me.PropertySettings.ListingSortDirection
End If
End Get
End Property
#End Region
#Region " Private Methods "
Private Sub ReadQueryString()
Dim agentTypeParam As String = PropertySettings.SEOAgentType
If (Request(agentTypeParam) = "") Then
agentTypeParam = "agentType"
End If
If Not (Request(agentTypeParam) Is Nothing) Then
_agentType = Request(agentTypeParam)
End If
Dim propertyTypeIDParam As String = PropertySettings.SEOPropertyTypeID
If (Request(propertyTypeIDParam) = "") Then
propertyTypeIDParam = "PropertyTypeID"
End If
If Not (Request(propertyTypeIDParam) Is Nothing) Then
Integer.TryParse(Request(propertyTypeIDParam), _propertyTypeID)
If (_propertyTypeID = 0) Then
Response.Redirect(NavigateURL(Me.TabId), True)
End If
End If
If Not (Request("PropertyAgentID") Is Nothing) Then
Integer.TryParse(Request("PropertyAgentID"), _propertyAgentID)
If (_propertyAgentID = 0) Then
Response.Redirect(NavigateURL(Me.TabId), True)
End If
End If
If Not (Request("PropertyBrokerID") Is Nothing) Then
Integer.TryParse(Request("PropertyBrokerID"), _propertyBrokerID)
If (_propertyBrokerID = 0) Then
Response.Redirect(NavigateURL(Me.TabId), True)
End If
End If
If Not (Request("CustomFieldIDs") Is Nothing) Then
_customFieldIDs = Request("CustomFieldIDs").Trim()
End If
If Not (Request("SearchValues") Is Nothing) Then
_searchValues = Request("SearchValues").Trim()
End If
If Not (Request("sortBy") Is Nothing) Then
_sortBy = Request("sortBy").Trim()
End If
If Not (Request("sortDir") Is Nothing) Then
_sortDirection = Request("sortDir").Trim()
End If
End Sub
Private Sub BindExport()
Dim objLayoutController As New LayoutController(Me.PortalSettings, Me.PropertySettings, Me.Page, Me, Me.IsEditable, Me.TabId, Me.ModuleId, Me.ModuleKey)
Dim objLayoutHeader As LayoutInfo = objLayoutController.GetLayout(Me.PropertySettings.Template, LayoutType.RSS_Header_Html)
Dim objLayoutItem As LayoutInfo = objLayoutController.GetLayout(Me.PropertySettings.Template, LayoutType.RSS_Item_Html)
Dim objLayoutPhoto As LayoutInfo = objLayoutController.GetLayout(Me.PropertySettings.Template, LayoutType.RSS_Photo_Html)
Dim objPropertyController As New PropertyController
Dim OnlyForAuthenticated As Boolean = Null.NullBoolean
If Me.UserId = -1 Then OnlyForAuthenticated = True
Dim objProperties As List(Of PropertyInfo) = objPropertyController.List(Me.ModuleId, _propertyTypeID, SearchStatusType.PublishedActive, _propertyAgentID, _propertyBrokerID, False, OnlyForAuthenticated, SortBy, SortByCustomField, SortDirection, _customFieldIDs, _searchValues, 0, Me.PropertySettings.RssMaxRecords, _totalRecords, PropertySettings.ListingBubbleFeatured, True, Null.NullInteger, Null.NullInteger)
Response.Clear()
Response.Buffer = True
Response.ContentType = "text/xml"
Response.ContentEncoding = Encoding.UTF8
Me.EnableViewState = False
Dim objPlaceHolder As New PlaceHolder
objLayoutController.ProcessRSSHeader(objPlaceHolder.Controls, objLayoutHeader.Tokens, CustomFields, objProperties, ModuleConfiguration, objLayoutItem, objLayoutPhoto)
Response.Write(RenderControlAsString(objPlaceHolder) & vbCrLf)
Response.End()
End Sub
Private Function RenderControlAsString(ByVal objControl As Control) As String
Dim sb As New StringBuilder
Dim tw As New StringWriter(sb)
Dim hw As New HtmlTextWriter(tw)
objControl.RenderControl(hw)
Return sb.ToString()
End Function
#End Region
#Region " Event Handlers "
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (PropertySettings.RssEnable = False) Then
Response.Redirect(NavigateURL(), True)
End If
ReadQueryString()
BindExport()
End Sub
#End Region
End Class
End Namespace