added: column 'guest_name' to 'item' table
used when user_id is -1 added: mount parameters: thread_with_info, thread_with_header added: function rm can remove threads git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@506 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -226,6 +226,61 @@ void dir_last_subject(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void dir_last_info(Info & i)
|
||||
{
|
||||
Ezc::Generator gen(i.out, pat_dir_last_info, functions);
|
||||
gen.Generate();
|
||||
}
|
||||
|
||||
|
||||
void dir_last_user(Info & i)
|
||||
{
|
||||
User * puser = data.users.GetUser(request.dir_table.back()->user_id);
|
||||
|
||||
if( puser )
|
||||
HtmlEscape(i.out, puser->name);
|
||||
else
|
||||
{
|
||||
i.out << "~";
|
||||
|
||||
if( !request.dir_table.back()->guest_name.empty() )
|
||||
HtmlEscape(i.out, request.dir_table.back()->guest_name);
|
||||
else
|
||||
i.out << "guest"; // !! dodac do konfiga
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dir_last_date_creation(Info & i)
|
||||
{
|
||||
tm * ptm = &request.dir_table.back()->date_creation;
|
||||
|
||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_date_modification(Info & i)
|
||||
{
|
||||
tm * ptm = &request.dir_table.back()->date_modification;
|
||||
|
||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_dates_equal(Info & i)
|
||||
{
|
||||
tm * ptm1 = &request.dir_table.back()->date_creation;
|
||||
tm * ptm2 = &request.dir_table.back()->date_modification;
|
||||
|
||||
i.result = ptm1->tm_year == ptm2->tm_year &&
|
||||
ptm1->tm_mon == ptm2->tm_mon &&
|
||||
ptm1->tm_mday == ptm2->tm_mday &&
|
||||
ptm1->tm_hour == ptm2->tm_hour &&
|
||||
ptm1->tm_min == ptm2->tm_min &&
|
||||
ptm1->tm_sec == ptm2->tm_sec;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void dir_old(Info & i)
|
||||
{
|
||||
|
||||
@@ -35,10 +35,16 @@ void doc_title(Info & i)
|
||||
|
||||
// from 1 means skipping the root directory
|
||||
for(a = 1 ; a<request.dir_table.size() ; ++a)
|
||||
i.out << " / " << request.dir_table[a]->subject;
|
||||
{
|
||||
i.out << " / ";
|
||||
HtmlEscape(i.out, request.dir_table[a]->subject);
|
||||
}
|
||||
|
||||
if( request.is_item )
|
||||
i.out << " / " << request.item.subject;
|
||||
{
|
||||
i.out << " / ";
|
||||
HtmlEscape(i.out, request.item.subject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -146,7 +146,14 @@ void item_user(Info & i)
|
||||
if( puser )
|
||||
HtmlEscape(i.out, puser->name);
|
||||
else
|
||||
i.out << "~guest"; // !! dodac do konfiga
|
||||
{
|
||||
i.out << "~";
|
||||
|
||||
if( !request.item.guest_name.empty() )
|
||||
HtmlEscape(i.out, request.item.guest_name);
|
||||
else
|
||||
i.out << "guest"; // !! dodac do konfiga
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +420,14 @@ void item_tab_user(Info & i)
|
||||
if( puser )
|
||||
HtmlEscape(i.out, puser->name);
|
||||
else
|
||||
i.out << "~guest"; // !! dodac do konfiga
|
||||
{
|
||||
i.out << "~";
|
||||
|
||||
if( !request.item_table[item_index].guest_name.empty() )
|
||||
HtmlEscape(i.out, request.item_table[item_index].guest_name);
|
||||
else
|
||||
i.out << "guest"; // !! dodac do konfiga
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,16 @@ void mount_param_withinfo(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void mount_param_thread_with_header(Info & i)
|
||||
{
|
||||
i.result = data.mounts.CurrentMountIsParam(Mount::thread_with_header);
|
||||
}
|
||||
|
||||
|
||||
void mount_param_thread_with_info(Info & i)
|
||||
{
|
||||
i.result = data.mounts.CurrentMountIsParam(Mount::thread_with_info);
|
||||
}
|
||||
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
@@ -35,6 +35,7 @@ Ezc::Pattern pat_err_per_denied;
|
||||
Ezc::Pattern pat_err_others;
|
||||
Ezc::Pattern pat_item_info;
|
||||
Ezc::Pattern pat_item_tab_info;
|
||||
Ezc::Pattern pat_dir_last_info;
|
||||
|
||||
Ezc::Functions functions;
|
||||
|
||||
@@ -280,9 +281,14 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("dir_tab_url", dir_tab_url);
|
||||
functions.Insert("dir_tab_link", dir_tab_link);
|
||||
|
||||
functions.Insert("dir_last_default_item_dir", dir_last_default_item_dir);
|
||||
functions.Insert("dir_last_default_item_url", dir_last_default_item_url);
|
||||
functions.Insert("dir_last_subject", dir_last_subject);
|
||||
functions.Insert("dir_last_default_item_dir", dir_last_default_item_dir);
|
||||
functions.Insert("dir_last_default_item_url", dir_last_default_item_url);
|
||||
functions.Insert("dir_last_subject", dir_last_subject);
|
||||
functions.Insert("dir_last_info", dir_last_info);
|
||||
functions.Insert("dir_last_user", dir_last_user);
|
||||
functions.Insert("dir_last_date_creation", dir_last_date_creation);
|
||||
functions.Insert("dir_last_date_modification", dir_last_date_modification);
|
||||
functions.Insert("dir_last_dates_equal", dir_last_dates_equal);
|
||||
|
||||
functions.Insert("dir_old", dir_old);
|
||||
|
||||
@@ -355,7 +361,6 @@ void Templates::CreateFunctions()
|
||||
thread
|
||||
*/
|
||||
functions.Insert("thread_is", thread_is);
|
||||
functions.Insert("thread_subject", thread_subject);
|
||||
functions.Insert("thread_show_edit_subject", thread_show_edit_subject);
|
||||
functions.Insert("thread_tab", thread_tab);
|
||||
functions.Insert("thread_tab_url", thread_tab_url);
|
||||
@@ -370,8 +375,10 @@ void Templates::CreateFunctions()
|
||||
/*
|
||||
mount
|
||||
*/
|
||||
functions.Insert("mount_param_withheader", mount_param_withheader);
|
||||
functions.Insert("mount_param_withinfo", mount_param_withinfo);
|
||||
functions.Insert("mount_param_withheader", mount_param_withheader);
|
||||
functions.Insert("mount_param_withinfo", mount_param_withinfo);
|
||||
functions.Insert("mount_param_thread_with_header", mount_param_thread_with_header);
|
||||
functions.Insert("mount_param_thread_with_info", mount_param_thread_with_info);
|
||||
|
||||
|
||||
|
||||
@@ -449,6 +456,9 @@ void Templates::Read()
|
||||
pat_fun_createthread.Directory(data.templates);
|
||||
pat_fun_createthread.ParseFile("fun_createthread.html");
|
||||
|
||||
pat_dir_last_info.Directory(data.templates);
|
||||
pat_dir_last_info.ParseFile("dir_last_info.html");
|
||||
|
||||
CreateFunctions();
|
||||
|
||||
#ifdef APPTEMPLATES
|
||||
|
||||
@@ -32,7 +32,9 @@ namespace TemplatesFunctions
|
||||
extern Ezc::Functions functions;
|
||||
extern Ezc::Pattern pat_item_info;
|
||||
extern Ezc::Pattern pat_item_tab_info;
|
||||
|
||||
extern Ezc::Pattern pat_dir_last_info;
|
||||
|
||||
|
||||
/*
|
||||
sys
|
||||
*/
|
||||
@@ -127,6 +129,11 @@ namespace TemplatesFunctions
|
||||
void dir_last_default_item_dir(Info &);
|
||||
void dir_last_default_item_url(Info & i);
|
||||
void dir_last_subject(Info & i);
|
||||
void dir_last_info(Info & i);
|
||||
void dir_last_user(Info & i);
|
||||
void dir_last_date_creation(Info & i);
|
||||
void dir_last_date_modification(Info & i);
|
||||
void dir_last_dates_equal(Info & i);
|
||||
|
||||
void dir_old(Info & i);
|
||||
|
||||
@@ -197,7 +204,6 @@ namespace TemplatesFunctions
|
||||
*/
|
||||
void thread_is(Info & i);
|
||||
void thread_show_edit_subject(Info & i);
|
||||
void thread_subject(Info & i);
|
||||
void thread_tab(Info & i);
|
||||
void thread_tab_url(Info & i);
|
||||
void thread_tab_subject(Info & i);
|
||||
@@ -212,7 +218,8 @@ namespace TemplatesFunctions
|
||||
*/
|
||||
void mount_param_withheader(Info & i);
|
||||
void mount_param_withinfo(Info & i);
|
||||
|
||||
void mount_param_thread_with_header(Info & i);
|
||||
void mount_param_thread_with_info(Info & i);
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
|
||||
@@ -34,20 +34,6 @@ void thread_show_edit_subject(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void thread_subject(Info & i)
|
||||
{
|
||||
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;
|
||||
@@ -131,7 +117,14 @@ bool unknown = true;
|
||||
if( puser )
|
||||
HtmlEscape(i.out, puser->name);
|
||||
else
|
||||
HtmlEscape(i.out, "~guest"); // !! dodac to do data
|
||||
{
|
||||
i.out << "~";
|
||||
|
||||
if( !dir->guest_name.empty() )
|
||||
HtmlEscape(i.out, dir->guest_name);
|
||||
else
|
||||
i.out << "guest"; // !! dodac do konfiga
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +155,14 @@ void thread_tab_last_item_user(Info & i)
|
||||
if( puser )
|
||||
HtmlEscape(i.out, puser->name);
|
||||
else
|
||||
HtmlEscape(i.out, "~guest"); // !! dodac to do data
|
||||
{
|
||||
i.out << "~";
|
||||
|
||||
if( !request.thread_tab[thread_tab_index].last_item.guest_name.empty() )
|
||||
HtmlEscape(i.out, request.thread_tab[thread_tab_index].last_item.guest_name);
|
||||
else
|
||||
i.out << "guest"; // !! dodac do konfiga
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user