renamed: ItemContent::meta_admin -> ItemContent::admin_meta

This commit is contained in:
Tomasz Sowa 2021-07-03 01:18:28 +02:00
parent 175dd17416
commit 746aa41111
11 changed files with 76 additions and 57 deletions

View File

@ -73,7 +73,7 @@ bool Meta::EditAdminMeta(Item & item, const std::wstring & meta_str, bool use_se
if( Parse(meta_str) )
{
item.propagate_connector();
item.item_content.meta_admin = space;
item.item_content.admin_meta = space;
//if( db->EditAdminMetaById(space, item_id) == WINIX_ERR_OK )
if( item.item_content.update() )

View File

@ -35,16 +35,12 @@
<div class="uk-form-controls">
<textarea class="uk-textarea" id="winix_content_id" rows="20" name="itemmeta">[ezc clear_all_white_nodes "yes"]
[if winix_function_param_is "a"]
[if request.is_item]
[item.content.admin_meta "dump_to_space" "pretty"]
[else]
[dir_last_admin_meta_str]
[if request.last_item.content.is_admin_meta_object]
[request.last_item.content.admin_meta "dump_to_space" "pretty"]
[end]
[else]
[if request.is_item]
[item.content.meta "dump_to_space" "pretty"]
[else]
[dir_last_meta_str]
[if request.last_item.content.is_meta_object]
[request.last_item.content.meta "dump_to_space" "pretty"]
[end]
[end]
[end]</textarea>

View File

@ -10,7 +10,7 @@
<div class="uk-margin">
<label class="uk-form-label" for="winix_sort_index">{sort_current_sortindex}</label>
<div class="uk-form-controls">
<input class="uk-input" id="winix_sort_index" type="text" name="sortindex" value="[item_sort]">
<input class="uk-input" id="winix_sort_index" type="text" name="sortindex" value="[item.sort_index]">
</div>
</div>
@ -38,13 +38,13 @@
<form class="uk-form-stacked" id="winix_sortable_form" action="[doc_base_url][dir]sort" method="post">
<ul class="uk-list" id="winix_sort_items" data-uk-sortable>
[for item_tab]
<li class="uk-tile uk-tile-muted uk-padding-small uk-padding-remove-top uk-padding-remove-bottom" id="winix_sort_item_[item_tab_index]" style="cursor: move;">
<input class="[if not [winix_function_param_is "index"]]uk-hidden [end]uk-input uk-width-1-6 uk-margin-small-right" type="text" name="sort[item_tab_id]" value="[item_tab_sort]">
<li class="uk-tile uk-tile-muted uk-padding-small uk-padding-remove-top uk-padding-remove-bottom" id="winix_sort_item_[item_tab.sort_index]" style="cursor: move;">
<input class="[if not [winix_function_param_is "index"]]uk-hidden [end]uk-input uk-width-1-6 uk-margin-small-right" type="text" name="sort[item_tab.id]" value="[item_tab.sort_index]">
[# is it correct? may give this 'if' only to /-/thumb param? ]
[if item_tab_has_thumb]<img src="[item_tab_link]/-/thumb" alt="[item_tab_subject]">[end]
[if item_tab.content.file_has_thumb]<img src="[item_tab.link]/-/thumb" alt="[item_tab.subject]">[end]
[item_tab_url][if item_tab_type_is_dir]/[end] [if not [is item_tab_subject ""]]<span class="uk-text-meta">({sort_item.subject}: [item_tab_subject])</span>[end]
[item_tab.url][if item_tab.type_is_dir]/[end] [if not [is item_tab.subject ""]]<span class="uk-text-meta">({sort_item.subject}: [item_tab.subject])</span>[end]
</li>
[end]
</ul>
@ -55,7 +55,7 @@
[if winix_function_param_is "index"]
<div class="uk-margin">
<button class="uk-button uk-button-default auk-button-primary" type="button" id="winix_sort_renumerate">renumeruj</button>
<button class="uk-button uk-button-default auk-button-primary" type="button" id="winix_sort_renumerate">{sort_item_renumber}</button>
</div>
[end]

View File

@ -476,6 +476,7 @@ sort_current_sortindex = Current sort index
sort_info_multi = Set an order of items by using the mouse.
sort_info_multi_index = Set an order of items by providing an index number. You can also set an order of items by using the mouse and then clicking the renumerate button.
sort_item_subject = Subject:
sort_item_renumber = Renumber
stat_header = Stat
stat_item_type = type

View File

@ -493,6 +493,7 @@ sort_current_sortindex = Bieżący indeks sortowania
sort_info_multi = Ustaw kolejność elementów przeciągając je przy pomocy myszki.
sort_info_multi_index = Ustaw kolejność elementów podająć ich indeks. Możesz także ustawić kolejność elementów przeciągając je przy pomocy myszki i następnie kliknąć przycisk Renumeruj.
sort_item_subject = Tytuł:
sort_item_renumber = Renumeruj
stat_header = Stat
stat_item_type = typ

View File

@ -61,35 +61,36 @@ void Item::fields()
int type_helper = static_cast<int>(type);
field(L"id", id, morm::FT::no_insertable | morm::FT::no_updatable | morm::FT::primary_key);
field(L"parent_id", parent_id);
field(L"type", type_helper);
field(L"url", url);
field(L"subject", subject);
field(L"template", html_template);
field(L"sort_index", sort_index);
field(L"content_id", L"content", item_content, morm::FT::foreign_key);
field(L"id", id, morm::FT::no_insertable | morm::FT::no_updatable | morm::FT::primary_key);
field(L"parent_id", parent_id);
field(L"type", type_helper);
field(L"url", url);
field(L"subject", subject);
field(L"template", html_template);
field(L"sort_index", sort_index);
field(L"content_id", L"content", item_content, morm::FT::foreign_key);
field(L"dir_link", &Item::dir_link);
field(L"link", &Item::link);
field(L"is_parent_for_current_dir", &Item::is_parent_for_current_dir);
field(L"is_current_dir", &Item::is_current_dir);
field(L"is_root_dir", &Item::is_root_dir);
field(L"dir_link", &Item::dir_link);
field(L"link", &Item::link);
field(L"type_is_symlink", &Item::type_is_symlink);
field(L"type_is_file", &Item::type_is_file);
field(L"type_is_dir", &Item::type_is_dir);
field(L"type_is_none", &Item::type_is_none);
field(L"is_parent_for_current_dir", &Item::is_parent_for_current_dir);
field(L"is_current_dir", &Item::is_current_dir);
field(L"is_root_dir", &Item::is_root_dir);
field(L"url_is", &Item::url_is);
field(L"type_is_symlink", &Item::type_is_symlink);
field(L"type_is_file", &Item::type_is_file);
field(L"type_is_dir", &Item::type_is_dir);
field(L"type_is_none", &Item::type_is_none);
field(L"can_be_removed", &Item::can_be_removed);
field(L"has_read_access", &Item::has_read_access);
field(L"has_write_access", &Item::has_write_access);
field(L"has_read_write_access", &Item::has_read_write_access);
field(L"has_read_exec_access", &Item::has_read_exec_access);
field(L"url_is", &Item::url_is);
field(L"execute", &Item::execute);
field(L"can_be_removed", &Item::can_be_removed);
field(L"has_read_access", &Item::has_read_access);
field(L"has_write_access", &Item::has_write_access);
field(L"has_read_write_access", &Item::has_read_write_access);
field(L"has_read_exec_access", &Item::has_read_exec_access);
field(L"execute", &Item::execute);
// may we should add a method setTypeFromInt(int t)?
@ -285,16 +286,7 @@ bool Item::do_migration_to_3()
};
size_t len = sizeof(str) / sizeof(const char*);
for(size_t i=0 ; i < len ; ++i)
{
if( !db_query(str[i]) )
{
return false;
}
}
return true;
return db_query(str, len);
}

View File

@ -83,7 +83,7 @@ void ItemContent::fields()
field(L"content_parsed", content_parsed);
field(L"content_parsed_type", content_parsed_type_helper);
field(L"meta", meta);
field(L"meta_admin", meta_admin);
field(L"admin_meta", admin_meta);
field(L"print_content", &ItemContent::print_content);
field(L"has_static_file", &ItemContent::has_static_file);
@ -103,6 +103,8 @@ void ItemContent::fields()
field(L"has_thumb", &ItemContent::has_thumb);
field(L"display_user_name", &ItemContent::display_user_name);
field(L"is_meta_object", &ItemContent::is_meta_object);
field(L"is_admin_meta_object", &ItemContent::is_admin_meta_object);
// IMPROVEME prepare a setter functions which tests whether content_raw_type_helper and content_parsed_type_helper are correct values
content_raw_type = static_cast<ContentType>(content_raw_type_helper);
@ -168,7 +170,7 @@ void ItemContent::Clear()
content_parsed_type = ct_formatted_text;
meta.clear();
meta_admin.clear();
admin_meta.clear();
SetDateToNow();
}
@ -182,6 +184,7 @@ bool ItemContent::do_migration(int & current_table_version)
ok = ok && morm::Model::do_migration(current_table_version, 1, this, &ItemContent::do_migration_to_1);
ok = ok && morm::Model::do_migration(current_table_version, 2, this, &ItemContent::do_migration_to_2);
ok = ok && morm::Model::do_migration(current_table_version, 3, this, &ItemContent::do_migration_to_3);
ok = ok && morm::Model::do_migration(current_table_version, 4, this, &ItemContent::do_migration_to_4);
return ok;
}
@ -257,6 +260,17 @@ bool ItemContent::do_migration_to_3()
}
bool ItemContent::do_migration_to_4()
{
const char * str[] = {
"alter table core.content rename column meta_admin to admin_meta;",
};
size_t len = sizeof(str) / sizeof(const char*);
return db_query(str, len);
}
bool ItemContent::has_access(const User * current_user, int mask) const
{
if( current_user )
@ -586,6 +600,16 @@ void ItemContent::display_user_name(EzcEnv & env)
}
bool ItemContent::is_meta_object()
{
return meta.is_object();
}
bool ItemContent::is_admin_meta_object()
{
return admin_meta.is_object();
}
} // namespace Winix

View File

@ -233,7 +233,7 @@ public:
* admin meta information
* additional information available to edit only by an admin
*/
pt::Space meta_admin;
pt::Space admin_meta;
ItemContent();
@ -273,11 +273,16 @@ public:
bool has_user() const;
bool has_group() const;
bool is_meta_object();
bool is_admin_meta_object();
protected:
bool do_migration_to_1();
bool do_migration_to_2();
bool do_migration_to_3();
bool do_migration_to_4();
bool has_access(const User * current_user, int mask) const;
bool content_type_is(const std::wstring & type);

View File

@ -80,7 +80,7 @@ bool Reply::HasAccess()
return false;
pt::Space * thread_space = cur->request->item.item_content.meta_admin.get_space(L"thread");
pt::Space * thread_space = cur->request->item.item_content.admin_meta.get_space(L"thread");
if( thread_space )
{

View File

@ -203,10 +203,10 @@ bool EditTicket::CloseTicket()
{
cur->request->item.propagate_connector();
pt::Space & ticket_space = cur->request->item.item_content.meta_admin.get_add_space(L"ticket"); //CHECKME it was find_add_child_space(L"ticket");
pt::Space & ticket_space = cur->request->item.item_content.admin_meta.get_add_space(L"ticket"); //CHECKME it was find_add_child_space(L"ticket");
ticket_space.add(L"closed", true);
pt::Space & thread_space = cur->request->item.item_content.meta_admin.get_add_space(L"thread"); //CHECKME it was find_add_child_space(L"thread");
pt::Space & thread_space = cur->request->item.item_content.admin_meta.get_add_space(L"thread"); //CHECKME it was find_add_child_space(L"thread");
thread_space.add(L"closed", true);
//if( db->EditAdminMetaById(cur->request->item.ameta, cur->request->item.id) == WINIX_ERR_OK )

View File

@ -318,7 +318,7 @@ void ticket_is_creating_new(Info & i)
void ticket_is_closed(Info & i)
{
pt::Space * ticket_space = ticket_info.item->item_content.meta_admin.get_space(L"ticket");
pt::Space * ticket_space = ticket_info.item->item_content.admin_meta.get_space(L"ticket");
if( ticket_space )
i.res = ticket_space->to_bool(L"closed", false);
@ -552,7 +552,7 @@ void tickets_tab_is_closed(Info & i)
if( tickets_value.is_item )
{
pt::Space * ticket_space = tickets_value.item->item_content.meta_admin.get_space(L"ticket");
pt::Space * ticket_space = tickets_value.item->item_content.admin_meta.get_space(L"ticket");
if( ticket_space )
i.res = ticket_space->to_bool(L"closed", false);