Files
winix/templatesnotify/templatesnotify.cpp
Tomasz Sowa 85b678a8fb added: notifications to users' emails
(core/notify.h core/notify.cpp)
       templatesnotify directory
       all notifications are managed by a second thread


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@512 e52654a7-88a9-db11-a3e9-0013d4bc506e
2009-09-30 22:31:20 +00:00

82 lines
1.7 KiB
C++
Executable File

/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
* All rights reserved.
*
*/
#include "templatesnotify.h"
#include "../core/misc.h"
namespace TemplatesNotifyFunctions
{
Ezc::Pattern pat_notify_email;
Ezc::Functions functions;
// you can use this pointer in template functions (will be always valid)
NotifyMsg * notify_msg;
} // namespace TemplatesNotifyFunctions
void TemplatesNotify::CreateFunctions()
{
using namespace TemplatesNotifyFunctions;
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_is_thread", notify_mount_is_thread);
functions.Insert("notify_mount_is_cms", notify_mount_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);
}
void TemplatesNotify::Read(const std::string & templates_dir)
{
using namespace TemplatesNotifyFunctions;
pat_notify_email.Directory(templates_dir);
pat_notify_email.ParseFile("notify_email.txt");
CreateFunctions();
notify_msg = 0;
}
void TemplatesNotify::Generate()
{
using namespace TemplatesNotifyFunctions;
notify_str.str("");
if( !notify_msg )
return;
Ezc::Generator generator(notify_str, pat_notify_email, functions);
generator.Generate();
}