struct Item has modification_user_id (long) now

this is the id of a user who has modified the item recently
this is only for information, persmissions don't use it


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@614 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-06-22 21:09:37 +00:00
parent 56075857f2
commit 759135fd7d
20 changed files with 110 additions and 53 deletions

View File

@@ -21,6 +21,22 @@ namespace TemplatesFunctions
void print_user_name(Info & i, const User * puser, const std::string & guest_name)
{
if( puser )
{
HtmlEscape(i.out, puser->name);
}
else
{
i.out << "~";
if( !guest_name.empty() )
HtmlEscape(i.out, guest_name);
else
i.out << "guest"; // !! dodac do konfiga
}
}
@@ -208,18 +224,21 @@ void item_info(Info & i)
void item_user(Info & i)
{
User * puser = data.users.GetUser(request.item.user_id);
if( puser )
HtmlEscape(i.out, puser->name);
else
{
i.out << "~";
if( !request.item.guest_name.empty() )
HtmlEscape(i.out, request.item.guest_name);
else
i.out << "guest"; // !! dodac do konfiga
}
print_user_name(i, puser, request.item.guest_name);
}
void item_modification_user(Info & i)
{
User * puser = data.users.GetUser(request.item.modification_user_id);
print_user_name(i, puser, request.item.guest_name);
}
void item_users_different(Info & i)
{
i.res = (request.item.user_id != request.item.modification_user_id);
}
@@ -434,22 +453,33 @@ void item_tab_user(Info & i)
if( item_index < request.item_table.size() )
{
User * puser = data.users.GetUser(request.item_table[item_index].user_id);
if( puser )
HtmlEscape(i.out, puser->name);
else
{
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
}
print_user_name(i, puser, request.item_table[item_index].guest_name);
}
}
void item_tab_modification_user(Info & i)
{
if( item_index < request.item_table.size() )
{
User * puser = data.users.GetUser(request.item_table[item_index].modification_user_id);
print_user_name(i, puser, request.item_table[item_index].guest_name);
}
}
void item_tab_users_different(Info & i)
{
if( item_index < request.item_table.size() )
{
i.res = (request.item_table[item_index].user_id != request.item_table[item_index].modification_user_id);
}
}
void item_tab_group(Info & i)
{
if( item_index < request.item_table.size() )
@@ -492,17 +522,22 @@ void item_tab_date_creation_nice(Info & i)
if( item_index < request.item_table.size() )
{
tm * ptm = &request.item_table[item_index].date_creation;
TemplatesMisc::print_date_nice(i, ptm);
TemplatesMisc::print_date_nice(i, ptm);
i.out << "<!-- creation hour: " << ptm->tm_hour << " -->";
}
}
void item_tab_date_modification_nice(Info & i)
{
if( item_index < request.item_table.size() )
{
tm * ptm = &request.item_table[item_index].date_modification;
TemplatesMisc::print_date_nice(i, ptm);
TemplatesMisc::print_date_nice(i, ptm);
i.out << "<!-- modification hour: " << ptm->tm_hour << " -->";
}
}
@@ -520,15 +555,6 @@ void item_tab_dates_equal(Info & i)
ptm1->tm_hour == ptm2->tm_hour &&
ptm1->tm_min == ptm2->tm_min &&
ptm1->tm_sec == ptm2->tm_sec;
i.out << "<!-- equal:(" << (int)i.res << ") \n";
i.out << 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
<< " -->";
}
}