From 149fd1629f381f98e308f46f8e35d4ac4f7a516d Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sat, 23 Oct 2010 23:51:44 +0000 Subject: [PATCH] rm function can remove tickets now git-svn-id: svn://ttmath.org/publicrep/winix/trunk@667 e52654a7-88a9-db11-a3e9-0013d4bc506e --- core/app.cpp | 7 ++++++- core/pluginmsg.h | 14 +++++++++++++- plugins/ticket/init.cpp | 11 +++++++++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/core/app.cpp b/core/app.cpp index 5520230..84f708f 100755 --- a/core/app.cpp +++ b/core/app.cpp @@ -324,7 +324,7 @@ bool sent = false; } - +// zmienic nazwe np na ProcessRequest void App::Make() { if( request.dir_tab.empty() ) @@ -336,6 +336,8 @@ void App::Make() // request.status can be changed by function_parser if( request.status == WINIX_ERR_OK ) { + plugin.Call(WINIX_PREPARE_REQUEST); + if( system.DirsHaveReadExecPerm() ) { if( request.method == Request::post ) @@ -354,6 +356,9 @@ void App::Make() if( request.IsParam("noredirect") ) request.redirect_to.clear(); + if( request.status == WINIX_ERR_OK ) + plugin.Call(WINIX_PROCESS_REQUEST); + if( !request.redirect_to.empty() ) return; diff --git a/core/pluginmsg.h b/core/pluginmsg.h index 35f54c5..c6df820 100755 --- a/core/pluginmsg.h +++ b/core/pluginmsg.h @@ -15,9 +15,21 @@ // PluginInfo.p1 is a pointer to Ezc::Functions object #define WINIX_TEMPLATES_CREATEFUNCTIONS 999 +// winix function and parameters have been parsed +// the request.status is OK +// (the winix function was not called yet) +#define WINIX_PREPARE_REQUEST 2000 -#define WINIX_CONTENT_MAKE 2000 +// post and get functions have done their jobs +// now you can act +// this is called only if the request.status is OK +#define WINIX_PROCESS_REQUEST 2001 +// prepere your content for displaying +// this is called after WINIX_PROCESS_REQUEST +// and when there is not a redirect +// request.status is not checked here +#define WINIX_CONTENT_MAKE 2002 // here you can attach your own session data (based on PluginDataBase class) // call request.session->plugin_data.Assign(pointer) diff --git a/plugins/ticket/init.cpp b/plugins/ticket/init.cpp index 10e8864..9b4d9b3 100755 --- a/plugins/ticket/init.cpp +++ b/plugins/ticket/init.cpp @@ -79,7 +79,7 @@ void FstabChanged(PluginInfo & info) } -void ContentMake(PluginInfo & info) +void ProcessRequest(PluginInfo & info) { if( info.request->function == &info.functions->fun_reload ) { @@ -89,6 +89,12 @@ void ContentMake(PluginInfo & info) } +void RemoveTicket(PluginInfo & i) +{ + tdb.RemoveTicket(i.l1); +} + + void InitTicket(PluginInfo & info) { ticket_info.progress_prefix = info.config->Text("ticket_form_progress_prefix", "progress"); @@ -110,7 +116,8 @@ using namespace Ticket; plugin.Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction); plugin.Assign(WINIX_ADD_MOUNTS, AddMounts); plugin.Assign(WINIX_FSTAB_CHANGED, FstabChanged); - plugin.Assign(WINIX_CONTENT_MAKE, ContentMake); + plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest); + plugin.Assign(WINIX_DIR_REMOVED, RemoveTicket); tdb.SetConn(info.db->GetConn()); tdb.LogQueries(info.config->log_db_query);