changed: the way how raw template is set
option for setting raw template from 'emacs' function has been removed now we have index_raw.html template and it can be set from 'template' function removed: template index_fullscreen.html changed: some work in miscspace (changed: space_list_tab, space_list_tab_value and space_list_tab_has_next) fixed: main index template could not be set through 'template' function git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1039 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -46,7 +46,7 @@ namespace TemplatesFunctions
|
||||
{
|
||||
|
||||
size_t pat_index; // main index pattern
|
||||
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_raw; // pattern for a raw content
|
||||
size_t pat_err_404; // 404 error
|
||||
size_t pat_err_per_denied; // permission denied error
|
||||
|
||||
@@ -678,7 +678,6 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("user_is_in_all_groups", user_is_in_all_groups);
|
||||
ezc_functions.Insert("user_can_use_html", user_can_use_html);
|
||||
ezc_functions.Insert("user_can_use_bbcode", user_can_use_bbcode);
|
||||
ezc_functions.Insert("user_can_use_raw", user_can_use_raw);
|
||||
ezc_functions.Insert("user_has_correct_time_zone",user_has_correct_time_zone);
|
||||
ezc_functions.Insert("user_time_zone_name", user_time_zone_name);
|
||||
ezc_functions.Insert("user_time_zone_id", user_time_zone_id);
|
||||
@@ -949,7 +948,7 @@ using namespace TemplatesFunctions;
|
||||
ezc_blocks.Clear();
|
||||
|
||||
pat_index = patterns.Add(config->templates_index);
|
||||
pat_index_fullscreen = patterns.Add(L"index_fullscreen.html"); // !! IMPROVE ME name to the config
|
||||
pat_index_raw = patterns.Add(config->templates_index_raw);
|
||||
pat_err_404 = patterns.Add(L"err_404.html"); // !! IMPROVE ME name to the config
|
||||
pat_err_per_denied = patterns.Add(L"err_per_denied.html"); // !! IMPROVE ME name to the config
|
||||
|
||||
@@ -1005,36 +1004,29 @@ using namespace TemplatesFunctions;
|
||||
|
||||
|
||||
// can return a null pointer
|
||||
Ezc::Pattern * Templates::SelectIndexPatternFromItemAndMountPoint()
|
||||
Ezc::Pattern * Templates::SelectIndexPattern(const std::wstring & template_name)
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
Ezc::Pattern * index = 0;
|
||||
|
||||
// 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() && cur->request->last_item->html_template != config->templates_index )
|
||||
if( template_name == config->templates_index )
|
||||
{
|
||||
index = index_patterns.Get(cur->request->last_item->html_template, locale.GetCurLang());
|
||||
|
||||
if( index )
|
||||
{
|
||||
log << log4 << "Templates: index template taken from the last item, template file name: "
|
||||
<< cur->request->last_item->html_template << logend;
|
||||
}
|
||||
index = patterns.Get(pat_index, locale.GetCurLang());
|
||||
}
|
||||
else
|
||||
if( template_name == config->templates_index_raw )
|
||||
{
|
||||
index = patterns.Get(pat_index_raw, locale.GetCurLang());
|
||||
}
|
||||
else
|
||||
{
|
||||
Mounts & mounts = TemplatesFunctions::system->mounts;
|
||||
const std::wstring & mount_file_name = cur->mount->FirstArg(mounts.MountParHtmlTemplate());
|
||||
index = index_patterns.Get(template_name, locale.GetCurLang());
|
||||
}
|
||||
|
||||
if( !mount_file_name.empty() && mount_file_name != config->templates_index )
|
||||
{
|
||||
index = index_patterns.Get(mount_file_name, locale.GetCurLang());
|
||||
|
||||
if( index )
|
||||
log << log4 << "Templates: index template taken from the mount point, template file name: " << mount_file_name << logend;
|
||||
}
|
||||
if( index )
|
||||
{
|
||||
log << log3 << "Templates: index template taken from: " << template_name << logend;
|
||||
}
|
||||
|
||||
return index;
|
||||
@@ -1050,18 +1042,19 @@ using namespace TemplatesFunctions;
|
||||
|
||||
Ezc::Pattern * index = 0;
|
||||
|
||||
if( cur->request->IsParam(L"fullscreen") )
|
||||
if( !cur->request->last_item->html_template.empty() )
|
||||
{
|
||||
index = patterns.Get(pat_index_fullscreen, locale.GetCurLang());
|
||||
|
||||
if( index )
|
||||
log << log3 << "Templates: index template taken from index_fullscreen.html" << logend;
|
||||
index = SelectIndexPattern(cur->request->last_item->html_template);
|
||||
}
|
||||
else
|
||||
{
|
||||
index = SelectIndexPatternFromItemAndMountPoint();
|
||||
Mounts & mounts = TemplatesFunctions::system->mounts;
|
||||
const std::wstring & mount_file_name = cur->mount->FirstArg(mounts.MountParHtmlTemplate());
|
||||
|
||||
if( !mount_file_name.empty() )
|
||||
index = SelectIndexPattern(mount_file_name);
|
||||
}
|
||||
|
||||
|
||||
if( !index )
|
||||
{
|
||||
index = change_patterns.Get(cur->mount->dir_id, config->templates_index, locale.GetCurLang());
|
||||
@@ -1072,7 +1065,7 @@ using namespace TemplatesFunctions;
|
||||
|
||||
if( !index )
|
||||
{
|
||||
index = patterns.Get(pat_index, locale.GetCurLang());;
|
||||
index = patterns.Get(pat_index, locale.GetCurLang());
|
||||
|
||||
if( index )
|
||||
log << log3 << "Templates: index template taken from: " << config->templates_index << logend;
|
||||
@@ -1114,21 +1107,6 @@ using namespace TemplatesFunctions;
|
||||
|
||||
|
||||
|
||||
void Templates::GenerateRunRaw()
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
if( !empty_pars.empty() )
|
||||
empty_pars.clear();
|
||||
|
||||
Ezc::Stack s;
|
||||
Info info(cur->request->out_main_stream, empty_pars, empty_string, empty_stream, s);
|
||||
|
||||
info.iter = s.iter;
|
||||
info.res = false;
|
||||
|
||||
item_run(info);
|
||||
}
|
||||
|
||||
|
||||
void Templates::Generate(Ezc::Pattern & pattern)
|
||||
|
Reference in New Issue
Block a user