added: winix uses now [filter] statement from ezc

added: notifications to threads (were temporarily disabled)
changed: templates in notifications



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@712 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-01-26 12:45:38 +00:00
parent 00521c490e
commit ecf19034ae
27 changed files with 244 additions and 141 deletions

View File

@@ -85,6 +85,31 @@ doc.o: ../core/users.h ../core/groups.h ../core/group.h ../core/loadavg.h
doc.o: ../core/thumb.h ../core/basethread.h ../core/sessionmanager.h
doc.o: ../core/sessioncontainer.h ../core/system.h ../core/request.h
doc.o: ../core/misc.h
filters.o: templates.h ../../ezc/src/ezc.h ../../ezc/src/utf8.h
filters.o: ../../ezc/src/generator.h ../../ezc/src/pattern.h
filters.o: ../../ezc/src/item.h ../../ezc/src/funinfo.h
filters.o: ../../ezc/src/functions.h ../../ezc/src/stringconv.h misc.h
filters.o: localefilter.h locale.h ../core/confparser.h htmltextstream.h
filters.o: ../core/textstream.h ../core/user.h patterncacher.h ../core/item.h
filters.o: ckeditorgetparser.h ../core/httpsimpleparser.h ../core/log.h
filters.o: ../core/textstream.h indexpatterns.h ../core/config.h
filters.o: ../core/confparser.h ../core/htmlfilter.h ../db/db.h
filters.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
filters.o: ../core/log.h ../db/dbitemquery.h ../db/dbitemcolumns.h
filters.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
filters.o: ../core/cur.h ../core/request.h ../core/requesttypes.h
filters.o: ../core/error.h ../core/config.h ../templates/htmltextstream.h
filters.o: ../core/session.h ../core/user.h ../core/plugindata.h
filters.o: ../core/rebus.h ../core/system.h ../core/dirs.h
filters.o: ../core/dircontainer.h ../notify/notify.h ../notify/notifypool.h
filters.o: ../templates/locale.h ../templates/misc.h ../notify/notifythread.h
filters.o: ../core/basethread.h ../core/synchro.h ../notify/templatesnotify.h
filters.o: ../core/users.h ../core/ugcontainer.h ../core/lastcontainer.h
filters.o: ../core/cur.h ../core/mounts.h ../core/mount.h
filters.o: ../core/mountparser.h ../core/users.h ../core/groups.h
filters.o: ../core/group.h ../core/loadavg.h ../core/thumb.h
filters.o: ../core/basethread.h ../core/sessionmanager.h
filters.o: ../core/sessioncontainer.h ../core/system.h ../core/misc.h
htmltextstream.o: htmltextstream.h ../core/textstream.h misc.h localefilter.h
htmltextstream.o: locale.h ../core/confparser.h ../../ezc/src/ezc.h
htmltextstream.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h

View File

@@ -1 +1 @@
o = adduser.o dir.o doc.o htmltextstream.o indexpatterns.o item.o last.o locale.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o stat.o sys.o template.o templates.o upload.o uptime.o user.o who.o winix.o
o = adduser.o dir.o doc.o filters.o htmltextstream.o indexpatterns.o item.o last.o locale.o localefilter.o ls.o misc.o mount.o patterncacher.o priv.o rebus.o stat.o sys.o template.o templates.o upload.o uptime.o user.o who.o winix.o

64
templates/filters.cpp Executable file
View File

@@ -0,0 +1,64 @@
/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include "templates.h"
#include "core/misc.h"
namespace TemplatesFunctions
{
static std::string urlencode_tmp;
static std::string qencode_tmp;
void fil_urlencode(Info & i)
{
UrlEncode(i.in.Str(), urlencode_tmp);
i.out << R(urlencode_tmp);
}
void fil_qencode(Info & i)
{
QEncode(i.in.Str(), qencode_tmp);
i.out << R(qencode_tmp);
}
void fil_capitalize(Info & i)
{
const std::wstring & str = i.in.Str();
for(size_t a=0 ; a<str.size() ; ++a)
{
if( str[a]>='a' && str[a]<='z' )
i.out << R(wchar_t(str[a] - 'a' + 'A'));
else
i.out << R(str[a]);
}
}
void fil_tosmall(Info & i)
{
const std::wstring & str = i.in.Str();
for(size_t a=0 ; a<str.size() ; ++a)
{
if( str[a]>='A' && str[a]<='Z' )
i.out << R(wchar_t(str[a] - 'A' + 'a'));
else
i.out << R(str[a]);
}
}
} // namespace

View File

@@ -17,7 +17,7 @@
/*
HtmlTextStream is used as a buffer for creating a html page
By default all operators<< escape its string artuments. If you don't want
By default all operators<< escape its string arguments. If you don't want
to escape an argument you should use a helper function R() (raw argument)
note: you have to define the function yourself, we do not provide it
because such a short name would make a mess in namespaces

View File

@@ -29,7 +29,9 @@ CKEditorGetParser ckeditor_getparser;
// used by GenerateRunRaw()
std::vector<std::wstring> empty_pars;
const std::wstring empty_string;
const std::wstring empty_string;
const HtmlTextStream empty_stream;
Db * db;
Cur * cur;
@@ -39,6 +41,10 @@ Functions * functions;
SessionManager * session_manager;
// generator used by content() function
static EzcGen content_gen;
Ezc::Pattern * content_for_function()
{
@@ -109,15 +115,9 @@ Ezc::Pattern * p = 0;
if( p )
{
EzcGen gen;
//gen.Generate(i.out, *p, ezc_functions);
gen.Generate(i.out, *p);
}
content_gen.Generate(i.out, *p);
else
{
i.out << "<!-- there are not any patterns -->";
}
}
@@ -182,6 +182,15 @@ void Templates::CreateFunctions()
ezc_functions.Insert("dir_last_has_html_template", dir_last_has_html_template);
/*
filters
*/
ezc_functions.Insert("fil_urlencode", fil_urlencode);
ezc_functions.Insert("fil_qencode", fil_qencode);
ezc_functions.Insert("fil_capitalize", fil_capitalize);
ezc_functions.Insert("fil_tosmall", fil_tosmall);
/*
doc
*/
@@ -614,8 +623,6 @@ using namespace TemplatesFunctions;
if( !index )
index = &patterns[locale.GetLang()][pat_index];
EzcGen generator;
//generator.Generate(cur->request->page, *index, ezc_functions);
generator.Generate(cur->request->page, *index);
}
@@ -628,7 +635,7 @@ using namespace TemplatesFunctions;
if( !empty_pars.empty() )
empty_pars.clear();
Info info(cur->request->page, empty_pars, empty_string);
Info info(cur->request->page, empty_pars, empty_string, empty_stream);
info.iter = 0;
info.res = false;

View File

@@ -122,6 +122,15 @@ namespace TemplatesFunctions
void doc_current_url(Info & i);
/*
filters
*/
void fil_urlencode(Info & i);
void fil_qencode(Info & i);
void fil_capitalize(Info & i);
void fil_tosmall(Info & i);
/*
item
*/
@@ -387,6 +396,7 @@ private:
void ReadFunctionsTemplates();
void SetLocale();
TemplatesFunctions::EzcGen generator;
std::wstring temp;
std::wstring fun_file;
};