added: to plugin ticket: message WINIX_PL_TICKET_LOAD_TICKETS
someone can send this message with a directory id and tickets will be loaded from the directory (and to display them you can use ezc functions) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@889 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
da15323c2f
commit
4ed535a3b7
|
@ -103,6 +103,7 @@ void SetSortTab(PluginInfo & info)
|
||||||
typedef std::vector<Item*> SortTab;
|
typedef std::vector<Item*> SortTab;
|
||||||
SortTab * psort_tab = reinterpret_cast<SortTab*>(info.p1);
|
SortTab * psort_tab = reinterpret_cast<SortTab*>(info.p1);
|
||||||
|
|
||||||
|
// !! IMPROVE ME
|
||||||
// !! dodac jakies czyszczenie tej tablicy wskaznikow na koncu przetwarzania requestu
|
// !! dodac jakies czyszczenie tej tablicy wskaznikow na koncu przetwarzania requestu
|
||||||
// aby kiedys przypadkowo nie odwolac sie do nie istniejacego obiektu
|
// aby kiedys przypadkowo nie odwolac sie do nie istniejacego obiektu
|
||||||
// poprzez bezposrednie uzycie jakiejs funkcji z ezc
|
// poprzez bezposrednie uzycie jakiejs funkcji z ezc
|
||||||
|
|
|
@ -161,7 +161,7 @@ void CreateTicket::MakePost()
|
||||||
if( !cur->request->IsPostVar(L"fileuploadsubmit") )
|
if( !cur->request->IsPostVar(L"fileuploadsubmit") )
|
||||||
{
|
{
|
||||||
Submit(ticket, item);
|
Submit(ticket, item);
|
||||||
ticket_info->ticket = 0; // ticket was deleted by Submit() method -- RemoveTmpTicket() was used
|
ticket_info->ticket = ticket_info->GetEmptyTicket(); // ticket was deleted by Submit() method -- RemoveTmpTicket() was used
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ void EditTicket::MakePost()
|
||||||
if( !cur->request->IsPostVar(L"fileuploadsubmit") )
|
if( !cur->request->IsPostVar(L"fileuploadsubmit") )
|
||||||
{
|
{
|
||||||
Submit(ticket, item);
|
Submit(ticket, item);
|
||||||
ticket_info->ticket = 0; // ticket was deleted by Submit() method -- RemoveTmpTicket() was used
|
ticket_info->ticket = ticket_info->GetEmptyTicket(); // ticket was deleted by Submit() method -- RemoveTmpTicket() was used
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "sessiondata.h"
|
#include "sessiondata.h"
|
||||||
#include "plugins/thread/showthreads.h"
|
#include "plugins/thread/showthreads.h"
|
||||||
#include "plugins/thread/pluginmsg.h"
|
#include "plugins/thread/pluginmsg.h"
|
||||||
|
#include "pluginmsg.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,6 +140,14 @@ void EndRequest(PluginInfo & info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ShowTicketsFromDir(PluginInfo & info)
|
||||||
|
{
|
||||||
|
fun_show_tickets.ShowTicketsFromDir(info.l1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// defined in templates.cpp
|
// defined in templates.cpp
|
||||||
void AddEzcFunctions(PluginInfo & info);
|
void AddEzcFunctions(PluginInfo & info);
|
||||||
|
|
||||||
|
@ -162,6 +171,7 @@ using namespace Ticket;
|
||||||
plugin.Assign(WINIX_SESSION_CREATED, CreateSession);
|
plugin.Assign(WINIX_SESSION_CREATED, CreateSession);
|
||||||
plugin.Assign(WINIX_PLUGIN_SESSION_DATA_REMOVE, RemoveSession);
|
plugin.Assign(WINIX_PLUGIN_SESSION_DATA_REMOVE, RemoveSession);
|
||||||
plugin.Assign(WINIX_END_REQUEST, EndRequest);
|
plugin.Assign(WINIX_END_REQUEST, EndRequest);
|
||||||
|
plugin.Assign(WINIX_PL_TICKET_LOAD_TICKETS, ShowTicketsFromDir);
|
||||||
|
|
||||||
tdb.SetConn(info.db->GetConn());
|
tdb.SetConn(info.db->GetConn());
|
||||||
tdb.LogQueries(info.config->log_db_query);
|
tdb.LogQueries(info.config->log_db_query);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This file is a part of Winix
|
* This file is a part of Winix
|
||||||
* and is not publicly distributed
|
* and is not publicly distributed
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011, Tomasz Sowa
|
* Copyright (c) 2011-2012, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -17,7 +17,13 @@
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
#define WINIX_PL_TICKET_CAN_MAKE_REDIRECT 4110
|
#define WINIX_PL_TICKET_CAN_MAKE_REDIRECT 4101
|
||||||
|
|
||||||
|
|
||||||
|
// in l1 you shoud give the directory_id
|
||||||
|
// from the tickets have to be read
|
||||||
|
// and you can use only ezc functions to display the tickets
|
||||||
|
#define WINIX_PL_TICKET_LOAD_TICKETS 4102
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ bool ShowTickets::Sort::operator()(const Item * item1, const Item * item2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ShowTickets::ReadFiles()
|
void ShowTickets::ReadFiles(long dir_id)
|
||||||
{
|
{
|
||||||
// reading files
|
// reading files
|
||||||
DbItemQuery iq;
|
DbItemQuery iq;
|
||||||
|
@ -77,7 +77,7 @@ void ShowTickets::ReadFiles()
|
||||||
iq.sel_privileges = true;
|
iq.sel_privileges = true;
|
||||||
iq.sel_date = true;
|
iq.sel_date = true;
|
||||||
iq.sel_meta = true;
|
iq.sel_meta = true;
|
||||||
iq.WhereParentId(cur->request->dir_tab.back()->id);
|
iq.WhereParentId(dir_id);
|
||||||
iq.WhereType(Item::file);
|
iq.WhereType(Item::file);
|
||||||
iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
|
iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
|
||||||
|
|
||||||
|
@ -128,22 +128,28 @@ void ShowTickets::ReadTickets()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ShowTickets::MakeGet()
|
void ShowTickets::ShowTicketsFromDir(long dir_id)
|
||||||
{
|
{
|
||||||
ticket_info->Clear();
|
ticket_info->Clear();
|
||||||
ticket_info->FindCurrentConf();
|
ticket_info->FindCurrentConf(dir_id);
|
||||||
|
|
||||||
ReadFiles();
|
ReadFiles(dir_id);
|
||||||
CreatePointers();
|
CreatePointers();
|
||||||
SortPointers();
|
SortPointers();
|
||||||
ReadTickets();
|
ReadTickets();
|
||||||
|
|
||||||
|
// !! IMPROVE ME may a better name instead of WINIX_PL_THREAD_SET_SORTTAB?
|
||||||
plugin.Call(WINIX_PL_THREAD_SET_SORTTAB, &ticket_info->item_sort_tab);
|
plugin.Call(WINIX_PL_THREAD_SET_SORTTAB, &ticket_info->item_sort_tab);
|
||||||
plugin.Call(WINIX_PL_THREAD_READ_THREADS);
|
plugin.Call(WINIX_PL_THREAD_READ_THREADS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ShowTickets::MakeGet()
|
||||||
|
{
|
||||||
|
ShowTicketsFromDir(cur->request->dir_tab.back()->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This file is a part of Winix
|
* This file is a part of Winix
|
||||||
* and is not publicly distributed
|
* and is not publicly distributed
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010, Tomasz Sowa
|
* Copyright (c) 2010-2012, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -31,13 +31,15 @@ public:
|
||||||
bool HasAccess();
|
bool HasAccess();
|
||||||
void MakeGet();
|
void MakeGet();
|
||||||
|
|
||||||
|
void ShowTicketsFromDir(long dir_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
TDb * tdb;
|
TDb * tdb;
|
||||||
TicketInfo * ticket_info;
|
TicketInfo * ticket_info;
|
||||||
std::vector<long> file_id_tab;
|
std::vector<long> file_id_tab;
|
||||||
|
|
||||||
void ReadFiles();
|
void ReadFiles(long dir_id);
|
||||||
void CreatePointers();
|
void CreatePointers();
|
||||||
void SortPointers();
|
void SortPointers();
|
||||||
void ReadTickets();
|
void ReadTickets();
|
||||||
|
|
|
@ -198,23 +198,38 @@ void TicketInfo::ReadTicketConf(bool skip_existing_configs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TicketInfo::FindCurrentConf()
|
void TicketInfo::FindCurrentConf(long dir_id)
|
||||||
{
|
{
|
||||||
long dir_id = cur->mount->dir_id;
|
Mount * mount = system->mounts.CalcMount(dir_id);
|
||||||
ConfTab::iterator i = conf_tab.find(dir_id);
|
|
||||||
|
|
||||||
if( i != conf_tab.end() )
|
if( mount )
|
||||||
{
|
{
|
||||||
cur_conf_wrap = &i->second;
|
// long dir_id = cur->mount->dir_id;
|
||||||
cur_conf = &i->second.conf;
|
ConfTab::iterator i = conf_tab.find(mount->dir_id);
|
||||||
|
|
||||||
|
if( i != conf_tab.end() )
|
||||||
|
{
|
||||||
|
cur_conf_wrap = &i->second;
|
||||||
|
cur_conf = &i->second.conf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log << log1 << "Ticket: there is no a ticket_conf parameter in the mount point (an empty config used)" << logend;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log << log1 << "Ticket: there is no a ticket_conf parameter in the mount point (an empty config used)" << logend;
|
log << log1 << "Ticket: I cannot find the mount point for dir id: " << dir_id << logend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TicketInfo::FindCurrentConf()
|
||||||
|
{
|
||||||
|
if( !cur->request->dir_tab.empty() )
|
||||||
|
FindCurrentConf(cur->request->dir_tab.back()->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
void ReadTicketConf(bool skip_existing_configs = false);
|
void ReadTicketConf(bool skip_existing_configs = false);
|
||||||
|
void FindCurrentConf(long dir_id);
|
||||||
void FindCurrentConf();
|
void FindCurrentConf();
|
||||||
void ReadTicketParams(Ticket & ticket, bool clear_ticket, PT::Space & meta);
|
void ReadTicketParams(Ticket & ticket, bool clear_ticket, PT::Space & meta);
|
||||||
void RemoveTicket(long file_id);
|
void RemoveTicket(long file_id);
|
||||||
|
@ -104,6 +105,10 @@ public:
|
||||||
|
|
||||||
void MakeRedirectIfPossible(const Item & item);
|
void MakeRedirectIfPossible(const Item & item);
|
||||||
|
|
||||||
|
// may now it is better to use null pointers instead of this empty objects?
|
||||||
|
Ticket * GetEmptyTicket() { return &ticket_empty; };
|
||||||
|
//Item * GetEmptyItem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Db * db;
|
Db * db;
|
||||||
|
|
Loading…
Reference in New Issue