#INCLUDE WCONNECT.H
DEFINE CLASS MemberDirectory AS rbPage
FUNCTION Page
LOCAL loDataMan
loDataMan = This.DataManager()
This.Content = This.DataGrid(loDataMan)
This.PageTitle = "Member Directory"
This.Merge('TemplatePage.htm')
ENDFUNC
FUNCTION Details
LOCAL lcMemberID
STORE [] TO lcMemberID
This.PageTitle = "Member Details"
lcMemberID = Request.QueryString("ID")
IF This.DetailData(lcMemberID)
This.Content = This.DetailHTML()
ELSE
This.Content = [Invalid URL]
Endif
This.Merge('TemplatePage.htm')
ENDFUNC
HIDDEN Function DataManager
LOCAL loDataMan
STORE .NULL. to loDataMan
loDataMan = CreateObject("DataManager")
loDataMan.SQL = [Select *,IIF(ShowEmail,"More Info",SPACE(9)) as MoreInfo from ]+Site.MemberPath+"Member.dbf where ShowOnWeb=.T."
loDataMan.PageSize = 20
loDataMan.QueryAsNeeded()
loDataMan.OrderDefault="LastName"
RETURN loDataMan
ENDFUNC
HIDDEN FUNCTION DataGrid(toData)
LOCAL lcHTML
LOCAL loGrid
STORE .NULL. to loGrid
STORE [] TO lcHTML
loGrid = CreateObject("DataGrid", toData)
loGrid.FieldList = [LastName,FirstName,MoreInfo]
loGrid.CaptionList = [Last Name,First Name,More Info]
loGrid.Col_MoreInfo.HrefExpression = ['/MemberDirectory.Details.fox?SessionID=_71P0O15YP&ID='+MemberID]
loGrid.Col_MoreInfo.Sortable = .F.
loSearch = CREATEOBJECT("DataSearchBox",loGrid)
lcHTML =[<B>]+This.PageTitle+[</B>] ;
+loSearch.HTML();
+loGrid.HTMLGrid() ;
+loGrid.HTMLNavBar()
RETURN lcHTML
ENDFUNC
HIDDEN FUNCTION DetailData(tcMemberID)
This.OpenAndSelect("Member")
LOCATE FOR (MemberID=tcMemberID) AND (ShowOnWeb=.T.)
RETURN FOUND()
ENDFUNC
HIDDEN FUNCTION DetailHTML
LOCAL lcHTML
STORE [] TO lcHTML
lcHTML = lcHTML+[<table border="2" cellpadding="2" cellspacing="2" width="100%" id="AutoNumber1">] + CRLF
lcHTML = lcHTML+[ <tr>] + CRLF
lcHTML = lcHTML+[ <td width="100%" colspan="2" bgcolor="C0C0C0">] + CRLF
lcHTML = lcHTML+[ <p align="left"><b><font size="4">] ;
+FirstName+LastName + CRLF
lcHTML = lcHTML+[ </font></b></td>] + CRLF
lcHTML = lcHTML+[ </tr>] + CRLF
IF ShowEmail
lcHTML = lcHTML+[ <tr>] + CRLF
lcHTML = lcHTML+[ <td width="10%" align="right"><b> Email </b></td>] + CRLF
lcHTML = lcHTML+[ <td width="90%"> <b>]+Email+[</b></td>] + CRLF
lcHTML = lcHTML+[ </tr>] + CRLF
ENDIF
IF ShowPhone
lcHTML = lcHTML+[ <tr>] + CRLF
lcHTML = lcHTML+[ <td width="10%" align="right"><b> Phone </b></td>] + CRLF
lcHTML = lcHTML+[ <td width="90%"> <b>]+Phone+[</b></td>] + CRLF
lcHTML = lcHTML+[ </tr>] + CRLF
Endif
IF NOT empty(ALLTRIM(WebNotes))
lcHTML = lcHTML+[ <tr>] + CRLF
lcHTML = lcHTML+[ <td width="10%" align="right"><b> Notes </b></td>] + CRLF
lcHTML = lcHTML+[ <td width="90%"> <b>]+ALLTRIM(WebNotes)+[</b></td>] + CRLF
lcHTML = lcHTML+[ </tr>] + CRLF
ENDIF
lcHTML = lcHTML+[</table>] + CRLF
RETURN lcHTML
ENDFUNC
ENDDEFINE
csCodeParser v0.9 stats: 164 lines in 0.01 seconds.