83 lines
1.7 KiB
C++
Executable File
83 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.delete_all_white = true;
|
|
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();
|
|
}
|
|
|
|
|