added: to config: 'content_type_header' parameter
the kind of "Content-Type" header send to the client if utf8 is enabled then 'charset=UTF-8' will also be appended added: to templates: an index pattern for 'rawcontent' used when 'rawcontent' parameter is present by default the template has only one [content] ezc function useful in AJAX requests git-svn-id: svn://ttmath.org/publicrep/winix/trunk@784 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -19,7 +19,8 @@ namespace TemplatesFunctions
|
||||
{
|
||||
|
||||
size_t pat_index; // main index pattern
|
||||
size_t pat_index_fullscreen; // an empty pattern (without menus etc., used for ckeditor images browser)
|
||||
size_t pat_index_fullscreen; // an empty pattern (without menus etc. but with all rest html tags, used for ckeditor images browser)
|
||||
size_t pat_index_rawcontent; // completly empty pattern (only content, without html tags such as <html>, <body>)
|
||||
size_t pat_err_404; // 404 error
|
||||
size_t pat_err_per_denied; // permission denied error
|
||||
|
||||
@@ -695,6 +696,7 @@ using namespace TemplatesFunctions;
|
||||
|
||||
pat_index = patterns.Add(config->templates_index);
|
||||
pat_index_fullscreen = patterns.Add(L"index_fullscreen.html");
|
||||
pat_index_rawcontent = patterns.Add(L"index_rawcontent.html");
|
||||
pat_err_404 = patterns.Add(L"err_404.html");
|
||||
pat_err_per_denied = patterns.Add(L"err_per_denied.html");
|
||||
|
||||
@@ -741,34 +743,53 @@ using namespace TemplatesFunctions;
|
||||
}
|
||||
|
||||
|
||||
void Templates::Generate()
|
||||
|
||||
// can return a null pointer
|
||||
Ezc::Pattern * Templates::SelectIndexPatternFromItemAndMountPoint()
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
Ezc::Pattern * index = 0;
|
||||
const std::wstring * index_file_local = 0;
|
||||
|
||||
if( cur->request->IsParam(L"fullscreen") )
|
||||
// first we try to get an index template from 'template' item parameter (template winix function)
|
||||
// if such a parameter is not defined then we try to get an index from the mount point
|
||||
if( !cur->request->last_item->html_template.empty() )
|
||||
{
|
||||
index = patterns.Get(pat_index_fullscreen, locale.GetLang());
|
||||
index_file_local = &cur->request->last_item->html_template;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !cur->request->last_item->html_template.empty() )
|
||||
index_file_local = &cur->request->last_item->html_template;
|
||||
Mounts & mounts = TemplatesFunctions::system->mounts;
|
||||
const std::wstring & temp = cur->mount->FirstArg(mounts.MountParHtmlTemplate());
|
||||
|
||||
if( !index_file_local )
|
||||
{
|
||||
Mounts & mounts = TemplatesFunctions::system->mounts;
|
||||
const std::wstring & temp = cur->mount->FirstArg(mounts.MountParHtmlTemplate());
|
||||
|
||||
if( !temp.empty() )
|
||||
index_file_local = &temp;
|
||||
}
|
||||
|
||||
if( index_file_local && *index_file_local != config->templates_index )
|
||||
index = index_patterns.Get(*index_file_local, locale.GetLang());
|
||||
if( !temp.empty() )
|
||||
index_file_local = &temp;
|
||||
}
|
||||
|
||||
if( index_file_local && *index_file_local != config->templates_index )
|
||||
index = index_patterns.Get(*index_file_local, locale.GetLang());
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// can return a null pointer
|
||||
Ezc::Pattern * Templates::SelectIndexPattern()
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
Ezc::Pattern * index = 0;
|
||||
|
||||
if( cur->request->IsParam(L"rawcontent") )
|
||||
index = patterns.Get(pat_index_rawcontent, locale.GetLang());
|
||||
else
|
||||
if( cur->request->IsParam(L"fullscreen") )
|
||||
index = patterns.Get(pat_index_fullscreen, locale.GetLang());
|
||||
else
|
||||
index = SelectIndexPatternFromItemAndMountPoint();
|
||||
|
||||
if( !index )
|
||||
index = change_patterns.Get(cur->mount->dir_id, config->templates_index, locale.GetLang());
|
||||
@@ -776,6 +797,17 @@ using namespace TemplatesFunctions;
|
||||
if( !index )
|
||||
index = patterns.Get(pat_index, locale.GetLang());;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Templates::Generate()
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
Ezc::Pattern * index = SelectIndexPattern();
|
||||
|
||||
if( index )
|
||||
generator.Generate(cur->request->page, *index);
|
||||
else
|
||||
|
@@ -37,6 +37,8 @@ class Functions;
|
||||
namespace TemplatesFunctions
|
||||
{
|
||||
extern size_t pat_index;
|
||||
extern size_t pat_index_fullscreen;
|
||||
extern size_t pat_index_rawcontent;
|
||||
extern size_t pat_err_404;
|
||||
extern size_t pat_err_per_denied;
|
||||
|
||||
@@ -485,6 +487,8 @@ private:
|
||||
void ReadLocale();
|
||||
void SetHtmlFilter();
|
||||
void CreateFunctions(); // should be called before reading patterns (patterns will cache ezc functions)
|
||||
Ezc::Pattern * SelectIndexPatternFromItemAndMountPoint();
|
||||
Ezc::Pattern * SelectIndexPattern();
|
||||
|
||||
TemplatesFunctions::EzcGen generator;
|
||||
std::wstring temp;
|
||||
|
Reference in New Issue
Block a user