Aggregate to the supplied chain (the HTML body), this article's preformulated value (the tags found within this article) Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | hdsArtref::Generate | (hzChain&,hzHttpEvent*,uint32_t&,) |
Declared in file: hzDissemino.h
Defined in file : hdsGenerate.cpp
Function Logic:
Function body:
void hdsArtref::Generate (hzChain& C)hzHttpEvent* pE, uint32_t& nLine,
{
// Aggregate to the supplied chain (the HTML body), this article's preformulated value (the tags found within this article)
//
// Arguments: 1) C The HTML output chain
// 2) pE The HTTP event being responded to
// 4) nLine Line number tracker (controls NL printing)
//
// Returns: None
_hzfunc("hdsArtref::Generate") ;
hzList<hdsVE*>::Iter ih ; // Html entity iterator
hdsInfo* pInfo = 0; // Session
// hdsLang* pLang ; // Applicable language
hdsNavtree* pAG = 0; // Article group
hdsArticle* pArt = 0; // The article
hdsArticleStd* pArtStd = 0; // The article as a visible entity container
hdsArticleCIF* pArtCIF = 0; // The article as a C-Interface function
hzString S ; // Temp string
if (!this)
Fatal("No instance\n") ;
// Get session if one applies
if (pE)
pInfo = (hdsInfo*) pE->Session() ;
threadLog("info %p\n", pInfo) ;
// Lookup the tree of articles. This could be in the hdsApp map m_ArticleGroups or it could be vested with the session
pAG = m_pApp->m_ArticleGroups[m_Group] ;
if (!pAG)
{
if (pInfo && pInfo->m_pTree)
if (pInfo->m_pTree->m_Groupname == m_Group)
pAG = pInfo->m_pTree ;
}
if (!pAG)
{
C.Printf("SORRY: No such article group (%s)", *m_Group) ;
return ;
}
if (m_Show == 300)
{
// Export tree as script
C << "\n<script language=\"javascript\">\n" ;
pAG->ExportDataScript(C) ;
C.Printf("makeTree('%s');\n", *m_Group) ;
C << "</script>\n" ;
return ;
}
if (m_Article[0]== CHAR_AT)
{
if (!memcmp(*m_Article, "@resarg;/", 9))
{
if (pE && pE->m_Resarg)
pArt = (hdsArticle*) pAG->GetItem(pE->m_Resarg) ;
else
{
S = *m_Article + 9;
pArt = (hdsArticle*) pAG->GetItem(S) ;
}
}
}
else
{
pArt = (hdsArticle*) pAG->GetItem(m_Article) ;
threadLog("fetched article %p %s\n", pArt, *m_Article) ;
}
if (!pArt)
{
C.Printf("SORRY: No article with group (%s) and name (%s)", *m_Group, *m_Article) ;
}
else
{
if (m_Show == 100)
{
C << pArt->m_Title ;
}
else if (m_Show == 200)
{
pArtStd = dynamic_cast<hdsArticleStd*>(pArt) ;
if (pArtStd)
{
// pLang = (hdsLang*) pE->m_pContextLang ;
// C << pLang->m_rawItems[pArtStd->m_USL] ;
pArtStd->Display(C, pE) ;
}
else
{
pArtCIF = dynamic_cast<hdsArticleCIF*>(pArt) ;
if (pArtCIF && pE)
pArtCIF->m_pFunc(C, pArtCIF, pE) ;
}
}
else
{
C.Printf("FOUND: article with group (%s) and name (%s) but no show directive", *m_Group, *pArt->m_Title) ;
}
}
}