changed: notification's template

added: notifications in tickets


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@650 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2010-09-07 23:54:01 +00:00
parent 81dd88d25a
commit f48f08a98b
14 changed files with 109 additions and 60 deletions

View File

@ -68,7 +68,11 @@ db_itemcolumns.o: dircontainer.h ugcontainer.h ticket.h
dircontainer.o: dircontainer.h item.h log.h
dirs.o: dirs.h item.h dircontainer.h db.h user.h group.h thread.h error.h
dirs.o: log.h ugcontainer.h ticket.h request.h requesttypes.h session.h
dirs.o: plugindata.h rebus.h config.h confparser.h htmlfilter.h
dirs.o: plugindata.h rebus.h config.h confparser.h htmlfilter.h notify.h
dirs.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
dirs.o: ../core/mount.h ../core/locale.h ../core/config.h ../templates/misc.h
dirs.o: ../templates/localefilter.h ../core/locale.h system.h mounts.h
dirs.o: mount.h users.h lastcontainer.h groups.h loadavg.h
groups.o: groups.h group.h ugcontainer.h log.h db.h item.h user.h thread.h
groups.o: error.h dircontainer.h ticket.h
htmlfilter.o: htmlfilter.h

View File

@ -10,6 +10,7 @@
#include "dirs.h"
#include "error.h"
#include "log.h"
#include "notify.h"
@ -418,6 +419,7 @@ Error Dirs::AddDirectory(Item & item, bool add_to_dir_tab)
if( status == WINIX_ERR_OK )
{
request->notify_code |= WINIX_NOTIFY_DIR_ADD;
Item * pdir = AddDir(item);
if( add_to_dir_tab && request->dir_tab.back()->id == item.parent_id )

View File

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa
* Copyright (c) 2009-2010, Tomasz Sowa
* All rights reserved.
*
*/

View File

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2009, Tomasz Sowa
* Copyright (c) 2009-2010, Tomasz Sowa
* All rights reserved.
*
*/

View File

@ -108,7 +108,7 @@ void Notify::SendEmail(const std::string & email, const std::string & message)
if( !ValidateEmail(email) )
{
nlog << "Notify: email: " << email << " is not correct" << logend;
nlog << log1 << "Notify: email: " << email << " is not correct" << logend;
return;
}
@ -117,14 +117,14 @@ void Notify::SendEmail(const std::string & email, const std::string & message)
if( !sendmail )
{
nlog << "Notify: can't run sendmail" << logend;
nlog << log1 << "Notify: can't run sendmail" << logend;
return;
}
SendMessage(sendmail, message);
pclose(sendmail);
nlog << "Notify: email to: " << email << " has been sent" << logend;
nlog << log1 << "Notify: email to: " << email << " has been sent" << logend;
nlog << logsave;
}
@ -252,7 +252,7 @@ Users::Iterator i;
{
sending = false;
if( system->mounts.pmount->type == Mount::thread )
if( system->mounts.pmount->type == Mount::thread || system->mounts.pmount->type == Mount::ticket )
{
if( (i->thread_notify & notify_code) != 0 )
sending = true;

View File

@ -93,6 +93,12 @@ void CreateTicket::AddTicket()
functions->fun_ticket.ticket.item_id = request->item.id; // this id is set by PostFunEmacsAdd()
request->status = db->AddTicket(functions->fun_ticket.ticket);
if( request->status == WINIX_ERR_OK )
{
}
}

View File

@ -9,7 +9,6 @@
#include "emacs.h"
#include "templates/templates.h"
#include "core/notify.h"
#include "functions.h"
@ -46,12 +45,7 @@ return false;
bool Emacs::HasAccess()
{
if( !request->is_item )
return HasAccess(*request->dir_tab.back()); // adding a new item
else
return HasAccess(request->item); // editing an existing item
return true;
return HasAccess(*request->last_item);
}

View File

@ -9,7 +9,6 @@
#include "mkdir.h"
#include "functions.h"
#include "core/notify.h"
@ -69,7 +68,6 @@ void Mkdir::PostFunMkdir(bool add_to_dir_tab, int privileges)
if( request->status == WINIX_ERR_OK )
{
request->notify_code |= WINIX_NOTIFY_DIR_ADD;
system->RedirectTo(request->item);
}
else

View File

@ -1,46 +1,70 @@
Subject: [if-one notify_item_added]{notify_new}[else]{notify_change}[end]
From: {notify_from}
To: [notify_to]
Subject: [if notify_item_added]{notify_new}[else]{notify_change}[end]\n
From: {notify_from}\n
To: [notify_to]\n
Content-Type: {notify_content_type}
\n\n
{notify_header}
\n\n
{notify_msg1}[if-one notify_mount_type_is_thread]
{notify_msg1}\s
[if-one notify_mount_type_is_thread notify_mount_type_is_ticket]
[if-one notify_dir_added] {notify_msg2}
[notify_doc_base_url][notify_item_dir]
[else]
[if-one notify_item_added] {notify_msg3}
[notify_doc_base_url][notify_item_dir]
[end]
[end]
[if-one notify_item_edited] {notify_msg4}
[notify_doc_base_url][notify_item_dir]
[end]
[if-one notify_item_deleted] {notify_msg5}
[notify_doc_base_url][notify_item_dir]
[end]
[if notify_dir_added]
[if notify_mount_type_is_thread]
{notify_msg2}\n
[else]
{notify_msg2b}\n
[end]
[notify_doc_base_url][notify_item_dir]\n\n
[else]
[if notify_item_added]
[if notify_mount_type_is_thread]
{notify_msg3}\n
[else]
{notify_msg3b}\n
[end]
[notify_doc_base_url][notify_item_dir]\n\n
[end]
[end]
[if notify_item_edited]
{notify_msg4}\n
[notify_doc_base_url][notify_item_dir]\n\n
[end]
[if notify_item_deleted]
{notify_msg5}\n
[notify_doc_base_url][notify_item_dir]\n\n
[end]
[else]
[if-one notify_mount_type_is_cms]
[if-one notify_item_added] {notify_msg6}
[notify_item_link]
[if notify_mount_type_is_cms]
[if-one notify_item_added notify_dir_added]
{notify_msg6}\n
[notify_item_link]\n\n
[end]
[if notify_item_edited]
{notify_msg7}\n
[notify_item_link]\n\n
[end]
[if notify_item_deleted]
{notify_msg8}\n
[notify_item_link]\n\n
[end]
[end]
[end]
[if-one notify_item_edited] {notify_msg7}
[notify_item_link]
[end]
[if-one notify_item_deleted] {notify_msg8}
[notify_item_link]
[end]
[end]
[end]
{notify_msg9}
{notify_footer}
{notify_msg9}\n
{notify_msg9b}\n
\n
-- \n
{notify_footer1}\n
{notify_footer2}\n
{notify_footer3}\n
{notify_footer4}\n

View File

@ -230,19 +230,25 @@ uname_header = Uname
# notifications
notify_new = News
notify_change = Changes
notify_from = ttmath.org notifications <dontreply@ttmath.org>
notify_from = winix notifications <dontreply@winix.org>
notify_content_type = text/plain; charset="ISO-8859-1"
notify_header = Welcome
notify_msg1 = We would like to inform you that
notify_msg2 = someone started a new thread:
notify_msg2 = someone created a new thread:
notify_msg2b = someone created a new ticket:
notify_msg3 = someone replayed in a thread:
notify_msg3b = someone replayed in a ticket:
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_msg8 = a page has been deleted:
notify_msg9 = We invite you to read.\nHave a good day. Bye.
notify_footer = \n\n-- \nhttp://www.ttmath.org\nThis message has been sent automatically - do not answer please.\nIf you do not want to receive such messages you can switch them off\nin your user control panel.
notify_msg9 = We invite you to read.
notify_msg9b = Have a good day. Bye.
notify_footer1 = http://www.winix.org
notify_footer2 = This message has been sent automatically - do not answer please.
notify_footer3 = If you do not want to receive such messages you can switch them off
notify_footer4 = in your user control panel.
# errors
winix_err_default = An error occured, error code:

View File

@ -234,19 +234,25 @@ uname_header = Nazwa systemu
# notifications
notify_new = Coś nowego
notify_change = Zmiany
notify_from = Ślimaczkowe powiadomienia <dontreply@slimaczek.pl>
notify_from = winix notifications <dontreply@winix.org>
notify_content_type = text/plain; charset="ISO-8859-2"
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_msg3 = ktoś odpowiedział w wątku:
notify_msg3b = ktoś odpowiedział w tickecie:
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_msg8 = skasowano następującą pozycję:
notify_msg9 = Życzymy miłego dnia i zapraszamy do lektury.
notify_footer = \n\n-- \nhttp://www.slimaczek.pl\nTa wiadomość została wysłana automatycznie - prosimy na nią nie odpowiadać.\nJeśli nie chcesz dostawać więcej takich wiadomości możesz je wyłączyć\nw swoim panelu użytkownika.
notify_msg9b = ""
notify_footer1 = http://www.winix.org
notify_footer2 = Ta wiadomość została wysłana automatycznie - prosimy na nią nie odpowiadać.
notify_footer3 = Jeśli nie chcesz dostawać więcej takich wiadomości możesz je wyłączyć
notify_footer4 = w swoim panelu użytkownika.
# errors

View File

@ -55,6 +55,10 @@ void notify_mount_type_is_thread(Info & i)
i.res = notify_msg->current_mount_type == Mount::thread;
}
void notify_mount_type_is_ticket(Info & i)
{
i.res = notify_msg->current_mount_type == Mount::ticket;
}
void notify_mount_type_is_cms(Info & i)
{

View File

@ -55,6 +55,7 @@ using namespace TemplatesNotifyFunctions;
ezc_functions.Insert("notify_dir_added", notify_dir_added);
ezc_functions.Insert("notify_to", notify_to);
ezc_functions.Insert("notify_mount_type_is_thread", notify_mount_type_is_thread);
ezc_functions.Insert("notify_mount_type_is_ticket", notify_mount_type_is_ticket);
ezc_functions.Insert("notify_mount_type_is_cms", notify_mount_type_is_cms);
ezc_functions.Insert("notify_doc_base_url", notify_doc_base_url);
ezc_functions.Insert("notify_item_dir", notify_item_dir);
@ -112,6 +113,9 @@ using namespace TemplatesNotifyFunctions;
}
Ezc::Generator generator(notify_str, patterns[lang][pat_email_notify], ezc_functions);
generator.RecognizeSpecialChars(true);
generator.TrimWhite(true);
generator.SkipNewLine(true);
generator.Generate();
}

View File

@ -56,6 +56,7 @@ namespace TemplatesNotifyFunctions
void notify_dir_added(Info & i);
void notify_to(Info & i);
void notify_mount_type_is_thread(Info & i);
void notify_mount_type_is_ticket(Info & i);
void notify_mount_type_is_cms(Info & i);
void notify_doc_base_url(Info & i);
void notify_item_dir(Info & i);