added 'stat' winix function
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@665 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -44,10 +44,11 @@ dir.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
|
||||
dir.o: ../functions/last.h ../functions/login.h ../functions/logout.h
|
||||
dir.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
|
||||
dir.o: ../functions/node.h ../functions/priv.h ../functions/reload.h
|
||||
dir.o: ../functions/rm.h ../functions/run.h ../functions/subject.h
|
||||
dir.o: ../functions/funthread.h ../functions/template.h
|
||||
dir.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
dir.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h
|
||||
dir.o: ../functions/rm.h ../functions/run.h ../functions/stat.h
|
||||
dir.o: ../functions/subject.h ../functions/funthread.h
|
||||
dir.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h
|
||||
dir.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
|
||||
dir.o: ../core/htmlfilter.h
|
||||
doc.o: templates.h ../../ezc/src/ezc.h misc.h localefilter.h ../core/locale.h
|
||||
doc.o: ../core/confparser.h ../core/user.h patterncacher.h ../core/item.h
|
||||
doc.o: ckeditorgetparser.h ../core/httpsimpleparser.h ../core/log.h
|
||||
@@ -185,10 +186,11 @@ priv.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
|
||||
priv.o: ../functions/last.h ../functions/login.h ../functions/logout.h
|
||||
priv.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
|
||||
priv.o: ../functions/node.h ../functions/priv.h ../functions/reload.h
|
||||
priv.o: ../functions/rm.h ../functions/run.h ../functions/subject.h
|
||||
priv.o: ../functions/funthread.h ../functions/template.h
|
||||
priv.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
priv.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h
|
||||
priv.o: ../functions/rm.h ../functions/run.h ../functions/stat.h
|
||||
priv.o: ../functions/subject.h ../functions/funthread.h
|
||||
priv.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h
|
||||
priv.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
|
||||
priv.o: ../core/htmlfilter.h
|
||||
rebus.o: ../core/request.h templates.h ../../ezc/src/ezc.h misc.h
|
||||
rebus.o: localefilter.h ../core/locale.h ../core/confparser.h ../core/user.h
|
||||
rebus.o: patterncacher.h ../core/item.h ckeditorgetparser.h
|
||||
@@ -207,6 +209,23 @@ rebus.o: ../core/mountparser.h ../core/users.h ../core/ugcontainer.h
|
||||
rebus.o: ../core/lastcontainer.h ../core/groups.h ../core/group.h
|
||||
rebus.o: ../core/loadavg.h ../core/sessionmanager.h
|
||||
rebus.o: ../core/sessioncontainer.h ../core/system.h
|
||||
stat.o: templates.h ../../ezc/src/ezc.h misc.h localefilter.h
|
||||
stat.o: ../core/locale.h ../core/confparser.h ../core/user.h patterncacher.h
|
||||
stat.o: ../core/item.h ckeditorgetparser.h ../core/httpsimpleparser.h
|
||||
stat.o: ../core/log.h indexpatterns.h ../core/locale.h ../core/config.h
|
||||
stat.o: ../core/htmlfilter.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
|
||||
stat.o: ../db/dbtextstream.h ../core/textstream.h ../core/error.h
|
||||
stat.o: ../core/log.h ../db/dbitemquery.h ../core/item.h
|
||||
stat.o: ../db/dbitemcolumns.h ../core/group.h ../core/thread.h
|
||||
stat.o: ../core/dircontainer.h ../core/item.h ../core/ugcontainer.h
|
||||
stat.o: ../core/request.h ../core/requesttypes.h ../core/session.h
|
||||
stat.o: ../core/error.h ../core/user.h ../core/plugindata.h ../core/rebus.h
|
||||
stat.o: ../core/config.h ../core/system.h ../core/dirs.h
|
||||
stat.o: ../core/dircontainer.h ../core/request.h ../core/mounts.h
|
||||
stat.o: ../core/mount.h ../core/mountparser.h ../core/users.h
|
||||
stat.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/groups.h
|
||||
stat.o: ../core/group.h ../core/loadavg.h ../core/sessionmanager.h
|
||||
stat.o: ../core/sessioncontainer.h ../core/system.h ../core/misc.h
|
||||
sys.o: templates.h ../../ezc/src/ezc.h misc.h localefilter.h ../core/locale.h
|
||||
sys.o: ../core/confparser.h ../core/user.h patterncacher.h ../core/item.h
|
||||
sys.o: ckeditorgetparser.h ../core/httpsimpleparser.h ../core/log.h
|
||||
@@ -273,7 +292,7 @@ templates.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
|
||||
templates.o: ../functions/login.h ../functions/logout.h ../functions/ls.h
|
||||
templates.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
|
||||
templates.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
templates.o: ../functions/run.h ../functions/subject.h
|
||||
templates.o: ../functions/run.h ../functions/stat.h ../functions/subject.h
|
||||
templates.o: ../functions/funthread.h ../functions/template.h
|
||||
templates.o: ../functions/tinymce.h ../functions/uname.h
|
||||
templates.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
|
||||
@@ -307,10 +326,10 @@ thread.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
|
||||
thread.o: ../functions/login.h ../functions/logout.h ../functions/ls.h
|
||||
thread.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
|
||||
thread.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
thread.o: ../functions/run.h ../functions/subject.h ../functions/funthread.h
|
||||
thread.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h
|
||||
thread.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
|
||||
thread.o: ../core/htmlfilter.h
|
||||
thread.o: ../functions/run.h ../functions/stat.h ../functions/subject.h
|
||||
thread.o: ../functions/funthread.h ../functions/template.h
|
||||
thread.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
thread.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h
|
||||
upload.o: templates.h ../../ezc/src/ezc.h misc.h localefilter.h
|
||||
upload.o: ../core/locale.h ../core/confparser.h ../core/user.h
|
||||
upload.o: patterncacher.h ../core/item.h ckeditorgetparser.h
|
||||
@@ -410,7 +429,8 @@ winix.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
|
||||
winix.o: ../functions/login.h ../functions/logout.h ../functions/ls.h
|
||||
winix.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
|
||||
winix.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
||||
winix.o: ../functions/run.h ../functions/subject.h ../functions/funthread.h
|
||||
winix.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h
|
||||
winix.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
|
||||
winix.o: ../core/htmlfilter.h ../templates/templates.h
|
||||
winix.o: ../functions/run.h ../functions/stat.h ../functions/subject.h
|
||||
winix.o: ../functions/funthread.h ../functions/template.h
|
||||
winix.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
winix.o: ../functions/uptime.h ../functions/who.h ../core/htmlfilter.h
|
||||
winix.o: ../templates/templates.h
|
||||
|
||||
@@ -1 +1 @@
|
||||
o = adduser.o dir.o doc.o indexpatterns.o item.o last.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o sys.o template.o templates.o thread.o upload.o uptime.o user.o who.o winix.o
|
||||
o = adduser.o dir.o doc.o indexpatterns.o item.o last.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o stat.o sys.o template.o templates.o thread.o upload.o uptime.o user.o who.o winix.o
|
||||
|
||||
104
templates/stat.cpp
Executable file
104
templates/stat.cpp
Executable file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "templates.h"
|
||||
#include "misc.h"
|
||||
#include "core/request.h"
|
||||
#include "core/misc.h"
|
||||
|
||||
|
||||
namespace TemplatesFunctions
|
||||
{
|
||||
|
||||
|
||||
void stat_item_type_is_file(Info & i)
|
||||
{
|
||||
i.res = request->is_item && request->item.auth == Item::auth_none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void stat_item_type_is_static_file(Info & i)
|
||||
{
|
||||
i.res = request->is_item && request->item.auth != Item::auth_none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void stat_item_type_is_dir(Info & i)
|
||||
{
|
||||
i.res = !request->is_item;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void stat_item_inode(Info & i)
|
||||
{
|
||||
i.out << request->last_item->id;
|
||||
}
|
||||
|
||||
|
||||
void stat_item_user(Info & i)
|
||||
{
|
||||
User * puser = system->users.GetUser(request->last_item->user_id);
|
||||
print_user_name(i, puser, request->last_item->guest_name);
|
||||
}
|
||||
|
||||
|
||||
void stat_item_group(Info & i)
|
||||
{
|
||||
long group_id = request->last_item->group_id;
|
||||
Group * pgroup = system->groups.GetGroup(group_id);
|
||||
|
||||
if( pgroup )
|
||||
HtmlEscape(i.out, pgroup->name);
|
||||
else
|
||||
i.out << group_id;
|
||||
}
|
||||
|
||||
|
||||
void stat_item_privileges(Info & i)
|
||||
{
|
||||
i.out << std::setbase(8) << request->last_item->privileges << std::setbase(10);
|
||||
}
|
||||
|
||||
|
||||
void stat_item_date_creation(Info & i)
|
||||
{
|
||||
tm * ptm = &request->last_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 stat_item_date_modification(Info & i)
|
||||
{
|
||||
tm * ptm = &request->last_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 stat_item_template(Info & i)
|
||||
{
|
||||
HtmlEscape(i.out, request->last_item->html_template);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void stat_item_is_template_from_mount_point(Info & i)
|
||||
{
|
||||
i.res = request->last_item->html_template.empty();
|
||||
}
|
||||
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
|
||||
|
||||
@@ -305,6 +305,22 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("rebus_question", rebus_question);
|
||||
|
||||
|
||||
/*
|
||||
stat
|
||||
*/
|
||||
ezc_functions.Insert("stat_item_type_is_file", stat_item_type_is_file);
|
||||
ezc_functions.Insert("stat_item_type_is_static_file", stat_item_type_is_static_file);
|
||||
ezc_functions.Insert("stat_item_type_is_dir", stat_item_type_is_dir);
|
||||
ezc_functions.Insert("stat_item_inode", stat_item_inode);
|
||||
ezc_functions.Insert("stat_item_user", stat_item_user);
|
||||
ezc_functions.Insert("stat_item_group", stat_item_group);
|
||||
ezc_functions.Insert("stat_item_privileges", stat_item_privileges);
|
||||
ezc_functions.Insert("stat_item_date_creation", stat_item_date_creation);
|
||||
ezc_functions.Insert("stat_item_date_modification", stat_item_date_modification);
|
||||
ezc_functions.Insert("stat_item_template", stat_item_template);
|
||||
ezc_functions.Insert("stat_item_is_template_from_mount_point", stat_item_is_template_from_mount_point);
|
||||
|
||||
|
||||
/*
|
||||
sys
|
||||
*/
|
||||
|
||||
@@ -236,6 +236,22 @@ namespace TemplatesFunctions
|
||||
void rebus_question(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
stat
|
||||
*/
|
||||
void stat_item_type_is_file(Info & i);
|
||||
void stat_item_type_is_static_file(Info & i);
|
||||
void stat_item_type_is_dir(Info & i);
|
||||
void stat_item_inode(Info & i);
|
||||
void stat_item_user(Info & i);
|
||||
void stat_item_group(Info & i);
|
||||
void stat_item_privileges(Info & i);
|
||||
void stat_item_date_creation(Info & i);
|
||||
void stat_item_date_modification(Info & i);
|
||||
void stat_item_template(Info & i);
|
||||
void stat_item_is_template_from_mount_point(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
sys
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user