diff --git a/core/Makefile.dep b/core/Makefile.dep index 58b207f..9d1cd32 100755 --- a/core/Makefile.dep +++ b/core/Makefile.dep @@ -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 diff --git a/core/dirs.cpp b/core/dirs.cpp index e30fbea..e3e4628 100755 --- a/core/dirs.cpp +++ b/core/dirs.cpp @@ -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 ) diff --git a/core/mount.cpp b/core/mount.cpp index 4e79432..9b21277 100755 --- a/core/mount.cpp +++ b/core/mount.cpp @@ -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. * */ diff --git a/core/mount.h b/core/mount.h index 34a8b10..d266165 100755 --- a/core/mount.h +++ b/core/mount.h @@ -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. * */ diff --git a/core/notify.cpp b/core/notify.cpp index ff4cea5..af935fb 100755 --- a/core/notify.cpp +++ b/core/notify.cpp @@ -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; diff --git a/functions/createticket.cpp b/functions/createticket.cpp index 31af555..5b890df 100755 --- a/functions/createticket.cpp +++ b/functions/createticket.cpp @@ -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 ) + { + + } + } diff --git a/functions/emacs.cpp b/functions/emacs.cpp index 264e4f3..25f0ef4 100755 --- a/functions/emacs.cpp +++ b/functions/emacs.cpp @@ -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); } diff --git a/functions/mkdir.cpp b/functions/mkdir.cpp index 98b3105..fe66d37 100755 --- a/functions/mkdir.cpp +++ b/functions/mkdir.cpp @@ -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 diff --git a/html/notify_email.txt b/html/notify_email.txt index 455fd53..0008981 100755 --- a/html/notify_email.txt +++ b/html/notify_email.txt @@ -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 diff --git a/locale/en b/locale/en index c04083d..466efe6 100755 --- a/locale/en +++ b/locale/en @@ -230,19 +230,25 @@ uname_header = Uname # notifications notify_new = News notify_change = Changes -notify_from = ttmath.org notifications +notify_from = winix notifications 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: diff --git a/locale/pl b/locale/pl index d32b448..892072e 100755 --- a/locale/pl +++ b/locale/pl @@ -234,19 +234,25 @@ uname_header = Nazwa systemu # notifications notify_new = Coś nowego notify_change = Zmiany -notify_from = Ślimaczkowe powiadomienia +notify_from = winix notifications 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 diff --git a/templatesnotify/notify.cpp b/templatesnotify/notify.cpp index 0d01c12..f8e49e9 100755 --- a/templatesnotify/notify.cpp +++ b/templatesnotify/notify.cpp @@ -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) { diff --git a/templatesnotify/templatesnotify.cpp b/templatesnotify/templatesnotify.cpp index d70573c..54aaacb 100755 --- a/templatesnotify/templatesnotify.cpp +++ b/templatesnotify/templatesnotify.cpp @@ -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(); } diff --git a/templatesnotify/templatesnotify.h b/templatesnotify/templatesnotify.h index 0b2c582..8fe2cc2 100755 --- a/templatesnotify/templatesnotify.h +++ b/templatesnotify/templatesnotify.h @@ -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);