Does not in itself produce HTML but the subtags do. The complete set of subtags are called for each member of the list the hdsTable controls. Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | hdsTable::Generate | (hzChain&,hzHttpEvent*,uint32_t&,) |
Declared in file: hzDissemino.h
Defined in file : hdsGenerate.cpp
Function Logic:
Function body:
void hdsTable::Generate (hzChain& C)hzHttpEvent* pE, uint32_t& nLine,
{
// Does not in itself produce HTML but the subtags do. The complete set of subtags are called for each member of the list the hdsTable controls.
//
// Arguments: 1) C The HTML output chain
// 2) pE The HTTP event being responded to
// 3) nLine Line number tracker (controls NL printing)
//
// Returns: None
_hzfunc("hdsTable::Generate") ;
hzList<hdsCol>::Iter ci ; // Column iterator
hzVect<uint32_t> items ; // Items drawn from class member (of table) to be listed as rows
hdbObject obj ; // Retrieved data object
hzIntset srchResult ; // Items selected from applicable repository
hdsCol col ; // Column
hdsVE* pVE ; // For processing subtags
hzAtom atom ; // Current value
hzString value ; // Value in session if set
uint32_t nFound ; // Table controller
uint32_t objId ; // Object id
hzEcode rc ; // Return code from Fetch()
// Do the heading
C.AddByte(CHAR_NL) ;
// Do the select
if (m_Criteria == "all")
nFound = m_pRepos->Count() ;
else
{
m_pRepos->Select(srchResult, *m_Criteria) ;
nFound = srchResult.Count() ;
}
// Display results
if (nFound == 0)
{
// In the event of no objects found, print the ifnone tags
for (pVE = m_pNone ; pVE ; pVE = pVE->Sibling())
pVE->Generate(C, pE, nLine) ;
}
else
{
// Create HTML table for listing
C.Printf("<table width=\"%d\" align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"%s\">\n", m_nWidth, *m_CSS) ;
C.Printf("<tr valign=\"top\" height=\"20\"><td>Listing %d objects</td></tr>\n", nFound) ;
C.Printf("<tr valign=\"top\" height=\"%d\">\n\t<td>\n", m_nHeight) ;
C.Printf("\t<table width=\"%d\" align=\"center\" border=\"1\" cellspacing=\"1\" cellpadding=\"1\" class=\"%s\">\n", m_nWidth, *m_CSS) ;
// Do table headers
C << "\t<tr>\n" ;
for (ci = m_Cols ; ci.Valid() ; ci++)
{
col = ci.Element() ;
C.Printf("\t<th width=\"%d\">%s</th>\n", col.m_nSize, *col.m_Title) ;
}
C << "\t</tr>\n" ;
// Provide filelist matching the criteria
obj.Init(m_pRepos->Class()) ;
for (objId = 1; objId <&eq; nFound ; objId++)
{
// Fetch data object
rc = m_pRepos->Fetch(obj, objId) ;
if (rc != E_OK)
break ;
// Now display object as row
C << "\t<tr>" ;
for (ci = m_Cols ; ci.Valid() ; ci++)
{
col = ci.Element() ;
// m_pRepos->Fetchval(atom, col.m_mbrNo, objId) ;
obj.GetValue(atom, m_pRepos->Class()->GetMember(col.m_mbrNo)) ;
if (atom.IsSet())
value = atom.Str() ;
else
value.Clear() ;
if (col.m_nSize)
C.Printf("<td width=\"%d\">%s</td>", col.m_nSize, *value) ; // atom.Str()) ;
else
C.Printf("<td>%s</td>", *value) ; // atom.Str()) ;
}
C << "</tr>\n" ;
}
C << "</table>\n" ;
}
}