Rev 6651 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%'=====================================================' view_package_owner_json.asp' Designed NOT to be used by a Scroller, but to load all the data' when the table is first created. Want to retain the checkbox values'=====================================================%><%Option explicit' Essential to get UTF through all the hoops. ie: VÄSTTRAFIK (VTK)Response.ContentType = "text/html"Response.AddHeader "Content-Type", "text/html;charset=UTF-8"Response.CodePage = 65001Response.CharSet = "UTF-8"%><!--#include file="common/conf.asp"--><!--#include file="common/globals.asp"--><!--#include file="common/qstr.asp"--><!--#include file="common/common_subs.asp"--><SCRIPT LANGUAGE="VBScript" RUNAT=SERVER SRC="class/classaspJSON.vbs"></SCRIPT><%'------------ Variable Definition -------------Dim result : result = -1Dim SqlQryDim rsQryDim parRtagId : parRtagId = Request("rtag_id")' Init the output JSON class' Operations can add data' Default data will be added at the endDim oJSON :Set oJSON = New aspJSONDim newitem' Basic Header' draw - sequence check' sReq_* - DebugoJSON.data("draw") = CLng(Request.QueryString("draw"))Dim vNamefor each vName in Request.QueryStringoJSON.data("sReq_" & vName) = Request.QueryString(vName)next' Extract selected rangeresult = 0' Define the data items to extract from the database' An array of items to extract'Dim dataCols: dataCols = Array ( _"pv.pv_id", _"pv.pkg_id", _"p.PKG_NAME", _"pv.PKG_VERSION", _"pv.PV_DESCRIPTION", _"v.VIEW_NAME", _"u.FULL_NAME", _"pv.COMMENTS",_"u.USER_NAME",_"u.USER_EMAIL", _"pv.v_ext", _"rc.SDKTAG_ID")' Dim determine sorting options'On Error goto 0'Response.Write "<pre>"' Create a list of cols that we need. Avoids ambiguity in selectionsDim x,colList,colListJoinFor x = Lbound(dataCols) to Ubound(dataCols)colList = colList & colListJoin & dataCols(x)colListJoin = ","NextDim sortStringsortString = "ORDER BY UPPER(p.PKG_NAME) asc"SqlQry = "select " & colList &_" FROM package_versions pv, " &_" RELEASE_CONTENT rc, " &_" PACKAGES p, " &_" VIEWS v, " &_" USERS u " &_" WHERE rc.rtag_id = " & parRtagId &_" AND rc.pv_id = pv.pv_id " &_" and p.PKG_ID = pv.pkg_id " &_" and rc.BASE_VIEW_ID = v.VIEW_ID " &_" and pv.OWNER_ID = u.USER_ID " &_sortString' Assist in debugoJSON.data("SqlQry") = SqlQry' Perform the database querySet oJSON.data("data") = oJSON.Collection()On Error Resume NextobjEH.ErrorRedirect = FALSEobjEH.TryORA ( OraSession )Set rsQry = OraDatabase.DbCreateDynaset( SqlQry, ORADYN_DEFAULT )objEH.CatchORA ( OraSession )' Process each row and return required fields to the userIf objEH.Finally ThenWhile (NOT rsQry.BOF) AND (NOT rsQry.EOF)Set newitem = oJSON.AddToCollection(oJSON.data("data"))'On Error GOTO 0' Attempt to speed up access to the data' Extract all fields for the row' Access fields by indexDim fieldsSet fields = rsQry.FieldsDim pv_id : pv_id = fields(0)Dim pkg_id : pkg_id = fields(1)Dim pkg_name : pkg_name = fields(2)Dim pkg_version : pkg_version = fields(3)Dim description : description = CleanUpJson(Server.HTMLEncode(fields(4)))Dim baseName : baseName = fields(5)Dim uFull : uFull = fields(6)Dim uName : uName = fields(8)Dim uEmail : uEmail = fields(9)Dim v_ext : v_ext = fields(10)Dim comments : comments = CleanUpJson(Server.HTMLEncode(fields(7)))Dim sdkId : sdkId = fields(11)Set fields = nothingnewitem(0) = pv_idnewitem(1) = "<a href=view_by_version.asp?pkg_id=" & pkg_id & "&fpkgversion=*" & v_ext & " title=""" & description & """>" & pkg_name & "</a>"newitem(2) = "<a href='fixed_issues.asp?pv_id=" & pv_id & "&rtag_id=" & parRtagId &"' title=""" & comments & """>" & pkg_version & "</a>"newitem(3) = baseNamenewitem(4) = descriptionnewitem(5) = uFullnewitem(6) = uNamenewitem(7) = uEmailnewitem(8) = sdkIdrsQry.MoveNextWendoJSON.data("result") = 0End IFrsQry.CloseSet rsQry = Nothing'' SQL error detection and reportingIf objEH.LastOraFailed ThenoJSON.data("error") = 1oJSON.data("emsgSummary") = objEH.MessageSummaryoJSON.data("emsgDetails") = objEH.MessageDetailsoJSON.data("SqlQry") = SqlQryEnd If'Return the objectResponse.Write oJSON.JSONoutput()Set oJSON = NothingCall Destroy_All_Objects%>