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:
@@ -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
|
||||
<< " -->";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,11 +17,14 @@ namespace TemplatesMisc
|
||||
{
|
||||
|
||||
|
||||
void print_date_nice(Ezc::Info & i, tm * ptm)
|
||||
void print_date_nice(Ezc::Info & i, const tm * ptm)
|
||||
{
|
||||
time_t t = mktime(ptm);
|
||||
tm tm_temp(*ptm);
|
||||
|
||||
time_t t = mktime(&tm_temp); // mktime do something in tm_temp
|
||||
time_t now = time(0);
|
||||
time_t one_day = 60 * 60 * 24;
|
||||
|
||||
|
||||
if( t + one_day > now )
|
||||
i.out << DateToStr(ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
||||
|
@@ -25,7 +25,7 @@ namespace TemplatesMisc
|
||||
typedef std::vector<std::vector<Ezc::Pattern> > Patterns;
|
||||
|
||||
|
||||
void print_date_nice(Ezc::Info & i, tm * ptm);
|
||||
void print_date_nice(Ezc::Info & i, const tm * ptm);
|
||||
|
||||
|
||||
|
||||
|
@@ -216,6 +216,8 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("item_can_remove", item_can_remove);
|
||||
functions.Insert("item_info", item_info);
|
||||
functions.Insert("item_user", item_user);
|
||||
functions.Insert("item_modification_user", item_modification_user);
|
||||
functions.Insert("item_users_different", item_users_different);
|
||||
functions.Insert("item_date_creation", item_date_creation);
|
||||
functions.Insert("item_date_modification", item_date_modification);
|
||||
functions.Insert("item_date_creation_nice", item_date_creation_nice);
|
||||
@@ -239,9 +241,11 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("item_tab_can_read", item_tab_can_read);
|
||||
functions.Insert("item_tab_info", item_tab_info);
|
||||
functions.Insert("item_tab_user", item_tab_user);
|
||||
functions.Insert("item_tab_modification_user", item_tab_modification_user);
|
||||
functions.Insert("item_tab_users_different", item_tab_users_different);
|
||||
functions.Insert("item_tab_group", item_tab_group);
|
||||
functions.Insert("item_tab_date_creation", item_tab_date_creation);
|
||||
functions.Insert("item_tab_date_modification", item_tab_date_modification);
|
||||
functions.Insert("item_tab_date_creation", item_tab_date_creation);
|
||||
functions.Insert("item_tab_date_modification", item_tab_date_modification);
|
||||
functions.Insert("item_tab_date_creation_nice", item_tab_date_creation_nice);
|
||||
functions.Insert("item_tab_date_modification_nice", item_tab_date_modification_nice);
|
||||
functions.Insert("item_tab_dates_equal", item_tab_dates_equal);
|
||||
|
@@ -127,6 +127,8 @@ namespace TemplatesFunctions
|
||||
void item_can_remove(Info & i);
|
||||
void item_info(Info & i);
|
||||
void item_user(Info & i);
|
||||
void item_modification_user(Info & i);
|
||||
void item_users_different(Info & i);
|
||||
void item_date_creation(Info & i);
|
||||
void item_date_modification(Info & i);
|
||||
void item_date_creation_nice(Info & i);
|
||||
@@ -150,6 +152,8 @@ namespace TemplatesFunctions
|
||||
void item_tab_can_read(Info & i);
|
||||
void item_tab_info(Info & i);
|
||||
void item_tab_user(Info & i);
|
||||
void item_tab_modification_user(Info & i);
|
||||
void item_tab_users_different(Info & i);
|
||||
void item_tab_group(Info & i);
|
||||
void item_tab_date_creation(Info & i);
|
||||
void item_tab_date_modification(Info & i);
|
||||
|
Reference in New Issue
Block a user