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:
@@ -10,7 +10,6 @@ dir.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
|
||||
dir.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
|
||||
dir.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
|
||||
dir.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
|
||||
dir.o: ../app/templates.h
|
||||
doc.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
|
||||
doc.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
|
||||
doc.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
|
||||
@@ -21,7 +20,6 @@ doc.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
|
||||
doc.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
|
||||
doc.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
|
||||
doc.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
|
||||
doc.o: ../app/templates.h
|
||||
done.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
|
||||
done.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
|
||||
done.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
|
||||
@@ -32,7 +30,6 @@ done.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
|
||||
done.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
|
||||
done.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
|
||||
done.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
|
||||
done.o: ../app/templates.h
|
||||
item.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
|
||||
item.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
|
||||
item.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
|
||||
@@ -43,7 +40,6 @@ item.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
|
||||
item.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
|
||||
item.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
|
||||
item.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
|
||||
item.o: ../app/templates.h
|
||||
patterncacher.o: patterncacher.h ../core/item.h ../../ezc/src/ezc.h
|
||||
patterncacher.o: ../core/log.h
|
||||
priv.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
|
||||
@@ -56,7 +52,6 @@ priv.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
|
||||
priv.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
|
||||
priv.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
|
||||
priv.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
|
||||
priv.o: ../app/templates.h
|
||||
sys.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
|
||||
sys.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
|
||||
sys.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
|
||||
@@ -67,7 +62,6 @@ sys.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
|
||||
sys.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
|
||||
sys.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
|
||||
sys.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
|
||||
sys.o: ../app/templates.h
|
||||
templates.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
|
||||
templates.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
|
||||
templates.o: ../core/db.h ../core/dircontainer.h ../core/user.h
|
||||
@@ -79,7 +73,6 @@ templates.o: ../core/getparser.h ../core/httpsimpleparser.h
|
||||
templates.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
|
||||
templates.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
|
||||
templates.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
|
||||
templates.o: ../app/templates.h
|
||||
user.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
|
||||
user.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
|
||||
user.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
|
||||
@@ -90,7 +83,6 @@ user.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
|
||||
user.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
|
||||
user.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
|
||||
user.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
|
||||
user.o: ../app/templates.h
|
||||
who.o: templates.h ../../ezc/src/ezc.h ../core/data.h ../core/misc.h
|
||||
who.o: ../core/log.h ../core/item.h ../core/error.h ../core/dirs.h
|
||||
who.o: ../core/db.h ../core/dircontainer.h ../core/user.h ../core/group.h
|
||||
@@ -101,8 +93,7 @@ who.o: ../core/done.h ../core/getparser.h ../core/httpsimpleparser.h
|
||||
who.o: ../core/postparser.h ../core/cookieparser.h ../core/item.h
|
||||
who.o: ../core/db.h ../core/error.h ../core/user.h ../core/group.h
|
||||
who.o: ../core/users.h ../core/groups.h ../core/log.h patterncacher.h
|
||||
who.o: ../app/templates.h ../core/sessioncontainer.h
|
||||
who.o: ../core/requestcontroller.h ../core/data.h ../core/request.h
|
||||
who.o: ../content/content.h ../templates/templates.h ../core/misc.h
|
||||
who.o: ../core/function.h ../core/functionparser.h ../app/content.h
|
||||
who.o: ../core/sessioncontainer.h ../core/requestcontroller.h ../core/data.h
|
||||
who.o: ../core/request.h ../content/content.h ../templates/templates.h
|
||||
who.o: ../core/misc.h ../core/function.h ../core/functionparser.h
|
||||
who.o: ../core/sessionmanager.h ../core/sessioncontainer.h
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -23,11 +23,12 @@ Ezc::Pattern pat_fun_default;
|
||||
Ezc::Pattern pat_fun_priv;
|
||||
Ezc::Pattern pat_fun_rm;
|
||||
Ezc::Pattern pat_fun_who;
|
||||
Ezc::Pattern pat_fun_run;
|
||||
Ezc::Pattern pat_err_item_required;
|
||||
Ezc::Pattern pat_err_404;
|
||||
Ezc::Pattern pat_err_per_denied;
|
||||
Ezc::Pattern pat_err_others;
|
||||
|
||||
Ezc::Pattern pat_item_info;
|
||||
|
||||
|
||||
Ezc::Functions functions;
|
||||
@@ -38,6 +39,8 @@ PatternCacher pattern_cacher;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// !! tymczasowa funkcja
|
||||
void is_group_tv(Info & i)
|
||||
{
|
||||
@@ -93,8 +96,7 @@ Ezc::Pattern * p = 0;
|
||||
break;
|
||||
|
||||
case FUN_RUN:
|
||||
if( request.is_item )
|
||||
p = pattern_cacher.GetPattern(request.item);
|
||||
p = &pat_fun_run;
|
||||
break;
|
||||
|
||||
case FUN_WHO:
|
||||
@@ -202,7 +204,12 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("item_url", item_url);
|
||||
functions.Insert("item_link", item_link);
|
||||
functions.Insert("item_can_read", item_can_read);
|
||||
|
||||
functions.Insert("item_info", item_info);
|
||||
functions.Insert("item_user", item_user);
|
||||
functions.Insert("item_date_creation", item_date_creation);
|
||||
functions.Insert("item_date_modification", item_date_modification);
|
||||
functions.Insert("item_dates_equal", item_dates_equal);
|
||||
functions.Insert("item_run", item_run);
|
||||
|
||||
functions.Insert("item_old_id", item_old_id);
|
||||
functions.Insert("item_old_subject", item_old_subject);
|
||||
@@ -353,6 +360,12 @@ void Templates::Read()
|
||||
pat_fun_who.Directory(data.templates);
|
||||
pat_fun_who.ParseFile("fun_who.html");
|
||||
|
||||
pat_fun_run.Directory(data.templates);
|
||||
pat_fun_run.ParseFile("fun_run.html");
|
||||
|
||||
pat_item_info.Directory(data.templates);
|
||||
pat_item_info.ParseFile("item_info.html");
|
||||
|
||||
CreateFunctions();
|
||||
|
||||
#ifdef APPTEMPLATES
|
||||
|
||||
@@ -39,7 +39,9 @@ namespace TemplatesFunctions
|
||||
using Ezc::Info;
|
||||
|
||||
extern PatternCacher pattern_cacher;
|
||||
|
||||
extern Ezc::Functions functions;
|
||||
extern Ezc::Pattern pat_item_info;
|
||||
|
||||
/*
|
||||
sys
|
||||
*/
|
||||
@@ -74,6 +76,12 @@ namespace TemplatesFunctions
|
||||
void item_url(Info & i);
|
||||
void item_link(Info & i);
|
||||
void item_can_read(Info & i);
|
||||
void item_info(Info & i);
|
||||
void item_user(Info & i);
|
||||
void item_date_creation(Info & i);
|
||||
void item_date_modification(Info & i);
|
||||
void item_dates_equal(Info & i);
|
||||
void item_run(Info & i);
|
||||
|
||||
// !! wprowadzic item_old_is ?
|
||||
void item_old_id(Info & i);
|
||||
|
||||
@@ -75,7 +75,8 @@ void who_tab_time(Info & i)
|
||||
if( !who_init() )
|
||||
return;
|
||||
|
||||
i.out << DateToStr( who_iterator->tm_time.tm_mon + 1,
|
||||
i.out << DateToStr( 0,
|
||||
who_iterator->tm_time.tm_mon + 1,
|
||||
who_iterator->tm_time.tm_mday,
|
||||
who_iterator->tm_time.tm_hour,
|
||||
who_iterator->tm_time.tm_min,
|
||||
@@ -88,7 +89,8 @@ void who_tab_last_time(Info & i)
|
||||
if( !who_init() )
|
||||
return;
|
||||
|
||||
i.out << DateToStr( who_iterator->tm_last_time.tm_mon + 1,
|
||||
i.out << DateToStr( 0,
|
||||
who_iterator->tm_last_time.tm_mon + 1,
|
||||
who_iterator->tm_last_time.tm_mday,
|
||||
who_iterator->tm_last_time.tm_hour,
|
||||
who_iterator->tm_last_time.tm_min,
|
||||
|
||||
Reference in New Issue
Block a user