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

@@ -71,18 +71,21 @@ return (conf_parser.ParseString(meta_str) == PT::SpaceParser::ok);
bool Meta::EditAdminMeta(long item_id, const std::wstring & meta_str, bool use_ses_log)
bool Meta::EditAdminMeta(Item & item, const std::wstring & meta_str, bool use_ses_log)
{
if( Parse(meta_str) )
{
if( db->EditAdminMetaById(space, item_id) == WINIX_ERR_OK )
item.item_content.meta_admin = space;
//if( db->EditAdminMetaById(space, item_id) == WINIX_ERR_OK )
if( item.update(false, true) )
{
return true;
}
else
{
log << log1 << "Meta: a database problem with changing admin meta information for item id: "
<< item_id << logend;
<< item.id << logend;
}
}
else
@@ -98,18 +101,21 @@ return false;
bool Meta::EditMeta(long item_id, const std::wstring & meta_str, bool use_ses_log)
bool Meta::EditMeta(Item & item, const std::wstring & meta_str, bool use_ses_log)
{
if( Parse(meta_str) )
{
if( db->EditMetaById(space, item_id) == WINIX_ERR_OK )
item.item_content.meta = space;
//if( db->EditMetaById(space, item_id) == WINIX_ERR_OK )
if( item.update(false, true) )
{
return true;
}
else
{
log << log1 << "Meta: a database problem with changing meta information for item id: "
<< item_id << logend;
<< item.id << logend;
}
}
else
@@ -133,11 +139,8 @@ void Meta::ChangeAdminMeta()
{
const std::wstring & meta_str = cur->request->PostVar(L"itemmeta");
if( EditAdminMeta(cur->request->last_item->id, meta_str, true) )
if( EditAdminMeta(*cur->request->last_item, meta_str, true) )
{
if( cur->request->last_item->type == Item::dir )
cur->request->last_item->ameta = space;
system->RedirectToLastItem();
}
}
@@ -150,11 +153,8 @@ void Meta::ChangeMeta()
{
const std::wstring & meta_str = cur->request->PostVar(L"itemmeta");
if( EditMeta(cur->request->last_item->id, meta_str, true) )
if( EditMeta(*cur->request->last_item, meta_str, true) )
{
if( cur->request->last_item->type == Item::dir )
cur->request->last_item->meta = space;
system->RedirectToLastItem();
}
}