diff --git a/winixd/models/item.cpp b/winixd/models/item.cpp index 81b8641..4647d13 100644 --- a/winixd/models/item.cpp +++ b/winixd/models/item.cpp @@ -637,7 +637,7 @@ void Item::execute(EzcEnv & env) Ezc::Pattern * p = pattern_cacher->GetPattern(*this); - TemplatesFunctions::InitGenerator(ezc_generator, request->models); + TemplatesFunctions::InitGenerator(ezc_generator, *request); ezc_generator.SetPattern(*p); if( config->allow_ezc_frames_in_executable_items ) diff --git a/winixd/plugins/thread/templates.cpp b/winixd/plugins/thread/templates.cpp index 3d4a270..3c8c2d5 100644 --- a/winixd/plugins/thread/templates.cpp +++ b/winixd/plugins/thread/templates.cpp @@ -354,7 +354,7 @@ void thread_sort_tab_run(Info & i) Ezc::Pattern * p = pattern_cacher.GetPattern(*thread_info.item_sort_tab[item_sort_index]); item_run_content.clear(); - InitGenerator(ezc_generator, cur->request->models); + InitGenerator(ezc_generator, *cur->request); ezc_generator.SetPattern(*p); ezc_generator.Generate(item_run_content); diff --git a/winixd/templates/insert.cpp b/winixd/templates/insert.cpp index 68679a1..ee499f2 100644 --- a/winixd/templates/insert.cpp +++ b/winixd/templates/insert.cpp @@ -74,7 +74,7 @@ void insert_page_run(Info & i) info.run_content.clear(); - InitGenerator(info.ezc_gen, cur->request->models); + InitGenerator(info.ezc_gen, *cur->request); info.ezc_gen.SetPattern(*pat); info.ezc_gen.Generate(info.run_content); ItemContent::print_content(i.out, info.run_content.get_buffer(), info.item.item_content.content_raw_type, config->html_filter); diff --git a/winixd/templates/misc.cpp b/winixd/templates/misc.cpp index fc19f9c..9f1ed83 100644 --- a/winixd/templates/misc.cpp +++ b/winixd/templates/misc.cpp @@ -40,8 +40,6 @@ namespace Winix { - - namespace TemplatesFunctions { @@ -92,7 +90,7 @@ int was_enter = 0; // how many enteres there were before -void InitGenerator(EzcGen & gen, Ezc::Models & ezc_models) +void InitGenerator(EzcGen & gen, Request & request) { gen.TrimWhite(gen_trim_white); gen.SkipNewLine(gen_skip_new_line); @@ -108,8 +106,17 @@ void InitGenerator(EzcGen & gen, Ezc::Models & ezc_models) gen.SetFunctions(ezc_functions); gen.SetVariables(ezc_vars); - gen.SetModels(ezc_models); + gen.SetModels(request.models); gen.SetLogger(log); + + if( request.send_all_frames ) + { + gen.OnlyFrames(nullptr); + } + else + { + gen.OnlyFrames(request.send_frames); + } } diff --git a/winixd/templates/misc.h b/winixd/templates/misc.h index 8755573..726cff5 100644 --- a/winixd/templates/misc.h +++ b/winixd/templates/misc.h @@ -43,9 +43,8 @@ namespace Winix { - - class User; +class Request; // Ezc::FunInfo<> will be renamed to Ezc::Env<> in the future typedef Ezc::FunInfo EzcEnv; @@ -66,7 +65,7 @@ HtmlTextStream::RawText R(const RawType & par) } -void InitGenerator(EzcGen & gen, Ezc::Models & ezc_models); +void InitGenerator(EzcGen & gen, Request & request); void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in); diff --git a/winixd/templates/templates.cpp b/winixd/templates/templates.cpp index 3e0bb06..bebcd68 100644 --- a/winixd/templates/templates.cpp +++ b/winixd/templates/templates.cpp @@ -168,7 +168,7 @@ Ezc::Pattern * pattern = 0; if( pattern ) { - InitGenerator(content_gen, cur->request->models); + InitGenerator(content_gen, *cur->request); content_gen.SetPattern(*pattern); content_gen.Generate(env.out, cur->request->out_streams); } @@ -1004,9 +1004,19 @@ using namespace TemplatesFunctions; if( index ) { - InitGenerator(generator, cur->request->models); + InitGenerator(generator, *cur->request); generator.SetPattern(*index); + generator.UseMainStream(cur->request->send_main_stream); generator.Generate(cur->request->out_main_stream, cur->request->out_streams); + + // for debug purposes: + // log << log4 << "Templates: main stream size: " << cur->request->out_main_stream.size() << logend; + // log << log4 << "Templates: produced frames: " << logend; + + // for(auto i=cur->request->out_streams.streams_map.begin() ; i != cur->request->out_streams.streams_map.end() ; ++i) + // { + // log << log4 << " frame name: " << i->first << ", size: " << i->second->size() << logend; + // } } else { @@ -1016,20 +1026,6 @@ using namespace TemplatesFunctions; - - -void Templates::Generate(Ezc::Pattern & pattern) -{ -using namespace TemplatesFunctions; - - ezc_vars.clear(); - InitGenerator(generator, cur->request->models); - generator.SetPattern(pattern); - generator.Generate(cur->request->out_main_stream, cur->request->out_streams); -} - - - void Templates::SetConfig(Config * pconfig) { TemplatesFunctions::config = pconfig; diff --git a/winixd/templates/templates.h b/winixd/templates/templates.h index 79efd9d..8454d42 100644 --- a/winixd/templates/templates.h +++ b/winixd/templates/templates.h @@ -584,7 +584,6 @@ public: void SetEzcParameters(bool trim_white, bool skip_new_line, bool use_special_chars); void Generate(); - void Generate(Ezc::Pattern & pattern); private: