101 lines
1.9 KiB
C++
Executable File
101 lines
1.9 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfilecmslutemplatestemplatesnotify
|
|
#define headerfilecmslutemplatestemplatesnotify
|
|
|
|
#include <iomanip>
|
|
#include <set>
|
|
#include <string>
|
|
#include "ezc.h"
|
|
#include "core/mount.h"
|
|
#include "core/config.h"
|
|
#include "core/textstream.h"
|
|
#include "templates/misc.h"
|
|
|
|
|
|
|
|
struct NotifyMsg
|
|
{
|
|
std::wstring email;
|
|
int notify_code;
|
|
int current_mount_type;
|
|
Locale::Lang lang;
|
|
std::wstring doc_base_url;
|
|
std::wstring item_dir;
|
|
std::wstring item_link;
|
|
};
|
|
|
|
|
|
namespace TemplatesNotifyFunctions
|
|
{
|
|
extern int mount_type_cms;
|
|
extern int mount_type_thread;
|
|
extern int mount_type_ticket;
|
|
|
|
typedef Ezc::FunInfo<TextStream<std::wstring> > Info;
|
|
|
|
enum Pat {
|
|
pat_email_notify = 0, // first should be zero
|
|
|
|
pat_last // should be last
|
|
};
|
|
|
|
typedef std::vector<std::vector<Ezc::Pattern> > Patterns;
|
|
|
|
extern Patterns patterns;
|
|
extern NotifyMsg * notify_msg;
|
|
|
|
extern Config * config;
|
|
|
|
void notify_item_added(Info & i);
|
|
void notify_item_edited(Info & i);
|
|
void notify_item_deleted(Info & i);
|
|
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);
|
|
void notify_item_link(Info & i);
|
|
|
|
} // namespace TemplatesNotifyFunctions
|
|
|
|
|
|
|
|
|
|
class TemplatesNotify
|
|
{
|
|
public:
|
|
|
|
TemplatesNotify();
|
|
|
|
void SetConfig(Config * pconfig);
|
|
void SetMountTypes(int mcms, int mthread, int mticket);
|
|
|
|
void Read();
|
|
void CreateFunctions();
|
|
void Generate(Locale::Lang lang);
|
|
|
|
TextStream<std::wstring> notify_str;
|
|
|
|
private:
|
|
|
|
void Read(TemplatesNotifyFunctions::Pat pat, const std::string & dir, const char * file);
|
|
void Read(TemplatesNotifyFunctions::Pat pat, const char * file);
|
|
void ClearPatterns();
|
|
|
|
std::wstring temp;
|
|
};
|
|
|
|
|
|
|
|
#endif
|