587 lines
21 KiB
Plaintext
587 lines
21 KiB
Plaintext
**
|
|
** wwresponse.fxp
|
|
**
|
|
*
|
|
DEFINE CLASS wwResponse AS RELATION
|
|
laSpobject = .F.
|
|
caUtosessioncookiename = "wwSessionId"
|
|
caUtosessioncookie = ""
|
|
laUtosessioncookiepersist = .F.
|
|
csTylesheet = ""
|
|
coUtput = .NULL.
|
|
coNtenttype = ""
|
|
PROTECTED lnOoutput
|
|
lnOoutput = .F.
|
|
*
|
|
FUNCTION Write
|
|
LPARAMETER lcText, llNooutput
|
|
RETURN ""
|
|
ENDFUNC
|
|
*
|
|
FUNCTION Send
|
|
LPARAMETER lcText, llNooutput
|
|
RETURN ""
|
|
ENDFUNC
|
|
*
|
|
FUNCTION FastWrite
|
|
LPARAMETER lcText, llNotused
|
|
RETURN ""
|
|
ENDFUNC
|
|
*
|
|
FUNCTION GetOutput
|
|
LPARAMETER llNoclear
|
|
RETURN ""
|
|
ENDFUNC
|
|
*
|
|
PROCEDURE Clear
|
|
ENDPROC
|
|
*
|
|
PROCEDURE Rewind
|
|
ENDPROC
|
|
*
|
|
PROCEDURE Reset
|
|
ENDPROC
|
|
*
|
|
PROCEDURE reset
|
|
STORE "" TO thIs.caUtosessioncookie, thIs.caUtosessioncookiename
|
|
STORE .F. TO thIs.lnOoutput
|
|
ENDPROC
|
|
*
|
|
FUNCTION HTMLHeader
|
|
LPARAMETER tcHeader, tcTitle, tcBackground, tcContenttype, tlNooutput
|
|
LOCAL lcOuttext
|
|
tcHeader = IIF(EMPTY(tcHeader), "", tcHeader)
|
|
tcTitle = IIF(EMPTY(tcTitle), tcHeader, tcTitle)
|
|
tcBackground = IIF(EMPTY(tcBackground), "", tcBackground)
|
|
thIs.coNtenttypeheader(tcContenttype)
|
|
IF .NOT. EMPTY(tcBackground)
|
|
lcBackground = IIF(AT("#", tcBackground)>0, 'BGCOLOR="', ;
|
|
'BACKGROUND="')+LOWER(tcBackground)+'"'
|
|
ELSE
|
|
lcBackground = ""
|
|
ENDIF
|
|
lcOuttext = "<HTML>"+CHR(13)+CHR(10)+"<HEAD><TITLE>"+tcTitle+ ;
|
|
"</TITLE></HEAD>"+CHR(13)+CHR(10)+IIF( .NOT. ;
|
|
EMPTY(thIs.csTylesheet), ;
|
|
'<LINK rel="stylesheet" type="text/css" href="'+ ;
|
|
thIs.csTylesheet+'">', "")+CHR(13)+CHR(10)+'<BODY '+ ;
|
|
lcBackground+'>'+CHR(13)+CHR(10)
|
|
IF ATC("<", tcHeader)>0 .AND. ATC(">", tcHeader)>0
|
|
lcOuttext = lcOuttext+thIs.wrIte(tcHeader+CHR(13)+CHR(10),.T.)+ ;
|
|
CHR(13)+CHR(10)
|
|
ELSE
|
|
IF .NOT. EMPTY(tcHeader)
|
|
lcOuttext = lcOuttext+'<FONT FACE="Verdana"><H1>'+ ;
|
|
tcHeader+'</H1></Font><HR>'+CHR(13)+CHR(10)
|
|
ENDIF
|
|
ENDIF
|
|
RETURN thIs.wrIte(@lcOuttext,tlNooutput)
|
|
ENDFUNC
|
|
*
|
|
PROCEDURE HTMLHeaderEx
|
|
LPARAMETER lvHtmlheader, loHttpheader
|
|
thIs.coNtenttypeheader(loHttpheader)
|
|
IF VARTYPE(lvHtmlheader)="O"
|
|
thIs.wrIte(lvHtmlheader.geToutput())
|
|
ELSE
|
|
IF VARTYPE(lvHtmlheader)="C"
|
|
thIs.wrIte("<html><head><title>"+lvHtmlheader+"</title><body>")
|
|
ELSE
|
|
thIs.wrIte("<html><body>")
|
|
ENDIF
|
|
ENDIF
|
|
ENDPROC
|
|
*
|
|
FUNCTION HTMLFooter
|
|
LPARAMETER tcText, tlNooutput
|
|
tcText = IIF(EMPTY(tcText), "", tcText)
|
|
RETURN thIs.wrIte(tcText+CHR(13)+CHR(10)+"<p></BODY>"+CHR(13)+ ;
|
|
CHR(10)+"</HTML>"+CHR(13)+CHR(10),tlNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION WriteLn
|
|
LPARAMETER lcOutput, llNooutput
|
|
IF EMPTY(lcOutput)
|
|
lcOutput = ""
|
|
ENDIF
|
|
RETURN thIs.wrIte(lcOutput+CHR(13)+CHR(10),llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION Sendln
|
|
LPARAMETER lcOutput, llNooutput
|
|
IF EMPTY(lcOutput)
|
|
lcOutput = ""
|
|
ENDIF
|
|
RETURN thIs.wrIte(lcOutput+CHR(13)+CHR(10),llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION ContentTypeHeader
|
|
LPARAMETER lvContenttype, tlNooutput
|
|
LOCAL loHeader, lcType, lcOutput
|
|
lcType = VARTYPE(lvContenttype)
|
|
DO CASE
|
|
CASE lcType="O"
|
|
IF .NOT. lvContenttype.lpAssedhtmlobject
|
|
RETURN thIs.wrIte(lvContenttype.geToutput(),tlNooutput)
|
|
ELSE
|
|
lvContenttype.coMpleteheader()
|
|
ENDIF
|
|
RETURN ""
|
|
CASE lcType="C"
|
|
lvContenttype = LOWER(lvContenttype)
|
|
IF lvContenttype="none" .OR. EMPTY(lvContenttype)
|
|
RETURN ""
|
|
ENDIF
|
|
lvContenttype = LOWER(lvContenttype)
|
|
loHeader = CREATEOBJECT('wwHTTPHeader', thIs)
|
|
IF lvContenttype="force reload"
|
|
loHeader.deFaultheader()
|
|
loHeader.adDforcereload()
|
|
loHeader.coMpleteheader()
|
|
RETURN ""
|
|
ENDIF
|
|
loHeader.seTprotocol()
|
|
loHeader.seTcontenttype(lvContenttype)
|
|
loHeader.coMpleteheader()
|
|
RETURN ""
|
|
OTHERWISE
|
|
loHeader = CREATEOBJECT('wwHTTPHeader', thIs)
|
|
loHeader.deFaultheader()
|
|
loHeader.coMpleteheader()
|
|
RETURN ""
|
|
ENDCASE
|
|
RETURN thIs.wrIte(loHeader.geToutput(),tlNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION WriteMemo
|
|
LPARAMETER lcText, llNooutput
|
|
LOCAL lcOutput
|
|
lcOutput = STRTRAN(lcText, CHR(13)+CHR(10), CHR(13))
|
|
lcOutput = STRTRAN(lcOutput, CHR(13)+CHR(13), "<p>")
|
|
lcOutput = STRTRAN(lcOutput, CHR(13), "<br>")
|
|
RETURN thIs.wrIte(@lcOutput,llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION ExpandTemplate
|
|
LPARAMETER tcPagename, tcContenttype, tlTemplatestring, tlNooutput
|
|
LOCAL lcOutput, lcOldalias, lnHandle, loEval
|
|
IF EMPTY(tcPagename)
|
|
RETURN ""
|
|
ENDIF
|
|
thIs.coNtenttypeheader(tcContenttype)
|
|
lcOutput = ""
|
|
IF .NOT. tlTemplatestring
|
|
lnHandle = FOPEN(tcPagename, 0)
|
|
IF lnHandle<>-1
|
|
lnSize = FSEEK(lnHandle, 0, 2)
|
|
FSEEK(lnHandle, 0, 0)
|
|
lcOutput = FREAD(lnHandle, lnSize)
|
|
= FCLOSE(lnHandle)
|
|
loEval = CREATEOBJECT('wwEval')
|
|
RETURN thIs.wrIte(loEval.meRgetext(@lcOutput),tlNooutput)
|
|
ELSE
|
|
RETURN thIs.wrIte(lcOutput+[<h2>Can't find or open page ]+ ;
|
|
tcPagename+'</h2>',tlNooutput)
|
|
ENDIF
|
|
ENDIF
|
|
loEval = CREATEOBJECT("wwEval")
|
|
RETURN thIs.wrIte(loEval.meRgetext(@tcPagename),tlNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION ExpandScript
|
|
LPARAMETER tcPagename, tnMode, tvContenttype, tlTemplatestring, ;
|
|
llNooutput
|
|
LOCAL lcOutput, lnHandle, osCript
|
|
tcPagename = IIF(EMPTY(tcPagename), "", tcPagename)
|
|
tnMode = IIF(EMPTY(tnMode), 3, tnMode)
|
|
thIs.coNtenttypeheader(tvContenttype)
|
|
lcOutput = ""
|
|
IF llNooutput
|
|
loResponse = CREATEOBJECT('wwResponseStringNoBuffer')
|
|
ELSE
|
|
loResponse = thIs
|
|
ENDIF
|
|
osCript = CREATEOBJECT('wwVFPScript', IIF(tlTemplatestring, .F., ;
|
|
tcPagename), loResponse)
|
|
osCript.laLwaysunloadscript = .T.
|
|
IF tnMode=3
|
|
IF tlTemplatestring
|
|
lcCode = osCript.coNvertpage(tcPagename,.T.)
|
|
ELSE
|
|
lcCode = osCript.coNvertpage(fiLe2var(osCript.cfIlename),.T.)
|
|
ENDIF
|
|
osCript.reNderpagefromvar(lcCode)
|
|
IF llNooutput
|
|
RETURN loResponse.geToutput()
|
|
ENDIF
|
|
RETURN
|
|
ENDIF
|
|
IF tnMode=2
|
|
osCript.reNderpage()
|
|
ENDIF
|
|
IF tnMode=1
|
|
osCript.coNvertpage()
|
|
osCript.reNderpage()
|
|
ENDIF
|
|
IF llNooutput
|
|
RETURN loResponse.geToutput()
|
|
ENDIF
|
|
RETURN
|
|
ENDFUNC
|
|
*
|
|
FUNCTION ShowCursor
|
|
LPARAMETER lvHeader, lcTitle, llSumnumbers, llNooutput, lcTabletags
|
|
LOCAL lcHeader, lnX, laTotals, lcOutput, lnSizeloc, lnSize, lvValue
|
|
IF EMPTY(ALIAS())
|
|
RETURN ""
|
|
ENDIF
|
|
lcOutput = ""
|
|
lnFields = AFIELDS(laFields)
|
|
lnReccount = RECCOUNT()
|
|
IF llSumnumbers
|
|
DIMENSION laTotals[1, lnFields]
|
|
laTotals = 0
|
|
ENDIF
|
|
lcTitle = IIF(TYPE("lcTitle")="C", lcTitle, "")
|
|
IF .NOT. llNooutput
|
|
loShowcursor = CREATEOBJECT("wwShowCursor", thIs)
|
|
ELSE
|
|
loShowcursor = CREATEOBJECT("wwShowCursor")
|
|
ENDIF
|
|
loShowcursor.ctAbletitle = lcTitle
|
|
loShowcursor.lsUmnumerics = llSumnumbers
|
|
loShowcursor.laLternaterows = .T.
|
|
IF .NOT. EMPTY(lcTabletags)
|
|
loShowcursor.ceXtratabletags = lcTabletags
|
|
ENDIF
|
|
IF TYPE("lvHeader[1]")<>"U"
|
|
loShowcursor.buIldfieldlistheader(@lvHeader)
|
|
ENDIF
|
|
loShowcursor.shOwcursor()
|
|
IF llNooutput
|
|
RETURN loShowcursor.geToutput()
|
|
ENDIF
|
|
RETURN ""
|
|
ENDFUNC
|
|
*
|
|
PROCEDURE NoOutput
|
|
LPARAMETER llNooutput
|
|
thIs.lnOoutput = .T.
|
|
ENDPROC
|
|
*
|
|
FUNCTION StandardPage
|
|
LPARAMETER lcHeader, lcBody, lvHeader, lnRefresh, lcRefreshurl, ;
|
|
llNooutput
|
|
LOCAL lcOutput
|
|
lcHeader = IIF( .NOT. EMPTY(lcHeader), lcHeader, "")
|
|
lcBody = IIF( .NOT. EMPTY(lcBody), lcBody, "")
|
|
lnRefresh = IIF(EMPTY(lnRefresh), 0, lnRefresh)
|
|
IF lnRefresh>0
|
|
lcRefreshurl = IIF(EMPTY(lcRefreshurl), "", lcRefreshurl)
|
|
ENDIF
|
|
loHtml = CREATEOBJECT('wwResponseStringNoBuffer')
|
|
loHtml.coNtenttypeheader(lvHeader)
|
|
lcOutput = '<table border="0" cellpadding="5" width="100%">'+ ;
|
|
CHR(13)+CHR(10)+ ;
|
|
' <tr><td align="center" colspan="2" bgcolor="#000000">'+ ;
|
|
CHR(13)+CHR(10)+ ;
|
|
' <font color="#FFFFFF" size="4" face="Verdana"><b>'+ ;
|
|
CHR(13)+CHR(10)+lcHeader+'</b></font>'+CHR(13)+CHR(10)+ ;
|
|
' </td></tr>'+CHR(13)+CHR(10)+' <tr><td><br><p>'+ ;
|
|
CHR(13)+CHR(10)+' <font face="Verdana" size=2>'+CHR(13)+ ;
|
|
CHR(10)+lcBody+'</font>'+CHR(13)+CHR(10)+' </td></tr>'+ ;
|
|
CHR(13)+CHR(10)+'</Table>'
|
|
lcOutput = '<html><head>'+CHR(13)+CHR(10)+'<title>'+lcHeader+ ;
|
|
'</title>'+CHR(13)+CHR(10)+IIF(lnRefresh>0, ;
|
|
'<META HTTP-EQUIV="Refresh" CONTENT="'+ ;
|
|
TRANSFORM(lnRefresh)+'; URL='+lcRefreshurl+'">', '')+ ;
|
|
CHR(13)+CHR(10)+'</head>'+CHR(13)+CHR(10)+ ;
|
|
'<body color="#FFFFFF" style="font:normal normal x-small Verdana">'+ ;
|
|
CHR(13)+CHR(10)+lcOutput
|
|
loHtml.wrIte(lcOutput)
|
|
loHtml.htMlfooter()
|
|
RETURN thIs.wrIte(loHtml.geToutput(),llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION tagtext
|
|
LPARAMETER lcTag, lcText, llNooutput
|
|
RETURN thIs.wrIte("<"+lcTag+">"+lcText+"</"+lcTag+">",llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION Authenticate
|
|
LPARAMETER lcRealm, lcErrormsg, llNooutput
|
|
LOCAL loHeader, lcOutput
|
|
loHeader = CREATEOBJECT('wwHTTPHeader')
|
|
loHeader.auThenticate(lcRealm,lcErrormsg)
|
|
thIs.clEar()
|
|
lcOutput = thIs.wrIte(loHeader.geToutput(),llNooutput)
|
|
thIs.lnOoutput = .T.
|
|
RETURN lcOutput
|
|
ENDFUNC
|
|
*
|
|
FUNCTION Redirect
|
|
LPARAMETER tcUrl, tlNooutput
|
|
LOCAL loHeader, lcOutput
|
|
loHeader = CREATEOBJECT('wwHTTPHeader')
|
|
loHeader.reDirect(tcUrl)
|
|
thIs.clEar()
|
|
lcOutput = thIs.wrIte(loHeader.geToutput(),tlNooutput)
|
|
thIs.lnOoutput = .T.
|
|
RETURN lcOutput
|
|
ENDFUNC
|
|
*
|
|
FUNCTION FormHeader
|
|
LPARAMETER lcAction, lcMethod, lcTarget, lcExtratags, llNooutput
|
|
IF EMPTY(lcMethod)
|
|
lcMethod = "POST"
|
|
ENDIF
|
|
IF EMPTY(lcExtratags)
|
|
lcExtratags = ""
|
|
ENDIF
|
|
RETURN thIs.wrIte('<FORM ACTION="'+lcAction+'" METHOD="'+lcMethod+ ;
|
|
'" '+IIF( .NOT. EMPTY(lcTarget), ' TARGET="'+lcTarget+'" ', ;
|
|
'')+lcExtratags+'>',llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION formtextbox
|
|
LPARAMETER lcName, lcValue, lnWidth, lnMaxwidth, lcCustomtags, llNooutput
|
|
IF EMPTY(lnWidth)
|
|
lnWidth = 20
|
|
ENDIF
|
|
IF EMPTY(lnMaxwidth)
|
|
lnMaxwidth = 0
|
|
ENDIF
|
|
IF EMPTY(lcCustomtags)
|
|
lcCustomtags = ""
|
|
ENDIF
|
|
lcOutput = '<INPUT TYPE="INPUT" NAME="'+lcName+'" VALUE="'+lcValue+'"'
|
|
IF .NOT. EMPTY(lnWidth)
|
|
lcOutput = lcOutput+' SIZE="'+LTRIM(STR(lnWidth, 3))+'"'
|
|
ENDIF
|
|
IF .NOT. EMPTY(lnMaxwidth)
|
|
lcOutput = lcOutput+' MAXLENGTH="'+LTRIM(STR(lnMaxwidth, 3))+'"'
|
|
ENDIF
|
|
IF .NOT. EMPTY(lcCustomtags)
|
|
lcOutput = lcOutput+' '+lcCustomtags
|
|
ENDIF
|
|
RETURN thIs.wrIte(lcOutput+'>',llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION formtextarea
|
|
LPARAMETER lcName, lcValue, lnHeight, lnWidth, lcCustomtags, llNooutput
|
|
IF EMPTY(lnWidth)
|
|
lnWidth = 20
|
|
ENDIF
|
|
IF EMPTY(lnHeight)
|
|
lnHeight = 0
|
|
ENDIF
|
|
IF EMPTY(lcCustomtags)
|
|
lcCustomtags = ""
|
|
ENDIF
|
|
lcOutput = '<TEXTAREA NAME="'+lcName+'"'
|
|
IF .NOT. EMPTY(lnWidth)
|
|
lcOutput = lcOutput+' COLS="'+LTRIM(STR(lnWidth, 3))+'"'
|
|
ENDIF
|
|
IF .NOT. EMPTY(lnHeight)
|
|
lcOutput = lcOutput+' ROWS="'+LTRIM(STR(lnHeight, 3))+'"'
|
|
ENDIF
|
|
IF .NOT. EMPTY(lcCustomtags)
|
|
lcOutput = lcOutput+' '+lcCustomtags
|
|
ENDIF
|
|
RETURN thIs.wrIte(lcOutput+'>'+lcValue+'</TEXTAREA>',llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION formhidden
|
|
LPARAMETER lcName, lcValue, llNooutput
|
|
RETURN thIs.wrIte('<INPUT TYPE="HIDDEN" NAME="'+lcName+'" VALUE="'+ ;
|
|
lcValue+'">',llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION formcheckbox
|
|
LPARAMETER lcName, llValue, lcText, lcCustomtags, llNooutput
|
|
lcCustomtags = IIF(TYPE("lcCustomTags")="C", lcCustomtags, "")
|
|
lcText = IIF(TYPE("lcText")="C", lcText, "")
|
|
RETURN thIs.wrIte('<INPUT TYPE="CheckBox" VALUE="ON" NAME="'+ ;
|
|
lcName+'"'+IIF(llValue, " CHECKED", "")+" "+lcCustomtags+'>'+ ;
|
|
lcText,llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION formradio
|
|
LPARAMETER lcName, lcValue, lcText, llSelected, lcCustomtags, llNooutput
|
|
IF EMPTY(lcCustomtags)
|
|
lcCustomtags = ""
|
|
ENDIF
|
|
RETURN thIs.wrIte('<INPUT TYPE="Radio" Value="'+lcValue+'" NAME="'+ ;
|
|
lcName+'"'+IIF(llSelected, " CHECKED", "")+" "+lcCustomtags+ ;
|
|
'> '+lcText,llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION formbutton
|
|
LPARAMETER lcName, lcCaption, lcType, lnWidth, lcCustomtags, llNooutput
|
|
lnWidth = IIF(VARTYPE(lnWidth)="N", lnWidth, 20)
|
|
lcCustomtags = IIF(VARTYPE(lcCustomtags)="C", lcCustomtags, "")
|
|
lcType = IIF(VARTYPE(lcType)="C", lcType, "SUBMIT")
|
|
lcOutput = '<INPUT TYPE="'+lcType+'" NAME="'+lcName+'" VALUE="'+ ;
|
|
lcCaption+'"'
|
|
IF .NOT. EMPTY(lnWidth)
|
|
lcOutput = lcOutput+' SIZE="'+LTRIM(STR(lnWidth, 3))+'"'
|
|
ENDIF
|
|
IF .NOT. EMPTY(lcCustomtags)
|
|
lcOutput = lcOutput+' '+lcCustomtags
|
|
ENDIF
|
|
RETURN thIs.wrIte(lcOutput+'>',llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION HRef
|
|
LPARAMETER lcLink, lcText, tlNooutput
|
|
IF EMPTY(lcText)
|
|
lcText = lcLink
|
|
ENDIF
|
|
RETURN thIs.wrIte('<A HREF="'+lcLink+'">'+lcText+'</A>',tlNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION DBFPopup
|
|
LPARAMETER lcFormvarname, lcCharexpression, lcDefault, lcFirstitem, ;
|
|
lnHeight, llNooutput, llMultiselect, lcKey
|
|
LOCAL lnX, lcOutput, lcValue, lcKey, lcInsertkey
|
|
lcCharexpression = IIF(VARTYPE(lcCharexpression)="C", ;
|
|
lcCharexpression, FIELD(1))
|
|
lnHeight = IIF(VARTYPE(lnHeight)="N", lnHeight, 1)
|
|
lcDefault = IIF(VARTYPE(lcDefault)="C", lcDefault, " xxxx")
|
|
lcFirstitem = IIF(VARTYPE(lcFirstitem)="C", lcFirstitem, " xxxx")
|
|
lcKey = IIF(VARTYPE(lcKey)="C", lcKey, "")
|
|
lcOutput = '<SELECT NAME="'+lcFormvarname+'" SIZE="'+ ;
|
|
ALLTRIM(STR(lnHeight))+'"'+IIF(llMultiselect, ;
|
|
' MULTIPLE', '')+'>'
|
|
lnX = 0
|
|
IF lcFirstitem<>" xxxx"
|
|
lnX = 1
|
|
lcOutput = lcOutput+'<OPTION>'+lcFirstitem+CHR(13)+CHR(10)
|
|
ENDIF
|
|
SCAN
|
|
lnX = lnX+1
|
|
lcInsertkey = IIF( .NOT. EMPTY(lcKey), ' Value ="'+ ;
|
|
EVALUATE(lcKey)+'" ', '')
|
|
lcValue = EVALUATE(lcCharexpression)
|
|
IF UPPER(lcDefault)=UPPER(TRIM(lcValue))
|
|
lcOutput = lcOutput+'<OPTION SELECTED'+lcInsertkey+'>'+ ;
|
|
lcValue+CHR(13)+CHR(10)
|
|
ELSE
|
|
lcOutput = lcOutput+'<OPTION '+lcInsertkey+'>'+lcValue+ ;
|
|
CHR(13)+CHR(10)
|
|
ENDIF
|
|
ENDSCAN
|
|
lcOutput = lcOutput+"</SELECT>"
|
|
RETURN thIs.wrIte(@lcOutput,llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION IEChart
|
|
LPARAMETER lcType, lnDatacols, lvWidth, lnHeight, lcLabels, llNooutput
|
|
LOCAL lnX, y, lnReccount, lnFields, lcOutput, lcWidth
|
|
lnDatacols = IIF(TYPE("lnDataCols")="N", lnDatacols, 1)
|
|
lcLabels = IIF(TYPE("lcLabels")="C", lcLabels, "")
|
|
lcType = IIF(TYPE("lcType")="C", UPPER(lcType), "")
|
|
lvWidth = IIF(TYPE("lvWidth")<>"L", lvWidth, "100%")
|
|
lnHeight = IIF(TYPE("lnHeight")="N", lnHeight, 250)
|
|
IF TYPE("lvWidth")="N"
|
|
lcWidth = LTRIM(STR(lvWidth))
|
|
ELSE
|
|
lcWidth = lvWidth
|
|
ENDIF
|
|
DO CASE
|
|
CASE lcType="BAR"
|
|
lcType = "12"
|
|
CASE lcType="LINE"
|
|
lcType = "5"
|
|
CASE lcType="AREA"
|
|
lcType = "8"
|
|
CASE lcType="PIE"
|
|
lcType = "1"
|
|
OTHERWISE
|
|
IF VAL(lcType)=0
|
|
lcType = "12"
|
|
ENDIF
|
|
ENDCASE
|
|
lnFields = AFIELDS(laFields)
|
|
lnReccount = RECCOUNT()
|
|
lcOutput = ""
|
|
lcOutput = lcOutput+'<OBJECT'+CHR(13)+CHR(10)+' ID="ocxGraph"'+ ;
|
|
CHR(13)+CHR(10)+ ;
|
|
' CLASSID="clsid:FC25B780-75BE-11CF-8B01-444553540000"'+ ;
|
|
CHR(13)+CHR(10)+ ;
|
|
' CODEBASE="http://activex.microsoft.com/controls/iexplorer/iechart.ocx#Version=4,70,0,1161"'+ ;
|
|
CHR(13)+CHR(10)+' TYPE="application/x-oleobject"'+ ;
|
|
CHR(13)+CHR(10)+' WIDTH='+lcWidth+CHR(13)+CHR(10)+ ;
|
|
' HEIGHT='+LTRIM(STR(lnHeight))+'>'+CHR(13)+CHR(10)+ ;
|
|
CHR(13)+CHR(10)
|
|
lcOutput = lcOutput+' <PARAM NAME="hgridStyle" VALUE="3">'+CHR(13)+ ;
|
|
CHR(10)+' <PARAM NAME="vgridStyle" VALUE="0">'+CHR(13)+ ;
|
|
CHR(10)+' <PARAM NAME="colorscheme" VALUE="0">'+CHR(13)+ ;
|
|
CHR(10)+' <PARAM NAME="BackStyle" VALUE="1">'+CHR(13)+ ;
|
|
CHR(10)+' <PARAM NAME="BackColor" VALUE="#ffffCC">'+ ;
|
|
CHR(13)+CHR(10)+ ;
|
|
' <PARAM NAME="ForeColor" VALUE="#0000ff">'+CHR(13)+ ;
|
|
CHR(10)+' <PARAM NAME="Scale" VALUE="100">'+CHR(13)+ ;
|
|
CHR(10)+CHR(13)+CHR(10)
|
|
lcOutput = lcOutput+IIF(lcType=="1", ;
|
|
' <PARAM NAME="columns" VALUE="'+LTRIM(STR(lnReccount))+ ;
|
|
'">', ' <PARAM NAME="rows" VALUE="'+ ;
|
|
LTRIM(STR(lnReccount))+'">')+CHR(13)+CHR(10)+ ;
|
|
' <PARAM NAME="ChartType" VALUE="'+lcType+'">'+CHR(13)+CHR(10)
|
|
lcOutput = lcOutput+' <PARAM NAME="'+IIF(lcType=="1", ;
|
|
"ColumnNames", "RowNames")+'" VALUE="'
|
|
SCAN
|
|
lcOutput = lcOutput+CHRTRAN(ALLTRIM(EVALUATE(laFields(1,1))), ;
|
|
" ", "_")+" "
|
|
ENDSCAN
|
|
lcOutput = TRIM(lcOutput)+'">'+CHR(13)+CHR(10)
|
|
IF .NOT. EMPTY(lcLabels)
|
|
lcOutput = lcOutput+ ;
|
|
' <PARAM NAME="ColumnNames" VALUE="'+ ;
|
|
lcLabels+'">'+CHR(13)+CHR(10)+ ;
|
|
' <PARAM NAME="DisplayLegend" VALUE="1'+'">'+ ;
|
|
CHR(13)+CHR(10)
|
|
ENDIF
|
|
lnX = 0
|
|
IF lcType=="1"
|
|
SCAN
|
|
lcOutput = lcOutput+' <PARAM NAME="DATA[0]['+ ;
|
|
LTRIM(STR(lnX))+']" VALUE="'+ ;
|
|
LTRIM(STR(EVALUATE(laFields(2,1))))+'">'+ ;
|
|
CHR(13)+CHR(10)
|
|
lnX = lnX+1
|
|
ENDSCAN
|
|
ELSE
|
|
SCAN
|
|
FOR y = 1 TO lnDatacols
|
|
lcOutput = lcOutput+' <PARAM NAME="DATA['+ ;
|
|
LTRIM(STR(lnX))+']['+LTRIM(STR(y-1))+ ;
|
|
']" VALUE="'+ ;
|
|
LTRIM(STR(EVALUATE(laFields(y+1,1))))+ ;
|
|
'">'+CHR(13)+CHR(10)
|
|
ENDFOR
|
|
lnX = lnX+1
|
|
ENDSCAN
|
|
ENDIF
|
|
lcOutput = lcOutput+ ;
|
|
'This graph can be viewed with ActiveX enabled browsers only...<p>'+ ;
|
|
'<A HREF="http://www.microsoft.com/ie/">Download Internet Explorer now!</a>'+ ;
|
|
CHR(13)+CHR(10)+'</object>'+CHR(13)+CHR(10)
|
|
RETURN thIs.wrIte(@lcOutput,llNooutput)
|
|
ENDFUNC
|
|
*
|
|
FUNCTION ContentType_Assign
|
|
LPARAMETER lcValue
|
|
thIs.coNtenttype = lcValue
|
|
thIs.coNtenttypeheader(lcValue)
|
|
RETURN lcValue
|
|
ENDFUNC
|
|
*
|
|
PROCEDURE BinaryWrite
|
|
LPARAMETER lcText
|
|
thIs.wrIte(lcText)
|
|
ENDPROC
|
|
*
|
|
ENDDEFINE
|
|
*
|