-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewFeedback.ascx.vb
executable file
·219 lines (155 loc) · 8.41 KB
/
ViewFeedback.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
'
' Feedback Center for DotNetNuke - http://www.dotnetnuke.com
' Copyright (c) 2002-2005
' by Scott McCulloch ( [email protected] ) ( http://www.smcculloch.net )
'
Imports System.IO
Imports System.Web
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports DotNetNuke
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Users
Imports DotNetNuke.Security
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Imports Ventrian.FeedbackCenter.Entities
Imports DotNetNuke.Security.Roles
Imports Ventrian.FeedbackCenter.Entities.Layout
Namespace Ventrian.FeedbackCenter
Partial Public Class ViewFeedback
Inherits FeedbackCenterBase
#Region " Private Members "
Private _feedbackID As Integer = Null.NullInteger
#End Region
#Region " Private Methods "
Private Sub ReadQueryString()
If Not (Request("FeedbackID") Is Nothing) Then
_feedbackID = Convert.ToInt32(Request("FeedbackID"))
End If
End Sub
Private Sub SetVisibility()
cmdEditFeedback.Visible = (Me.IsEditable Or PortalSecurity.IsInRoles(FeedbackSettings.PermissionApprove))
End Sub
Private Sub BindTemplate()
Dim objFeedbackController As New FeedbackController
Dim objFeedback As FeedbackInfo = objFeedbackController.Get(_feedbackID)
If Not (objFeedback Is Nothing) Then
If (objFeedback.IsApproved = False) Then
If (Settings.Contains(Constants.PERMISSION_APPROVE_SETTING)) Then
If (PortalSecurity.IsInRoles(FeedbackSettings.PermissionApprove) = False) Then
Response.Redirect(NavigateURL(Me.TabId, "", "fbType=NotAuthorized"), True)
End If
End If
End If
Dim objProductController As New ProductController()
Dim objProduct As ProductInfo = objProductController.Get(objFeedback.ProductID)
If (objProduct IsNot Nothing) Then
If (objProduct.InheritSecurity = False) Then
If (Settings.Contains(objProduct.ProductID.ToString() & "-" & Constants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
If (PortalSecurity.IsInRoles(Settings(objProduct.ProductID.ToString() & "-" & Constants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then
Response.Redirect(NavigateURL(Me.TabId, "", "fbType=NotAuthorized"), True)
End If
End If
End If
End If
Dim objLayoutController As New LayoutController()
Dim objView As LayoutInfo = objLayoutController.GetLayout(LayoutType.View_Item_Html, ModuleId, Settings)
ProcessFeedbackItem(phControls.Controls, objView.Tokens, objFeedback)
Dim crumbs As New ArrayList
Dim crumbAll As New CrumbInfo
crumbAll.Caption = Localization.GetString("AllFeedback", LocalResourceFile)
crumbAll.Url = NavigateURL()
crumbs.Add(crumbAll)
If (Request("Return") <> "") Then
Dim crumbReturn As New CrumbInfo
crumbReturn.Caption = Localization.GetString(Request("Return"), Me.LocalResourceFile)
crumbReturn.Url = NavigateURL(Me.TabId, "", "fbType=" & Request("Return"))
crumbs.Add(crumbReturn)
End If
Dim crumbProduct As New CrumbInfo
crumbProduct.Caption = objFeedback.ProductName
crumbProduct.Url = Request.RawUrl.ToString()
crumbs.Add(crumbProduct)
rptBreadCrumbs.DataSource = crumbs
rptBreadCrumbs.DataBind()
If (Request.IsAuthenticated) Then
Dim objTrackingController As New TrackingController
Dim objTracking As TrackingInfo = objTrackingController.Get(_feedbackID, UserId)
lblNoSubscribe.Visible = False
If (objTracking Is Nothing) Then
chkSubscribe.Checked = False
Else
chkSubscribe.Checked = True
End If
Else
lblNoSubscribe.Visible = True
chkSubscribe.Visible = False
End If
End If
End Sub
#End Region
#Region " Event Handlers "
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
ReadQueryString()
If (Request("Approval") <> "") Then
divApprovalMessage.Visible = True
End If
BindTemplate()
If (IsPostBack = False) Then
SetVisibility()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub chkSubscribe_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkSubscribe.CheckedChanged
Try
If (chkSubscribe.Checked) Then
Dim objTracking As New TrackingInfo
objTracking.CreateDate = DateTime.Now
objTracking.UserID = UserId
objTracking.FeedbackID = _feedbackID
Dim objTrackingController As New TrackingController
objTrackingController.Add(objTracking)
If (FeedbackSettings.ActiveSocialSubscribeKey <> "" And Request.IsAuthenticated = True) Then
If IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")) Then
Dim ai As Object = Nothing
Dim asm As System.Reflection.Assembly
Dim ac As Object = Nothing
Try
asm = System.Reflection.Assembly.Load("Active.Modules.Social")
ac = asm.CreateInstance("Active.Modules.Social.API.Journal")
If Not ac Is Nothing Then
Dim objFeedbackController As New FeedbackController()
Dim objFeedback As FeedbackInfo = objFeedbackController.Get(_feedbackID)
If (objFeedback IsNot Nothing) Then
Dim link As String = ""
link = NavigateURL(Me.TabId, "", "fbType=View", "FeedbackID=" & objFeedback.FeedbackID.ToString())
If Not (link.ToLower().StartsWith("http://") Or link.ToLower().StartsWith("https://")) Then
link = "http://" & System.Web.HttpContext.Current.Request.Url.Host & link
End If
ac.AddProfileItem(New Guid(FeedbackSettings.ActiveSocialSubscribeKey), objTracking.UserID, link, objFeedback.Title, objFeedback.Details, objFeedback.Details, 1, "", True)
End If
End If
Catch ex As Exception
End Try
End If
End If
Else
Dim objTrackingController As New TrackingController
objTrackingController.Delete(_feedbackID, UserId)
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub cmdEditFeedback_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEditFeedback.Click
Response.Redirect(NavigateURL(Me.TabId, "", "fbType=Edit", "FeedbackID=" & _feedbackID.ToString()), True)
End Sub
#End Region
End Class
End Namespace