added: date_creation and date_modification to items

changed: function 'run' is using a template: fun_run.html
         there is: [item_run] called from this template


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@489 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-03-22 23:54:15 +00:00
parent 951d0e8653
commit bbaefd0f77
20 changed files with 274 additions and 107 deletions

View File

@@ -85,6 +85,80 @@ void item_link(Info & i)
void item_can_read(Info & i)
{
if( request.HasReadAccess(request.item) )
i.result = true;
}
void item_info(Info & i)
{
Ezc::Generator gen(i.out, pat_item_info, functions);
gen.Generate();
}
void item_user(Info & i)
{
User * puser = data.users.GetUser(request.item.user_id);
if( puser )
HtmlEscape(i.out, puser->name);
else
i.out << "unknown";
}
void item_date_creation(Info & i)
{
tm * ptm = &request.item.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 item_date_modification(Info & i)
{
tm * ptm = &request.item.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 item_dates_equal(Info & i)
{
tm * ptm1 = &request.item.date_creation;
tm * ptm2 = &request.item.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 item_run(Info & i)
{
if( !request.is_item )
{
i.out << "<!-- there is no an item to run -->";
return;
}
if( !request.HasReadExecAccess(request.item) )
{
i.out << "<!-- run: permission denied -->";
return;
}
Ezc::Pattern * p = pattern_cacher.GetPattern(request.item);
Ezc::Generator gen(i.out, *p, functions);
gen.Generate();
}
@@ -155,7 +229,6 @@ void item_old_link(Info & i)
static size_t item_index;
@@ -240,12 +313,6 @@ void item_tab_link(Info & i)
}
void item_can_read(Info & i)
{
if( request.HasReadAccess(request.item) )
i.result = true;
}
} // namespace TemplatesFunctions