Web Connect How To : Show Me the Code!

 LAFOX Home How URL Maps to Code  LAFOX Design Oveview  Framework Extensions 
*Foxfiles.prg #INCLUDE WCONNECT.H ************************************************************* DEFINE CLASS FoxFiles AS rbPage ************************************************************* ************************************************************* ** FoxFiles.Page() - PUBLIC - ** Show Contents of our File Library ************************************************************* FUNCTION Page ** Create cursor qResult This.DataSetup() ** Create a custom HTML Table This.Content = This.HTMLTable() ** Merge the page to show the user This.PageTitle = Site.SiteName+" Files" THIS.Merge("TemplatePage.htm") ** Cleanup USE IN (SELECT('qResult')) ENDFUNC &&FileLibraryPage ***************************************************************** ** Helper functions below ***************************************************************** ************************************************************* ** Show Contents of our File Library ************************************************************* HIDDEN FUNCTION DataSetup() SELECT FileLibrary.*, Member.LastName, Member.FirstName, ; Speaker.LastName as sLast, Speaker.FirstName as SFirst ; FROM (Site.DataPath+"FileLibrary.dbf") ; LEFT OUTER JOIN (Site.MemberPath+"member.dbf") ; ON FileLibrary.memberid = member.memberid ; LEFT OUTER JOIN (Site.DataPath+"Speaker.dbf") ; ON FileLibrary.Speakerid = Speaker.Speakerid ; ORDER BY FileName ; WHERE Approved ; INTO CURSOR qResult ReadWrite ** Fixup for Speaker Names Replace LastName WITH sLast FOR NOT EMPTY(SpeakerID) Replace FirstName WITH sFirst FOR NOT EMPTY(SpeakerID) GO Top EndFunc ************************************************************* ** Build a formatted HTML table ************************************************************* HIDDEN FUNCTION HTMLTable() LOCAL lcHTML lcHTML = "" **Page Header lcHTML = [<table border="3" width="610" cellspacing="0" cellpadding="3">] + chr(13) + ; [ <tr>] + chr(13) + ; [ <td bgcolor="#C0C0C0">] + chr(13) + ; [ <p align="left"><font face="Arial"><b>&nbsp;]+Site.SiteName+[ Files</b></font></td>] + chr(13) + ; [ </tr>] + CHR(13)+ ; [</table>] SELECT qResult ** Table Header lcHTML = lcHTML+ [<table border="3" width="610" cellspacing="0" cellpadding="3">] + chr(13) + ; [ <tr>] + chr(13) + ; [ <td width="218" bgcolor="#C0C0C0">] + chr(13) + ; [ <p align="left"><font face="Arial"><b>&nbsp;File Name</b></font></td>] + chr(13) + ; [ <td width="478" bgcolor="#C0C0C0">] + chr(13) + ; [ <p align="left"><font face="Arial"><b>&nbsp;Description</b></font></td>] + chr(13) + ; [ <td width="478" bgcolor="#C0C0C0">] + chr(13) + ; [ <p align="left"><font face="Arial"><b>&nbsp;Contributor</b></font></td>] + chr(13) + ; [ </tr>] ; **Body SCAN FOR Approved lcHTML = lcHTML + [ <tr>] + chr(13) + ; [ <td width="478">] + chr(13) +; [ <p align="left"><font face="Arial">&nbsp;<a href="/files/] + ALLTRIM(FileName) + [">] + ALLTRIM(FileName) + [&nbsp;</font></td>] + chr(13) + ; [ <td width="218">] + chr(13) + ; [ <p align="left"><font face="Arial">&nbsp;] + ALLTRIM(Description) + [&nbsp;</font></td>] + chr(13) + ; [ <td width="218">] + chr(13) + ; [ <p align="left"><font face="Arial">&nbsp;] + ALLTRIM(LastName) + [ , ] + ALLTRIM(FirstName) + [&nbsp;</font></td>] + chr(13) + ; [ </tr>] ENDSCAN ************ **End Table lcHTML = lcHTML + [</table>] Return lcHTML ENDFUNC &&HTMLTable() ENDDEFINE
csCodeParser v0.9 stats: 100 lines in 0.00 seconds.