- added to FunctionBase: bool register_default_models (default true)
if true then winix will add default models for ezc templates such as "request", "item", etc. - some methods from templates/item.cpp moved to Item
This commit is contained in:
@@ -58,6 +58,13 @@ void HtmlTextStream::clear()
|
||||
}
|
||||
|
||||
|
||||
void HtmlTextStream::to_str(std::wstring & str)
|
||||
{
|
||||
str = TextStream<std::wstring>::Str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
without escaping
|
||||
@@ -253,6 +260,11 @@ HtmlTextStream & HtmlTextStream::operator<<(RawText<pt::Date> raw)
|
||||
}
|
||||
|
||||
|
||||
HtmlTextStream & HtmlTextStream::operator<<(const HtmlTextStream & stream)
|
||||
{
|
||||
TextStream<std::wstring>::operator<<(stream.Str());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2015, Tomasz Sowa
|
||||
* Copyright (c) 2010-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -87,6 +87,7 @@ public:
|
||||
void Clear();
|
||||
void clear(); // utf8 methods call clear(), in the future Clear() will be renamed to clear()
|
||||
|
||||
void to_str(std::wstring & str);
|
||||
|
||||
/*
|
||||
a helper struct to select a proper operator<<
|
||||
@@ -151,6 +152,9 @@ public:
|
||||
HtmlTextStream & operator<<(RawText<pt::TextStreamBase<arg_char_type, arg_stack_size, arg_heap_block_size> > raw);
|
||||
|
||||
|
||||
// this method doesn't escape stream as there is no need for such behavior - stream should be already escaped
|
||||
HtmlTextStream & operator<<(const HtmlTextStream & stream);
|
||||
|
||||
|
||||
// 'write' don't escapes too
|
||||
// with these methods you can write a zero character too
|
||||
|
||||
@@ -280,46 +280,46 @@ void item_dates_equal(Info & i)
|
||||
|
||||
|
||||
|
||||
void item_run(Info & i)
|
||||
{
|
||||
if( !cur->request->is_item )
|
||||
{
|
||||
i.out << "<!-- there is no an item to run -->";
|
||||
return;
|
||||
}
|
||||
|
||||
if( system->HasReadExecAccess(*cur->request->last_item) )
|
||||
{
|
||||
Ezc::Pattern * p = pattern_cacher.GetPattern(*cur->request->last_item);
|
||||
|
||||
item_run_content.Clear();
|
||||
InitGenerator(ezc_generator, cur->request->models);
|
||||
ezc_generator.SetPattern(*p);
|
||||
|
||||
if( config->allow_ezc_frames_in_executable_items )
|
||||
ezc_generator.Generate(item_run_content, cur->request->out_streams);
|
||||
else
|
||||
ezc_generator.Generate(item_run_content);
|
||||
|
||||
ItemContent::print_content(i.out, item_run_content.Str(), cur->request->last_item->item_content.content_raw_type, config->html_filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
i.out << "<!-- run: permission denied -->";
|
||||
}
|
||||
}
|
||||
//void item_run(Info & i)
|
||||
//{
|
||||
// if( !cur->request->is_item )
|
||||
// {
|
||||
// i.out << "<!-- there is no an item to run -->";
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if( system->HasReadExecAccess(*cur->request->last_item) )
|
||||
// {
|
||||
// Ezc::Pattern * p = pattern_cacher.GetPattern(*cur->request->last_item);
|
||||
//
|
||||
// item_run_content.Clear();
|
||||
// InitGenerator(ezc_generator, cur->request->models);
|
||||
// ezc_generator.SetPattern(*p);
|
||||
//
|
||||
// if( config->allow_ezc_frames_in_executable_items )
|
||||
// ezc_generator.Generate(item_run_content, cur->request->out_streams);
|
||||
// else
|
||||
// ezc_generator.Generate(item_run_content);
|
||||
//
|
||||
// ItemContent::print_content(i.out, item_run_content.Str(), cur->request->last_item->item_content.content_raw_type, config->html_filter);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// i.out << "<!-- run: permission denied -->";
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
void item_guest_name(Info & i)
|
||||
{
|
||||
i.out << cur->request->last_item->item_content.guest_name;
|
||||
}
|
||||
//void item_guest_name(Info & i)
|
||||
//{
|
||||
// i.out << cur->request->last_item->item_content.guest_name;
|
||||
//}
|
||||
|
||||
|
||||
void item_html_template(Info & i)
|
||||
{
|
||||
i.out << cur->request->last_item->html_template;
|
||||
}
|
||||
//void item_html_template(Info & i)
|
||||
//{
|
||||
// i.out << cur->request->last_item->html_template;
|
||||
//}
|
||||
|
||||
|
||||
void item_has_html_template(Info & i)
|
||||
|
||||
@@ -463,9 +463,9 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("item_date_creation_nice", item_date_creation_nice);
|
||||
ezc_functions.Insert("item_date_modification_nice",item_date_modification_nice);
|
||||
ezc_functions.Insert("item_dates_equal", item_dates_equal);
|
||||
ezc_functions.Insert("item_run", item_run);
|
||||
ezc_functions.Insert("item_guest_name", item_guest_name);
|
||||
ezc_functions.Insert("item_html_template", item_html_template);
|
||||
// ezc_functions.Insert("item_run", item_run);
|
||||
// ezc_functions.Insert("item_guest_name", item_guest_name);
|
||||
// ezc_functions.Insert("item_html_template", item_html_template);
|
||||
ezc_functions.Insert("item_has_html_template", item_has_html_template);
|
||||
// ezc_functions.Insert("item_type_is_dir", item_type_is_dir);
|
||||
// ezc_functions.Insert("item_type_is_file", item_type_is_file);
|
||||
|
||||
@@ -353,9 +353,9 @@ namespace TemplatesFunctions
|
||||
void item_date_creation_nice(Info & i);
|
||||
void item_date_modification_nice(Info & i);
|
||||
void item_dates_equal(Info & i);
|
||||
void item_run(Info & i);
|
||||
void item_guest_name(Info & i);
|
||||
void item_html_template(Info & i);
|
||||
//void item_run(Info & i);
|
||||
//void item_guest_name(Info & i);
|
||||
//void item_html_template(Info & i);
|
||||
void item_has_html_template(Info & i);
|
||||
//void item_type_is_dir(Info & i);
|
||||
//void item_type_is_file(Info & i);
|
||||
|
||||
Reference in New Issue
Block a user