changed: rewritten templates/man

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@789 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2012-01-06 12:55:08 +00:00
parent f967a428ce
commit 84eaa6b7b6
2 changed files with 45 additions and 12 deletions

View File

@ -148,10 +148,15 @@ void Functions::SetObjects(FunctionBase * fun)
void Functions::Add(FunctionBase * fun)
{
if( fun->fun.url.empty() )
{
log << log1 << "Functions: skipping a function with an empty url" << logend;
return;
}
if( Find(fun->fun.url) )
{
log << log1 << "Functions: function " << fun->fun.url
<< " already exists (skipped)" << logend;
log << log1 << "Functions: function " << fun->fun.url << " already exists (skipped)" << logend;
return;
}

View File

@ -17,19 +17,33 @@ namespace TemplatesFunctions
{
static Functions::Iterator winixfun_iter;
static bool winixfun_iter_valid = false;
static size_t winixfun_curreq = 0;
bool man_winixfun_tabcheck()
{
if( winixfun_curreq != cur->request->id )
{
winixfun_curreq = cur->request->id;
winixfun_iter = functions->Begin();
}
return winixfun_iter != functions->End();
}
void man_winixfun_tab(Info & i)
{
man_winixfun_tabcheck();
if( i.iter == 0 )
winixfun_iter = functions->Begin();
else
if( winixfun_iter != functions->End() )
++winixfun_iter;
i.res = (winixfun_iter != functions->End());
winixfun_iter_valid = i.res;
i.res = winixfun_iter != functions->End();
}
@ -41,27 +55,41 @@ void man_winixfun_tab_index(Info & i)
void man_winixfun_tab_name(Info & i)
{
if( winixfun_iter_valid )
if( man_winixfun_tabcheck() )
i.out << winixfun_iter->first;
}
static EzcFun::Iterator ezcfun_iter;
static bool ezcfun_valid = false;
static EzcFun::Iterator ezcfun_iter;
static size_t ezcfun_curreq = 0;
bool man_ezcfun_tabcheck()
{
if( ezcfun_curreq != cur->request->id )
{
ezcfun_curreq = cur->request->id;
ezcfun_iter = ezc_functions.Begin();
}
return ezcfun_iter != ezc_functions.End();
}
void man_ezcfun_tab(Info & i)
{
man_ezcfun_tabcheck();
if( i.iter == 0 )
ezcfun_iter = ezc_functions.Begin();
else
if( ezcfun_iter != ezc_functions.End() )
++ezcfun_iter;
i.res = (ezcfun_iter != ezc_functions.End());
ezcfun_valid = i.res;
i.res = ezcfun_iter != ezc_functions.End();
}
@ -73,7 +101,7 @@ void man_ezcfun_tab_index(Info & i)
void man_ezcfun_tab_name(Info & i)
{
if( ezcfun_valid )
if( man_ezcfun_tabcheck() )
i.out << ezcfun_iter->first;
}