- updated to the new pikotools api (child spaces were removed)

some plugins need to be fixed yet: ticket, gallery, group, menu
- added current user to default models as "user"
- renamed in User: super_user -> is_super_user, env -> admin_env, pass_hash_salted -> is_pass_hash_salted
- now Users class has a WinixModel as a base class
  some plugin calls have to be fixed yet
- added UserWrapper model with a pointer to User class
- removed from ItemContent: methods for accessing 'meta' and 'admin_meta', now ezc can iterate through Space classes
- fixed in env winix function: if there is "changeuser" parameter then we should only switch the user (not save anything)
This commit is contained in:
2021-06-27 23:31:50 +02:00
parent 472490c239
commit 1d18b7fa12
59 changed files with 1419 additions and 1607 deletions

View File

@@ -302,13 +302,13 @@ void TicketInfo::CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par)
else
if( *type == L"select" )
{
pt::Space::TableType * child_table = space.find_child_space_table();
pt::Space::TableType * child_table = space.get_table(L"ticket_params"); // CHECKME it was space.find_child_space_table();
if( child_table )
{
for(pt::Space * sp : *child_table)
{
if( sp->is_child_space_name(L"option") )
if( sp->is_equal(L"name", L"option") )
{
if( sp->to_long(L"id") == par.intv )
{
@@ -329,13 +329,13 @@ void TicketInfo::CheckMinMaxValue(pt::Space & space, Ticket::TicketParam & par)
pt::Space & TicketInfo::FindAddMetaByParam(pt::Space & meta, long param)
{
pt::Space::TableType * child_table = meta.find_child_space_table();
pt::Space * child_table = meta.get_space(L"params"); // CHECKME it was meta.find_child_space_table();
if( child_table )
if( child_table && child_table->is_table() )
{
for(pt::Space * sp : *child_table)
for(pt::Space * sp : *child_table->get_table() )
{
if( sp->is_child_space_name(L"param") )
if( sp->is_equal(L"name", L"param") )
{
if( sp->to_long(L"id") == param )
{
@@ -344,8 +344,14 @@ pt::Space & TicketInfo::FindAddMetaByParam(pt::Space & meta, long param)
}
}
}
else
if( !child_table )
{
child_table = &meta.add_empty_space(L"params");
}
pt::Space & sp = meta.add_child_space(L"param");
pt::Space & sp = child_table->add_empty_space();
sp.add(L"name", L"param");
sp.add(L"id", param);
return sp;
@@ -419,7 +425,7 @@ void TicketInfo::ReadTicketValue(pt::Space & space,
if( cur->request->status == WINIX_ERR_OK )
{
pt::Space & space = FindAddMetaByParam(meta, param_id);
pt::Space & file_space = space.add_child_space(L"file");
pt::Space & file_space = space.get_add_space(L"file"); // CHECKME it was space.add_child_space(L"file");
if( file.item_content.file_type == WINIX_ITEM_FILETYPE_IMAGE )
file_space.add(L"type", L"image");
@@ -493,14 +499,13 @@ void TicketInfo::ReadTicketParam(pt::Space & space, Ticket & ticket, long param_
void TicketInfo::ReadTicketParam(Ticket & ticket, long param_id, const std::wstring & value, pt::Space & meta)
{
ticket_param.Clear();
pt::Space::TableType * child_table = cur_conf->find_child_space_table();
pt::Space::TableType * child_table = cur_conf->get_table(L"params"); // CHECKME it was cur_conf->find_child_space_table();
if( child_table )
{
for(pt::Space * space : *child_table)
{
if( space->is_child_space_name(L"param") && space->to_long(L"id") == param_id )
if( space->is_equal(L"name", L"param") && space->to_long(L"id") == param_id )
{
ReadTicketParam(*space, ticket, param_id, value, meta);
return;
@@ -515,13 +520,13 @@ 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)
{
pt::Space::TableType * child_table = cur_conf->find_child_space_table();
pt::Space::TableType * child_table = cur_conf->get_table(L"params"); // CHECKME it was cur_conf->find_child_space_table();
if( child_table )
{
for(pt::Space * sp : *child_table)
{
if( sp->is_child_space_name(L"param") )
if( sp->is_equal(L"name", L"param") )
{
if( sp->to_long(L"id") == param_id )
{
@@ -541,6 +546,8 @@ void TicketInfo::ReadTicketParam(long param_id, const PostFile & value, pt::Spac
bool TicketInfo::DeleteTicketFile(Ticket & ticket, long file_id, pt::Space & meta)
{
// FIXME !!!!!!!!!!!!!!1
/*
pt::Space::TableType * meta_child_table = meta.find_child_space_table();
if( meta_child_table )
@@ -572,7 +579,9 @@ bool TicketInfo::DeleteTicketFile(Ticket & ticket, long file_id, pt::Space & met
}
}
*/
return false;
}
@@ -642,7 +651,7 @@ void TicketInfo::RemoveTicket(long file_id)
void TicketInfo::CopyTicketSpace(pt::Space & ticket_space, Item & item)
{
pt::Space & ticket_meta = item.item_content.meta.find_add_child_space(L"ticket");
pt::Space & ticket_meta = item.item_content.meta.get_add_space(L"ticket");
ticket_meta = ticket_space;
}