%@ LANGUAGE="VBSCRIPT" %>
<% Session.Codepage=65001 ' ensure QueryString is interpreted as UTF-8 %>
<%
dim oXmlResp,id,offset,size,total,distinct
id=trim(Request.QueryString("id"))
offset=trim(Request.QueryString("offset"))
size=trim(Request.QueryString("page_size"))
total=lcase(Request.QueryString("get_total"))
distinct=trim(Request.QueryString("distinct"))
if offset="" then offset="0"
if total="" then total="false"
response.clear
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
Response.ContentType="text/xml"
Response.write "" & vbLf
response.write vbLf & ""
if id="" then
ErrorResponse "No ID provided!"
elseif distinct="" and not IsNumeric(offset) then
ErrorResponse "Invalid offset!"
elseif distinct="" and not IsNumeric(size) then
ErrorResponse "Invalid size!"
elseif distinct<>"" and not IsNumeric(distinct) then
ErrorResponse "Invalid distinct parameter!"
elseif IsEmpty(session.contents(id)) then
ErrorResponse "Your connection with the server was idle for too long and timed out. Please refresh this page and try again."
elseif not OpenDB then
ErrorResponse server.htmlencode(oDB.LastErrorMsg)
else
oDB.DisplayErrors=false
oDB.ErrMsgFmt="MULTILINE"
set oXmlResp=new ricoXmlResponse
oXmlResp.sendDebugMsgs=true
if distinct="" then
oXmlResp.Query2xml session.contents(id),CLng(offset),CLng(size),(total<>"false"),session.contents(id & ".filters")
else
oXmlResp.Query2xmlDistinct session.contents(id), CLng(distinct), 999, session.contents(id & ".filters")
end if
if not IsEmpty(oDB.LastErrorMsg) then
response.write vbLf & ""
response.write server.htmlencode(oDB.LastErrorMsg)
response.write ""
end if
set oXmlResp=Nothing
end if
CloseApp
response.write vbLf & ""
sub ErrorResponse(msg)
response.write vbLf & ""
response.write msg
response.write ""
end sub
%>