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:
parent
00521c490e
commit
ecf19034ae
2
Makefile
2
Makefile
|
@ -5,7 +5,7 @@ CXX = g++
|
|||
endif
|
||||
|
||||
ifndef CXXFLAGS
|
||||
CXXFLAGS = -fPIC -Wall -pedantic -O2 -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER
|
||||
CXXFLAGS = -fPIC -Wall -pedantic -O2 -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER -DEZC_HAS_SPECIAL_STREAM
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
@ -986,7 +986,7 @@ void QEncodeAddChar(wchar_t c, std::string & out)
|
|||
|
||||
/*
|
||||
this encoding is used in mails headers
|
||||
encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
|
||||
encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
|
||||
http://www.faqs.org/rfcs/rfc1522.html
|
||||
|
||||
we have:
|
||||
|
@ -995,7 +995,7 @@ void QEncodeAddChar(wchar_t c, std::string & out)
|
|||
|
||||
current limitation:
|
||||
we do not support checking the maximum length:
|
||||
"An encoded-word may not be more than 75 characters long, including
|
||||
"An encoded-word may not be more than 75 characters long, including
|
||||
charset, encoding, encoded-text, and delimiters."
|
||||
*/
|
||||
void QEncode(const std::wstring & in, std::string & out, bool clear)
|
||||
|
|
|
@ -74,10 +74,11 @@ return true;
|
|||
}
|
||||
|
||||
|
||||
|
||||
// !! zmienic nazwy
|
||||
// albo w ogole te metody nie sa potrzebne teraz (byly zmiany)
|
||||
void Emacs::PostFunEmacsModifyMountPoint(bool adding)
|
||||
{
|
||||
system->RedirectToLastItem();
|
||||
system->RedirectTo(cur->request->item);
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,7 +90,7 @@ int Emacs::NotifyCodeEdit()
|
|||
// if( system->mounts.pmount->type == system->mounts.MountTypeThread() )
|
||||
// return WINIX_NOTIFY_CODE_THREAD_POST_CHANGED;
|
||||
|
||||
return WINIX_NOTIFY_CODE_FILE_EDIT;
|
||||
return WINIX_NOTIFY_CODE_EDIT;
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,7 +102,7 @@ int Emacs::NotifyCodeAdd()
|
|||
// if( system->mounts.pmount->type == system->mounts.MountTypeThread() )
|
||||
// return WINIX_NOTIFY_CODE_THREAD_REPLAYED;
|
||||
|
||||
return WINIX_NOTIFY_CODE_FILE_ADD;
|
||||
return WINIX_NOTIFY_CODE_ADD;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
</ul>
|
||||
[end]
|
||||
|
||||
|
||||
[if-no thread_mount_arg_is "sort_desc"]
|
||||
<div class="threadbox">
|
||||
[if item_can_write]<a class="threadedit" href="[item_link]/emacs" rel="nofollow">\[{edit}\]</a>[end]
|
||||
|
|
|
@ -268,17 +268,20 @@ uname_header = Uname
|
|||
# notifications
|
||||
notify_new = News
|
||||
notify_change = Changes
|
||||
notify_from = winix notifications <dontreply@winix.org>
|
||||
notify_reply = Reply
|
||||
notify_from_name = winix notifications
|
||||
notify_from_email = dontreply@winix.org
|
||||
notify_content_type = text/plain; charset="UTF-8"
|
||||
notify_header = Welcome
|
||||
notify_msg1 = We would like to inform you that
|
||||
notify_msg2 = someone created a new thread:
|
||||
notify_msg2b = someone created a new ticket:
|
||||
notify_msg3 = someone replayed in a thread:
|
||||
notify_msg3 = someone replied in a thread:
|
||||
notify_msg4 = someone has changed its post:
|
||||
notify_msg5 = a post has been deleted from a thread:
|
||||
notify_msg6 = a new page has been added:
|
||||
notify_msg7 = a page has been modified:
|
||||
notify_msg7b = a ticket has been modified:
|
||||
notify_msg8 = a page has been deleted:
|
||||
notify_msg9 = We invite you to read.
|
||||
notify_msg9b = Have a good day. Bye.
|
||||
|
|
|
@ -269,19 +269,22 @@ uname_header = Nazwa systemu
|
|||
# notifications
|
||||
# subjects should be coded in a special way: http://tools.ietf.org/html/rfc2047
|
||||
# we don't use it at the moment
|
||||
notify_new = Cos nowego
|
||||
notify_new = Coś nowego
|
||||
notify_change = Zmiany
|
||||
notify_from = winix notifications <dontreply@winix.org>
|
||||
notify_reply = Odpowiedź
|
||||
notify_from_name = winix notifications
|
||||
notify_from_email = dontreply@winix.org
|
||||
notify_content_type = text/plain; charset="UTF-8"
|
||||
notify_header = Witamy
|
||||
notify_msg1 = Chcielibyśmy powiadomić że właśnie
|
||||
notify_msg2 = ktoś rozpoczął nowy wątek:
|
||||
notify_msg2b = ktoś rozpoczął nowy ticket:
|
||||
notify_msg2b = ktoś założył nowy ticket:
|
||||
notify_msg3 = ktoś odpowiedział w wątku:
|
||||
notify_msg4 = ktoś zmienił swoją odpowiedź w wątku:
|
||||
notify_msg5 = czyjaś odpowiedź została skasowana z wątku:
|
||||
notify_msg6 = pojawiła się nowa pozycja do poczytania:
|
||||
notify_msg7 = zmieniono coś na:
|
||||
notify_msg7b = zmieniony został ticket:
|
||||
notify_msg8 = skasowano następującą pozycję:
|
||||
notify_msg9 = Życzymy miłego dnia i zapraszamy do lektury.
|
||||
notify_msg9b = ""
|
||||
|
|
|
@ -64,8 +64,7 @@ void Notify::Init()
|
|||
notify_thread.SetPatterns(&patterns);
|
||||
notify_thread.SetSynchro(synchro);
|
||||
|
||||
notify_template_cms = AddTemplate(L"notify_email_cms.txt"); // !! do konfiga
|
||||
notify_template_thread = AddTemplate(L"notify_email_thread.txt");
|
||||
notify_template_cms = AddTemplate(L"notify_email_cms.txt");
|
||||
|
||||
plugin.Call(WINIX_NOTIFY_ADD_TEMPLATE);
|
||||
}
|
||||
|
@ -109,19 +108,9 @@ void Notify::ItemChanged(int notify_code, const Item & item)
|
|||
return;
|
||||
|
||||
msg.code = notify_code;
|
||||
msg.template_index = notify_template_cms;
|
||||
CreateItemLink(item, msg.item_link, msg.dir_link);
|
||||
|
||||
if( msg.code >=0 && msg.code <= WINIX_NOTIFY_CODE_FILE_DELETE )
|
||||
msg.template_index = notify_template_cms;
|
||||
else
|
||||
if( msg.code >= WINIX_NOTIFY_CODE_THREAD_ADD && msg.code <= WINIX_NOTIFY_CODE_THREAD_DELETE )
|
||||
msg.template_index = notify_template_thread;
|
||||
else
|
||||
{
|
||||
log << log1 << "Notify: don't know what to do with this mount point (skipping)" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
ItemChanged(msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ private:
|
|||
NotifyPool notify_pool;
|
||||
|
||||
size_t notify_template_cms;
|
||||
size_t notify_template_thread;
|
||||
|
||||
// templates file names
|
||||
std::vector<std::wstring> templates_names;
|
||||
|
|
|
@ -15,33 +15,16 @@
|
|||
#include "templates/locale.h"
|
||||
|
||||
|
||||
|
||||
#define WINIX_NOTIFY_CODE_DIR_ADD 1
|
||||
#define WINIX_NOTIFY_CODE_DIR_EDIT 2
|
||||
#define WINIX_NOTIFY_CODE_DIR_DELETE 4
|
||||
|
||||
#define WINIX_NOTIFY_CODE_FILE_ADD 8
|
||||
#define WINIX_NOTIFY_CODE_FILE_EDIT 16
|
||||
#define WINIX_NOTIFY_CODE_FILE_DELETE 32
|
||||
|
||||
// new thread has been starded
|
||||
#define WINIX_NOTIFY_CODE_THREAD_ADD 64
|
||||
|
||||
// someone replayed in a thread
|
||||
#define WINIX_NOTIFY_CODE_THREAD_REPLAYED 128
|
||||
|
||||
// someone edited its post
|
||||
#define WINIX_NOTIFY_CODE_THREAD_POST_CHANGED 256
|
||||
|
||||
|
||||
#define WINIX_NOTIFY_CODE_THREAD_DELETE 512
|
||||
#define WINIX_NOTIFY_CODE_ADD 1
|
||||
#define WINIX_NOTIFY_CODE_EDIT 2
|
||||
#define WINIX_NOTIFY_CODE_DELETE 4
|
||||
#define WINIX_NOTIFY_CODE_REPLY 8
|
||||
|
||||
|
||||
|
||||
// additional codes, use it of your own
|
||||
// you should prepare NotifyMsg structure and use it with ItemChanged method of notify object
|
||||
// remember that from this code an appropirate user is selected (db->core->user notify value)
|
||||
// and ezc templates may behave differently
|
||||
/* temporarily not used
|
||||
#define WINIX_NOTIFY_CODE_USER1 1024
|
||||
#define WINIX_NOTIFY_CODE_USER2 2048
|
||||
#define WINIX_NOTIFY_CODE_USER3 4096
|
||||
|
@ -50,7 +33,7 @@
|
|||
#define WINIX_NOTIFY_CODE_USER6 32768
|
||||
#define WINIX_NOTIFY_CODE_USER7 65536
|
||||
#define WINIX_NOTIFY_CODE_USER8 131072
|
||||
|
||||
*/
|
||||
|
||||
|
||||
struct NotifyMsg
|
||||
|
|
|
@ -23,56 +23,44 @@ Ezc::Functions<NotifyStream> ezc_functions;
|
|||
NotifyUserMsg notify_user_msg;
|
||||
NotifyMsg notify_msg;
|
||||
|
||||
// name in qencoding
|
||||
static std::string name_q;
|
||||
static std::string qencode_tmp;
|
||||
|
||||
|
||||
void notify_file_added(Info & i)
|
||||
void fil_qencode(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_ADD) != 0;
|
||||
// QEncode can be used in other threads
|
||||
QEncode(i.in.Str(), qencode_tmp);
|
||||
i.out << qencode_tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void notify_file_edited(Info & i)
|
||||
void notify_add(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_EDIT) != 0;
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_ADD) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void notify_file_deleted(Info & i)
|
||||
void notify_edit(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_FILE_DELETE) != 0;
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_EDIT) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void notify_dir_added(Info & i)
|
||||
void notify_delete(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_DIR_ADD) != 0;
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_DELETE) != 0;
|
||||
}
|
||||
|
||||
|
||||
void notify_thread_added(Info & i)
|
||||
void notify_reply(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_ADD) != 0;
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_REPLY) != 0;
|
||||
}
|
||||
|
||||
|
||||
void notify_thread_replayed(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_REPLAYED) != 0;
|
||||
}
|
||||
|
||||
|
||||
void notify_thread_post_changed(Info & i)
|
||||
{
|
||||
i.res = (notify_msg.code & WINIX_NOTIFY_CODE_THREAD_POST_CHANGED) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void notify_to_email(Info & i)
|
||||
{
|
||||
i.out << notify_user_msg.email;
|
||||
|
@ -81,8 +69,7 @@ void notify_to_email(Info & i)
|
|||
|
||||
void notify_to_name(Info & i)
|
||||
{
|
||||
QEncode(notify_user_msg.name, name_q);
|
||||
i.out << name_q;
|
||||
i.out << notify_user_msg.name;
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,19 +91,17 @@ void CreateFunctions()
|
|||
{
|
||||
ezc_functions.Clear();
|
||||
|
||||
ezc_functions.Insert("notify_file_added", notify_file_added);
|
||||
ezc_functions.Insert("notify_file_edited", notify_file_edited);
|
||||
ezc_functions.Insert("notify_file_deleted", notify_file_deleted);
|
||||
ezc_functions.Insert("notify_dir_added", notify_dir_added);
|
||||
ezc_functions.Insert("fil_qencode", fil_qencode);
|
||||
|
||||
ezc_functions.Insert("notify_thread_added", notify_thread_added);
|
||||
ezc_functions.Insert("notify_thread_replayed", notify_thread_replayed);
|
||||
ezc_functions.Insert("notify_thread_post_changed", notify_thread_post_changed);
|
||||
ezc_functions.Insert("notify_add", notify_add);
|
||||
ezc_functions.Insert("notify_edit", notify_edit);
|
||||
ezc_functions.Insert("notify_delete", notify_delete);
|
||||
ezc_functions.Insert("notify_reply", notify_reply);
|
||||
|
||||
ezc_functions.Insert("notify_to_email", notify_to_email);
|
||||
ezc_functions.Insert("notify_to_name", notify_to_name);
|
||||
ezc_functions.Insert("notify_item_link", notify_item_link);
|
||||
ezc_functions.Insert("notify_dir_link", notify_dir_link);
|
||||
ezc_functions.Insert("notify_to_email", notify_to_email);
|
||||
ezc_functions.Insert("notify_to_name", notify_to_name);
|
||||
ezc_functions.Insert("notify_item_link", notify_item_link);
|
||||
ezc_functions.Insert("notify_dir_link", notify_dir_link);
|
||||
|
||||
plugin.Call(WINIX_NOTIFY_TEMPLATES_CREATEFUNCTIONS, &ezc_functions);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,18 @@ return true;
|
|||
}
|
||||
|
||||
|
||||
void CreateThread::SendNotify(const Item & item)
|
||||
{
|
||||
// sending notification
|
||||
notify_msg.code = WINIX_NOTIFY_CODE_ADD;
|
||||
notify_msg.template_index = thread_info->template_index;
|
||||
notify_msg.dir_link = config->base_url;
|
||||
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
|
||||
notify_msg.item_link = notify_msg.dir_link;
|
||||
notify_msg.item_link += item.url;
|
||||
|
||||
system->notify.ItemChanged(notify_msg);
|
||||
}
|
||||
|
||||
|
||||
void CreateThread::MakePost()
|
||||
|
@ -77,6 +89,7 @@ void CreateThread::MakePost()
|
|||
{
|
||||
log << log2 << "CreateThread: added a new thread" << logend;
|
||||
system->RedirectTo(cur->request->item);
|
||||
SendNotify(cur->request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "functions/functionbase.h"
|
||||
#include "tdb.h"
|
||||
#include "threadinfo.h"
|
||||
#include "notify/notify.h"
|
||||
|
||||
|
||||
namespace Thread
|
||||
|
@ -35,7 +36,9 @@ private:
|
|||
TDb * tdb;
|
||||
ThreadInfo * thread_info;
|
||||
Thread thread;
|
||||
NotifyMsg notify_msg;
|
||||
|
||||
void SendNotify(const Item & item);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -56,6 +56,19 @@ return true;
|
|||
}
|
||||
|
||||
|
||||
void Reply::SendNotify(const Item & item)
|
||||
{
|
||||
// sending notification
|
||||
notify_msg.code = WINIX_NOTIFY_CODE_REPLY;
|
||||
notify_msg.template_index = thread_info->template_index;
|
||||
notify_msg.dir_link = config->base_url;
|
||||
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
|
||||
notify_msg.item_link = notify_msg.dir_link;
|
||||
notify_msg.item_link += item.url;
|
||||
|
||||
system->notify.ItemChanged(notify_msg);
|
||||
}
|
||||
|
||||
|
||||
void Reply::MakePost()
|
||||
{
|
||||
|
@ -93,6 +106,7 @@ void Reply::MakePost()
|
|||
{
|
||||
log << log2 << "Reply: added an answer in a thread" << logend;
|
||||
system->RedirectTo(cur->request->item);
|
||||
SendNotify(cur->request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "functions/functionbase.h"
|
||||
#include "tdb.h"
|
||||
#include "threadinfo.h"
|
||||
#include "notify/notify.h"
|
||||
|
||||
|
||||
|
||||
|
@ -39,7 +40,9 @@ private:
|
|||
Item answer;
|
||||
Thread thread;
|
||||
Item * files_dir;
|
||||
NotifyMsg notify_msg;
|
||||
|
||||
void SendNotify(const Item & item);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void CreateTicket::AddTicket(Ticket & ticket, Item & item)
|
|||
if( cur->request->status == WINIX_ERR_OK )
|
||||
{
|
||||
// sending notification
|
||||
notify_msg.code = WINIX_NOTIFY_CODE_USER1;
|
||||
notify_msg.code = WINIX_NOTIFY_CODE_ADD;
|
||||
notify_msg.template_index = ticket_info->template_index;
|
||||
notify_msg.dir_link = config->base_url;
|
||||
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
|
||||
|
|
|
@ -63,8 +63,8 @@ void EditTicket::ChangeTicket(Ticket & ticket, Item & item)
|
|||
if( cur->request->status == WINIX_ERR_OK )
|
||||
{
|
||||
// sending notification
|
||||
/*
|
||||
notify_msg.code = WINIX_NOTIFY_CODE_USER1;
|
||||
|
||||
notify_msg.code = WINIX_NOTIFY_CODE_EDIT;
|
||||
notify_msg.template_index = ticket_info->template_index;
|
||||
notify_msg.dir_link = config->base_url;
|
||||
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
|
||||
|
@ -72,7 +72,6 @@ void EditTicket::ChangeTicket(Ticket & ticket, Item & item)
|
|||
notify_msg.item_link += item.url;
|
||||
|
||||
system->notify.ItemChanged(notify_msg);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "ticket.h"
|
||||
#include "ticketinfo.h"
|
||||
#include "functions/functionbase.h"
|
||||
#include "notify/notify.h"
|
||||
|
||||
|
||||
|
||||
namespace Ticket
|
||||
|
@ -34,16 +36,17 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
TDb * tdb;
|
||||
TicketInfo * ticket_info;
|
||||
std::wstring old_url;
|
||||
NotifyMsg notify_msg;
|
||||
|
||||
void RemoveTmpTicket();
|
||||
Ticket & PrepareTicket();
|
||||
std::vector<long> & PrepareFileMap();
|
||||
std::wstring old_url;
|
||||
|
||||
void ChangeTicket(Ticket & ticket, Item & item);
|
||||
void Submit(Ticket & ticket, Item & item);
|
||||
|
||||
TDb * tdb;
|
||||
TicketInfo * ticket_info;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -336,8 +336,6 @@ bool exists = false;
|
|||
|
||||
ticket_param.Clear();
|
||||
|
||||
log << log1 << "szukamy dla param_id: " << param_id << logend;
|
||||
|
||||
for(size_t i=0 ; i<cur_conf->tab.size() ; ++i)
|
||||
{
|
||||
if( param_id == cur_conf->tab[i].id )
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
Subject: [if notify_file_added]{notify_new}[else]{notify_change}[end]\n
|
||||
From: {notify_from}\n
|
||||
To: [notify_to_name] <[notify_to_email]>\n
|
||||
Subject: [filter fil_qencode][if notify_add]{notify_new}[else]{notify_change}[end][end]\n
|
||||
From: [filter fil_qencode]{notify_from_name}[end] <{notify_from_email}>\n
|
||||
To: [filter fil_qencode][notify_to_name][end] <[notify_to_email]>\n
|
||||
Content-Type: {notify_content_type}
|
||||
\n\n
|
||||
|
||||
|
||||
{notify_header}
|
||||
\n\n
|
||||
|
||||
{notify_msg1}\s
|
||||
|
||||
[if-one notify_file_added notify_dir_added]
|
||||
|
||||
[if notify_add]
|
||||
{notify_msg6}\n
|
||||
[notify_item_link]\n\n
|
||||
[end]
|
||||
|
||||
[if notify_file_edited]
|
||||
[if notify_edit]
|
||||
{notify_msg7}\n
|
||||
[notify_item_link]\n\n
|
||||
[end]
|
||||
|
||||
[if notify_file_deleted]
|
||||
[if notify_delete]
|
||||
{notify_msg8}\n
|
||||
[notify_item_link]\n\n
|
||||
[end]
|
||||
|
|
|
@ -1,34 +1,23 @@
|
|||
Subject: [if notify_thread_added]{notify_new}[else]{notify_change}[end]\n
|
||||
From: {notify_from}\n
|
||||
To: [notify_to_name] <[notify_to_email]>\n
|
||||
Subject: [filter fil_qencode][if notify_add]{notify_new}[else]{notify_reply}[end][end]\n
|
||||
From: [filter fil_qencode]{notify_from_name}[end] <{notify_from_email}>\n
|
||||
To: [filter fil_qencode][notify_to_name][end] <[notify_to_email]>\n
|
||||
Content-Type: {notify_content_type}
|
||||
\n\n
|
||||
|
||||
|
||||
{notify_header}
|
||||
\n\n
|
||||
|
||||
{notify_msg1}\s
|
||||
|
||||
|
||||
[if notify_thread_added]
|
||||
[if notify_add]
|
||||
{notify_msg2}\n
|
||||
[notify_dir_link]\n\n
|
||||
[end]
|
||||
|
||||
[if notify_thread_replayed]
|
||||
{notify_msg3}\n
|
||||
[notify_dir_link]\n\n
|
||||
[end]
|
||||
|
||||
[if notify_thread_post_changed]
|
||||
{notify_msg4}\n
|
||||
[notify_item_link]\n\n
|
||||
|
||||
[# dodac drugi link typu: caly watek i adres url]
|
||||
[end]
|
||||
|
||||
[# tu bedzie jakos inaczej]
|
||||
[if notify_file_deleted]
|
||||
{notify_msg5}\n
|
||||
[if notify_reply]
|
||||
{notify_msg3}\n
|
||||
[notify_item_link]\n\n
|
||||
[end]
|
||||
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
Subject: {notify_new}\n
|
||||
From: {notify_from}\n
|
||||
To: [notify_to_name] <[notify_to_email]>\n
|
||||
Subject: [filter fil_qencode][if notify_add]{notify_new}[else]{notify_change}[end][end]\n
|
||||
From: [filter fil_qencode]{notify_from_name}[end] <{notify_from_email}>\n
|
||||
To: [filter fil_qencode][notify_to_name][end] <[notify_to_email]>\n
|
||||
Content-Type: {notify_content_type}
|
||||
\n\n
|
||||
|
||||
|
||||
{notify_header}
|
||||
\n\n
|
||||
|
||||
{notify_msg1}\s
|
||||
|
||||
{notify_msg2b}\n
|
||||
[notify_item_link]\n\n
|
||||
|
||||
[if notify_add]
|
||||
{notify_msg2b}\n
|
||||
[notify_item_link]\n\n
|
||||
[end]
|
||||
|
||||
[if notify_edit]
|
||||
{notify_msg7b}\n
|
||||
[notify_item_link]\n\n
|
||||
[end]
|
||||
|
||||
|
||||
{notify_msg9}\n
|
||||
|
|
Loading…
Reference in New Issue