Files
winix/templatesnotify/templatesnotify.cpp
Tomasz Sowa 89daf6489d added: issues ticket system
added functions: ticket, createticket, editticket
         (there is no 'rm' function working for tickets yet)
changed: mount parser and mount points
         now we have more parameters (arguments in parameters)
some refactoring in functions 'emacs' and 'mkdir'



git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@554 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-01-25 04:52:17 +00:00

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_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);
}
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();
}