added: forum

added: mount params can have arguments (in parentheses)
added: mount params: withheader, withinfo, restrictcreatethread, only_root_can_remove,
       can_use_emacs_on(level), can_use_mkdir_on(level), 
added: table Item has 'subject' column now
removed: column 'subject' from table Content




git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@505 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-06-05 20:29:06 +00:00
parent 3d001e7458
commit 1eb42446f8
38 changed files with 1357 additions and 369 deletions

View File

@@ -17,10 +17,160 @@
namespace TemplatesFunctions
{
void thread_is(Info & i)
{
i.result = request.is_thread;
}
bool thread_show_edit_subject_var = false; // !! tymczasowe rozwiazanie, cos lepszego wymyslec
void thread_show_edit_subject(Info & i)
{
i.result = thread_show_edit_subject_var;
thread_show_edit_subject_var = false;
}
void thread_subject(Info & i)
{
HtmlEscape(i.out, request.thread.subject);
Item * dir = data.dirs.GetDir( request.thread.dir_id );
if( dir )
{
HtmlEscape(i.out, dir->subject);
}
else
{
i.out << "<!-- unknown subject -->";
}
}
static size_t thread_tab_index;
void thread_tab(Info & i)
{
thread_tab_index = i.iter;
i.result = thread_tab_index < request.thread_tab.size();
}
void thread_tab_url(Info & i)
{
if( thread_tab_index < request.thread_tab.size() )
{
Item * dir = data.dirs.GetDir( request.thread_tab[thread_tab_index].dir_id );
if( dir )
{
HtmlEscape(i.out, dir->url);
}
else
{
i.out << "<!-- unknown directory -->";
}
}
}
void thread_tab_subject(Info & i)
{
if( thread_tab_index < request.thread_tab.size() )
{
Item * dir = data.dirs.GetDir( request.thread_tab[thread_tab_index].dir_id );
if( dir )
{
HtmlEscape(i.out, dir->subject);
}
else
{
i.out << "<!-- unknown subject -->";
}
}
}
void thread_tab_answers(Info & i)
{
if( thread_tab_index < request.thread_tab.size() )
{
long a = request.thread_tab[thread_tab_index].items;
// the first is created by the author
// we count only the rest
if( a > 0 )
--a;
i.out << a;
}
}
void thread_tab_author(Info & i)
{
bool unknown = true;
if( thread_tab_index < request.thread_tab.size() )
{
Item * dir = data.dirs.GetDir( request.thread_tab[thread_tab_index].dir_id );
if( dir )
{
User * puser = data.users.GetUser(dir->user_id);
unknown = false;
if( puser )
HtmlEscape(i.out, puser->name);
else
HtmlEscape(i.out, "~guest"); // !! dodac to do data
}
}
if( unknown )
{
i.out << "<!-- unknown user -->";
}
}
void thread_tab_last_item_date_modification(Info & i)
{
if( thread_tab_index < request.thread_tab.size() )
if( request.thread_tab[thread_tab_index].last_item.id != -1 )
i.out << DateToStr( &request.thread_tab[thread_tab_index].last_item.date_modification );
}
void thread_tab_last_item_user(Info & i)
{
if( thread_tab_index < request.thread_tab.size() )
{
if( request.thread_tab[thread_tab_index].last_item.id != -1 )
{
User * puser = data.users.GetUser( request.thread_tab[thread_tab_index].last_item.user_id );
if( puser )
HtmlEscape(i.out, puser->name);
else
HtmlEscape(i.out, "~guest"); // !! dodac to do data
}
}
}
void thread_can_create(Info & i)
{
i.result = request.CanCreateThread(true);
}