added: a new index template: index_fullscreen.html

is chosen automatically when 'fullscreen' parameter is passed


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@776 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-12-01 18:54:09 +00:00
parent 7902389ef1
commit 024ce8e73c
9 changed files with 201 additions and 33 deletions

View File

@@ -18,13 +18,14 @@
namespace TemplatesFunctions
{
size_t pat_index;
size_t pat_err_404;
size_t pat_err_per_denied;
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_err_404; // 404 error
size_t pat_err_per_denied; // permission denied error
Patterns patterns; // all html patterns
IndexPatterns index_patterns; // patterns for main index template (those from mountpoint)
// index_atterns uses patterns as a storage
// index_patterns uses patterns as a storage
ChangePatterns change_patterns; // patterns for change_template mount option (storage is in 'patterns' too)
PatternCacher pattern_cacher; // patterns for user items (files with an executable bit set)
@@ -690,9 +691,10 @@ using namespace TemplatesFunctions;
index_patterns.Clear();
change_patterns.Clear();
pat_index = patterns.Add(config->templates_index);
pat_err_404 = patterns.Add(L"err_404.html");
pat_err_per_denied = patterns.Add(L"err_per_denied.html");
pat_index = patterns.Add(config->templates_index);
pat_index_fullscreen = patterns.Add(L"index_fullscreen.html");
pat_err_404 = patterns.Add(L"err_404.html");
pat_err_per_denied = patterns.Add(L"err_per_denied.html");
ReadTemplatesForFunctions();
ReadIndexTemplates();
@@ -744,20 +746,27 @@ using namespace TemplatesFunctions;
Ezc::Pattern * index = 0;
const std::wstring * index_file_local = 0;
if( !cur->request->last_item->html_template.empty() )
index_file_local = &cur->request->last_item->html_template;
if( !index_file_local )
if( cur->request->IsParam(L"fullscreen") )
{
Mounts & mounts = TemplatesFunctions::system->mounts;
const std::wstring & temp = cur->mount->FirstArg(mounts.MountParHtmlTemplate());
if( !temp.empty() )
index_file_local = &temp;
index = patterns.Get(pat_index_fullscreen, locale.GetLang());
}
else
{
if( !cur->request->last_item->html_template.empty() )
index_file_local = &cur->request->last_item->html_template;
if( index_file_local && *index_file_local != config->templates_index )
index = index_patterns.Get(*index_file_local, locale.GetLang());
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( !index )
index = change_patterns.Get(cur->mount->dir_id, config->templates_index, locale.GetLang());