start adding support for Models objects from Ezc
This commit is contained in:
parent
22de3322ae
commit
6e4f8f5191
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
#include "cat.h"
|
#include "cat.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Winix
|
namespace Winix
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -68,6 +67,23 @@ void Cat::MakeGet()
|
||||||
}
|
}
|
||||||
|
|
||||||
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
|
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);
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include "functionbase.h"
|
#include "functionbase.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Winix
|
namespace Winix
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -52,6 +53,12 @@ public:
|
||||||
Cat();
|
Cat();
|
||||||
void MakeGet();
|
void MakeGet();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Item foo1;
|
||||||
|
Item foo2;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
#include "functionbase.h"
|
#include "functionbase.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
#include "templates/templates.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Winix
|
namespace Winix
|
||||||
|
@ -148,6 +149,18 @@ 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
|
} // namespace Winix
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,10 @@ public:
|
||||||
//void SetSynchro(Synchro * psynchro);
|
//void SetSynchro(Synchro * psynchro);
|
||||||
//void SetSessionManager(SessionManager * pmanager);
|
//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:
|
protected:
|
||||||
|
|
||||||
//Config * config;
|
//Config * config;
|
||||||
|
|
|
@ -63,7 +63,9 @@ void Item::fields()
|
||||||
field(L"subject", subject);
|
field(L"subject", subject);
|
||||||
field(L"template", html_template);
|
field(L"template", html_template);
|
||||||
field(L"sort_index", sort_index);
|
field(L"sort_index", sort_index);
|
||||||
field(L"content_id", item_content, morm::FT::foreign_key);
|
field(L"content_id", L"content", item_content, morm::FT::foreign_key);
|
||||||
|
|
||||||
|
//field(L"my_test_function", my_test_function);
|
||||||
|
|
||||||
// may we should add a method setTypeFromInt(int t)?
|
// may we should add a method setTypeFromInt(int t)?
|
||||||
type = static_cast<Type>(type_helper);
|
type = static_cast<Type>(type_helper);
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
#include "core/log.h"
|
#include "core/log.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "funinfo.h"
|
||||||
|
#include "templates/htmltextstream.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Winix
|
namespace Winix
|
||||||
{
|
{
|
||||||
|
@ -180,6 +184,12 @@ public:
|
||||||
void propagate_connector();
|
void propagate_connector();
|
||||||
|
|
||||||
|
|
||||||
|
// for tests
|
||||||
|
static void my_test_function(Ezc::FunInfo<HtmlTextStream> & env)
|
||||||
|
{
|
||||||
|
env.out << L"hello from function";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ namespace TemplatesFunctions
|
||||||
extern EzcFun ezc_functions;
|
extern EzcFun ezc_functions;
|
||||||
extern Ezc::Blocks ezc_blocks;
|
extern Ezc::Blocks ezc_blocks;
|
||||||
extern Ezc::Vars ezc_vars;
|
extern Ezc::Vars ezc_vars;
|
||||||
|
extern Ezc::Models ezc_models;
|
||||||
|
|
||||||
|
|
||||||
void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in)
|
void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in)
|
||||||
|
@ -108,6 +109,8 @@ void InitGenerator(EzcGen & gen)
|
||||||
gen.SetBlocks(ezc_blocks);
|
gen.SetBlocks(ezc_blocks);
|
||||||
gen.SetFunctions(ezc_functions);
|
gen.SetFunctions(ezc_functions);
|
||||||
gen.SetVariables(ezc_vars);
|
gen.SetVariables(ezc_vars);
|
||||||
|
|
||||||
|
gen.SetModels(ezc_models);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ EzcFun ezc_functions;
|
||||||
Ezc::Blocks ezc_blocks;
|
Ezc::Blocks ezc_blocks;
|
||||||
Ezc::Objects<HtmlTextStream> ezc_objects;
|
Ezc::Objects<HtmlTextStream> ezc_objects;
|
||||||
Ezc::Vars ezc_vars;
|
Ezc::Vars ezc_vars;
|
||||||
|
Ezc::Models ezc_models;
|
||||||
LocaleFilter locale_filter;
|
LocaleFilter locale_filter;
|
||||||
HTMLFilter html_filter;
|
HTMLFilter html_filter;
|
||||||
|
|
||||||
|
@ -1023,6 +1024,8 @@ using namespace TemplatesFunctions;
|
||||||
|
|
||||||
log << log4 << "Templates: patterns cache size: " << pattern_cacher.Size() << logend;
|
log << log4 << "Templates: patterns cache size: " << pattern_cacher.Size() << logend;
|
||||||
pattern_cacher.DeleteOldPatterns();
|
pattern_cacher.DeleteOldPatterns();
|
||||||
|
|
||||||
|
ezc_models.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,7 @@ namespace TemplatesFunctions
|
||||||
extern bool gen_skip_new_line;
|
extern bool gen_skip_new_line;
|
||||||
extern bool gen_use_special_chars;
|
extern bool gen_use_special_chars;
|
||||||
|
|
||||||
|
extern Ezc::Models ezc_models;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue