added: to templates: an interface for getting information from Space
miscspace.h, miscspace.cpp changed: plugin ticket now as a config we use a PT::Space struct (not finished yet, only 'integer', 'select' and 'progress' are done) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@794 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -18,7 +18,8 @@
|
||||
#include "templates/templates.h"
|
||||
#include "sessiondata.h"
|
||||
#include "plugins/thread/pluginmsg.h"
|
||||
|
||||
#include "templates/miscspace.h"
|
||||
#include "confparser/space.h"
|
||||
|
||||
|
||||
namespace Ticket
|
||||
@@ -47,10 +48,31 @@ return percent;
|
||||
}
|
||||
|
||||
|
||||
PT::Space & find_add_meta_for_param(PT::Space & meta, long param_id)
|
||||
{
|
||||
for(size_t i=0 ; i<meta.spaces.size() ; ++i)
|
||||
{
|
||||
PT::Space & sp = *meta.spaces[i];
|
||||
|
||||
// !! moze lepiej najpierw zamienic na string i pozniej tylko stringi porownywac (performance)
|
||||
|
||||
if( sp.name == L"param" && sp.Long(L"id") == param_id )
|
||||
{
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PT::Space & sp = meta.AddSpace(L"param");
|
||||
sp.Add(L"id", param_id);
|
||||
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// binary search for param in ticket.par_tab (ticket.par_tab must be sorted by 'param')
|
||||
// !! zmienic nazwe na find_ticket_param
|
||||
bool find_ticket_value(long param, const Ticket & ticket, size_t & ticket_par_index)
|
||||
bool find_ticket_param(long param, const Ticket & ticket, size_t & ticket_par_index)
|
||||
{
|
||||
if( ticket.par_tab.empty() )
|
||||
return false;
|
||||
@@ -69,6 +91,8 @@ bool find_ticket_value(long param, const Ticket & ticket, size_t & ticket_par_in
|
||||
|
||||
if( ticket.par_tab[o2].param == param )
|
||||
{
|
||||
// looking for the first param
|
||||
// (there can be more params with the same 'param' value)
|
||||
while( o2 > 0 && ticket.par_tab[o2-1].param == param )
|
||||
--o2;
|
||||
|
||||
@@ -105,36 +129,38 @@ return false;
|
||||
|
||||
|
||||
|
||||
void ticket_print_value(Info & i, size_t conf_index, const Ticket::TicketParam & ticket_param)
|
||||
void ticket_print_value(Info & i, PT::Space & space, const Ticket::TicketParam & ticket_param, PT::Space & meta)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index];
|
||||
std::wstring & type = space.Text(L"type");
|
||||
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeInteger ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeProgress )
|
||||
if( type == L"integer" || type == L"progress" )
|
||||
{
|
||||
i.out << ticket_param.intv;
|
||||
}
|
||||
else
|
||||
if( type == L"select" )
|
||||
{
|
||||
for(size_t a=0 ; a<space.spaces.size() ; ++a)
|
||||
{
|
||||
i.out << ticket_param.int_value;
|
||||
}
|
||||
else
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeSelect )
|
||||
{
|
||||
if( ticket_param.int_value < (int)conf_item.select.size() )
|
||||
i.out << conf_item.select[ticket_param.int_value].name;
|
||||
}
|
||||
else
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeString ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeMultistring )
|
||||
{
|
||||
i.out << ticket_param.str_value;
|
||||
}
|
||||
else
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeImages ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeFiles )
|
||||
{
|
||||
i.out << ticket_param.str_value;
|
||||
PT::Space & sp = *space.spaces[a];
|
||||
|
||||
if( sp.name == L"option" && Tol(sp.Text(L"id")) == ticket_param.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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +186,7 @@ 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->tab
|
||||
static size_t conf_tab_index; // index for: ticket_info.cur_conf->spaces
|
||||
static bool has_ticket;
|
||||
static bool has_value;
|
||||
|
||||
@@ -249,6 +275,7 @@ void tickets_tab_subject(Info & i)
|
||||
}
|
||||
|
||||
|
||||
// !! do czego to w ogole sluzy?
|
||||
void tickets_tab_has_value(Info & i)
|
||||
{
|
||||
if( has_ticket && ticket_index < ticket_info.ticket_tab.size() )
|
||||
@@ -257,37 +284,43 @@ void tickets_tab_has_value(Info & i)
|
||||
long id = Tol(i.par);
|
||||
Ticket & ticket = ticket_info.ticket_tab[ticket_index];
|
||||
|
||||
if( find_ticket_value(id, ticket, par_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 id = Tol(i.par);
|
||||
long param = Tol(i.par);
|
||||
Ticket & ticket = ticket_info.ticket_tab[ticket_index];
|
||||
|
||||
if( find_ticket_value(id, ticket, par_index) )
|
||||
i.out << ticket.par_tab[par_index].int_value;
|
||||
if( find_ticket_param(param, ticket, par_index) )
|
||||
i.out << ticket.par_tab[par_index].intv;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tickets_tab_value_str(Info & i)
|
||||
// !! czy to w ogole jest gdzies uzywane?
|
||||
void tickets_tab_value_meta(Info & i)
|
||||
{
|
||||
if( has_ticket && ticket_index < ticket_info.ticket_tab.size() )
|
||||
if( has_ticket &&
|
||||
item_sort_index < ticket_info.item_sort_tab.size() &&
|
||||
ticket_index < ticket_info.ticket_tab.size() )
|
||||
{
|
||||
size_t par_index;
|
||||
long id = Tol(i.par);
|
||||
Ticket & ticket = ticket_info.ticket_tab[ticket_index];
|
||||
long param = Tol(i.par);
|
||||
|
||||
if( find_ticket_value(id, ticket, par_index) )
|
||||
i.out << ticket.par_tab[par_index].str_value;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,14 +335,24 @@ void tickets_tab_conf_tab(Info & i)
|
||||
item_sort_index < ticket_info.item_sort_tab.size() &&
|
||||
ticket_index < ticket_info.ticket_tab.size() )
|
||||
{
|
||||
conf_tab_index = i.iter;
|
||||
i.res = conf_tab_index < ticket_info.cur_conf->tab.size();
|
||||
if( i.iter == 0 )
|
||||
conf_tab_index = 0;
|
||||
else
|
||||
conf_tab_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;
|
||||
|
||||
i.res = conf_tab_index < space.spaces.size();
|
||||
|
||||
if( i.res )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
PT::Space & sp = *space.spaces[conf_tab_index];
|
||||
const Ticket & ticket = ticket_info.ticket_tab[ticket_index];
|
||||
has_value = find_ticket_value(conf_item.id, ticket, par_index);
|
||||
has_value = find_ticket_param(sp.Long(L"id"), ticket, par_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,82 +367,30 @@ void tickets_tab_conf_tab_has_value(Info & i)
|
||||
void tickets_tab_conf_tab_value(Info & i)
|
||||
{
|
||||
if( has_value &&
|
||||
item_sort_index < ticket_info.item_sort_tab.size() &&
|
||||
ticket_index < ticket_info.ticket_tab.size() &&
|
||||
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() )
|
||||
{
|
||||
ticket_print_value(i, conf_tab_index, ticket_info.ticket_tab[ticket_index].par_tab[par_index]);
|
||||
PT::Space & space = *ticket_info.cur_conf->spaces[conf_tab_index];
|
||||
|
||||
// !! 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_integer(Info & i)
|
||||
void tickets_tab_conf_tab_type_is(Info & i)
|
||||
{
|
||||
if( conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
if( conf_tab_index < ticket_info.cur_conf->spaces.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeInteger;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_progress(Info & i)
|
||||
{
|
||||
if( conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeProgress;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_select(Info & i)
|
||||
{
|
||||
if( conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeSelect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_string(Info & i)
|
||||
{
|
||||
if( conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_multistring(Info & i)
|
||||
{
|
||||
if( conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeMultistring;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_images(Info & i)
|
||||
{
|
||||
if( conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeImages;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_files(Info & i)
|
||||
{
|
||||
if( conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeFiles;
|
||||
PT::Space & space = *ticket_info.cur_conf->spaces[conf_tab_index];
|
||||
i.res = (space.Text(L"type") == i.par);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +401,7 @@ void tickets_tab_conf_tab_progress_image_number(Info & i)
|
||||
ticket_index < ticket_info.ticket_tab.size() &&
|
||||
par_index < ticket_info.ticket_tab[ticket_index].par_tab.size() )
|
||||
{
|
||||
int progress = ticket_info.ticket_tab[ticket_index].par_tab[par_index].int_value;
|
||||
int progress = ticket_info.ticket_tab[ticket_index].par_tab[par_index].intv;
|
||||
i.out << ticket_calc_progress_image_number(progress);
|
||||
}
|
||||
}
|
||||
@@ -425,8 +416,8 @@ 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->tab
|
||||
static size_t select_index; // index for: ticket_info.cur_conf->tab[conf_index].select
|
||||
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;
|
||||
@@ -435,13 +426,23 @@ static bool has_value;
|
||||
|
||||
void ticket_tab(Info & i)
|
||||
{
|
||||
conf_index = i.iter;
|
||||
i.res = conf_index < ticket_info.cur_conf->tab.size();
|
||||
if( i.iter == 0 )
|
||||
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;
|
||||
|
||||
i.res = conf_index < space.spaces.size();
|
||||
|
||||
if( i.res )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index];
|
||||
has_value = find_ticket_value(conf_item.id, *ticket_info.ticket, par_index);
|
||||
PT::Space & sp = *space.spaces[conf_index];
|
||||
has_value = find_ticket_param(sp.Long(L"id"), *ticket_info.ticket, par_index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,110 +450,98 @@ void ticket_tab(Info & i)
|
||||
|
||||
void ticket_tab_param_id(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.out << ticket_info.cur_conf->tab[conf_index].id;
|
||||
if( conf_index < ticket_info.cur_conf->spaces.size() )
|
||||
i.out << ticket_info.cur_conf->spaces[conf_index]->Long(L"id");
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_param_name(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.out << ticket_info.cur_conf->tab[conf_index].name;
|
||||
if( conf_index < ticket_info.cur_conf->spaces.size() )
|
||||
i.out << ticket_info.cur_conf->spaces[conf_index]->Text(L"name");
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_value(Info & i)
|
||||
{
|
||||
if( has_value && par_index < ticket_info.ticket->par_tab.size() )
|
||||
ticket_print_value(i, conf_index, ticket_info.ticket->par_tab[par_index]);
|
||||
// !! has_value mowi tylko czy opcja byla w tabeli tickets
|
||||
// nalezy dodac aby has_value mialo obsluge meta (albo sie pozbyc go w ogole...)
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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].int_value;
|
||||
i.out << ticket_info.ticket->par_tab[par_index].intv;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_value_str(Info & i)
|
||||
void ticket_tab_value_meta(Info & i)
|
||||
{
|
||||
if( has_value && par_index < ticket_info.ticket->par_tab.size() )
|
||||
i.out << ticket_info.ticket->par_tab[par_index].str_value;
|
||||
{
|
||||
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"));
|
||||
|
||||
space(i, meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_integer(Info & i)
|
||||
void ticket_tab_type_is(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeInteger;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_progress(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeProgress;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_select(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeSelect;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_string(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeString;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_multistring(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeMultistring;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_images(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeImages;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_files(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeFiles;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_select_tab(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
if( conf_index < ticket_info.cur_conf->spaces.size() )
|
||||
{
|
||||
select_index = i.iter;
|
||||
i.res = select_index < ticket_info.cur_conf->tab[conf_index].select.size();
|
||||
if( i.iter == 0 )
|
||||
select_index = 0;
|
||||
else
|
||||
select_index += 1;
|
||||
|
||||
PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index];
|
||||
|
||||
for( ; select_index < sp.spaces.size() ; ++select_index)
|
||||
if( sp.spaces[select_index]->name == L"option" )
|
||||
break;
|
||||
|
||||
i.res = (select_index < sp.spaces.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_select_tab_is_selected(Info & i)
|
||||
{
|
||||
if( has_value && par_index < ticket_info.ticket->par_tab.size() )
|
||||
if( conf_index < ticket_info.cur_conf->spaces.size() &&
|
||||
select_index < ticket_info.cur_conf->spaces[conf_index]->spaces.size() )
|
||||
{
|
||||
i.res = select_index == (size_t)ticket_info.ticket->par_tab[par_index].int_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() &&
|
||||
select_index < ticket_info.cur_conf->tab[conf_index].select.size() )
|
||||
PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index];
|
||||
long id = sp.spaces[select_index]->Long(L"id");
|
||||
|
||||
if( has_value && par_index < ticket_info.ticket->par_tab.size() )
|
||||
{
|
||||
i.res = select_index == ticket_info.cur_conf->tab[conf_index].select_default;
|
||||
i.res = (id == ticket_info.ticket->par_tab[par_index].intv);
|
||||
}
|
||||
else
|
||||
{
|
||||
i.res = (id == sp.Long(L"default"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -560,20 +549,20 @@ void ticket_tab_select_tab_is_selected(Info & i)
|
||||
|
||||
void ticket_tab_select_tab_name(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() &&
|
||||
select_index < ticket_info.cur_conf->tab[conf_index].select.size() )
|
||||
if( conf_index < ticket_info.cur_conf->spaces.size() &&
|
||||
select_index < ticket_info.cur_conf->spaces[conf_index]->spaces.size() )
|
||||
{
|
||||
i.out << ticket_info.cur_conf->tab[conf_index].select[select_index].name;
|
||||
i.out << ticket_info.cur_conf->spaces[conf_index]->spaces[select_index]->Text(L"value");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_select_tab_id(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() &&
|
||||
select_index < ticket_info.cur_conf->tab[conf_index].select.size() )
|
||||
if( conf_index < ticket_info.cur_conf->spaces.size() &&
|
||||
select_index < ticket_info.cur_conf->spaces[conf_index]->spaces.size() )
|
||||
{
|
||||
i.out << ticket_info.cur_conf->tab[conf_index].select[select_index].id;
|
||||
i.out << ticket_info.cur_conf->spaces[conf_index]->spaces[select_index]->Text(L"id");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,7 +573,7 @@ void ticket_tab_files_tab(Info & i)
|
||||
{
|
||||
files_number = i.iter;
|
||||
|
||||
if( has_value && conf_index < ticket_info.cur_conf->tab.size() )
|
||||
if( has_value && conf_index < ticket_info.cur_conf->spaces.size() )
|
||||
{
|
||||
if( i.iter == 0 )
|
||||
{
|
||||
@@ -595,11 +584,13 @@ void ticket_tab_files_tab(Info & i)
|
||||
else
|
||||
{
|
||||
// next iteration, we are looking for the next par_index
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_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 == conf_item.id )
|
||||
if( ticket_info.ticket->par_tab[par_index].param == param )
|
||||
{
|
||||
i.res = true;
|
||||
return;
|
||||
@@ -646,19 +637,13 @@ using namespace ns_ticket_tab;
|
||||
// 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_str", tickets_tab_value_str);
|
||||
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_is_integer", tickets_tab_conf_tab_is_integer);
|
||||
fun->Insert("tickets_tab_conf_tab_is_progress", tickets_tab_conf_tab_is_progress);
|
||||
fun->Insert("tickets_tab_conf_tab_is_select", tickets_tab_conf_tab_is_select);
|
||||
fun->Insert("tickets_tab_conf_tab_is_string", tickets_tab_conf_tab_is_string);
|
||||
fun->Insert("tickets_tab_conf_tab_is_multistring", tickets_tab_conf_tab_is_multistring);
|
||||
fun->Insert("tickets_tab_conf_tab_is_images", tickets_tab_conf_tab_is_images);
|
||||
fun->Insert("tickets_tab_conf_tab_is_files", tickets_tab_conf_tab_is_files);
|
||||
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);
|
||||
|
||||
|
||||
@@ -669,15 +654,8 @@ using namespace ns_ticket_tab;
|
||||
fun->Insert("ticket_tab_param_name", ticket_tab_param_name);
|
||||
fun->Insert("ticket_tab_value", ticket_tab_value);
|
||||
fun->Insert("ticket_tab_value_int", ticket_tab_value_int);
|
||||
fun->Insert("ticket_tab_value_str", ticket_tab_value_str);
|
||||
|
||||
fun->Insert("ticket_tab_is_integer", ticket_tab_is_integer);
|
||||
fun->Insert("ticket_tab_is_progress", ticket_tab_is_progress);
|
||||
fun->Insert("ticket_tab_is_select", ticket_tab_is_select);
|
||||
fun->Insert("ticket_tab_is_string", ticket_tab_is_string);
|
||||
fun->Insert("ticket_tab_is_multistring", ticket_tab_is_multistring);
|
||||
fun->Insert("ticket_tab_is_images", ticket_tab_is_images);
|
||||
fun->Insert("ticket_tab_is_files", ticket_tab_is_files);
|
||||
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);
|
||||
|
Reference in New Issue
Block a user