db: core/user table has only 'notify' column now (previous was cms_notify, thread_notify)

added: notifications for tickets (not finished yet)


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@688 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-12-06 00:25:46 +00:00
parent b721fb6860
commit ad9d6f4301
29 changed files with 432 additions and 269 deletions

View File

@@ -30,7 +30,7 @@ createticket.o: ../../core/ugcontainer.h ../../core/lastcontainer.h
createticket.o: ../../core/mounts.h ../../core/mount.h
createticket.o: ../../core/mountparser.h ../../core/users.h
createticket.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
createticket.o: ticketinfo.h ticketparser.h ticketconf.h
createticket.o: ../../core/synchro.h ticketinfo.h ticketparser.h ticketconf.h
createticket.o: ../../functions/functions.h ../../functions/functionbase.h
createticket.o: ../../functions/functionparser.h ../../functions/adduser.h
createticket.o: ../../functions/cat.h ../../functions/chmod.h
@@ -78,24 +78,25 @@ editticket.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
editticket.o: ../../functions/functionbase.h ../../core/request.h
editticket.o: ../../core/requesttypes.h ../../core/session.h
editticket.o: ../../core/plugindata.h ../../templates/htmltextstream.h
editticket.o: ../../functions/functions.h ../../functions/functionbase.h
editticket.o: ../../functions/functionparser.h ../../functions/adduser.h
editticket.o: ../../functions/cat.h ../../functions/chmod.h
editticket.o: ../../functions/privchanger.h ../../functions/chown.h
editticket.o: ../../functions/ckeditor.h ../../functions/cp.h
editticket.o: ../../functions/createthread.h ../../functions/default.h
editticket.o: ../../functions/download.h ../../functions/emacs.h
editticket.o: ../../functions/last.h ../../functions/login.h
editticket.o: ../../functions/logout.h ../../functions/ls.h
editticket.o: ../../functions/mkdir.h ../../functions/mv.h
editticket.o: ../../functions/node.h ../../functions/priv.h
editticket.o: ../../functions/reload.h ../../functions/rm.h
editticket.o: ../../functions/run.h ../../functions/stat.h
editticket.o: ../../functions/subject.h ../../functions/funthread.h
editticket.o: ../../functions/template.h ../../functions/tinymce.h
editticket.o: ../../functions/uname.h ../../functions/upload.h
editticket.o: ../../functions/uptime.h ../../functions/who.h
editticket.o: ../../functions/vim.h ../../core/htmlfilter.h
editticket.o: ../../core/synchro.h ../../functions/functions.h
editticket.o: ../../functions/functionbase.h ../../functions/functionparser.h
editticket.o: ../../functions/adduser.h ../../functions/cat.h
editticket.o: ../../functions/chmod.h ../../functions/privchanger.h
editticket.o: ../../functions/chown.h ../../functions/ckeditor.h
editticket.o: ../../functions/cp.h ../../functions/createthread.h
editticket.o: ../../functions/default.h ../../functions/download.h
editticket.o: ../../functions/emacs.h ../../functions/last.h
editticket.o: ../../functions/login.h ../../functions/logout.h
editticket.o: ../../functions/ls.h ../../functions/mkdir.h
editticket.o: ../../functions/mv.h ../../functions/node.h
editticket.o: ../../functions/priv.h ../../functions/reload.h
editticket.o: ../../functions/rm.h ../../functions/run.h
editticket.o: ../../functions/stat.h ../../functions/subject.h
editticket.o: ../../functions/funthread.h ../../functions/template.h
editticket.o: ../../functions/tinymce.h ../../functions/uname.h
editticket.o: ../../functions/upload.h ../../functions/uptime.h
editticket.o: ../../functions/who.h ../../functions/vim.h
editticket.o: ../../core/htmlfilter.h
funticket.o: funticket.h tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
funticket.o: ../../db/dbtextstream.h ../../core/textstream.h
funticket.o: ../../core/misc.h ../../core/item.h ../../core/error.h
@@ -125,7 +126,7 @@ funticket.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
funticket.o: ../../functions/functionbase.h ../../core/request.h
funticket.o: ../../core/requesttypes.h ../../core/session.h
funticket.o: ../../core/plugindata.h ../../templates/htmltextstream.h
funticket.o: ../../core/misc.h
funticket.o: ../../core/synchro.h ../../core/misc.h
init.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
init.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/misc.h
init.o: ../../core/item.h ../../core/error.h ../../core/log.h
@@ -152,9 +153,9 @@ init.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h
init.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
init.o: ../../functions/functionbase.h ../../core/request.h
init.o: ../../core/requesttypes.h ../../core/session.h
init.o: ../../core/plugindata.h ../../templates/htmltextstream.h editticket.h
init.o: createticket.h ../../core/log.h ../../core/plugin.h
init.o: ../../core/pluginmsg.h ../../core/system.h
init.o: ../../core/plugindata.h ../../templates/htmltextstream.h
init.o: ../../core/synchro.h editticket.h createticket.h ../../core/log.h
init.o: ../../core/plugin.h ../../core/pluginmsg.h ../../core/system.h
init.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
init.o: ../../functions/functions.h ../../functions/functionbase.h
init.o: ../../functions/functionparser.h ../../functions/adduser.h
@@ -208,29 +209,29 @@ templates.o: ../../db/dbbase.h ../../db/dbconn.h ../../db/dbtextstream.h
templates.o: ../../core/error.h editticket.h ../../functions/functionbase.h
templates.o: ../../core/request.h ../../core/requesttypes.h
templates.o: ../../core/session.h ../../core/plugindata.h
templates.o: ../../templates/htmltextstream.h createticket.h
templates.o: ../../core/misc.h ../../core/plugin.h ../../core/pluginmsg.h
templates.o: ../../core/system.h ../../core/sessionmanager.h
templates.o: ../../core/sessioncontainer.h ../../functions/functions.h
templates.o: ../../functions/functionbase.h ../../functions/functionparser.h
templates.o: ../../functions/adduser.h ../../functions/cat.h
templates.o: ../../functions/chmod.h ../../functions/privchanger.h
templates.o: ../../functions/chown.h ../../functions/ckeditor.h
templates.o: ../../functions/cp.h ../../functions/createthread.h
templates.o: ../../functions/default.h ../../functions/download.h
templates.o: ../../functions/emacs.h ../../functions/last.h
templates.o: ../../functions/login.h ../../functions/logout.h
templates.o: ../../functions/ls.h ../../functions/mkdir.h
templates.o: ../../functions/mv.h ../../functions/node.h
templates.o: ../../functions/priv.h ../../functions/reload.h
templates.o: ../../functions/rm.h ../../functions/run.h
templates.o: ../../functions/stat.h ../../functions/subject.h
templates.o: ../../functions/funthread.h ../../functions/template.h
templates.o: ../../functions/tinymce.h ../../functions/uname.h
templates.o: ../../functions/upload.h ../../functions/uptime.h
templates.o: ../../functions/who.h ../../functions/vim.h
templates.o: ../../core/htmlfilter.h ../../templates/templates.h
templates.o: ../../templates/patterncacher.h
templates.o: ../../templates/htmltextstream.h ../../core/synchro.h
templates.o: createticket.h ../../core/misc.h ../../core/plugin.h
templates.o: ../../core/pluginmsg.h ../../core/system.h
templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
templates.o: ../../functions/functions.h ../../functions/functionbase.h
templates.o: ../../functions/functionparser.h ../../functions/adduser.h
templates.o: ../../functions/cat.h ../../functions/chmod.h
templates.o: ../../functions/privchanger.h ../../functions/chown.h
templates.o: ../../functions/ckeditor.h ../../functions/cp.h
templates.o: ../../functions/createthread.h ../../functions/default.h
templates.o: ../../functions/download.h ../../functions/emacs.h
templates.o: ../../functions/last.h ../../functions/login.h
templates.o: ../../functions/logout.h ../../functions/ls.h
templates.o: ../../functions/mkdir.h ../../functions/mv.h
templates.o: ../../functions/node.h ../../functions/priv.h
templates.o: ../../functions/reload.h ../../functions/rm.h
templates.o: ../../functions/run.h ../../functions/stat.h
templates.o: ../../functions/subject.h ../../functions/funthread.h
templates.o: ../../functions/template.h ../../functions/tinymce.h
templates.o: ../../functions/uname.h ../../functions/upload.h
templates.o: ../../functions/uptime.h ../../functions/who.h
templates.o: ../../functions/vim.h ../../core/htmlfilter.h
templates.o: ../../templates/templates.h ../../templates/patterncacher.h
templates.o: ../../templates/ckeditorgetparser.h
templates.o: ../../core/httpsimpleparser.h ../../core/log.h
templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h

View File

@@ -15,6 +15,7 @@ namespace Ticket
{
CreateTicket::CreateTicket()
{
fun.url = L"createticket";
@@ -83,8 +84,19 @@ bool CreateTicket::HasAccess()
void CreateTicket::AddTicket()
{
// a new directory created by system->AddDir()
ticket_info->ticket.dir_id = request->dir_tab.back()->id;
ticket_info->ticket.dir_id = request->dir_tab.back()->id;
request->status = tdb->AddTicket(ticket_info->ticket);
// sending notification
notify_msg.code = WINIX_NOTIFY_CODE_USER1;
notify_msg.template_index = ticket_info->template_index;
system->dirs.MakePath(ticket_info->item.parent_id, tmp_path);
notify_msg.item_link = config->base_url;
notify_msg.item_link += tmp_path;
notify_msg.dir_link = notify_msg.item_link;
system->notify.ItemChanged(notify_msg);
}

View File

@@ -13,6 +13,7 @@
#include "tdb.h"
#include "functions/functionbase.h"
#include "ticketinfo.h"
#include "notify/notify.h"
namespace Ticket
@@ -40,6 +41,8 @@ private:
TDb * tdb;
TicketInfo * ticket_info;
NotifyMsg notify_msg;
std::wstring tmp_path;
};

View File

@@ -101,6 +101,13 @@ void InitTicket(PluginInfo & info)
ticket_info.progress_prefix = info.config->Text(L"ticket_form_progress_prefix", L"progress");
}
void AddNotifyTemplate(PluginInfo & info)
{
ticket_info.template_index = info.system->notify.AddTemplate(L"notify_email_ticket.txt");
}
void AddEzcFunctions(PluginInfo & info);
} // namespace Ticket
@@ -119,6 +126,7 @@ using namespace Ticket;
plugin.Assign(WINIX_FSTAB_CHANGED, FstabChanged);
plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest);
plugin.Assign(WINIX_DIR_REMOVED, RemoveTicket);
plugin.Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate);
tdb.SetConn(info.db->GetConn());
tdb.LogQueries(info.config->log_db_query);
@@ -137,7 +145,7 @@ using namespace Ticket;
fun_create_ticket.SetTDb(&tdb);
fun_create_ticket.SetTicketInfo(&ticket_info);
info.p1 = (void*)plugin_name;
info.p1 = (void*)(plugin_name);
}

View File

@@ -89,6 +89,10 @@ public:
int mount_par_createticket_on;
// template index for notifications
size_t template_index;
void ReadTicketConf(bool skip_existing_configs = false);
void FindCurrentConf();
bool CheckMinMaxValue(const TicketConf::TicketItem & ticket_item, Ticket::TicketParam & par);