Web Connect How To : Show Me the Code!

 LAFOX Home How URL Maps to Code  LAFOX Design Oveview  Framework Extensions 
*Jobboardlistpublic.prg * JobBoardListPublic.prg * 03/07/2002-pa #INCLUDE WCONNECT.H ************************************************************* DEFINE CLASS JobBoardListPublic AS rbPage ************************************************************* JobDescription = [] ************************************************************** ** Page() - PUBLIC - ************************************************************** FUNCTION Page ** Prepare Data This.Data() * Create the HTML page - combine the generic table header with * a link to JobBoardSubmit followed by the JobBoard list (in a table) This.Content = This.TableHeader() +; this.JobBoardSubmitLink() + ; This.HTMLTable() * Show the page This.PageTitle = "Job Board List" This.Merge('TemplatePage.htm') ENDFUNC FUNCTION Details LOCAL lcID, lcContent STORE [] TO lcID, lcContent ** Fetch ID off the URL line lcID = Request.QueryString("ID") lcContent = This.DataGetDescription(lcID) lcContent = STRTRAN(lcContent,CHR(13),[<br>]) lcContent = STRTRAN(lcContent, [ ],[&nbsp;]) This.JobDescription = lcContent This.Content = This.MergeToString("JobBoardDetail.htm") * Show the page This.PageTitle = "Job Board Details" This.Merge('TemplatePage.htm') ENDFUNC ****************************************************************** ** Helper functions below ****************************************************************** ************************************************************** ** Data() - Hidden - ** Job Board cuts off in 3 months ************************************************************** HIDDEN FUNCTION Data LOCAL ldCutoff ldCutoff = GOMONTH(DATE(),-3) * SQL the data into cursor * close the cursor first USE IN (SELECT("qResult")) * select the columns to show and add a link to the details page SELECT DatePosted, ; City, ; State, ; Company , ; Position , ; [<a href="/JobBoardListPublic.Details.fox?SessionID=_6ZN0XR8EI&ID=]+JobBoardID+[">Description</a>] as Description, ; Contact, ; Phone, ; Fax, ; Email ; From (Site.DataPath + "JobBoard.dbf") ; ORDER BY DatePosted desc ; WHERE Approved ; AND DatePosted > ldCutoff ; INTO CURSOR qResult SELECT qResult RETURN RECCOUNT('qResult') ENDFUNC ** Fetch the description memo contents for a given ID HIDDEN Function DataGetDescription(tcID) USE IN (SELECT("qResult")) * select the columns to show and add a link to the details page SELECT ; * ; From (Site.DataPath + "JobBoard.dbf") ; WHERE JobBoardID = tcID ; INTO CURSOR qResult SELECT qResult IF RECCOUNT('qResult') > 0 RETURN qResult.Description ELSE RETURN "Error in JobBoardListPublic.DataGetDescription - No Results" ENDIF ENDFUNC ************************************************************** ** HTMLTable() - Hidden - ** Make an HTML Table of the links ************************************************************** HIDDEN FUNCTION HTMLTable() ** Use Rick's wwShowCursor LOCAL ARRAY laHeaders(1) DIMENSION laHeaders[10] laHeaders[1] = "Date Posted" laHeaders[2] = "City" laHeaders[3] = "State" laHeaders[4] = "Company" laHeaders[5] = "Position" laHeaders[6] = 'Description' laHeaders[7] = 'Contact' laHeaders[8] = 'Phone' laHeaders[9] = 'Fax' laHeaders[10] = 'Email' loSC = CREATEOBJECT("wwShowCursor") loSC.BuildFieldListHeader(@laHeaders) loSC.lAlternateRows = .T. && Alternate row colors loSC.cAlternatingBGColor =["#DFEEFF"] loSC.cTableBGColor =["#FFFFFF"] loSC.cPage_PageURL = [/JobBoardListPublic.Page.fox?SessionID=_6ZN0XR8EI&] loSC.cTableBorder = [1] loSC.nPage_ItemsPerPage = 20 loSC.ShowCursor() *** This writes grabs and writes the output from ShowCursor Return loSC.GetOutput() ENDFUNC HIDDEN Function TableHeader() RETURN [<p align="center"><b>] + Site.SiteName + [ Job Board</b></p>] ENDFUNC * prepare a link to the submit page * perry is not sure how to do this HIDDEN Function JobBoardSubmitLink() RETURN [<strong><a href="/JobBoardSubmit.Page.fox?SessionID=_6ZN0XR8EI" ] + ; [style="text-decoration: none"> ] + ; [<font face="Arial" style="font-size: smaller" ] + ; [color="#000099">Submit New Jobs</font></a></strong> ] + ; [<P align=left>] ENDFUNC ENDDEFINE && JobBoardListPublic
csCodeParser v0.9 stats: 156 lines in 0.01 seconds.