| 6651 |
dpurdie |
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
|
|
2 |
<%
|
|
|
3 |
'=====================================================
|
|
|
4 |
' view_package_owner_json.asp
|
|
|
5 |
' Designed NOT to be used by a Scroller, but to load all the data
|
|
|
6 |
' when the table is first created. Want to retain the checkbox values
|
|
|
7 |
'=====================================================
|
|
|
8 |
%>
|
|
|
9 |
<%
|
|
|
10 |
Option explicit
|
|
|
11 |
' Essential to get UTF through all the hoops. ie: VÄSTTRAFIK (VTK)
|
|
|
12 |
Response.ContentType = "text/html"
|
|
|
13 |
Response.AddHeader "Content-Type", "text/html;charset=UTF-8"
|
|
|
14 |
Response.CodePage = 65001
|
|
|
15 |
Response.CharSet = "UTF-8"
|
|
|
16 |
%>
|
|
|
17 |
<!--#include file="common/conf.asp"-->
|
|
|
18 |
<!--#include file="common/globals.asp"-->
|
|
|
19 |
<!--#include file="common/qstr.asp"-->
|
|
|
20 |
<!--#include file="common/common_subs.asp"-->
|
|
|
21 |
<SCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="class/classaspJSON.vbs"></SCRIPT>
|
|
|
22 |
<%
|
|
|
23 |
'------------ Variable Definition -------------
|
|
|
24 |
Dim result : result = -1
|
|
|
25 |
Dim SqlQry
|
|
|
26 |
Dim rsQry
|
|
|
27 |
Dim parRtagId : parRtagId = Request("rtag_id")
|
|
|
28 |
|
|
|
29 |
' Init the output JSON class
|
|
|
30 |
' Operations can add data
|
|
|
31 |
' Default data will be added at the end
|
|
|
32 |
Dim oJSON :Set oJSON = New aspJSON
|
|
|
33 |
Dim newitem
|
|
|
34 |
|
|
|
35 |
' Basic Header
|
|
|
36 |
' draw - sequence check
|
|
|
37 |
' sReq_* - Debug
|
|
|
38 |
|
|
|
39 |
oJSON.data("draw") = CLng(Request.QueryString("draw"))
|
|
|
40 |
|
|
|
41 |
Dim vName
|
|
|
42 |
for each vName in Request.QueryString
|
|
|
43 |
oJSON.data("sReq_" & vName) = Request.QueryString(vName)
|
|
|
44 |
next
|
|
|
45 |
|
|
|
46 |
' Extract selected range
|
|
|
47 |
result = 0
|
|
|
48 |
|
|
|
49 |
' Define the data items to extract from the database
|
|
|
50 |
' An array of items to extract
|
|
|
51 |
'
|
|
|
52 |
Dim dataCols: dataCols = Array ( _
|
|
|
53 |
"pv.pv_id", _
|
|
|
54 |
"pv.pkg_id", _
|
|
|
55 |
"p.PKG_NAME", _
|
|
|
56 |
"pv.PKG_VERSION", _
|
|
|
57 |
"pv.PV_DESCRIPTION", _
|
|
|
58 |
"v.VIEW_NAME", _
|
|
|
59 |
"u.FULL_NAME", _
|
|
|
60 |
"pv.COMMENTS",_
|
|
|
61 |
"u.USER_NAME",_
|
|
|
62 |
"u.USER_EMAIL", _
|
|
|
63 |
"pv.v_ext", _
|
|
|
64 |
"rc.SDKTAG_ID")
|
|
|
65 |
|
|
|
66 |
' Dim determine sorting options
|
|
|
67 |
'On Error goto 0
|
|
|
68 |
'Response.Write "<pre>"
|
|
|
69 |
|
|
|
70 |
' Create a list of cols that we need. Avoids ambiguity in selections
|
|
|
71 |
Dim x,colList,colListJoin
|
|
|
72 |
For x = Lbound(dataCols) to Ubound(dataCols)
|
|
|
73 |
colList = colList & colListJoin & dataCols(x)
|
|
|
74 |
colListJoin = ","
|
|
|
75 |
Next
|
|
|
76 |
Dim sortString
|
|
|
77 |
sortString = "ORDER BY UPPER(p.PKG_NAME) asc"
|
|
|
78 |
|
|
|
79 |
SqlQry = "select " & colList &_
|
|
|
80 |
" FROM package_versions pv, " &_
|
|
|
81 |
" RELEASE_CONTENT rc, " &_
|
|
|
82 |
" PACKAGES p, " &_
|
|
|
83 |
" VIEWS v, " &_
|
|
|
84 |
" USERS u " &_
|
|
|
85 |
" WHERE rc.rtag_id = " & parRtagId &_
|
|
|
86 |
" AND rc.pv_id = pv.pv_id " &_
|
|
|
87 |
" and p.PKG_ID = pv.pkg_id " &_
|
|
|
88 |
" and rc.BASE_VIEW_ID = v.VIEW_ID " &_
|
|
|
89 |
" and pv.OWNER_ID = u.USER_ID " &_
|
|
|
90 |
sortString
|
|
|
91 |
|
|
|
92 |
' Assist in debug
|
|
|
93 |
oJSON.data("SqlQry") = SqlQry
|
|
|
94 |
|
|
|
95 |
' Perform the database query
|
|
|
96 |
Set oJSON.data("data") = oJSON.Collection()
|
|
|
97 |
On Error Resume Next
|
|
|
98 |
objEH.ErrorRedirect = FALSE
|
|
|
99 |
objEH.TryORA ( OraSession )
|
|
|
100 |
Set rsQry = OraDatabase.DbCreateDynaset( SqlQry, ORADYN_DEFAULT )
|
|
|
101 |
objEH.CatchORA ( OraSession )
|
|
|
102 |
' Process each row and return required fields to the user
|
|
|
103 |
If objEH.Finally Then
|
|
|
104 |
While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
|
|
|
105 |
Set newitem = oJSON.AddToCollection(oJSON.data("data"))
|
|
|
106 |
'On Error GOTO 0
|
|
|
107 |
' Attempt to speed up access to the data
|
|
|
108 |
' Extract all fields for the row
|
|
|
109 |
' Access fields by index
|
|
|
110 |
Dim fields
|
|
|
111 |
Set fields = rsQry.Fields
|
|
|
112 |
|
|
|
113 |
Dim pv_id : pv_id = fields(0)
|
|
|
114 |
Dim pkg_id : pkg_id = fields(1)
|
|
|
115 |
Dim pkg_name : pkg_name = fields(2)
|
|
|
116 |
Dim pkg_version : pkg_version = fields(3)
|
| 7250 |
dpurdie |
117 |
Dim description : description = CleanUpJson(Server.HTMLEncode(fields(4)))
|
| 6651 |
dpurdie |
118 |
Dim baseName : baseName = fields(5)
|
|
|
119 |
Dim uFull : uFull = fields(6)
|
|
|
120 |
Dim uName : uName = fields(8)
|
|
|
121 |
Dim uEmail : uEmail = fields(9)
|
|
|
122 |
Dim v_ext : v_ext = fields(10)
|
| 7250 |
dpurdie |
123 |
Dim comments : comments = CleanUpJson(Server.HTMLEncode(fields(7)))
|
| 6651 |
dpurdie |
124 |
Dim sdkId : sdkId = fields(11)
|
|
|
125 |
|
|
|
126 |
Set fields = nothing
|
|
|
127 |
|
|
|
128 |
newitem(0) = pv_id
|
|
|
129 |
newitem(1) = "<a href=view_by_version.asp?pkg_id=" & pkg_id & "&fpkgversion=*" & v_ext & " title=""" & description & """>" & pkg_name & "</a>"
|
|
|
130 |
newitem(2) = "<a href='fixed_issues.asp?pv_id=" & pv_id & "&rtag_id=" & parRtagId &"' title=""" & comments & """>" & pkg_version & "</a>"
|
|
|
131 |
newitem(3) = baseName
|
|
|
132 |
newitem(4) = description
|
|
|
133 |
newitem(5) = uFull
|
|
|
134 |
newitem(6) = uName
|
|
|
135 |
newitem(7) = uEmail
|
|
|
136 |
newitem(8) = sdkId
|
|
|
137 |
|
|
|
138 |
rsQry.MoveNext
|
|
|
139 |
Wend
|
|
|
140 |
oJSON.data("result") = 0
|
|
|
141 |
End IF
|
|
|
142 |
|
|
|
143 |
rsQry.Close
|
|
|
144 |
Set rsQry = Nothing
|
|
|
145 |
|
|
|
146 |
'
|
|
|
147 |
' SQL error detection and reporting
|
|
|
148 |
If objEH.LastOraFailed Then
|
|
|
149 |
oJSON.data("error") = 1
|
|
|
150 |
|
|
|
151 |
oJSON.data("emsgSummary") = objEH.MessageSummary
|
|
|
152 |
oJSON.data("emsgDetails") = objEH.MessageDetails
|
|
|
153 |
oJSON.data("SqlQry") = SqlQry
|
|
|
154 |
End If
|
|
|
155 |
|
|
|
156 |
'Return the object
|
|
|
157 |
Response.Write oJSON.JSONoutput()
|
|
|
158 |
Set oJSON = Nothing
|
|
|
159 |
Call Destroy_All_Objects
|
|
|
160 |
%>
|