added: to Request options used by ezc generators:

bool gen_trim_white;
       bool gen_skip_new_line;
       bool gen_use_special_chars;
added: new ezc filter: fil_csv_escape
       for escaping csv fields





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@877 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-08-26 19:53:47 +00:00
parent adf273479a
commit 260c12894d
9 changed files with 102 additions and 1 deletions

View File

@@ -57,6 +57,12 @@ SessionManager * session_manager;
// generator used by content() function
static EzcGen content_gen;
// options used by ezc generators
// set from each Request object
bool gen_trim_white;
bool gen_skip_new_line;
bool gen_use_special_chars;
Ezc::Pattern * GetPatternForFunction()
@@ -126,6 +132,9 @@ Ezc::Pattern * p = 0;
if( p )
{
content_gen.TrimWhite(gen_trim_white);
content_gen.SkipNewLine(gen_skip_new_line);
content_gen.RecognizeSpecialChars(gen_use_special_chars);
content_gen.SetMax(config->ezc_max_elements, config->ezc_max_loop_elements);
content_gen.Generate(i.out, *p);
}
@@ -224,7 +233,7 @@ void Templates::CreateFunctions()
ezc_functions.Insert("env_user_tab_id", env_user_tab_id);
ezc_functions.Insert("env_user_tab_name", env_user_tab_name);
ezc_functions.Insert("env_user_tab_is_current", env_user_tab_is_current);
ezc_functions.Insert("fil_csv_escape", fil_csv_escape);
/*
filters
@@ -877,6 +886,16 @@ return index;
}
void Templates::SetEzcParameters(bool trim_white, bool skip_new_line, bool use_special_chars)
{
using namespace TemplatesFunctions;
gen_trim_white = trim_white;
gen_skip_new_line = skip_new_line;
gen_use_special_chars = use_special_chars;
}
void Templates::Generate()
{
@@ -885,9 +904,17 @@ using namespace TemplatesFunctions;
Ezc::Pattern * index = SelectIndexPattern();
if( index )
{
generator.TrimWhite(gen_trim_white);
generator.SkipNewLine(gen_skip_new_line);
generator.RecognizeSpecialChars(gen_use_special_chars);
generator.SetMax(config->ezc_max_elements, config->ezc_max_loop_elements);
generator.Generate(cur->request->page, *index);
}
else
{
log << log1 << "Templates: I cannot find an index template" << logend;
}
}
@@ -912,6 +939,10 @@ void Templates::Generate(Ezc::Pattern & pattern)
{
using namespace TemplatesFunctions;
generator.TrimWhite(gen_trim_white);
generator.SkipNewLine(gen_skip_new_line);
generator.RecognizeSpecialChars(gen_use_special_chars);
generator.SetMax(config->ezc_max_elements, config->ezc_max_loop_elements);
generator.Generate(cur->request->page, pattern);
}