2009-10-01 00:31:20 +02:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2009-10-01 00:31:20 +02:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2010-02-28 22:33:06 +01:00
|
|
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
2009-10-01 00:31:20 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef headerfilecmslutemplatestemplatesnotify
|
|
|
|
#define headerfilecmslutemplatestemplatesnotify
|
|
|
|
|
|
|
|
#include <iomanip>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
2009-11-13 21:40:11 +01:00
|
|
|
#include "ezc.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "core/mount.h"
|
|
|
|
#include "core/config.h"
|
2010-11-21 01:19:17 +01:00
|
|
|
#include "core/textstream.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "templates/misc.h"
|
|
|
|
|
2009-10-01 00:31:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
struct NotifyMsg
|
|
|
|
{
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring email;
|
2009-10-01 00:31:20 +02:00
|
|
|
int notify_code;
|
2010-09-13 01:33:27 +02:00
|
|
|
int current_mount_type;
|
2010-01-28 16:39:01 +01:00
|
|
|
Locale::Lang lang;
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring doc_base_url;
|
|
|
|
std::wstring item_dir;
|
|
|
|
std::wstring item_link;
|
2009-10-01 00:31:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
namespace TemplatesNotifyFunctions
|
|
|
|
{
|
2010-09-13 01:33:27 +02:00
|
|
|
extern int mount_type_cms;
|
|
|
|
extern int mount_type_thread;
|
|
|
|
extern int mount_type_ticket;
|
|
|
|
|
added: uptime winix function prints how many sessions there are
changed: functions for text/numbers conversions
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
added: HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
this is a special stream for automatically escaping html tags
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
2010-11-25 02:34:46 +01:00
|
|
|
typedef Ezc::FunInfo<TextStream<std::wstring> > Info;
|
2009-10-01 00:31:20 +02:00
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
enum Pat {
|
|
|
|
pat_email_notify = 0, // first should be zero
|
|
|
|
|
|
|
|
pat_last // should be last
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<std::vector<Ezc::Pattern> > Patterns;
|
|
|
|
|
2010-07-04 22:27:14 +02:00
|
|
|
extern Patterns patterns;
|
2009-10-01 00:31:20 +02:00
|
|
|
extern NotifyMsg * notify_msg;
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
extern Config * config;
|
|
|
|
|
2009-10-01 00:31:20 +02:00
|
|
|
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);
|
2010-01-25 05:52:17 +01:00
|
|
|
void notify_mount_type_is_thread(Info & i);
|
2010-09-08 01:54:01 +02:00
|
|
|
void notify_mount_type_is_ticket(Info & i);
|
2010-01-25 05:52:17 +01:00
|
|
|
void notify_mount_type_is_cms(Info & i);
|
2009-10-01 00:31:20 +02:00
|
|
|
void notify_doc_base_url(Info & i);
|
|
|
|
void notify_item_dir(Info & i);
|
|
|
|
void notify_item_link(Info & i);
|
|
|
|
|
|
|
|
} // namespace TemplatesNotifyFunctions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TemplatesNotify
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
TemplatesNotify();
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
void SetConfig(Config * pconfig);
|
2010-09-13 01:33:27 +02:00
|
|
|
void SetMountTypes(int mcms, int mthread, int mticket);
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
void Read();
|
|
|
|
void CreateFunctions();
|
|
|
|
void Generate(Locale::Lang lang);
|
2009-10-01 00:31:20 +02:00
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
TextStream<std::wstring> notify_str;
|
2009-10-01 00:31:20 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2010-01-28 16:39:01 +01:00
|
|
|
void Read(TemplatesNotifyFunctions::Pat pat, const std::string & dir, const char * file);
|
|
|
|
void Read(TemplatesNotifyFunctions::Pat pat, const char * file);
|
|
|
|
void ClearPatterns();
|
2009-10-01 00:31:20 +02:00
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring temp;
|
2009-10-01 00:31:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|