Item class has been moved to a new directory 'models', a new class has been added: ItemContent

and same fields from Item were moved to ItemContent

Item
- id
- parent_id
- type (file, dir, symlink)
- url
- subject
- template (html template)
- sort_index
- content_id

ItemContent
- id
- ref -> references (renamed)
- user_id
- modification_user_id
- group_id
- privileges
- date_creation
- date_modification
- guest_name
- link_to
- link_redirect
- file_path
- file_fs
- file_type
- file_size
- has_thumb -> file_has_thumb (renamed)
- hash -> file_hash (renamed)
- hash_type -> file_hash_type (renamed)
- content -> content_raw (renamed)
- content_type -> content_raw_type (renamed)
- content_parsed
- content_parsed_type
- meta
- ameta -> meta_admin (renamed)
- modify_index (removed)

WIP: #4
This commit is contained in:
2021-02-24 01:19:47 +01:00
parent 3d7ece15f8
commit 32e93a04c5
118 changed files with 5795 additions and 4514 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -164,14 +164,14 @@ void thread_sort_tab_subject_noescape(Info & i)
void thread_sort_tab_content(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << thread_info.item_sort_tab[item_sort_index]->content;
i.out << thread_info.item_sort_tab[item_sort_index]->item_content.content_raw;
}
void thread_sort_tab_content_noescape(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << R(thread_info.item_sort_tab[item_sort_index]->content);
i.out << R(thread_info.item_sort_tab[item_sort_index]->item_content.content_raw);
}
@@ -180,8 +180,8 @@ void thread_sort_tab_print_content(Info & i)
if( item_sort_index >= thread_info.item_sort_tab.size() )
return;
std::wstring & content = thread_info.item_sort_tab[item_sort_index]->content;
Item::ContentType type = thread_info.item_sort_tab[item_sort_index]->content_type;
std::wstring & content = thread_info.item_sort_tab[item_sort_index]->item_content.content_raw;
ItemContent::ContentType type = thread_info.item_sort_tab[item_sort_index]->item_content.content_raw_type;
item_print_content(i.out, content, type);
}
@@ -190,7 +190,7 @@ void thread_sort_tab_print_content(Info & i)
void thread_sort_tab_privileges(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << "0" << Toa(thread_info.item_sort_tab[item_sort_index]->privileges, 8);
i.out << "0" << Toa(thread_info.item_sort_tab[item_sort_index]->item_content.privileges, 8);
}
@@ -251,8 +251,8 @@ void thread_sort_tab_user(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
User * puser = system->users.GetUser(thread_info.item_sort_tab[item_sort_index]->user_id);
print_user_name(i, puser, thread_info.item_sort_tab[item_sort_index]->guest_name);
User * puser = system->users.GetUser(thread_info.item_sort_tab[item_sort_index]->item_content.user_id);
print_user_name(i, puser, thread_info.item_sort_tab[item_sort_index]->item_content.guest_name);
}
}
@@ -262,8 +262,8 @@ void thread_sort_tab_modification_user(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
User * puser = system->users.GetUser(thread_info.item_sort_tab[item_sort_index]->modification_user_id);
print_user_name(i, puser, thread_info.item_sort_tab[item_sort_index]->guest_name);
User * puser = system->users.GetUser(thread_info.item_sort_tab[item_sort_index]->item_content.modification_user_id);
print_user_name(i, puser, thread_info.item_sort_tab[item_sort_index]->item_content.guest_name);
}
}
@@ -273,7 +273,7 @@ void thread_sort_tab_users_different(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
i.res = (thread_info.item_sort_tab[item_sort_index]->user_id != thread_info.item_sort_tab[item_sort_index]->modification_user_id);
i.res = (thread_info.item_sort_tab[item_sort_index]->item_content.user_id != thread_info.item_sort_tab[item_sort_index]->item_content.modification_user_id);
}
}
@@ -283,7 +283,7 @@ void thread_sort_tab_group(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
long group_id = thread_info.item_sort_tab[item_sort_index]->group_id;
long group_id = thread_info.item_sort_tab[item_sort_index]->item_content.group_id;
Group * pgroup = system->groups.GetGroup(group_id);
if( pgroup )
@@ -298,7 +298,7 @@ void thread_sort_tab_date_creation(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
PT::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->date_creation);
PT::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->item_content.date_creation);
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
}
}
@@ -308,7 +308,7 @@ void thread_sort_tab_date_modification(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
PT::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->date_modification);
PT::Date date = system->ToLocal(thread_info.item_sort_tab[item_sort_index]->item_content.date_modification);
i.out << DateToStr(date.year, date.month, date.day, date.hour, date.min, date.sec);
}
}
@@ -318,7 +318,7 @@ void thread_sort_tab_date_creation_nice(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
print_date_nice(i, thread_info.item_sort_tab[item_sort_index]->date_creation);
print_date_nice(i, thread_info.item_sort_tab[item_sort_index]->item_content.date_creation);
}
}
@@ -328,7 +328,7 @@ void thread_sort_tab_date_modification_nice(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
print_date_nice(i, thread_info.item_sort_tab[item_sort_index]->date_modification);
print_date_nice(i, thread_info.item_sort_tab[item_sort_index]->item_content.date_modification);
}
}
@@ -337,8 +337,8 @@ void thread_sort_tab_dates_equal(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
PT::Date & date1 = thread_info.item_sort_tab[item_sort_index]->date_creation;
PT::Date & date2 = thread_info.item_sort_tab[item_sort_index]->date_modification;
PT::Date & date1 = thread_info.item_sort_tab[item_sort_index]->item_content.date_creation;
PT::Date & date2 = thread_info.item_sort_tab[item_sort_index]->item_content.date_modification;
i.res = date1 == date2;
}
@@ -358,7 +358,7 @@ void thread_sort_tab_run(Info & i)
ezc_generator.SetPattern(*p);
ezc_generator.Generate(item_run_content);
item_print_content(i.out, item_run_content.Str(), thread_info.item_sort_tab[item_sort_index]->content_type);
item_print_content(i.out, item_run_content.Str(), thread_info.item_sort_tab[item_sort_index]->item_content.content_raw_type);
}
else
{
@@ -373,8 +373,8 @@ void thread_sort_tab_has_static_file(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
{
i.res = thread_info.item_sort_tab[item_sort_index]->file_type != WINIX_ITEM_FILETYPE_NONE &&
!thread_info.item_sort_tab[item_sort_index]->file_path.empty();
i.res = thread_info.item_sort_tab[item_sort_index]->item_content.file_type != WINIX_ITEM_FILETYPE_NONE &&
!thread_info.item_sort_tab[item_sort_index]->item_content.file_path.empty();
}
}
@@ -382,7 +382,7 @@ void thread_sort_tab_has_static_file(Info & i)
void thread_sort_tab_has_thumb(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = thread_info.item_sort_tab[item_sort_index]->has_thumb;
i.res = thread_info.item_sort_tab[item_sort_index]->item_content.file_has_thumb;
}
@@ -410,21 +410,21 @@ void thread_sort_tab_type_is_symlink(Info & i)
void thread_sort_tab_is_link_to(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = !thread_info.item_sort_tab[item_sort_index]->link_to.empty();
i.res = !thread_info.item_sort_tab[item_sort_index]->item_content.link_to.empty();
}
void thread_sort_tab_link_to(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.out << thread_info.item_sort_tab[item_sort_index]->link_to;
i.out << thread_info.item_sort_tab[item_sort_index]->item_content.link_to;
}
void thread_sort_tab_is_link_redirect(Info & i)
{
if( item_sort_index < thread_info.item_sort_tab.size() )
i.res = thread_info.item_sort_tab[item_sort_index]->link_redirect == 1;
i.res = thread_info.item_sort_tab[item_sort_index]->item_content.link_redirect == 1;
}
@@ -455,7 +455,7 @@ void thread_sort_tab_last_item_date_modification_nice(Info & i)
if( thread.last_item_id != -1 )
print_date_nice(i, thread.last_item_date_modification);
else
print_date_nice(i, thread_info.item_sort_tab[item_sort_index]->date_modification);
print_date_nice(i, thread_info.item_sort_tab[item_sort_index]->item_content.date_modification);
}
}
}
@@ -476,8 +476,8 @@ void thread_sort_tab_last_item_user(Info & i)
}
else
{
User * puser = system->users.GetUser(thread_info.item_sort_tab[item_sort_index]->user_id);
print_user_name(i, puser, thread_info.item_sort_tab[item_sort_index]->guest_name);
User * puser = system->users.GetUser(thread_info.item_sort_tab[item_sort_index]->item_content.user_id);
print_user_name(i, puser, thread_info.item_sort_tab[item_sort_index]->item_content.guest_name);
}
}
}