From 631ca4f8a3659a9ac8abdcb2d8b7d453762de239 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Tue, 17 Jan 2012 22:54:41 +0000 Subject: [PATCH] plugin ticket: rewritten templates ezc functions (now images/files are working fine) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@795 e52654a7-88a9-db11-a3e9-0013d4bc506e --- html/fun_createticket.html | 21 +- html/fun_showtickets.html | 2 +- html/fun_ticket.html | 34 +- locale/en | 2 + locale/pl | 1 + plugins/ticket/createticket.cpp | 27 +- plugins/ticket/createticket.h | 2 +- plugins/ticket/editticket.cpp | 34 +- plugins/ticket/editticket.h | 2 +- plugins/ticket/sessiondata.cpp | 59 ++- plugins/ticket/sessiondata.h | 27 +- plugins/ticket/templates.cpp | 719 ++++++++++++++++++++------------ plugins/ticket/ticket.h | 25 +- plugins/ticket/ticketinfo.cpp | 58 +-- plugins/ticket/ticketinfo.h | 20 +- 15 files changed, 641 insertions(+), 392 deletions(-) diff --git a/html/fun_createticket.html b/html/fun_createticket.html index 02981d7..cf8da43 100755 --- a/html/fun_createticket.html +++ b/html/fun_createticket.html @@ -45,29 +45,36 @@ [if ticket_tab_type_is "multistring"] - + [end] [if ticket_tab_type_is "images"] - [for ticket_tab_files_tab] - [ticket_tab_value] + [for ticket_tab_file_tab] + [ticket_tab_file_tab_path] [end] - + [end] [if ticket_tab_type_is "files"] - [for ticket_tab_files_tab] - [ticket_tab_value] + [if ticket_tab_file_tab] + [end] - + [end] + [if-any-no ticket_tab_type_is "images" ticket_tab_type_is "files" ticket_is_creating_new ticket_tab_has_value] + {ticket_value_not_set} + [end] diff --git a/html/fun_showtickets.html b/html/fun_showtickets.html index aaab581..cf60461 100755 --- a/html/fun_showtickets.html +++ b/html/fun_showtickets.html @@ -16,7 +16,7 @@ {tickets_header_name} [for ticket_tab] [if-any-no ticket_tab_type_is "images" ticket_tab_type_is "files"] - [ticket_tab_param_name] + [filter fil_firstup][ticket_tab_param_name][end] [end] [end] diff --git a/html/fun_ticket.html b/html/fun_ticket.html index a6bb2c0..53969e7 100755 --- a/html/fun_ticket.html +++ b/html/fun_ticket.html @@ -7,30 +7,38 @@ [if ticket_can_edit]

\[{edit}\]

[end] [for ticket_tab] + [if ticket_tab_has_value] + - [end] + [end]
[filter fil_firstup][ticket_tab_param_name]:[end] - [if ticket_tab_type_is "images"] - [for ticket_tab_files_tab] - [ticket_tab_value] + [if ticket_tab_type_is "images"] + [for ticket_tab_file_tab] + + [ticket_tab_file_tab_path] + + [end] + [end] + + [if ticket_tab_type_is "files"] + [if ticket_tab_file_tab] + [end] - [end] - - [if ticket_tab_type_is "files"] - [for ticket_tab_files_tab] - [ticket_tab_value] [end] - [end] - [if-any-no ticket_tab_type_is "images" ticket_tab_type_is "files"] - [ticket_tab_value] - [end] + [if-any-no ticket_tab_type_is "images" ticket_tab_type_is "files"] + [ticket_tab_value] + [end]
[item_print_content] diff --git a/locale/en b/locale/en index b6ea5a3..655f748 100755 --- a/locale/en +++ b/locale/en @@ -205,6 +205,8 @@ ticket_info_category = Category ticket_info_expected = Expected in ticket_info_progress = Progress ticket_reply_in_this_thread = Replay in this thread +ticket_value_not_set = this ticket doesn't have such a value yet + template_header = Template template_info_file = Current html template for this file diff --git a/locale/pl b/locale/pl index d5fffab..dbb0036 100755 --- a/locale/pl +++ b/locale/pl @@ -223,6 +223,7 @@ ticket_info_category = Kategoria ticket_info_expected = Oczekiwany w ticket_info_progress = Postęp prac ticket_reply_in_this_thread = Odpowiedz w tym wątku +ticket_value_not_set = to zgłoszenie nie ma jeszcze ustawionej tej wartości template_header = Szablon template_info_file = Bieżący szablon dla tego pliku diff --git a/plugins/ticket/createticket.cpp b/plugins/ticket/createticket.cpp index a0d69ff..d5e4907 100755 --- a/plugins/ticket/createticket.cpp +++ b/plugins/ticket/createticket.cpp @@ -111,7 +111,7 @@ void CreateTicket::RemoveTmpTicket() long dir_id = cur->request->dir_tab.back()->id; session_data->create_ticket_map.erase(dir_id); - session_data->create_file_map.erase(dir_id); + session_data->create_space_map.erase(dir_id); } @@ -121,22 +121,24 @@ Ticket & CreateTicket::PrepareTicket() SessionData * session_data = reinterpret_cast( cur->session->plugin_data.Get(ticket_info->plugin_id) ); + bool is_new; long dir_id = cur->request->dir_tab.back()->id; - Ticket & ticket = session_data->GetTicket(dir_id, session_data->create_ticket_map); + Ticket & ticket = session_data->GetTicket(dir_id, session_data->create_ticket_map, &is_new); + ticket_info->create_new_ticket = is_new; return ticket; } -std::vector & CreateTicket::PrepareFileMap() +PT::Space & CreateTicket::PrepareSpace() { SessionData * session_data = reinterpret_cast( cur->session->plugin_data.Get(ticket_info->plugin_id) ); long dir_id = cur->request->dir_tab.back()->id; - std::vector & file_map = session_data->GetFileTab(dir_id, session_data->create_file_map); + PT::Space & space = session_data->GetSpace(dir_id, session_data->create_space_map); -return file_map; +return space; } @@ -145,15 +147,17 @@ void CreateTicket::MakePost() ticket_info->Clear(); ticket_info->FindCurrentConf(); - Ticket & ticket = PrepareTicket(); - Item & item = cur->request->item; + Ticket & ticket = PrepareTicket(); + PT::Space & meta = PrepareSpace(); + Item & item = cur->request->item; ticket_info->ticket = &ticket; ticket_info->item = &item; - std::vector & file_map = PrepareFileMap(); - ticket_info->ReadTicketParams(ticket, false, file_map, item.meta); + ticket_info->ReadTicketParams(ticket, false, meta); functions->ReadItem(item, Item::file); + ticket_info->CopyTicketSpace(meta, item); + if( !cur->request->IsPostVar(L"fileuploadsubmit") ) Submit(ticket, item); } @@ -165,9 +169,12 @@ void CreateTicket::MakeGet() ticket_info->Clear(); ticket_info->FindCurrentConf(); - Ticket & ticket = PrepareTicket(); + Ticket & ticket = PrepareTicket(); + PT::Space & meta = PrepareSpace(); ticket_info->ticket = &ticket; ticket_info->item = &cur->request->item; + + ticket_info->CopyTicketSpace(meta, *ticket_info->item); } diff --git a/plugins/ticket/createticket.h b/plugins/ticket/createticket.h index aa8d1ae..7b9d40e 100755 --- a/plugins/ticket/createticket.h +++ b/plugins/ticket/createticket.h @@ -38,7 +38,7 @@ private: void Submit(Ticket & ticket, Item & item); void RemoveTmpTicket(); Ticket & PrepareTicket(); - std::vector & PrepareFileMap(); + PT::Space & PrepareSpace(); TDb * tdb; TicketInfo * ticket_info; diff --git a/plugins/ticket/editticket.cpp b/plugins/ticket/editticket.cpp index e5a0807..ac53d95 100755 --- a/plugins/ticket/editticket.cpp +++ b/plugins/ticket/editticket.cpp @@ -113,7 +113,7 @@ void EditTicket::RemoveTmpTicket() long file_id = cur->request->item.id; session_data->edit_ticket_map.erase(file_id); - session_data->edit_file_map.erase(file_id); + session_data->edit_space_map.erase(file_id); } @@ -137,15 +137,24 @@ return ticket; -std::vector & EditTicket::PrepareFileMap() +PT::Space & EditTicket::PrepareSpace() { SessionData * session_data = reinterpret_cast( cur->session->plugin_data.Get(ticket_info->plugin_id) ); + bool is_new; long file_id = cur->request->item.id; - std::vector & file_map = session_data->GetFileTab(file_id, session_data->edit_file_map); + PT::Space & space = session_data->GetSpace(file_id, session_data->edit_space_map, &is_new); -return file_map; + if( is_new ) + { + PT::Space * ticket_space = cur->request->item.meta.FindSpace(L"ticket"); + + if( ticket_space ) + space = *ticket_space; + } + +return space; } @@ -154,16 +163,18 @@ void EditTicket::MakePost() ticket_info->Clear(); ticket_info->FindCurrentConf(); - Ticket & ticket = PrepareTicket(); - Item & item = cur->request->item; - old_url = item.url; - std::vector & file_map = PrepareFileMap(); + Ticket & ticket = PrepareTicket(); + PT::Space & meta = PrepareSpace(); + Item & item = cur->request->item; + old_url = item.url; ticket_info->ticket = &ticket; ticket_info->item = &item; - ticket_info->ReadTicketParams(ticket, false, file_map, item.meta); + ticket_info->ReadTicketParams(ticket, false, meta); functions->ReadItem(item, Item::file); + ticket_info->CopyTicketSpace(meta, item); + if( !cur->request->IsPostVar(L"fileuploadsubmit") ) Submit(ticket, item); } @@ -175,9 +186,12 @@ void EditTicket::MakeGet() ticket_info->Clear(); ticket_info->FindCurrentConf(); - Ticket & ticket = PrepareTicket(); + Ticket & ticket = PrepareTicket(); + PT::Space & meta = PrepareSpace(); ticket_info->ticket = &ticket; ticket_info->item = &cur->request->item; + + ticket_info->CopyTicketSpace(meta, *ticket_info->item); } diff --git a/plugins/ticket/editticket.h b/plugins/ticket/editticket.h index 146160a..c7e674b 100755 --- a/plugins/ticket/editticket.h +++ b/plugins/ticket/editticket.h @@ -43,7 +43,7 @@ private: void RemoveTmpTicket(); Ticket & PrepareTicket(); - std::vector & PrepareFileMap(); + PT::Space & PrepareSpace(); void ChangeTicket(Ticket & ticket, Item & item); void Submit(Ticket & ticket, Item & item); diff --git a/plugins/ticket/sessiondata.cpp b/plugins/ticket/sessiondata.cpp index bc8b3f5..427c16f 100755 --- a/plugins/ticket/sessiondata.cpp +++ b/plugins/ticket/sessiondata.cpp @@ -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. * */ @@ -21,32 +21,56 @@ SessionData::SessionData() SessionData::~SessionData() { - RemoveFileMap(create_file_map); - RemoveFileMap(edit_file_map); + RemoveFiles(create_space_map); + RemoveFiles(edit_space_map); } -void SessionData::RemoveFileMap(SessionData::FileMap & file_map) + + +void SessionData::RemoveFiles(SessionData::SpaceMap & space_map) { -FileMap::iterator i; +SpaceMap::iterator i; if( fun_rm ) { - for(i=file_map.begin() ; i!=file_map.end() ; ++i) - { - for(size_t a=0 ; asecond.size() ; ++a) - { - long file_id = i->second[a]; - fun_rm->RemoveItemById(file_id); - } - } + for(i=space_map.begin() ; i!=space_map.end() ; ++i) + RemoveFiles(i->second); - file_map.clear(); + space_map.clear(); } } +void SessionData::RemoveFiles(PT::Space & space) +{ + for(size_t i=0 ; iRemoveItemById(file_id); + } + } + } + } + } +} + Ticket & SessionData::GetTicket(long id, SessionData::TicketMap & ticket_map, bool * is_new) { @@ -60,9 +84,12 @@ return res.first->second; -std::vector & SessionData::GetFileTab(long id, FileMap & file_map) +PT::Space & SessionData::GetSpace(long id, SpaceMap & space_map, bool * is_new) { - std::pair res = file_map.insert( std::make_pair(id, std::vector()) ); + std::pair res = space_map.insert( std::make_pair(id, PT::Space()) ); + + if( is_new ) + *is_new = res.second; return res.first->second; } diff --git a/plugins/ticket/sessiondata.h b/plugins/ticket/sessiondata.h index f857149..bc62fac 100755 --- a/plugins/ticket/sessiondata.h +++ b/plugins/ticket/sessiondata.h @@ -16,6 +16,7 @@ #include "core/plugindata.h" #include "ticket.h" #include "functions/rm.h" +#include "confparser/space.h" namespace Ticket @@ -28,8 +29,8 @@ struct SessionData : public PluginDataBase ~SessionData(); - typedef std::map TicketMap; - typedef std::map > FileMap; + typedef std::map TicketMap; + typedef std::map SpaceMap; // temporary tickets for 'createticket' function @@ -41,28 +42,34 @@ struct SessionData : public PluginDataBase TicketMap edit_ticket_map; - // temporary files for 'createticket' function + // temporary spaces for 'createticket' function // these files should be deleted if a user will not click on the submit button - FileMap create_file_map; + SpaceMap create_space_map; - // temporary files for 'editticket' function + // temporary spaces for 'editticket' function // these files should be deleted if a user will not click on the submit button - // !! zmienic nazwe na edit_file_map albo podobnie - FileMap edit_file_map; + SpaceMap edit_space_map; // inserting and returning a new ticket or just returning the ticket if it exists Ticket & GetTicket(long id, TicketMap & ticket_map, bool * is_new = 0); - std::vector & GetFileTab(long id, FileMap & file_map); + // inserting and returning a new space or just returning the space if it exists + PT::Space & GetSpace(long id, SpaceMap & space_map, bool * is_new = 0); - // for deleting edit_file_map files + // for deleting files // !! IMPROVE ME: when the program exits there can be a situation that // fun_rm was finished and then an object of this class exits and call fun_rm // so we should guarantee that all sessions object are removed first Fun::Rm * fun_rm; - void RemoveFileMap(FileMap & file_map); + void RemoveFiles(SpaceMap & space_map); + + +private: + + void RemoveFiles(PT::Space & space); + }; diff --git a/plugins/ticket/templates.cpp b/plugins/ticket/templates.cpp index 9795c3e..8348be2 100755 --- a/plugins/ticket/templates.cpp +++ b/plugins/ticket/templates.cpp @@ -32,6 +32,34 @@ extern CreateTicket fun_create_ticket; extern EditTicket fun_edit_ticket; +struct TicketValue +{ +bool is_param; // true if there is a paremeter (in config Space) +PT::Space * config_par; // current space param (from current config) if is_param is true + // when is_param is true then this pointer is never null +long param_id; // param id (the same as config_par->Long(L"id")) +bool is_value; // true if value for such a param was defined +bool is_in_ticket_par; // true if the value is defined in ticket.par_tab + // else the value is defined in meta + +Ticket::TicketParam * ticket_par; // if is_in_ticket_par is true: +PT::Space * value_meta; // if is_in_ticket_par is false: + + TicketValue() + { + Clear(); + } + + void Clear() + { + is_param = false; + config_par = 0; + param_id = 0; + is_value = false; + is_in_ticket_par = false; + value_meta = 0; + } +}; int ticket_calc_progress_image_number(int percent) @@ -48,59 +76,35 @@ return percent; } -PT::Space & find_add_meta_for_param(PT::Space & meta, long param_id) + +/* + binary search for param in par_tab + (par_tab must be sorted by 'param') +*/ +bool find_ticket_param(long param, const Ticket::ParTab & par_tab, size_t & ticket_par_index) { - for(size_t i=0 ; i 0 && ticket.par_tab[o2-1].param == param ) - --o2; - ticket_par_index = o2; return true; } - if( param > ticket.par_tab[o2].param ) + if( param > par_tab[o2].param ) return false; @@ -108,15 +112,10 @@ bool find_ticket_param(long param, const Ticket & ticket, size_t & ticket_par_in { ticket_par_index = (o1 + o2) / 2; - if( ticket.par_tab[ticket_par_index].param == param ) - { - while( ticket_par_index > 0 && ticket.par_tab[ticket_par_index-1].param == param ) - --ticket_par_index; - + if( par_tab[ticket_par_index].param == param ) return true; - } - if( ticket.par_tab[ticket_par_index].param < param ) + if( par_tab[ticket_par_index].param < param ) o1 = ticket_par_index; else o2 = ticket_par_index; @@ -128,42 +127,126 @@ return false; - -void ticket_print_value(Info & i, PT::Space & space, const Ticket::TicketParam & ticket_param, PT::Space & meta) +/* + looking for a subspace in meta which has id equal to param_id + can return a null pointer +*/ +PT::Space * find_ticket_param(long param_id, PT::Space & meta) { - std::wstring & type = space.Text(L"type"); +wchar_t param_id_str[50]; - if( type == L"integer" || type == L"progress" ) + // for performane + // should be a little faster in each loop comparing only just text + Toa(param_id, param_id_str, sizeof(param_id_str)/sizeof(wchar_t)); + + for(size_t i=0 ; ispaces.size() ; ++a) + { + PT::Space & sp = *value.config_par->spaces[a]; + + if( sp.name == L"option" && sp.Long(L"id") == value.ticket_par->intv ) { i.out << sp.Text(L"value"); break; } } } - else - if( type == L"string" || type == L"multistring" ) - { - i.out << meta.Text(L"value"); - } - else - if( type == L"images" || type == L"files" ) - { - i.out << meta.Text(L"value"); - } } +void ticket_print_value(Info & i, TicketValue & value) +{ + if( !value.is_param || !value.is_value ) + return; + + std::wstring & type = value.config_par->Text(L"type"); + + if( value.is_in_ticket_par ) + { + if( type == L"decimal" ) + i.out << value.ticket_par->decv; + else + if( type == L"select" ) + ticket_print_value_select(i, value); + else + i.out << value.ticket_par->intv; + } + else + { + i.out << value.value_meta->Text(L"value"); + } +} + void ticket_can_create(Info & i) @@ -178,21 +261,39 @@ void ticket_can_edit(Info & i) } +void ticket_is_creating_new(Info & i) +{ + i.res = ticket_info.create_new_ticket; +} namespace ns_tickets_tab { -static size_t item_sort_index; // index for: ticket_info.item_sort_tab -static size_t ticket_index; // index for: ticket_info.ticket_tab -static size_t par_index; // index for: ticket_info.ticket_tab[ticket_index].par_tab -static size_t conf_tab_index; // index for: ticket_info.cur_conf->spaces -static bool has_ticket; -static bool has_value; + +struct TicketsTabValue +{ + bool is_ticket; // true if there is a ticket + Ticket * ticket; // pointer to the ticket (if is_ticket is true) + Item * item; // an item for that ticket (if is_ticket is true) + + TicketsTabValue() + { + Clear(); + } + + void Clear() + { + is_ticket = false; + ticket = 0; + item = 0; + } +}; -// binary search for id in ticket_tab (ticket_tab must be sorted by 'file_id') -bool find_ticket(const std::vector & ticket_tab, long id, size_t & ticket_index) + +// binary search for file_id in ticket_tab (ticket_tab must be sorted by 'file_id') +bool find_ticket(long file_id, const std::vector & ticket_tab, size_t & ticket_index) { if( ticket_tab.empty() ) return false; @@ -200,22 +301,22 @@ bool find_ticket(const std::vector & ticket_tab, long id, size_t & ticke size_t o1 = 0; size_t o2 = ticket_tab.size() - 1; - if( ticket_tab[o1].file_id == id ) + if( ticket_tab[o1].file_id == file_id ) { ticket_index = o1; return true; } - if( id < ticket_tab[o1].file_id ) + if( file_id < ticket_tab[o1].file_id ) return false; - if( ticket_tab[o2].file_id == id ) + if( ticket_tab[o2].file_id == file_id ) { ticket_index = o2; return true; } - if( id > ticket_tab[o2].file_id ) + if( file_id > ticket_tab[o2].file_id ) return false; @@ -223,10 +324,10 @@ bool find_ticket(const std::vector & ticket_tab, long id, size_t & ticke { ticket_index = (o1 + o2) / 2; - if( ticket_tab[ticket_index].file_id == id ) + if( ticket_tab[ticket_index].file_id == file_id ) return true; - if( ticket_tab[ticket_index].file_id < id ) + if( ticket_tab[ticket_index].file_id < file_id ) o1 = ticket_index; else o2 = ticket_index; @@ -238,16 +339,45 @@ return false; +static size_t tickets_tab_reqid = 0; +static TicketsTabValue tickets_value; +static TicketValue value; +static size_t item_sort_index; // index for: ticket_info.item_sort_tab +static size_t conf_index; // index for: ticket_info.cur_conf->spaces + + + +void tickets_tab_check_reqid() +{ + if( tickets_tab_reqid != cur->request->id ) + { + tickets_tab_reqid = cur->request->id; + tickets_value.Clear(); + value.Clear(); + } +} + + void tickets_tab(Info & i) { - has_ticket = false; + tickets_tab_check_reqid(); + + tickets_value.Clear(); + value.Clear(); item_sort_index = i.iter; - i.res = item_sort_index < ticket_info.item_sort_tab.size(); + i.res = (item_sort_index < ticket_info.item_sort_tab.size()); if( i.res ) { - long id = ticket_info.item_sort_tab[item_sort_index]->id; - has_ticket = find_ticket(ticket_info.ticket_tab, id, ticket_index); + size_t ticket_index; + long file_id = ticket_info.item_sort_tab[item_sort_index]->id; + + if( find_ticket(file_id, ticket_info.ticket_tab, ticket_index) ) + { + tickets_value.is_ticket = true; + tickets_value.ticket = &ticket_info.ticket_tab[ticket_index]; + tickets_value.item = ticket_info.item_sort_tab[item_sort_index]; + } plugin.Call(WINIX_PL_THREAD_SET_SORTTAB_INDEX, item_sort_index); } @@ -256,103 +386,56 @@ void tickets_tab(Info & i) void tickets_tab_url(Info & i) { - if( item_sort_index < ticket_info.item_sort_tab.size() ) - i.out << ticket_info.item_sort_tab[item_sort_index]->url; + tickets_tab_check_reqid(); + + if( tickets_value.is_ticket ) + i.out << tickets_value.item->url; } void tickets_tab_subject_empty(Info & i) { - if( item_sort_index < ticket_info.item_sort_tab.size() ) - i.res = ticket_info.item_sort_tab[item_sort_index]->subject.empty(); + tickets_tab_check_reqid(); + + if( tickets_value.is_ticket ) + i.res = tickets_value.item->subject.empty(); } void tickets_tab_subject(Info & i) { - if( item_sort_index < ticket_info.item_sort_tab.size() ) - i.out << ticket_info.item_sort_tab[item_sort_index]->subject; + tickets_tab_check_reqid(); + + if( tickets_value.is_ticket ) + i.out << tickets_value.item->subject; } -// !! do czego to w ogole sluzy? -void tickets_tab_has_value(Info & i) -{ - if( has_ticket && ticket_index < ticket_info.ticket_tab.size() ) - { - size_t par_index; - long id = Tol(i.par); - Ticket & ticket = ticket_info.ticket_tab[ticket_index]; - - // !! dodac takze sprawdzanie czy jest wartosc w ticket_info.ticket->meta - - if( find_ticket_param(id, ticket, par_index) ) - i.res = true; - } -} - - -// !! czy to w ogole jest gdzies uzywane? -void tickets_tab_value_int(Info & i) -{ - if( has_ticket && ticket_index < ticket_info.ticket_tab.size() ) - { - size_t par_index; - long param = Tol(i.par); - Ticket & ticket = ticket_info.ticket_tab[ticket_index]; - - if( find_ticket_param(param, ticket, par_index) ) - i.out << ticket.par_tab[par_index].intv; - } -} - - -// !! czy to w ogole jest gdzies uzywane? -void tickets_tab_value_meta(Info & i) -{ - if( has_ticket && - item_sort_index < ticket_info.item_sort_tab.size() && - ticket_index < ticket_info.ticket_tab.size() ) - { - long param = Tol(i.par); - - PT::Space & meta = ticket_info.item_sort_tab[item_sort_index]->meta.FindAddSpace(L"ticket"); - PT::Space & sp = find_add_meta_for_param(meta, param); - - // !! to nie zadziala bo pierwszy parametr w i.par to jest param_id - space(i, sp); - } -} - - - - void tickets_tab_conf_tab(Info & i) { - has_value = false; + tickets_tab_check_reqid(); + value.Clear(); - if( has_ticket && - item_sort_index < ticket_info.item_sort_tab.size() && - ticket_index < ticket_info.ticket_tab.size() ) + if( tickets_value.is_ticket ) { - if( i.iter == 0 ) - conf_tab_index = 0; + if( !i.is_for || i.is_for_first_iter ) + conf_index = 0; else - conf_tab_index += 1; + conf_index += 1; PT::Space & space = *ticket_info.cur_conf; - for( ; conf_tab_index < space.spaces.size() ; conf_tab_index++) - if( space.spaces[conf_tab_index]->name == L"param" ) - break; + while( conf_index < space.spaces.size() && space.spaces[conf_index]->name != L"param" ) + conf_index += 1; - i.res = conf_tab_index < space.spaces.size(); + i.res = conf_index < space.spaces.size(); if( i.res ) { - PT::Space & sp = *space.spaces[conf_tab_index]; - const Ticket & ticket = ticket_info.ticket_tab[ticket_index]; - has_value = find_ticket_param(sp.Long(L"id"), ticket, par_index); + value.is_param = true; + value.config_par = space.spaces[conf_index]; + value.param_id = value.config_par->Long(L"id"); + find_ticket_value(value, tickets_value.ticket->par_tab, tickets_value.item->meta); } } } @@ -360,48 +443,37 @@ void tickets_tab_conf_tab(Info & i) void tickets_tab_conf_tab_has_value(Info & i) { - i.res = has_value; + tickets_tab_check_reqid(); + + i.res = value.is_value; } void tickets_tab_conf_tab_value(Info & i) { - if( has_value && - conf_tab_index < ticket_info.cur_conf->spaces.size() && - item_sort_index < ticket_info.item_sort_tab.size() && - ticket_index < ticket_info.ticket_tab.size() && - par_index < ticket_info.ticket_tab[ticket_index].par_tab.size() ) - { - PT::Space & space = *ticket_info.cur_conf->spaces[conf_tab_index]; + tickets_tab_check_reqid(); - // !! to mozna jakos gdzies zapamietac - // aby nie wyszukiwac ciagle - PT::Space & meta_ticket = ticket_info.item_sort_tab[item_sort_index]->meta.FindAddSpace(L"ticket"); - PT::Space & meta = find_add_meta_for_param(meta_ticket, space.Long(L"id")); - - ticket_print_value(i, space, ticket_info.ticket_tab[ticket_index].par_tab[par_index], meta); - } + if( value.is_value ) + ticket_print_value(i, value); } - void tickets_tab_conf_tab_type_is(Info & i) { - if( conf_tab_index < ticket_info.cur_conf->spaces.size() ) - { - PT::Space & space = *ticket_info.cur_conf->spaces[conf_tab_index]; - i.res = (space.Text(L"type") == i.par); - } + tickets_tab_check_reqid(); + + if( value.is_param ) + i.res = (value.config_par->Text(L"type") == i.par); } void tickets_tab_conf_tab_progress_image_number(Info & i) { - if( has_value && - ticket_index < ticket_info.ticket_tab.size() && - par_index < ticket_info.ticket_tab[ticket_index].par_tab.size() ) + tickets_tab_check_reqid(); + + if( value.is_value && value.is_in_ticket_par ) { - int progress = ticket_info.ticket_tab[ticket_index].par_tab[par_index].intv; + int progress = value.ticket_par->intv; i.out << ticket_calc_progress_image_number(progress); } } @@ -416,33 +488,47 @@ void tickets_tab_conf_tab_progress_image_number(Info & i) namespace ns_ticket_tab { -static size_t conf_index; // index for: ticket_info.cur_conf->spaces -static size_t select_index; // index for: ticket_info.cur_conf->spaces[conf_index]->spaces -static size_t par_index; // index for: ticket_info.ticket->par_tab -static size_t files_number; -static bool has_value; +static size_t conf_index; // index for: ticket_info.cur_conf->spaces +static TicketValue value; // current ticket value +static size_t ticket_req_id = 0; +static size_t select_index; +static size_t ticket_file_index; +static size_t ticket_file_number; +void ticket_tab_check_reqid() +{ + if( ticket_req_id != cur->request->id ) + { + ticket_req_id = cur->request->id; + value.Clear(); + } +} + void ticket_tab(Info & i) { - if( i.iter == 0 ) + ticket_tab_check_reqid(); + value.Clear(); + + if( !i.is_for || i.is_for_first_iter ) conf_index = 0; else conf_index += 1; PT::Space & space = *ticket_info.cur_conf; - for( ; conf_index < space.spaces.size() ; conf_index++) - if( space.spaces[conf_index]->name == L"param" ) - break; + while( conf_index < space.spaces.size() && space.spaces[conf_index]->name != L"param" ) + conf_index += 1; i.res = conf_index < space.spaces.size(); if( i.res ) { - PT::Space & sp = *space.spaces[conf_index]; - has_value = find_ticket_param(sp.Long(L"id"), *ticket_info.ticket, par_index); + value.is_param = true; + value.config_par = space.spaces[conf_index]; + value.param_id = value.config_par->Long(L"id"); + find_ticket_value(value, ticket_info.ticket->par_tab, ticket_info.item->meta); } } @@ -450,77 +536,90 @@ void ticket_tab(Info & i) void ticket_tab_param_id(Info & i) { - if( conf_index < ticket_info.cur_conf->spaces.size() ) - i.out << ticket_info.cur_conf->spaces[conf_index]->Long(L"id"); + ticket_tab_check_reqid(); + + if( value.is_param ) + i.out << value.param_id; } void ticket_tab_param_name(Info & i) { - if( conf_index < ticket_info.cur_conf->spaces.size() ) - i.out << ticket_info.cur_conf->spaces[conf_index]->Text(L"name"); + ticket_tab_check_reqid(); + + if( value.is_param ) + i.out << value.config_par->Text(L"name"); +} + + +void ticket_tab_has_value(Info & i) +{ + ticket_tab_check_reqid(); + + i.res = value.is_value; } void ticket_tab_value(Info & i) { - // !! has_value mowi tylko czy opcja byla w tabeli tickets - // nalezy dodac aby has_value mialo obsluge meta (albo sie pozbyc go w ogole...) + ticket_tab_check_reqid(); - if( has_value && par_index < ticket_info.ticket->par_tab.size() && - conf_index < ticket_info.cur_conf->spaces.size() ) - { - PT::Space & space = *ticket_info.cur_conf->spaces[conf_index]; - PT::Space & meta = find_add_meta_for_param(ticket_info.item->meta.FindAddSpace(L"ticket"), space.Long(L"id")); - - ticket_print_value(i, space, ticket_info.ticket->par_tab[par_index], meta); - } + if( value.is_value ) + ticket_print_value(i, value); } void ticket_tab_value_int(Info & i) { - if( has_value && par_index < ticket_info.ticket->par_tab.size() ) - i.out << ticket_info.ticket->par_tab[par_index].intv; + ticket_tab_check_reqid(); + + if( value.is_value && value.is_in_ticket_par ) + i.out << value.ticket_par->intv; +} + + +void ticket_tab_value_dec(Info & i) +{ + ticket_tab_check_reqid(); + + if( value.is_value && value.is_in_ticket_par ) + i.out << value.ticket_par->decv; } void ticket_tab_value_meta(Info & i) { - if( has_value && par_index < ticket_info.ticket->par_tab.size() ) - { - PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index]; - PT::Space & meta = find_add_meta_for_param(ticket_info.item->meta.FindAddSpace(L"ticket"), sp.Long(L"id")); + ticket_tab_check_reqid(); - space(i, meta); - } + if( value.is_value && !value.is_in_ticket_par ) + space(i, *value.value_meta); } void ticket_tab_type_is(Info & i) { - if( conf_index < ticket_info.cur_conf->spaces.size() ) - { - PT::Space & space = *ticket_info.cur_conf->spaces[conf_index]; - i.res = (space.Text(L"type") == i.par); - } + ticket_tab_check_reqid(); + + if( value.is_param ) + i.res = (value.config_par->Text(L"type") == i.par); } void ticket_tab_select_tab(Info & i) { - if( conf_index < ticket_info.cur_conf->spaces.size() ) + ticket_tab_check_reqid(); + + if( value.is_param ) { - if( i.iter == 0 ) + if( !i.is_for || i.is_for_first_iter ) select_index = 0; else select_index += 1; - PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index]; + PT::Space & sp = *value.config_par; - for( ; select_index < sp.spaces.size() ; ++select_index) - if( sp.spaces[select_index]->name == L"option" ) - break; + while( select_index < sp.spaces.size() && sp.spaces[select_index]->name != L"option" ) + select_index += 1; i.res = (select_index < sp.spaces.size()); } @@ -529,19 +628,25 @@ void ticket_tab_select_tab(Info & i) void ticket_tab_select_tab_is_selected(Info & i) { - if( conf_index < ticket_info.cur_conf->spaces.size() && - select_index < ticket_info.cur_conf->spaces[conf_index]->spaces.size() ) - { - PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index]; - long id = sp.spaces[select_index]->Long(L"id"); + ticket_tab_check_reqid(); - if( has_value && par_index < ticket_info.ticket->par_tab.size() ) + if( value.is_param ) + { + PT::Space & sp = *value.config_par; + + if( select_index < sp.spaces.size() ) { - i.res = (id == ticket_info.ticket->par_tab[par_index].intv); - } - else - { - i.res = (id == sp.Long(L"default")); + long id = sp.spaces[select_index]->Long(L"id"); + + if( value.is_value ) + { + if( value.is_in_ticket_par ) + i.res = (id == value.ticket_par->intv); + } + else + { + i.res = (id == sp.Long(L"default")); + } } } } @@ -549,65 +654,126 @@ void ticket_tab_select_tab_is_selected(Info & i) void ticket_tab_select_tab_name(Info & i) { - if( conf_index < ticket_info.cur_conf->spaces.size() && - select_index < ticket_info.cur_conf->spaces[conf_index]->spaces.size() ) + ticket_tab_check_reqid(); + + if( value.is_param ) { - i.out << ticket_info.cur_conf->spaces[conf_index]->spaces[select_index]->Text(L"value"); + PT::Space & sp = *value.config_par; + + if( select_index < sp.spaces.size() ) + i.out << sp.spaces[select_index]->Text(L"value"); } } void ticket_tab_select_tab_id(Info & i) { - if( conf_index < ticket_info.cur_conf->spaces.size() && - select_index < ticket_info.cur_conf->spaces[conf_index]->spaces.size() ) + ticket_tab_check_reqid(); + + if( value.is_param ) { - i.out << ticket_info.cur_conf->spaces[conf_index]->spaces[select_index]->Text(L"id"); + PT::Space & sp = *value.config_par; + + if( select_index < sp.spaces.size() ) + i.out << sp.spaces[select_index]->Text(L"id"); + } +} + +void ticket_tab_select_tab_meta(Info & i) +{ + ticket_tab_check_reqid(); + + if( value.is_param ) + { + PT::Space & sp = *value.config_par; + + if( select_index < sp.spaces.size() ) + space(i, *sp.spaces[select_index]); } } - -void ticket_tab_files_tab(Info & i) +void ticket_tab_file_tab(Info & i) { - files_number = i.iter; + ticket_tab_check_reqid(); - if( has_value && conf_index < ticket_info.cur_conf->spaces.size() ) + if( value.is_value && !value.is_in_ticket_par ) { - if( i.iter == 0 ) + if( !i.is_for || i.is_for_first_iter ) { - // first iteration, we are using the par_index found by previous call to ticket_tab - i.res = true; - return; + ticket_file_index = 0; + ticket_file_number = 0; } else { - // next iteration, we are looking for the next par_index - PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index]; - - long param = sp.Long(L"id"); - - for(++par_index ; par_index < ticket_info.ticket->par_tab.size() ; ++par_index) - { - if( ticket_info.ticket->par_tab[par_index].param == param ) - { - i.res = true; - return; - } - } - - // there are no more such items - has_value = false; - i.res = false; + ticket_file_index += 1; } + + PT::Space & mt = *value.value_meta; + + while( ticket_file_index < mt.spaces.size() && mt.spaces[ticket_file_index]->name != L"file" ) + ticket_file_index += 1; + + i.res = (ticket_file_index < mt.spaces.size()); + + if( i.res && i.is_for && i.iter > 0 ) + ticket_file_number += 1; } } -void ticket_tab_files_tab_index(Info & i) +void ticket_tab_file_tab_index(Info & i) { - i.out << files_number; + ticket_tab_check_reqid(); + + if( value.is_value && !value.is_in_ticket_par ) + { + PT::Space & mt = *value.value_meta; + + if( ticket_file_index < mt.spaces.size() ) + i.out << ticket_file_number; + } +} + + +void ticket_tab_file_tab_path(Info & i) +{ + ticket_tab_check_reqid(); + + if( value.is_value && !value.is_in_ticket_par ) + { + PT::Space & mt = *value.value_meta; + + if( ticket_file_index < mt.spaces.size() ) + i.out << mt.spaces[ticket_file_index]->Text(L"path"); + } +} + +void ticket_tab_file_tab_itemid(Info & i) +{ + ticket_tab_check_reqid(); + + if( value.is_value && !value.is_in_ticket_par ) + { + PT::Space & mt = *value.value_meta; + + if( ticket_file_index < mt.spaces.size() ) + i.out << mt.spaces[ticket_file_index]->Text(L"itemid"); + } +} + +void ticket_tab_file_tab_meta(Info & i) +{ + ticket_tab_check_reqid(); + + if( value.is_value && !value.is_in_ticket_par ) + { + PT::Space & mt = *value.value_meta; + + if( ticket_file_index < mt.spaces.size() ) + space(i, *mt.spaces[ticket_file_index]); + } } @@ -628,42 +794,43 @@ using namespace ns_ticket_tab; fun->Insert("ticket_can_create", ticket_can_create); fun->Insert("ticket_can_edit", ticket_can_edit); + fun->Insert("ticket_is_creating_new", ticket_is_creating_new); fun->Insert("tickets_tab", tickets_tab); fun->Insert("tickets_tab_url", tickets_tab_url); fun->Insert("tickets_tab_subject_empty", tickets_tab_subject_empty); fun->Insert("tickets_tab_subject", tickets_tab_subject); - // you should provide an id (param) as a first parameter - fun->Insert("tickets_tab_has_value", tickets_tab_has_value); - fun->Insert("tickets_tab_value_int", tickets_tab_value_int); - fun->Insert("tickets_tab_value_meta", tickets_tab_value_meta); - fun->Insert("tickets_tab_conf_tab", tickets_tab_conf_tab); fun->Insert("tickets_tab_conf_tab_has_value", tickets_tab_conf_tab_has_value); fun->Insert("tickets_tab_conf_tab_value", tickets_tab_conf_tab_value); - fun->Insert("tickets_tab_conf_tab_type_is", tickets_tab_conf_tab_type_is); fun->Insert("tickets_tab_conf_tab_progress_image_number", tickets_tab_conf_tab_progress_image_number); fun->Insert("ticket_tab", ticket_tab); - fun->Insert("ticket_tab_param_id", ticket_tab_param_id); fun->Insert("ticket_tab_param_name", ticket_tab_param_name); + fun->Insert("ticket_tab_has_value", ticket_tab_has_value); fun->Insert("ticket_tab_value", ticket_tab_value); fun->Insert("ticket_tab_value_int", ticket_tab_value_int); + fun->Insert("ticket_tab_value_dec", ticket_tab_value_dec); fun->Insert("ticket_tab_value_meta", ticket_tab_value_meta); fun->Insert("ticket_tab_type_is", ticket_tab_type_is); fun->Insert("ticket_tab_select_tab", ticket_tab_select_tab); fun->Insert("ticket_tab_select_tab_is_selected", ticket_tab_select_tab_is_selected); - fun->Insert("ticket_tab_select_tab_id", ticket_tab_select_tab_id); fun->Insert("ticket_tab_select_tab_name", ticket_tab_select_tab_name); + fun->Insert("ticket_tab_select_tab_id", ticket_tab_select_tab_id); + fun->Insert("ticket_tab_select_tab_meta", ticket_tab_select_tab_meta); + + fun->Insert("ticket_tab_file_tab", ticket_tab_file_tab); + fun->Insert("ticket_tab_file_tab_index", ticket_tab_file_tab_index); + fun->Insert("ticket_tab_file_tab_path", ticket_tab_file_tab_path); + fun->Insert("ticket_tab_file_tab_itemid", ticket_tab_file_tab_itemid); + fun->Insert("ticket_tab_file_tab_meta", ticket_tab_file_tab_meta); - fun->Insert("ticket_tab_files_tab", ticket_tab_files_tab); - fun->Insert("ticket_tab_files_tab_index", ticket_tab_files_tab_index); } diff --git a/plugins/ticket/ticket.h b/plugins/ticket/ticket.h index 570e271..36bbb2a 100755 --- a/plugins/ticket/ticket.h +++ b/plugins/ticket/ticket.h @@ -24,7 +24,7 @@ struct Ticket { long param; long intv; - std::wstring decv; // !! temporarily as a string (in the future there'll be a Dec type from ttmath) + std::wstring decv; // !! temporarily as a string (in the future there'll be a Dec type from ttmath) void Clear() { @@ -40,16 +40,19 @@ struct Ticket }; long file_id; - std::vector par_tab; - - // auxiliary object used during sorting - //unsigned long sort_id; + typedef std::vector ParTab; + ParTab par_tab; + + + Ticket() + { + Clear(); + } void Clear() { - file_id = -1; + file_id = -1; par_tab.clear(); - //sort_id = 0; } @@ -61,19 +64,11 @@ struct Ticket } }; - void SortParTab() { std::sort(par_tab.begin(), par_tab.end(), Sort()); } - - - - Ticket() - { - Clear(); - } }; diff --git a/plugins/ticket/ticketinfo.cpp b/plugins/ticket/ticketinfo.cpp index ac2a7b3..07303e3 100755 --- a/plugins/ticket/ticketinfo.cpp +++ b/plugins/ticket/ticketinfo.cpp @@ -67,15 +67,19 @@ void TicketInfo::Clear() { ticket = &ticket_empty; item = &item_empty; + ticket->Clear(); item->Clear(); // we use meta from item which should not be const cur_conf_wrap = &cur_conf_wrap_empty; cur_conf = &cur_conf_empty; + cur_conf->Clear(); item_tab.clear(); ticket_tab.clear(); item_sort_tab.clear(); + + create_new_ticket = false; } @@ -333,7 +337,6 @@ return false; void TicketInfo::ReadTicketValue(PT::Space & space, long param_id, const PostFile & value, - std::vector & file_map, PT::Space & meta, Item & upload_dir) { @@ -349,20 +352,17 @@ void TicketInfo::ReadTicketValue(PT::Space & space, if( cur->request->status == WINIX_ERR_OK ) { - PT::Space & sp = meta.AddSpace(L"param"); - - sp.Add(L"id", param_id); + PT::Space & space = FindAddMetaByParam(meta, param_id); + PT::Space & file_space = space.AddSpace(L"file"); if( file.file_type == WINIX_ITEM_FILETYPE_IMAGE ) - sp.Add(L"type", L"image"); + file_space.Add(L"type", L"image"); else - sp.Add(L"type", L"file"); + file_space.Add(L"type", L"file"); - sp.Add(L"file_id", file.id); + file_space.Add(L"itemid", file.id); system->MakePath(file, file_path); - sp.Add(L"path", file_path); - - file_map.push_back(file.id); + file_space.Add(L"path", file_path); } else { @@ -372,21 +372,24 @@ void TicketInfo::ReadTicketValue(PT::Space & space, void TicketInfo::ReadTicketValue(PT::Space & space, - long param_id, const PostFile & value, std::vector & file_map, PT::Space & meta) + long param_id, const PostFile & value, PT::Space & meta) { - if( space.Text(L"type") == L"images" || - space.Text(L"type") == L"files" ) + if( space.Text(L"type") == L"images" || space.Text(L"type") == L"files" ) { std::wstring & upload_path = space.Text(L"upload_dir"); - Item * upload_dir = system->dirs.GetDir(upload_path); - if( upload_dir ) + if( !upload_path.empty() ) { - ReadTicketValue(space, param_id, value, file_map, meta, *upload_dir); + Item * upload_dir = system->dirs.GetDir(upload_path); + + if( upload_dir ) + ReadTicketValue(space, param_id, value, meta, *upload_dir); + else + log << log1 << "Ticket: there is no an upload directory: " << upload_path << logend; } else { - log << log1 << "Ticket: there is no an upload directory: " << upload_path << logend; + log << log1 << "Ticket: you must set 'upload_dir' directory in the config" << logend; } } } @@ -439,15 +442,15 @@ void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstr // always adds a new parameter -void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const PostFile & value, std::vector & file_map, PT::Space & meta) +void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, PT::Space & meta) { for(size_t i=0 ; ispaces.size() ; ++i) { PT::Space & space = *cur_conf->spaces[i]; - if( space.name == L"param" && Tol(space.Text(L"id")) == param_id ) + if( space.name == L"param" && space.Long(L"id") == param_id ) { - ReadTicketValue(space, param_id, value, file_map, meta); + ReadTicketValue(space, param_id, value, meta); return; } } @@ -457,7 +460,7 @@ void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const PostFile -void TicketInfo::ReadTicketParams(Ticket & ticket, bool clear_ticket, std::vector & file_map, PT::Space & meta) +void TicketInfo::ReadTicketParams(Ticket & ticket, bool clear_ticket, PT::Space & meta) { PostTab::iterator i; PostFileTab::iterator i2; @@ -465,18 +468,16 @@ PostFileTab::iterator i2; if( clear_ticket ) ticket.Clear(); - PT::Space & ticket_meta = meta.FindAddSpace(L"ticket"); - for(i=cur->request->post_tab.begin() ; i!=cur->request->post_tab.end() ; ++i) { if( IsSubString(config->ticket_form_prefix, i->first) ) - ReadTicketParam(ticket, Tol(i->first.c_str() + config->ticket_form_prefix.size()), i->second, ticket_meta); + ReadTicketParam(ticket, Tol(i->first.c_str() + config->ticket_form_prefix.size()), i->second, meta); } for(i2=cur->request->post_file_tab.begin() ; i2!=cur->request->post_file_tab.end() ; ++i2) { if( IsSubString(config->ticket_form_prefix, i2->first) ) - ReadTicketParam(ticket, Tol(i2->first.c_str() + config->ticket_form_prefix.size()), i2->second, file_map, ticket_meta); + ReadTicketParam(Tol(i2->first.c_str() + config->ticket_form_prefix.size()), i2->second, meta); } ticket.SortParTab(); @@ -505,5 +506,12 @@ void TicketInfo::RemoveTicket(long file_id) } +void TicketInfo::CopyTicketSpace(PT::Space & ticket_space, Item & item) +{ + PT::Space & ticket_meta = item.meta.FindAddSpace(L"ticket"); + ticket_meta = ticket_space; + ticket_meta.name = L"ticket"; +} + } // namespace diff --git a/plugins/ticket/ticketinfo.h b/plugins/ticket/ticketinfo.h index 9066139..949eea4 100755 --- a/plugins/ticket/ticketinfo.h +++ b/plugins/ticket/ticketinfo.h @@ -55,11 +55,16 @@ public: void Clear(); // current ticket for templates - const Ticket * ticket; + Ticket * ticket; // current item for templates + // !! zobaczyc czy sie da na conts zamienic + // teraz zmieniona obsluga templatow wiec moze sie da Item * item; + // true if 'createticket' function is creating a new ticket + bool create_new_ticket; + // for displaying all tickets in a directory std::vector item_tab; // !! in the future we'll use cur->request->item_tab[number] (an array of arrays) std::vector ticket_tab; @@ -93,8 +98,9 @@ public: void ReadTicketConf(bool skip_existing_configs = false); void FindCurrentConf(); - void ReadTicketParams(Ticket & ticket, bool clear_ticket, std::vector & file_map, PT::Space & meta); + void ReadTicketParams(Ticket & ticket, bool clear_ticket, PT::Space & meta); void RemoveTicket(long file_id); + void CopyTicketSpace(PT::Space & ticket_space, Item & item); private: @@ -121,8 +127,8 @@ private: // (we don't want to use empty pointers) TicketConfWrap cur_conf_wrap_empty; PT::Space cur_conf_empty; - const Ticket ticket_empty; - Item item_empty; + Ticket ticket_empty; + Item item_empty; // for removing a ticket Ticket rm_ticket; @@ -138,11 +144,11 @@ private: void CheckMinMaxValue(PT::Space & space, Ticket::TicketParam & par); bool ReadTicketValue(PT::Space & space, long param_id, Ticket::TicketParam & par, const std::wstring & value, PT::Space & meta); - void ReadTicketValue(PT::Space & space, long param_id, const PostFile & value, std::vector & file_map, PT::Space & meta, Item & upload_dir); - void ReadTicketValue(PT::Space & space, long param_id, const PostFile & value, std::vector & file_map, PT::Space & meta); + void ReadTicketValue(PT::Space & space, long param_id, const PostFile & value, PT::Space & meta, Item & upload_dir); + void ReadTicketValue(PT::Space & space, long param_id, const PostFile & value, PT::Space & meta); void ReadTicketParam(PT::Space & space, Ticket & ticket, long param_id, const std::wstring & value, PT::Space & meta); void ReadTicketParam(Ticket & ticket, long param_id, const std::wstring & value, PT::Space & meta); - void ReadTicketParam(Ticket & ticket, long param_id, const PostFile & value, std::vector & file_map, PT::Space & meta); + void ReadTicketParam(long param_id, const PostFile & value, PT::Space & meta); };