added: created directory 'content' which has Content:: files
added: created directory 'templates' which has Templates:: and TemplatesFunctions:: files
changed: content.cpp split into many files (directory 'content')
changed: templates.cpp split into many files (directory 'templates')
added: full permissions
changed: building of the program (GNU make is used now)
Makefile and Makefile.dep added into directories
added: a parser 'FunctionParser'
is used to parse the GET string
it recognizes directories, items, functions, functions parameters
added: other classes: Function, Functions
added: function: ls, privileges
changed: function 'id' to 'node'
changed: version: to 0.2.0
added/changed: a lot of work have been done
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@469 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
104
templates/dir.cpp
Executable file
104
templates/dir.cpp
Executable file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* This file is a part of CMSLU -- Content Management System like Unix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "templates.h"
|
||||
|
||||
|
||||
namespace TemplatesFunctions
|
||||
{
|
||||
|
||||
|
||||
|
||||
void dir(Info & i)
|
||||
{
|
||||
for(size_t a=0 ; a<request.dir_table.size() ; ++a)
|
||||
{
|
||||
HtmlEscape(i.out, request.dir_table[a]->url);
|
||||
i.out << '/';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static std::vector<Item*> dir_childs_table;
|
||||
static size_t dir_childs_index;
|
||||
|
||||
// request.id is never 0 and we can start dir_childs_reqid from 0
|
||||
static size_t dir_childs_reqid = 0;
|
||||
|
||||
|
||||
|
||||
void dir_childs_tab(Info & i)
|
||||
{
|
||||
if( dir_childs_reqid != request.id )
|
||||
{
|
||||
dir_childs_reqid = request.id;
|
||||
dir_childs_table.clear();
|
||||
|
||||
if( !request.dir_table.empty() )
|
||||
data.dirs.GetDirChilds(request.dir_table.back()->id, dir_childs_table);
|
||||
}
|
||||
|
||||
dir_childs_index = i.iter;
|
||||
i.result = dir_childs_index < dir_childs_table.size();
|
||||
}
|
||||
|
||||
|
||||
void dir_childs_tab_url(Info & i)
|
||||
{
|
||||
if( dir_childs_index < dir_childs_table.size() )
|
||||
HtmlEscape(i.out, dir_childs_table[dir_childs_index]->url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static size_t dir_index;
|
||||
|
||||
|
||||
void dir_tab(Info & i)
|
||||
{
|
||||
dir_index = i.iter;
|
||||
i.result = dir_index < request.dir_table.size();
|
||||
}
|
||||
|
||||
|
||||
void dir_tab_url(Info & i)
|
||||
{
|
||||
if( dir_index < request.dir_table.size() )
|
||||
HtmlEscape(i.out, request.dir_table[dir_index]->url);
|
||||
}
|
||||
|
||||
|
||||
void dir_tab_link(Info & i)
|
||||
{
|
||||
i.out << data.base_url;
|
||||
|
||||
for(size_t a = 0 ; a <= dir_index && a < request.dir_table.size() ; ++a)
|
||||
{
|
||||
HtmlEscape(i.out, request.dir_table[a]->url);
|
||||
i.out << '/';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user