updated to the new pikotools api: changed the way how child_spaces are created in Space class
This commit is contained in:
@@ -302,14 +302,19 @@ void TicketInfo::CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par)
|
||||
else
|
||||
if( *type == L"select" )
|
||||
{
|
||||
if( space.child_spaces )
|
||||
{
|
||||
for(size_t a=0 ; a<space.child_spaces->size() ; ++a)
|
||||
{
|
||||
pt::Space & sp = *(*space.child_spaces)[a];
|
||||
pt::Space::TableType * child_table = space.find_child_space_table();
|
||||
|
||||
if( sp.name && *sp.name == L"option" && sp.to_long(L"id") == par.intv )
|
||||
return;
|
||||
if( child_table )
|
||||
{
|
||||
for(pt::Space * sp : *child_table)
|
||||
{
|
||||
if( sp->is_child_space_name(L"option") )
|
||||
{
|
||||
if( sp->to_long(L"id") == par.intv )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,21 +329,26 @@ void TicketInfo::CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par)
|
||||
|
||||
pt::Space & TicketInfo::FindAddMetaByParam(pt::Space & meta, long param)
|
||||
{
|
||||
if( meta.child_spaces )
|
||||
{
|
||||
for(size_t i=0 ; i<meta.child_spaces->size() ; ++i)
|
||||
{
|
||||
pt::Space & sp = *(*meta.child_spaces)[i];
|
||||
pt::Space::TableType * child_table = meta.find_child_space_table();
|
||||
|
||||
if( sp.name && *sp.name == L"param" && sp.to_long(L"id") == param )
|
||||
return sp;
|
||||
if( child_table )
|
||||
{
|
||||
for(pt::Space * sp : *child_table)
|
||||
{
|
||||
if( sp->is_child_space_name(L"param") )
|
||||
{
|
||||
if( sp->to_long(L"id") == param )
|
||||
{
|
||||
return *sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pt::Space & sp = meta.add_child_space(L"param");
|
||||
sp.add(L"id", param);
|
||||
|
||||
return sp;
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
||||
@@ -484,15 +494,15 @@ void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstr
|
||||
{
|
||||
ticket_param.Clear();
|
||||
|
||||
if( cur_conf->child_spaces )
|
||||
{
|
||||
for(size_t i=0 ; i<cur_conf->child_spaces->size() ; ++i)
|
||||
{
|
||||
pt::Space & space = *(*cur_conf->child_spaces)[i];
|
||||
pt::Space::TableType * child_table = cur_conf->find_child_space_table();
|
||||
|
||||
if( space.name && *space.name == L"param" && space.to_long(L"id") == param_id )
|
||||
if( child_table )
|
||||
{
|
||||
for(pt::Space * space : *child_table)
|
||||
{
|
||||
if( space->is_child_space_name(L"param") && space->to_long(L"id") == param_id )
|
||||
{
|
||||
ReadTicketParam(space, ticket, param_id, value, meta);
|
||||
ReadTicketParam(*space, ticket, param_id, value, meta);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -505,16 +515,19 @@ void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstr
|
||||
// always adds a new parameter
|
||||
void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, pt::Space & meta)
|
||||
{
|
||||
if( cur_conf->child_spaces )
|
||||
{
|
||||
for(size_t i=0 ; i<cur_conf->child_spaces->size() ; ++i)
|
||||
{
|
||||
pt::Space & space = *(*cur_conf->child_spaces)[i];
|
||||
pt::Space::TableType * child_table = cur_conf->find_child_space_table();
|
||||
|
||||
if( space.name && *space.name == L"param" && space.to_long(L"id") == param_id )
|
||||
if( child_table )
|
||||
{
|
||||
for(pt::Space * sp : *child_table)
|
||||
{
|
||||
if( sp->is_child_space_name(L"param") )
|
||||
{
|
||||
ReadTicketValue(space, param_id, value, meta);
|
||||
return;
|
||||
if( sp->to_long(L"id") == param_id )
|
||||
{
|
||||
ReadTicketValue(*sp, param_id, value, meta);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -528,39 +541,38 @@ void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, pt::Spac
|
||||
|
||||
bool TicketInfo::DeleteTicketFile(Ticket & ticket, long file_id, pt::Space & meta)
|
||||
{
|
||||
if( meta.child_spaces )
|
||||
pt::Space::TableType * meta_child_table = meta.find_child_space_table();
|
||||
|
||||
if( meta_child_table )
|
||||
{
|
||||
for(size_t i=0 ; i<meta.child_spaces->size() ; ++i)
|
||||
for(pt::Space * param : *meta_child_table)
|
||||
{
|
||||
pt::Space & param = *(*meta.child_spaces)[i];
|
||||
pt::Space::TableType * param_child_table = param->find_child_space_table();
|
||||
|
||||
if( param.name && *param.name == L"param" && param.child_spaces )
|
||||
if( param_child_table && param->is_child_space_name(L"param") )
|
||||
{
|
||||
for(size_t z=0 ; z<param.child_spaces->size() ; ++z)
|
||||
for(size_t z=0 ; z < param_child_table->size() ; ++z)
|
||||
{
|
||||
pt::Space & file = *(*param.child_spaces)[z];
|
||||
pt::Space * file = (*param_child_table)[z];
|
||||
|
||||
if( file.name && *file.name == L"file" )
|
||||
if( file->is_child_space_name(L"file") && file->to_long(L"itemid") == file_id )
|
||||
{
|
||||
if( file.to_long(L"itemid") == file_id )
|
||||
{
|
||||
param.remove_child_space(z);
|
||||
param->remove_child_space(z);
|
||||
|
||||
// !! IMPROVE ME
|
||||
// temporarily we delete the file here
|
||||
// but it should be really deleted when the user will press
|
||||
// the submit button
|
||||
//functions->fun_rm.RemoveFileOrSymlink(file_id, true);
|
||||
// !! IMPROVE ME
|
||||
// temporarily we delete the file here
|
||||
// but it should be really deleted when the user will press
|
||||
// the submit button
|
||||
//functions->fun_rm.RemoveFileOrSymlink(file_id, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user