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:
Tomasz Sowa 2012-09-14 23:48:39 +00:00
parent da15323c2f
commit 4ed535a3b7
9 changed files with 63 additions and 18 deletions

View File

@ -103,6 +103,7 @@ void SetSortTab(PluginInfo & info)
typedef std::vector<Item*> SortTab;
SortTab * psort_tab = reinterpret_cast<SortTab*>(info.p1);
// !! IMPROVE ME
// !! dodac jakies czyszczenie tej tablicy wskaznikow na koncu przetwarzania requestu
// aby kiedys przypadkowo nie odwolac sie do nie istniejacego obiektu
// poprzez bezposrednie uzycie jakiejs funkcji z ezc

View File

@ -161,7 +161,7 @@ void CreateTicket::MakePost()
if( !cur->request->IsPostVar(L"fileuploadsubmit") )
{
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
}
}

View File

@ -182,7 +182,7 @@ void EditTicket::MakePost()
if( !cur->request->IsPostVar(L"fileuploadsubmit") )
{
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
}
}

View File

@ -17,6 +17,7 @@
#include "sessiondata.h"
#include "plugins/thread/showthreads.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
void AddEzcFunctions(PluginInfo & info);
@ -162,6 +171,7 @@ using namespace Ticket;
plugin.Assign(WINIX_SESSION_CREATED, CreateSession);
plugin.Assign(WINIX_PLUGIN_SESSION_DATA_REMOVE, RemoveSession);
plugin.Assign(WINIX_END_REQUEST, EndRequest);
plugin.Assign(WINIX_PL_TICKET_LOAD_TICKETS, ShowTicketsFromDir);
tdb.SetConn(info.db->GetConn());
tdb.LogQueries(info.config->log_db_query);

View File

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* Copyright (c) 2011-2012, Tomasz Sowa
* 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

View File

@ -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
DbItemQuery iq;
@ -77,7 +77,7 @@ void ShowTickets::ReadFiles()
iq.sel_privileges = true;
iq.sel_date = true;
iq.sel_meta = true;
iq.WhereParentId(cur->request->dir_tab.back()->id);
iq.WhereParentId(dir_id);
iq.WhereType(Item::file);
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->FindCurrentConf();
ticket_info->FindCurrentConf(dir_id);
ReadFiles();
ReadFiles(dir_id);
CreatePointers();
SortPointers();
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_READ_THREADS);
}
void ShowTickets::MakeGet()
{
ShowTicketsFromDir(cur->request->dir_tab.back()->id);
}
} // namespace

View File

@ -2,7 +2,7 @@
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* Copyright (c) 2010-2012, Tomasz Sowa
* All rights reserved.
*
*/
@ -31,13 +31,15 @@ public:
bool HasAccess();
void MakeGet();
void ShowTicketsFromDir(long dir_id);
private:
TDb * tdb;
TicketInfo * ticket_info;
std::vector<long> file_id_tab;
void ReadFiles();
void ReadFiles(long dir_id);
void CreatePointers();
void SortPointers();
void ReadTickets();

View File

@ -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;
ConfTab::iterator i = conf_tab.find(dir_id);
Mount * mount = system->mounts.CalcMount(dir_id);
if( i != conf_tab.end() )
if( mount )
{
cur_conf_wrap = &i->second;
cur_conf = &i->second.conf;
// long dir_id = cur->mount->dir_id;
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
{
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);
}

View File

@ -97,6 +97,7 @@ public:
void ReadTicketConf(bool skip_existing_configs = false);
void FindCurrentConf(long dir_id);
void FindCurrentConf();
void ReadTicketParams(Ticket & ticket, bool clear_ticket, PT::Space & meta);
void RemoveTicket(long file_id);
@ -104,6 +105,10 @@ public:
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:
Db * db;