renamed: WinixModel -> WinixModelDeprecated (this class will be removed)

added: WinixModel (models/winixmodel.h|cpp) - a class inheriting from morm::WinixModel, we have methods such as: get_config(), get_logger(), get_request()
       and this class will be a base class for our models
added: WinixModelConnector (models/winixmodelconnector.h|cpp) - a class inheriting from morm::WinixModelConnector
       this connector we are using instead of morm::ModelConnector - there are pointers to winix objects there (config, request, log)
added to Request: Ezc::Models models
removed from TemplatesFunctions: Ezc::Models ezc_models;
changed: ImgCrop winix functions is using its own item_tab vector now (not finished yet)
added: Item::is(), Item::link(), ItemContent::print_content()
This commit is contained in:
2021-06-16 18:07:44 +02:00
parent 9688b1a26a
commit 6dddc5e948
63 changed files with 654 additions and 225 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2018, Tomasz Sowa
* Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,23 +67,7 @@ void Cat::MakeGet()
}
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
// temporary for tests
////////////////////////////////////////////////////////////
foo1.subject = L"subject <h2>from</h2> foo1";
foo2.subject = L"subject <strong>from</strong> foo2";
foo1.item_content.content_raw = L"raw content from foo1";
foo2.item_content.content_raw = L"raw content from foo2";
foo1.set_connector(model_connector);
foo2.set_connector(model_connector);
return_model(L"foo1", foo1);
return_model(L"foo2", foo2);
////////////////////////////////////////////////////////////
cur->request->models.Add(L"item", cur->request->item);
}

View File

@@ -54,10 +54,6 @@ public:
void MakeGet();
private:
Item foo1;
Item foo2;
};

View File

@@ -149,18 +149,6 @@ void FunctionBase::MakeDelete()
void FunctionBase::return_model(const wchar_t * name, morm::Model & model)
{
TemplatesFunctions::ezc_models.Add(name, model);
}
void FunctionBase::return_model(const wchar_t * name, morm::Model * model)
{
TemplatesFunctions::ezc_models.Add(name, model);
}
} // namespace Winix

View File

@@ -102,9 +102,6 @@ public:
//void SetSessionManager(SessionManager * pmanager);
virtual void return_model(const wchar_t * name, morm::Model & model);
virtual void return_model(const wchar_t * name, morm::Model * model);
protected:
//Config * config;

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2018, Tomasz Sowa
* Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,10 +36,11 @@
#define headerfile_winix_functions_functionparser
#include <string>
#include "core/winixmodeldeprecated.h"
#include "db/db.h"
#include "core/cur.h"
#include "core/system.h"
#include "core/winixmodel.h"
namespace Winix
@@ -49,7 +50,7 @@ namespace Winix
class Functions;
class FunctionParser : public WinixModel
class FunctionParser : public WinixModelDeprecated
{
public:

View File

@@ -72,7 +72,7 @@ void ImgCrop::GetDirContent()
morm::Finder<Item> finder(model_connector);
cur->request->item_tab = finder.
item_tab = finder.
select().
where().
eq(L"type", static_cast<int>(Item::file)).
@@ -81,7 +81,7 @@ void ImgCrop::GetDirContent()
get_vector();
//db->GetItems(cur->request->item_tab, iq);
system->CheckWriteAccessToItems(cur->request->item_tab);
system->CheckWriteAccessToItems(item_tab);
}
@@ -137,7 +137,10 @@ void ImgCrop::MakePost()
void ImgCrop::MakeGet()
{
if( !cur->request->is_item )
{
GetDirContent();
cur->request->models.Add(L"item_tab", item_tab);
}
}

View File

@@ -55,9 +55,11 @@ public:
void MakeGet();
void MakePost();
// IMPROVEME add method Clear() or ClearAfterRequest()? and clear item_tab
private:
//DbItemQuery iq;
std::vector<Item> item_tab;
void GetDirContent();

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2018, Tomasz Sowa
* Copyright (c) 2010-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,17 +35,17 @@
#ifndef headerfile_winix_functions_privchanger
#define headerfile_winix_functions_privchanger
#include "core/winixmodeldeprecated.h"
#include "core/request.h"
#include "core/system.h"
#include "db/db.h"
#include "core/winixmodel.h"
namespace Winix
{
class PrivChanger : public WinixModel
class PrivChanger : public WinixModelDeprecated
{
public: