Subversion Repositories DevTools

Rev

Rev 6879 | Rev 6884 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6879 Rev 6883
Line 18... Line 18...
18
<!--#include file="common/common_subs.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<SCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="class/classaspJSON.vbs"></SCRIPT> 
19
<SCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="class/classaspJSON.vbs"></SCRIPT> 
20
<%
20
<%
21
'------------ Variable Definition -------------
21
'------------ Variable Definition -------------
22
Dim result : result = -1
22
Dim result : result = -1
-
 
23
Dim joiner
23
Dim SqlQry
24
Dim SqlQry
24
Dim rsQry
25
Dim rsQry
25
Dim parRtagId : parRtagId = Request.Form("rtag_id")
26
Dim parRtagId : parRtagId = Request.Form("rtag_id")
26
Dim parOnlyNew : parOnlyNew = RequestBool("onlyNew", False)
27
Dim parReason : parReason = Request.Form("fReason")
27
Dim parOnlyComplete : parOnlyComplete = RequestBool("onlyComplete", False)
28
Dim parResult : parResult = Request.Form("fResult")
28
 
29
 
29
' Init the output JSON class
30
' Init the output JSON class
30
'   Operations can add data
31
'   Operations can add data
31
'   Default data will be added at the end
32
'   Default data will be added at the end
32
Dim oJSON :Set oJSON = New aspJSON
33
Dim oJSON :Set oJSON = New aspJSON
Line 35... Line 36...
35
'
36
'
36
' Determine the size of the record set
37
' Determine the size of the record set
37
'   Gives bad results when searching
38
'   Gives bad results when searching
38
Dim MaxCount : MaxCount = 0
39
Dim MaxCount : MaxCount = 0
39
 
40
 
40
SqlQry = "select count(*) as count from BUILD_INSTANCES bi"
41
SqlQry = "select count(*) as count from BUILD_INSTANCES bi WHERE bi.state is not null "
41
If parRtagId <> "" Then
42
If parRtagId <> "" Then
42
    SqlQry = SqlQry + " WHERE rtag_id = " &  parRtagId
43
    SqlQry = SqlQry + " AND rtag_id = " &  parRtagId
43
End If
44
End If
44
 
45
 
45
On Error Resume Next
46
On Error Resume Next
46
objEH.ErrorRedirect = FALSE
47
objEH.ErrorRedirect = FALSE
47
objEH.TryORA ( OraSession )
48
objEH.TryORA ( OraSession )
Line 62... Line 63...
62
oJSON.data("recordsFiltered") = CLng(MaxCount)
63
oJSON.data("recordsFiltered") = CLng(MaxCount)
63
 
64
 
64
' Assist in debug
65
' Assist in debug
65
oJSON.data("start") = CLng(Request.Form("start"))
66
oJSON.data("start") = CLng(Request.Form("start"))
66
oJSON.data("length") = CLng(Request.Form("length"))
67
oJSON.data("length") = CLng(Request.Form("length"))
-
 
68
oJSON.data("iSql") = SqlQry
67
 
69
 
68
Dim vName
70
'Dim vName
69
for each vName in Request.QueryString
71
'for each vName in Request.QueryString
70
    oJSON.data("sReq_" & vName) = Request.Form(vName)
72
'    oJSON.data("sReq_" & vName) = Request(vName)
71
next
73
'next
-
 
74
'For Each vName In Request.Form
-
 
75
'    oJSON.data("sFrm_" & vName) = Request(vName)
-
 
76
'Next
72
 
77
 
73
' Extract selected range
78
' Extract selected range
74
result = 0
79
result = 0
75
dim firstRow,lastRow,noBuildTime
80
dim firstRow,lastRow,noBuildTime
76
firstRow = CLng(Request.Form("start"))
81
firstRow = CLng(Request.Form("start"))
Line 97... Line 102...
97
 
102
 
98
    Dim sortCol : sortCol = CInt(Request.Form("order[0][column]"))
103
    Dim sortCol : sortCol = CInt(Request.Form("order[0][column]"))
99
    Dim sortDir : sortDir = " " & Request.Form("order[0][dir]")
104
    Dim sortDir : sortDir = " " & Request.Form("order[0][dir]")
100
 
105
 
101
    Dim splitArg: splitArg = Split( sortCols(sortCol), "," )
106
    Dim splitArg: splitArg = Split( sortCols(sortCol), "," )
102
    Dim splitItem, joiner
107
    Dim splitItem
103
    joiner = ""
108
    joiner = ""
104
    for each splitItem in splitArg
109
    for each splitItem in splitArg
105
        If splitItem = "NOBUILDTIME" Then
110
        If splitItem = "NOBUILDTIME" Then
106
            noBuildTime = " AND PV.BUILD_TIME is not null"
111
            noBuildTime = " AND PV.BUILD_TIME is not null"
107
        Else
112
        Else
Line 121... Line 126...
121
Dim whereString
126
Dim whereString
122
If parRtagId <> "" Then
127
If parRtagId <> "" Then
123
    whereString = " AND bi.rtag_id = " &  parRtagId
128
    whereString = " AND bi.rtag_id = " &  parRtagId
124
End If
129
End If
125
 
130
 
126
' Limit to only new packages
131
' Filter Results and Reason
127
Dim onlyNewString : onlyNewString = ""
132
Dim sResult : sResult = ""
-
 
133
joiner = ""
128
If parOnlyNew Then
134
If parResult <> "CEO" Then
-
 
135
    If InStr(parResult, "C") <> 0 Then sResult = sResult & "'C'" : joiner = ","
-
 
136
    If InStr(parResult, "E") <> 0 Then sResult = sResult & joiner & "'E'" : joiner = ","
-
 
137
    If InStr(parResult, "O") <> 0 Then sResult = sResult & joiner & "'B'," & "'S'"
-
 
138
    If sResult <> "" Then
129
    onlyNewString = onlyNewString & " AND bi.reason = 'N' "
139
        sResult = " AND bi.state in (" & sResult & ")"
-
 
140
    End If
130
End If
141
End If
-
 
142
 
-
 
143
Dim sReason : sReason = ""
-
 
144
joiner = ""
131
If parOnlyComplete Then
145
If parReason <> "NRTP" Then
-
 
146
    If InStr(parReason, "N") <> 0 Then sReason = sReason & joiner & "'N'" : joiner = ","
-
 
147
    If InStr(parReason, "R") <> 0 Then sReason = sReason & joiner & "'R'" : joiner = ","
-
 
148
    If InStr(parReason, "T") <> 0 Then sReason = sReason & joiner & "'T'" : joiner = ","
-
 
149
    If InStr(parReason, "P") <> 0 Then sReason = sReason & joiner & "'P'" : joiner = ","
-
 
150
    'If InStr(parReason, "O") <> 0 Then sReason = sReason & joiner & "'B'," & "'S'"
-
 
151
    If sReason <> "" Then
132
    onlyNewString = onlyNewString & " AND bi.state = 'C' "
152
        sReason = " AND bi.reason in (" & sReason & ")"
-
 
153
    End If
133
End If
154
End If
134
 
155
 
135
Dim BasicSql
156
Dim BasicSql
136
BasicSql =  "SELECT bi.PV_ID, " &_
157
BasicSql =  "SELECT bi.PV_ID, " &_
137
            "  bi.RTAG_ID, " &_
158
            "  bi.RTAG_ID, " &_
Line 152... Line 173...
152
            "  PACKAGE_VERSIONS pv " &_
173
            "  PACKAGE_VERSIONS pv " &_
153
            "WHERE bi.PV_ID = pv.pv_id " &_
174
            "WHERE bi.PV_ID = pv.pv_id " &_
154
            "AND pv.PKG_ID  = p.PKG_ID " &_
175
            "AND pv.PKG_ID  = p.PKG_ID " &_
155
            "AND bi.RTAG_ID = rt.RTAG_ID " &_
176
            "AND bi.RTAG_ID = rt.RTAG_ID " &_
156
            "AND rt.proj_id = pj.proj_id " &_
177
            "AND rt.proj_id = pj.proj_id " &_
157
            onlyNewString &_
178
            sResult & sReason &_
158
            noBuildTime &_
179
            noBuildTime &_
159
            whereString &_
180
            whereString &_
160
            searchString &_
181
            searchString &_
161
            sortString
182
            sortString
162
 
183
 
Line 172... Line 193...
172
            ") where rnum >= " & firstRow & ") z"
193
            ") where rnum >= " & firstRow & ") z"
173
 
194
 
174
' Assist in debug
195
' Assist in debug
175
oJSON.data("BasicSql") = BasicSql
196
oJSON.data("BasicSql") = BasicSql
176
oJSON.data("SqlQry") = SqlQry
197
oJSON.data("SqlQry") = SqlQry
-
 
198
oJSON.data("sqlFilter") = sResult & sReason
177
 
199
 
178
' Perform the database query
200
' Perform the database query
179
Set oJSON.data("data") = oJSON.Collection()
201
Set oJSON.data("data") = oJSON.Collection()
180
On Error Resume Next
202
On Error Resume Next
181
objEH.ErrorRedirect = FALSE
203
objEH.ErrorRedirect = FALSE
Line 204... Line 226...
204
       Dim reason       : reason = fields(9)
226
       Dim reason       : reason = fields(9)
205
       Dim state        : state = fields(10)
227
       Dim state        : state = fields(10)
206
       Dim buildId      : buildId = fields(11)
228
       Dim buildId      : buildId = fields(11)
207
       Dim tcount       : tcount = fields(13)
229
       Dim tcount       : tcount = fields(13)
208
       Dim pkg_version  : pkg_version = fields(14)
230
       Dim pkg_version  : pkg_version = fields(14)
209
       Dim description  : description = Server.HTMLEncode(fields(15))
231
       Dim description  : description = CleanUp(Server.HTMLEncode(fields(15)))
210
       Dim comments     : comments = Server.HTMLEncode(fields(16))
232
       Dim comments     : comments = CleanUp(Server.HTMLEncode(fields(16)))
211
       Dim buildTime    : buildTime = Server.HTMLEncode(fields(17))
233
       Dim buildTime    : buildTime = Server.HTMLEncode(fields(17))
212
 
234
 
213
       Set fields = nothing
235
       Set fields = nothing
214
 
236
 
215
        If buildTime <= 0 Then buildTime = ""
237
        If buildTime <= 0 Then buildTime = ""
216
        If tcount <= 0 Then tcount = ""
238
        If tcount <= 0 Then tcount = ""
217
 
239
 
218
        newitem(0) = "<a href='rtree.asp?proj_id=" & proj_id & "'>" & proj_name &"</a>"
240
        newitem(0) = "<a href='rtree.asp?proj_id=" & proj_id & "'>" & proj_name &"</a>"
219
        newitem(1) = "<a href='dependencies.asp?rtag_id=" & rtag_id & "'>" & rtag_name & "</a>"
241
        newitem(1) = "<a href='dependencies.asp?rtag_id=" & rtag_id & "'>" & rtag_name & "</a>"
220
        newitem(2) = "<a href=view_by_version.asp?pkg_id=" & pkg_id & "&fpkgversion=*" & v_ext & " title=""" & description & """>" & pkg_name & "</a>"
242
        newitem(2) = "<a href=view_by_version.asp?pkg_id=" & pkg_id & "&fpkgversion=*" & v_ext & " title='" & description & "'>" & pkg_name & "</a>"
221
        newitem(3) =  "<a href='dependencies.asp?pv_id=" & pv_id & "&rtag_id=" & rtag_id &"' title=""" & comments & """>" & pkg_version & "</a>"
243
        newitem(3) =  "<a href='dependencies.asp?pv_id=" & pv_id & "&rtag_id=" & rtag_id &"' title='" & comments & "'>" & pkg_version & "</a>"
222
        newitem(4) = timestamp
244
        newitem(4) = timestamp
223
        newitem(5) = reason
245
        newitem(5) = reason
224
        newitem(6) = buildTime
246
        newitem(6) = buildTime
225
        newitem(7) = "<a href='unit_test_log.asp?rtag_id=" & rtag_id & "&pv_id=" & pv_id & "'>" & state & "</a>"
247
        newitem(7) = "<a href='unit_test_log.asp?rtag_id=" & rtag_id & "&pv_id=" & pv_id & "'>" & state & "</a>"
226
        newitem(8) = tcount
248
        newitem(8) = tcount
Line 244... Line 266...
244
 
266
 
245
'Return the object
267
'Return the object
246
Response.Write oJSON.JSONoutput()
268
Response.Write oJSON.JSONoutput()
247
Set oJSON = Nothing
269
Set oJSON = Nothing
248
Call Destroy_All_Objects
270
Call Destroy_All_Objects
-
 
271
 
-
 
272
' Quick and ugly code to attempt to remove nasty characters from strings
-
 
273
' In particular some unicode characters that mess with the json decoder
-
 
274
Function CleanUp (input)
-
 
275
      Dim objRegExp, outputStr
-
 
276
      Set objRegExp = New Regexp
-
 
277
 
-
 
278
      objRegExp.IgnoreCase = True
-
 
279
      objRegExp.Global = True
-
 
280
      objRegExp.Pattern = "((?![\[\]\(\)\{\}\$-_?/""';:.,a-zA-Z0-9]).)+"
-
 
281
      outputStr = objRegExp.Replace(input, " ")
-
 
282
 
-
 
283
      CleanUp = outputStr
-
 
284
    End Function
249
%>
285
%>