the first part of reimplementing has been done
now we have app object and singletons are only: log logn plugin and app git-svn-id: svn://ttmath.org/publicrep/winix/trunk@628 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -8,10 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "templatesnotify.h"
|
||||
#include "../core/misc.h"
|
||||
#include "../core/locale.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/log.h"
|
||||
#include "core/misc.h"
|
||||
#include "core/locale.h"
|
||||
#include "core/log.h"
|
||||
|
||||
|
||||
|
||||
@@ -20,10 +19,11 @@ namespace TemplatesNotifyFunctions
|
||||
{
|
||||
|
||||
Patterns patterns;
|
||||
Ezc::Functions functions;
|
||||
Ezc::Functions ezc_functions;
|
||||
Locale locale;
|
||||
LocaleFilter locale_filter;
|
||||
|
||||
Config * config;
|
||||
|
||||
|
||||
// you can use this pointer in template functions (will be always valid)
|
||||
@@ -35,24 +35,30 @@ NotifyMsg * notify_msg;
|
||||
|
||||
|
||||
|
||||
void TemplatesNotify::SetConfig(Config * pconfig)
|
||||
{
|
||||
TemplatesNotifyFunctions::config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TemplatesNotify::CreateFunctions()
|
||||
{
|
||||
using namespace TemplatesNotifyFunctions;
|
||||
|
||||
functions.Clear();
|
||||
ezc_functions.Clear();
|
||||
|
||||
functions.Insert("notify_item_added", notify_item_added);
|
||||
functions.Insert("notify_item_edited", notify_item_edited);
|
||||
functions.Insert("notify_item_deleted", notify_item_deleted);
|
||||
functions.Insert("notify_dir_added", notify_dir_added);
|
||||
functions.Insert("notify_to", notify_to);
|
||||
functions.Insert("notify_mount_type_is_thread", notify_mount_type_is_thread);
|
||||
functions.Insert("notify_mount_type_is_cms", notify_mount_type_is_cms);
|
||||
functions.Insert("notify_doc_base_url", notify_doc_base_url);
|
||||
functions.Insert("notify_item_dir", notify_item_dir);
|
||||
functions.Insert("notify_item_link", notify_item_link);
|
||||
ezc_functions.Insert("notify_item_added", notify_item_added);
|
||||
ezc_functions.Insert("notify_item_edited", notify_item_edited);
|
||||
ezc_functions.Insert("notify_item_deleted", notify_item_deleted);
|
||||
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_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);
|
||||
ezc_functions.Insert("notify_item_link", notify_item_link);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +80,7 @@ void TemplatesNotify::Read()
|
||||
{
|
||||
using namespace TemplatesNotifyFunctions;
|
||||
|
||||
Locale::Lang lang = Locale::StrToLang(data.locale_str);
|
||||
Locale::Lang lang = Locale::StrToLang(config->locale_str);
|
||||
|
||||
if( lang != Locale::lang_unknown )
|
||||
locale.SetLang(lang);
|
||||
@@ -82,7 +88,7 @@ using namespace TemplatesNotifyFunctions;
|
||||
locale.SetLang(Locale::lang_en);
|
||||
|
||||
ClearPatterns();
|
||||
locale.Read(data.locale_dir, data.locale_dir_default);
|
||||
locale.Read(config->locale_dir, config->locale_dir_default);
|
||||
TemplatesFunctions::Read(patterns, pat_email_notify, locale, locale_filter, "notify_email.txt", true);
|
||||
|
||||
notify_msg = 0;
|
||||
@@ -105,7 +111,7 @@ using namespace TemplatesNotifyFunctions;
|
||||
return;
|
||||
}
|
||||
|
||||
Ezc::Generator generator(notify_str, patterns[lang][pat_email_notify], functions);
|
||||
Ezc::Generator generator(notify_str, patterns[lang][pat_email_notify], ezc_functions);
|
||||
generator.Generate();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user