<% =SYS(3101,1256) olddate=SET("Date") oldmark=SET("Mark") SET DATe YMD SET MARK TO [-] SET CENTURY ON ajaxresponse=CREATEOBJECT('empty') oJSON=NEWOBJECT('json','json.fxp') *dbclocation=[d:\shahprjs\recruiting\dataorigin\] fref=ALLTRIM(TRANSFORM(NVL(orequest.form('txtreffid'),''))) if isnull(orequest.form('txtreffid')) fref=ALLTRIM(TRANSFORM(NVL(orequest.querystring('t'),''))) endif theaction=orequest.form('taction') DO case CASE theaction='num' SELECT * FROM (dbclocation+[fileref]) WHERE ALLTRIM(reffid)==fref INTO CURSOR SearchResults readwrite CASE theaction='back' SELECT TOP 1 VAL(reffid) as vtr, * FROM (dbclocation+[fileref]) WHERE VAL(TRANSFORM(ALLTRIM(reffid)))VAL(fref) ; ORDER BY vtr INTO CURSOR SearchResults readwrite OTHERWISE SELECT TOP 1 VAL(reffid) as vtr, * FROM (dbclocation+[fileref]) WHERE VAL(TRANSFORM(ALLTRIM(reffid)))>VAL(fref) ; ORDER BY vtr DESC INTO CURSOR SearchResults readwrite endcase IF RECCOUNT()=0 APPEND BLANK ENDIF return (ADDBS(oprop.appstartpath)+[nfjson.fxp]) SET PROCEDURE TO (ADDBS(oprop.appstartpath)+[nfjson.fxp]) additive filedata=nfcursortojson4vfp() return filedata IF theaction='num' ADDPROPERTY(ajaxresponse,'nav',fref) ELSE ADDPROPERTY(ajaxresponse,'nav',ALLTRIM(reffid)) endif fref=ALLTRIM(SearchResults.reffid) USE (dbclocation+[details]) IN SELECT([details]) SELECT [details] SCAN FOR ALLTRIM(reffid)==fref IF NOT EMPTY(photoname) AND FILE(ADDBS(oprop.appstartpath)+'photos\'+ALLTRIM(photoname)+[.jpeg]) LOOP ENDIF IF NOT EMPTY(photop) filename=[photos\]+SYS(2015)+[.jpeg] COPY MEMO photop TO (ADDBS(oprop.appstartpath)+filename) replace photoname WITH JUSTSTEM(filename) ELSE replace photoname WITH '' ENDIF ENDSCAN SELECT RECNO() as therecord, * FROM (dbclocation+[category]) WHERE ALLTRIM(reffid)==fref INTO CURSOR categories ORDER BY category readwrite IF RECCOUNT()=0 APPEND BLANK endif catdata=nfcursortojson4vfp() SELECT RECNO() as therecord, VAL(srno) as serial, * FROM (dbclocation+[details]) WHERE ALLTRIM(reffid)==fref INTO CURSOR thedetails readwrite ORDER BY category, serial IF RECCOUNT()=0 APPEND BLANK ENDIF *responseText=[{] SELECT [thedetails] GO top SCAN FOR i=1 TO FCOUNT() IF TYPE(FIELD(i))=[M] replace (FIELD(i)) WITH '' ENDIF ENDFOR ENDSCAN detaildata=nfcursortojson4vfp() ADDPROPERTY(ajaxresponse,'cats',RECCOUNT('categories')) ADDPROPERTY(ajaxresponse,'dets',RECCOUNT('thedetails')) *CURSORTOXML('searchresults','filedata',1,0,0,'1') *CURSORTOXML('categories','catdata',1,0,0,'1') *CURSORTOXML('thedetails','detaildata',1,0,0,'1') filedata=chr(13)+chr(10)+"*fileDataStart*"+filedata+"*fileDataEnd*"+chr(13)+chr(10) catdata=chr(13)+chr(10)+"*catDataStart*"+catdata+"*catDataEnd*"+chr(13)+chr(10) detaildata=chr(13)+chr(10)+"*acsDataStart*"+detaildata+"*acsDataEnd*"+chr(13)+chr(10) ADDPROPERTY(ajaxresponse,'file',filedata) ADDPROPERTY(ajaxresponse,'catdata',catdata) ADDPROPERTY(ajaxresponse,'details',detaildata) *returnstring=oJSON.AddJSONProps(theMaster,theChild) *returnstring=oJSON.AddJSONProps(returnstring,theAcs) *returnstring=oJSON.AddJSONProps(ojson.stringify(ajaxresponse),returnstring) oResponse.Write(ojson.stringify(ajaxresponse)) oresponse.flush SET DATE &olddate SET MARK TO &oldmark CLOSE TABLES CLOSE DATABASES %>