added: log info about what html template is used
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1026 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
e53e2e6af9
commit
7d0508961e
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011-2014, Tomasz Sowa
|
||||
* Copyright (c) 2011-2016, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -79,7 +79,9 @@ public:
|
|||
void SetEzcBlocks(Ezc::Blocks * blocks);
|
||||
|
||||
|
||||
// dodaj komentarz !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
/*
|
||||
remembering a pointer to ezc objects
|
||||
*/
|
||||
void SetEzcObjects(Ezc::Objects<HtmlTextStream> * obj);
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2015, Tomasz Sowa
|
||||
* Copyright (c) 2008-2016, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -95,6 +95,7 @@ bool gen_use_special_chars;
|
|||
Ezc::Pattern * GetPatternForFunction()
|
||||
{
|
||||
static std::wstring fun_file;
|
||||
Ezc::Pattern * p;
|
||||
|
||||
if( !cur->request->function )
|
||||
{
|
||||
|
@ -106,12 +107,22 @@ static std::wstring fun_file;
|
|||
fun_file += cur->request->function->fun.url;
|
||||
fun_file += config->templates_fun_postfix;
|
||||
|
||||
Ezc::Pattern * p = change_patterns.Get(cur->mount->dir_id, fun_file, locale.GetCurLang());
|
||||
p = change_patterns.Get(cur->mount->dir_id, fun_file, locale.GetCurLang());
|
||||
|
||||
if( p )
|
||||
{
|
||||
log << log3 << "Templates: function template taken from change_patterns" << logend;
|
||||
return p;
|
||||
}
|
||||
|
||||
return patterns.Get(cur->request->function->template_index, locale.GetCurLang());
|
||||
p = patterns.Get(cur->request->function->template_index, locale.GetCurLang());
|
||||
|
||||
if( p )
|
||||
{
|
||||
log << log3 << "Templates: function template taken from: " << fun_file << logend;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,6 +145,10 @@ Ezc::Pattern * p = 0;
|
|||
case WINIX_ERR_CANT_CHANGE_PRIVILEGES:
|
||||
// !! locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = patterns.Get(pat_err_per_denied, locale.GetCurLang());
|
||||
|
||||
if( p )
|
||||
log << log3 << "Templates: error pattern taken from: " << patterns.GetFileName(pat_err_per_denied) << logend;
|
||||
|
||||
break;
|
||||
|
||||
case WINIX_ERR_NO_ITEM:
|
||||
|
@ -141,6 +156,10 @@ Ezc::Pattern * p = 0;
|
|||
case WINIX_ERR_UNKNOWN_PARAM:
|
||||
// !! locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = patterns.Get(pat_err_404, locale.GetCurLang());
|
||||
|
||||
if( p )
|
||||
log << log3 << "Templates: error pattern taken from: " << patterns.GetFileName(pat_err_404) << logend;
|
||||
|
||||
break;
|
||||
|
||||
//default:
|
||||
|
@ -991,26 +1010,33 @@ Ezc::Pattern * Templates::SelectIndexPatternFromItemAndMountPoint()
|
|||
using namespace TemplatesFunctions;
|
||||
|
||||
Ezc::Pattern * index = 0;
|
||||
const std::wstring * index_file_local = 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() )
|
||||
if( !cur->request->last_item->html_template.empty() && cur->request->last_item->html_template != config->templates_index )
|
||||
{
|
||||
index_file_local = &cur->request->last_item->html_template;
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Mounts & mounts = TemplatesFunctions::system->mounts;
|
||||
const std::wstring & temp = cur->mount->FirstArg(mounts.MountParHtmlTemplate());
|
||||
const std::wstring & mount_file_name = cur->mount->FirstArg(mounts.MountParHtmlTemplate());
|
||||
|
||||
if( !temp.empty() )
|
||||
index_file_local = &temp;
|
||||
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_file_local && *index_file_local != config->templates_index )
|
||||
index = index_patterns.Get(*index_file_local, locale.GetCurLang());
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
@ -1025,16 +1051,34 @@ using namespace TemplatesFunctions;
|
|||
Ezc::Pattern * index = 0;
|
||||
|
||||
if( cur->request->IsParam(L"fullscreen") )
|
||||
{
|
||||
index = patterns.Get(pat_index_fullscreen, locale.GetCurLang());
|
||||
|
||||
if( index )
|
||||
log << log3 << "Templates: index template taken from index_fullscreen.html" << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = SelectIndexPatternFromItemAndMountPoint();
|
||||
}
|
||||
|
||||
if( !index )
|
||||
{
|
||||
index = change_patterns.Get(cur->mount->dir_id, config->templates_index, locale.GetCurLang());
|
||||
|
||||
if( index )
|
||||
log << log3 << "Templates: index template taken from change_patterns" << logend;
|
||||
}
|
||||
|
||||
if( !index )
|
||||
{
|
||||
index = patterns.Get(pat_index, locale.GetCurLang());;
|
||||
|
||||
if( index )
|
||||
log << log3 << "Templates: index template taken from: " << config->templates_index << logend;
|
||||
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue