- added to FunctionBase: bool register_default_models (default true)

if true then winix will add default models for ezc templates such as "request", "item", etc.
- some methods from templates/item.cpp moved to Item
This commit is contained in:
2021-06-20 18:04:50 +02:00
parent e7c7324058
commit 79eda7abb0
21 changed files with 271 additions and 83 deletions

View File

@@ -67,12 +67,6 @@ void Cat::MakeGet()
}
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
// IMPROVEME this will be put by a generic method from winix
// if output is html
cur->request->models.Add(L"item", cur->request->item);
////////////////////////////////////////////////////////////
}

View File

@@ -47,6 +47,7 @@ FunctionBase::FunctionBase()
template_index = size_t(-1);
need_ssl = false;
need_session = true;
register_default_models = true;
fun.item_content.user_id = -1;
fun.item_content.group_id = -1;

View File

@@ -86,6 +86,11 @@ public:
// if false then a temporary session is used
bool need_session;
// true if the function allows to register default models such as 'request', 'item', etc.
// default: true
bool register_default_models;
virtual void Init();
virtual bool HasAccess();
virtual void MakePost();

View File

@@ -102,16 +102,6 @@ void Ls::MakeGet()
cur->request->models.Add(L"items", item_tab);
cur->request->models.Add(L"child_dirs", dir_tab);
}
// IMPROVEME this will be put by a generic method from winix
// if output is html
cur->request->models.Add(L"request", cur->request);
if( cur->request->is_item )
{
cur->request->models.Add(L"item", cur->request->item);
}
////////////////////////////////////////////////////////////
}