some methods from templates/item.cpp moved to ItemContent
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "core/request.h"
|
||||
#include "core/users.h"
|
||||
#include "core/groups.h"
|
||||
#include "templates/miscspace.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -88,6 +89,8 @@ void ItemContent::fields()
|
||||
field(L"print_content", &ItemContent::print_content);
|
||||
field(L"has_static_file", &ItemContent::has_static_file);
|
||||
field(L"privileges_octal", &ItemContent::privileges_octal);
|
||||
field(L"has_user", &ItemContent::has_user);
|
||||
field(L"has_group", &ItemContent::has_group);
|
||||
field(L"user", &ItemContent::user);
|
||||
field(L"group", &ItemContent::group);
|
||||
field(L"type_is", &ItemContent::type_is);
|
||||
@@ -101,6 +104,19 @@ void ItemContent::fields()
|
||||
field(L"has_thumb", &ItemContent::has_thumb);
|
||||
field(L"display_user_name", &ItemContent::display_user_name);
|
||||
|
||||
field(L"meta_to_str", &ItemContent::meta_to_str);
|
||||
field(L"meta_prop", &ItemContent::meta_prop);
|
||||
field(L"meta_prop_no_escape", &ItemContent::meta_prop_no_escape);
|
||||
field(L"meta_prop_tab", &ItemContent::meta_prop_tab);
|
||||
field(L"meta_prop_tab_value", &ItemContent::meta_prop_tab_value);
|
||||
field(L"meta_prop_tab_has_next",&ItemContent::meta_prop_tab_has_next);
|
||||
|
||||
field(L"admin_meta_to_str", &ItemContent::admin_meta_to_str);
|
||||
field(L"admin_meta_prop", &ItemContent::admin_meta_prop);
|
||||
field(L"admin_meta_prop_no_escape", &ItemContent::admin_meta_prop_no_escape);
|
||||
field(L"admin_meta_prop_tab", &ItemContent::admin_meta_prop_tab);
|
||||
field(L"admin_meta_prop_tab_value", &ItemContent::admin_meta_prop_tab_value);
|
||||
field(L"admin_meta_prop_tab_has_next", &ItemContent::admin_meta_prop_tab_has_next);
|
||||
|
||||
|
||||
// IMPROVEME prepare a setter functions which tests whether content_raw_type_helper and content_parsed_type_helper are correct values
|
||||
@@ -433,6 +449,17 @@ void ItemContent::privileges_octal(EzcEnv & env)
|
||||
}
|
||||
|
||||
|
||||
bool ItemContent::has_user() const
|
||||
{
|
||||
return user_id != -1;
|
||||
}
|
||||
|
||||
|
||||
bool ItemContent::has_group() const
|
||||
{
|
||||
return group_id != -1;
|
||||
}
|
||||
|
||||
void ItemContent::user(morm::ModelWrapper ** model_wrapper)
|
||||
{
|
||||
Users * users = get_users();
|
||||
@@ -576,5 +603,75 @@ void ItemContent::display_user_name(EzcEnv & env)
|
||||
}
|
||||
|
||||
|
||||
void ItemContent::meta_to_str(EzcEnv & env)
|
||||
{
|
||||
meta.serialize_to_space_stream(env.out, true);
|
||||
}
|
||||
|
||||
void ItemContent::meta_prop(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_value(env, meta);
|
||||
}
|
||||
|
||||
void ItemContent::meta_prop_no_escape(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_value(env, meta, false);
|
||||
}
|
||||
|
||||
|
||||
void ItemContent::meta_prop_tab(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_list_tab(env, meta);
|
||||
}
|
||||
|
||||
void ItemContent::meta_prop_tab_value(EzcEnv & env)
|
||||
{
|
||||
// FIXME there is no "item_meta_tab" now
|
||||
TemplatesFunctions::space_list_tab_value(env, meta, L"item_meta_tab");
|
||||
}
|
||||
|
||||
void ItemContent::meta_prop_tab_has_next(EzcEnv & env)
|
||||
{
|
||||
// FIXME there is no "item_meta_tab" now
|
||||
TemplatesFunctions::space_list_tab_has_next(env, meta, L"item_meta_tab");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ItemContent::admin_meta_to_str(EzcEnv & env)
|
||||
{
|
||||
meta_admin.serialize_to_space_stream(env.out, true);
|
||||
}
|
||||
|
||||
void ItemContent::admin_meta_prop(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_value(env, meta_admin);
|
||||
}
|
||||
|
||||
void ItemContent::admin_meta_prop_no_escape(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_value(env, meta_admin, false);
|
||||
}
|
||||
|
||||
|
||||
void ItemContent::admin_meta_prop_tab(EzcEnv & env)
|
||||
{
|
||||
TemplatesFunctions::space_list_tab(env, meta_admin);
|
||||
}
|
||||
|
||||
void ItemContent::admin_meta_prop_tab_value(EzcEnv & env)
|
||||
{
|
||||
// FIXME there is no "item_admin_meta_tab" now
|
||||
TemplatesFunctions::space_list_tab_value(env, meta_admin, L"item_admin_meta_tab");
|
||||
}
|
||||
|
||||
void ItemContent::admin_meta_prop_tab_has_next(EzcEnv & env)
|
||||
{
|
||||
// FIXME there is no "item_admin_meta_tab" now
|
||||
TemplatesFunctions::space_list_tab_has_next(env, meta_admin, L"item_admin_meta_tab");
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
|
Reference in New Issue
Block a user