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

@@ -1,21 +1,19 @@
# DO NOT DELETE
cache.o: cache.h ../../../../winix/winixd/core/item.h
cache.o: ../../../../pikotools/space/space.h
cache.o: ../../../../pikotools/textstream/types.h
cache.o: ../../../../pikotools/date/date.h
cache.o: ../../../../pikotools/convert/inttostr.h
cache.o: ../../../../winix/winixd/core/dirs.h
cache.o: ../../../../winix/winixd/core/item.h
cache.o: cache.h ../../../../winix/winixd/core/dirs.h
cache.o: ../../../../winix/winixd/core/dircontainer.h
cache.o: ../../../../winix/winixd/core/winixbase.h
cache.o: ../../../../winix/winixd/core/config.h
cache.o: ../../../../pikotools/space/spaceparser.h
cache.o: ../../../../pikotools/space/space.h
cache.o: ../../../../pikotools/textstream/types.h
cache.o: ../../../../winix/winixd/core/log.h
cache.o: ../../../../winix/winixd/core/logmanipulators.h
cache.o: ../../../../pikotools/log/log.h
cache.o: ../../../../pikotools/textstream/textstream.h
cache.o: ../../../../pikotools/space/space.h
cache.o: ../../../../pikotools/date/date.h
cache.o: ../../../../pikotools/convert/inttostr.h
cache.o: ../../../../pikotools/membuffer/membuffer.h
cache.o: ../../../../pikotools/textstream/types.h
cache.o: ../../../../pikotools/log/filelog.h
@@ -24,6 +22,19 @@ cache.o: ../../../../winix/winixd/core/synchro.h
cache.o: ../../../../winix/winixd/core/filelog.h
cache.o: ../../../../winix/winixd/core/lock.h
cache.o: ../../../../winix/winixd/core/synchro.h
cache.o: ../../../../winix/winixd/models/item.h ../../../../morm/src/model.h
cache.o: ../../../../morm/src/modelconnector.h ../../../../morm/src/clearer.h
cache.o: ../../../../morm/src/dbconnector.h
cache.o: ../../../../morm/src/queryresult.h
cache.o: ../../../../morm/src/flatconnector.h
cache.o: ../../../../morm/src/dbexpression.h
cache.o: ../../../../morm/src/baseexpression.h
cache.o: ../../../../morm/src/morm_types.h ../../../../morm/src/modelenv.h
cache.o: ../../../../morm/src/modeldata.h ../../../../morm/src/cursorhelper.h
cache.o: ../../../../morm/src/finderhelper.h
cache.o: ../../../../morm/src/fieldvaluehelper.h
cache.o: ../../../../morm/src/flatexpression.h
cache.o: ../../../../winix/winixd/models/itemcontent.h
cache.o: ../../../../winix/winixd/db/db.h
cache.o: ../../../../winix/winixd/db/dbbase.h
cache.o: ../../../../winix/winixd/db/dbconn.h
@@ -57,18 +68,7 @@ cache.o: ../../../../winix/winixd/core/winixmodel.h
cache.o: ../../../../winix/winixd/core/plugin.h
cache.o: ../../../../winix/winixd/core/pluginmsg.h
cache.o: ../../../../winix/winixd/core/plugindata.h
cache.o: ../../../../morm/src/morm.h ../../../../morm/src/morm_types.h
cache.o: ../../../../morm/src/model.h ../../../../morm/src/modelconnector.h
cache.o: ../../../../morm/src/clearer.h ../../../../morm/src/dbconnector.h
cache.o: ../../../../morm/src/queryresult.h
cache.o: ../../../../morm/src/flatconnector.h
cache.o: ../../../../morm/src/dbexpression.h
cache.o: ../../../../morm/src/baseexpression.h
cache.o: ../../../../morm/src/modelenv.h ../../../../morm/src/modeldata.h
cache.o: ../../../../morm/src/cursorhelper.h
cache.o: ../../../../morm/src/finderhelper.h
cache.o: ../../../../morm/src/fieldvaluehelper.h
cache.o: ../../../../morm/src/flatexpression.h ../../../../morm/src/finder.h
cache.o: ../../../../morm/src/morm.h ../../../../morm/src/finder.h
cache.o: ../../../../morm/src/cursor.h ../../../../morm/src/jsonexpression.h
cache.o: ../../../../morm/src/postgresqlexpression.h
cache.o: ../../../../morm/src/jsonconnector.h
@@ -83,13 +83,12 @@ init.o: ../../../../winix/winixd/core/winixbase.h
init.o: ../../../../winix/winixd/core/config.h
init.o: ../../../../pikotools/space/spaceparser.h
init.o: ../../../../pikotools/space/space.h
init.o: ../../../../pikotools/textstream/types.h
init.o: ../../../../winix/winixd/core/log.h
init.o: ../../../../winix/winixd/core/logmanipulators.h
init.o: ../../../../pikotools/log/log.h
init.o: ../../../../pikotools/textstream/textstream.h
init.o: ../../../../pikotools/space/space.h
init.o: ../../../../pikotools/textstream/types.h
init.o: ../../../../pikotools/date/date.h
init.o: ../../../../pikotools/space/space.h ../../../../pikotools/date/date.h
init.o: ../../../../pikotools/convert/inttostr.h
init.o: ../../../../pikotools/membuffer/membuffer.h
init.o: ../../../../pikotools/textstream/types.h
@@ -97,11 +96,21 @@ init.o: ../../../../pikotools/log/filelog.h
init.o: ../../../../winix/winixd/core/synchro.h
init.o: ../../../../winix/winixd/core/filelog.h
init.o: ../../../../winix/winixd/core/lock.h
init.o: ../../../../winix/winixd/core/synchro.h cache.h
init.o: ../../../../winix/winixd/core/item.h
init.o: ../../../../winix/winixd/core/synchro.h
init.o: ../../../../morm/src/modelconnector.h ../../../../morm/src/clearer.h
init.o: ../../../../morm/src/dbconnector.h ../../../../morm/src/queryresult.h
init.o: ../../../../morm/src/flatconnector.h cache.h
init.o: ../../../../winix/winixd/core/dirs.h
init.o: ../../../../winix/winixd/core/item.h
init.o: ../../../../winix/winixd/core/dircontainer.h
init.o: ../../../../winix/winixd/models/item.h ../../../../morm/src/model.h
init.o: ../../../../morm/src/dbexpression.h
init.o: ../../../../morm/src/baseexpression.h
init.o: ../../../../morm/src/morm_types.h ../../../../morm/src/modelenv.h
init.o: ../../../../morm/src/modeldata.h ../../../../morm/src/cursorhelper.h
init.o: ../../../../morm/src/finderhelper.h
init.o: ../../../../morm/src/fieldvaluehelper.h
init.o: ../../../../morm/src/flatexpression.h
init.o: ../../../../winix/winixd/models/itemcontent.h
init.o: ../../../../winix/winixd/db/db.h ../../../../winix/winixd/db/dbbase.h
init.o: ../../../../winix/winixd/db/dbconn.h
init.o: ../../../../winix/winixd/db/dbtextstream.h
@@ -132,26 +141,18 @@ init.o: ../../../../pikotools/space/spacetojson.h
init.o: ../../../../ezc/src/outstreams.h
init.o: ../../../../winix/winixd/core/winixmodel.h
init.o: ../../../../winix/winixd/core/plugin.h ../../../../morm/src/morm.h
init.o: ../../../../morm/src/morm_types.h ../../../../morm/src/model.h
init.o: ../../../../morm/src/modelconnector.h ../../../../morm/src/clearer.h
init.o: ../../../../morm/src/dbconnector.h ../../../../morm/src/queryresult.h
init.o: ../../../../morm/src/flatconnector.h
init.o: ../../../../morm/src/dbexpression.h
init.o: ../../../../morm/src/baseexpression.h ../../../../morm/src/modelenv.h
init.o: ../../../../morm/src/modeldata.h ../../../../morm/src/cursorhelper.h
init.o: ../../../../morm/src/finderhelper.h
init.o: ../../../../morm/src/fieldvaluehelper.h
init.o: ../../../../morm/src/flatexpression.h ../../../../morm/src/finder.h
init.o: ../../../../morm/src/cursor.h ../../../../morm/src/jsonexpression.h
init.o: ../../../../morm/src/finder.h ../../../../morm/src/cursor.h
init.o: ../../../../morm/src/jsonexpression.h
init.o: ../../../../morm/src/postgresqlexpression.h
init.o: ../../../../morm/src/jsonconnector.h
init.o: ../../../../morm/src/postgresqlconnector.h
init.o: ../../../../morm/src/postgresqlqueryresult.h
init.o: ../../../../winix/winixd/templates/templates.h
init.o: ../../../../ezc/src/ezc.h ../../../../ezc/src/generator.h
init.o: ../../../../ezc/src/blocks.h ../../../../ezc/src/pattern.h
init.o: ../../../../ezc/src/functions.h ../../../../ezc/src/funinfo.h
init.o: ../../../../ezc/src/objects.h ../../../../ezc/src/expressionparser.h
init.o: ../../../../ezc/src/blocks.h ../../../../ezc/src/item.h
init.o: ../../../../ezc/src/pattern.h ../../../../ezc/src/functions.h
init.o: ../../../../ezc/src/funinfo.h ../../../../ezc/src/objects.h
init.o: ../../../../ezc/src/expressionparser.h
init.o: ../../../../ezc/src/patternparser.h
init.o: ../../../../winix/winixd/templates/patterncacher.h
init.o: ../../../../winix/winixd/templates/indexpatterns.h
@@ -252,23 +253,21 @@ init.o: ../../../../winix/winixd/functions/who.h
init.o: ../../../../winix/winixd/functions/vim.h
templates.o: ../../../../winix/winixd/templates/templates.h
templates.o: ../../../../ezc/src/ezc.h ../../../../ezc/src/generator.h
templates.o: ../../../../ezc/src/blocks.h
templates.o: ../../../../winix/winixd/core/item.h cache.h
templates.o: ../../../../winix/winixd/core/item.h
templates.o: ../../../../pikotools/space/space.h
templates.o: ../../../../pikotools/textstream/types.h
templates.o: ../../../../pikotools/date/date.h
templates.o: ../../../../pikotools/convert/inttostr.h
templates.o: ../../../../ezc/src/blocks.h ../../../../ezc/src/item.h cache.h
templates.o: ../../../../winix/winixd/core/dirs.h
templates.o: ../../../../winix/winixd/core/dircontainer.h
templates.o: ../../../../winix/winixd/core/winixbase.h
templates.o: ../../../../winix/winixd/core/config.h
templates.o: ../../../../pikotools/space/spaceparser.h
templates.o: ../../../../pikotools/space/space.h
templates.o: ../../../../pikotools/textstream/types.h
templates.o: ../../../../winix/winixd/core/log.h
templates.o: ../../../../winix/winixd/core/logmanipulators.h
templates.o: ../../../../pikotools/log/log.h
templates.o: ../../../../pikotools/textstream/textstream.h
templates.o: ../../../../pikotools/space/space.h
templates.o: ../../../../pikotools/date/date.h
templates.o: ../../../../pikotools/convert/inttostr.h
templates.o: ../../../../pikotools/membuffer/membuffer.h
templates.o: ../../../../pikotools/textstream/types.h
templates.o: ../../../../pikotools/log/filelog.h
@@ -277,6 +276,22 @@ templates.o: ../../../../winix/winixd/core/synchro.h
templates.o: ../../../../winix/winixd/core/filelog.h
templates.o: ../../../../winix/winixd/core/lock.h
templates.o: ../../../../winix/winixd/core/synchro.h
templates.o: ../../../../winix/winixd/models/item.h
templates.o: ../../../../morm/src/model.h
templates.o: ../../../../morm/src/modelconnector.h
templates.o: ../../../../morm/src/clearer.h
templates.o: ../../../../morm/src/dbconnector.h
templates.o: ../../../../morm/src/queryresult.h
templates.o: ../../../../morm/src/flatconnector.h
templates.o: ../../../../morm/src/dbexpression.h
templates.o: ../../../../morm/src/baseexpression.h
templates.o: ../../../../morm/src/morm_types.h
templates.o: ../../../../morm/src/modelenv.h ../../../../morm/src/modeldata.h
templates.o: ../../../../morm/src/cursorhelper.h
templates.o: ../../../../morm/src/finderhelper.h
templates.o: ../../../../morm/src/fieldvaluehelper.h
templates.o: ../../../../morm/src/flatexpression.h
templates.o: ../../../../winix/winixd/models/itemcontent.h
templates.o: ../../../../winix/winixd/db/db.h
templates.o: ../../../../winix/winixd/db/dbbase.h
templates.o: ../../../../winix/winixd/db/dbconn.h
@@ -310,21 +325,8 @@ templates.o: ../../../../winix/winixd/core/winixmodel.h
templates.o: ../../../../winix/winixd/core/plugin.h
templates.o: ../../../../winix/winixd/core/pluginmsg.h
templates.o: ../../../../winix/winixd/core/plugindata.h
templates.o: ../../../../morm/src/morm.h ../../../../morm/src/morm_types.h
templates.o: ../../../../morm/src/model.h
templates.o: ../../../../morm/src/modelconnector.h
templates.o: ../../../../morm/src/clearer.h
templates.o: ../../../../morm/src/dbconnector.h
templates.o: ../../../../morm/src/queryresult.h
templates.o: ../../../../morm/src/flatconnector.h
templates.o: ../../../../morm/src/dbexpression.h
templates.o: ../../../../morm/src/baseexpression.h
templates.o: ../../../../morm/src/modelenv.h ../../../../morm/src/modeldata.h
templates.o: ../../../../morm/src/cursorhelper.h
templates.o: ../../../../morm/src/finderhelper.h
templates.o: ../../../../morm/src/fieldvaluehelper.h
templates.o: ../../../../morm/src/flatexpression.h
templates.o: ../../../../morm/src/finder.h ../../../../morm/src/cursor.h
templates.o: ../../../../morm/src/morm.h ../../../../morm/src/finder.h
templates.o: ../../../../morm/src/cursor.h
templates.o: ../../../../morm/src/jsonexpression.h
templates.o: ../../../../morm/src/postgresqlexpression.h
templates.o: ../../../../morm/src/jsonconnector.h

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2012-2014, Tomasz Sowa
* Copyright (c) 2012-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,8 +38,9 @@
#include <string>
#include <vector>
#include <list>
#include "core/item.h"
#include "core/dirs.h"
#include "models/item.h"
namespace Winix
{

View File

@@ -151,15 +151,15 @@ using namespace Menu;
// (not implemented yet)
info.plugin->Assign(WINIX_FILE_REMOVED, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_DIR_ADDED, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_DIR_PREPARE_TO_REMOVE, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_DIR_ADDED, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_DIR_PREPARE_TO_REMOVE, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_DIR_REMOVED, InvalidateCacheById);
info.plugin->Assign(WINIX_FILE_ADDED, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_FILE_ADDED, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_FILE_CHANGED, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_FILE_COPIED, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_FILE_PREPARE_TO_MOVE, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_FILE_MOVED, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_DIR_CONTENT_SORTED, InvalidateCacheByPointer);
info.plugin->Assign(WINIX_FILE_MOVED, InvalidateCacheByPointerParent);
info.plugin->Assign(WINIX_DIR_CONTENT_SORTED, InvalidateCacheByPointer);
info.plugin->Assign(WINIX_PROCESS_REQUEST, ProcessRequest);
// !! IMPROVE ME

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2011-2016, Tomasz Sowa
* Copyright (c) 2011-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,11 +34,12 @@
#include "templates/templates.h"
#include "core/plugin.h"
#include "core/item.h"
#include "core/log.h"
#include "core/misc.h"
#include "cache.h"
#include "templates/miscspace.h"
#include "models/item.h"
namespace Winix
{
@@ -61,11 +62,12 @@ extern int mount_par_menu_skip;
extern Cache cache;
static Ezc::Stack * stack = &empty_stack;
static DbItemQuery iq;
//static DbItemQuery iq;
static std::vector<Item> item_tab;
static MenuItem menu_item;
struct StackItem : public Ezc::FunData
{
CacheItem * citem;
@@ -99,36 +101,53 @@ return WINIX_PL_MENU_PARAM_NONE;
}
void read_from_db(long dir_id, int param, bool with_meta)
{
iq.SetAll(false, false);
iq.sel_subject = true;
iq.sel_url = true;
iq.sel_sort_index = true;
iq.sort_date_asc = false; // !! FIXED ME we need an option for this
iq.sel_type = true;
iq.sel_file = true;
iq.sel_meta = with_meta;
iq.WhereParentId(dir_id);
// iq.SetAll(false, false);
// iq.sel_subject = true;
// iq.sel_url = true;
// iq.sel_sort_index = true;
// iq.sort_date_asc = false; // !! FIXED ME we need an option for this
// iq.sel_type = true;
// iq.sel_file = true;
// iq.sel_meta = with_meta;
// iq.WhereParentId(dir_id);
// CHECKME is it correct to get the connector from last item?
morm::ModelConnector * model_connector = cur->request->last_item->get_connector();
morm::Finder<Item> finder(model_connector);
finder.
select().
where().
eq(L"parent_id", dir_id);
if( param == WINIX_PL_MENU_PARAM_IMAGES )
{
iq.WhereType(Item::file);
iq.WhereFileType(WINIX_ITEM_FILETYPE_IMAGE);
// iq.WhereType(Item::file);
// iq.WhereFileType(WINIX_ITEM_FILETYPE_IMAGE);
finder.
eq(L"type", static_cast<int>(Item::file)).
eq(L"content.file_type", WINIX_ITEM_FILETYPE_IMAGE);
}
else
if( param == WINIX_PL_MENU_PARAM_DIRS )
{
iq.WhereType(Item::dir);
//iq.WhereType(Item::dir);
finder.eq(L"type", static_cast<int>(Item::dir));
}
else
if( param == WINIX_PL_MENU_PARAM_FILES )
{
iq.WhereType(Item::file);
//iq.WhereType(Item::file);
finder.eq(L"type", static_cast<int>(Item::file));
}
db->GetItems(item_tab, iq);
finder.get_vector(item_tab);
//db->GetItems(item_tab, iq);
log << log4 << "Menu: loaded directories/files from the database for parent_id: "
<< dir_id << logend;
}
@@ -190,9 +209,9 @@ void copy_items(CacheItem & citem)
menu_item.id = item_tab[i].id;
menu_item.subject = item_tab[i].subject;
menu_item.url = item_tab[i].url;
menu_item.meta = item_tab[i].meta;
menu_item.meta = item_tab[i].item_content.meta;
menu_item.type = item_tab[i].type;
menu_item.file_type = item_tab[i].file_type;
menu_item.file_type = item_tab[i].item_content.file_type;
citem.menu_items.push_back(menu_item);
}