added support for UTF-8

now the UTF-8 is a default charset


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@677 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-11-21 00:19:17 +00:00
parent f1f0fa34cb
commit 8e72a820dd
153 changed files with 4270 additions and 2784 deletions

View File

@@ -10,6 +10,7 @@
#include "templates.h"
#include "core/misc.h"
#include "core/plugin.h"
#include "core/textstream.h"
#include "localefilter.h"
#include "functions/functions.h"
@@ -21,15 +22,15 @@ namespace TemplatesFunctions
IndexPatterns index_patterns;
Patterns patterns;
Patterns patterns_fun;
Ezc::Functions ezc_functions;
Ezc::Functions<TextStream<std::wstring> > ezc_functions;
PatternCacher pattern_cacher;
Locale locale;
LocaleFilter locale_filter;
CKEditorGetParser ckeditor_getparser;
// used by GenerateRunRaw()
std::vector<std::string> empty_pars;
const std::string empty_string;
std::vector<std::wstring> empty_pars;
const std::wstring empty_string;
Config * config;
Request * request;
@@ -110,7 +111,7 @@ Ezc::Pattern * p = 0;
if( p )
{
Ezc::Generator gen(i.out, *p, ezc_functions);
Ezc::Generator<TextStream<std::wstring> > gen(i.out, *p, ezc_functions);
gen.Generate();
}
else
@@ -427,7 +428,7 @@ void Templates::CreateFunctions()
void Templates::ReadFile(TemplatesFunctions::Pat pat, const char * file)
void Templates::ReadFile(TemplatesFunctions::Pat pat, const wchar_t * file)
{
using namespace TemplatesFunctions;
@@ -435,7 +436,7 @@ using namespace TemplatesFunctions;
}
void Templates::ReadFileFun(size_t index, const char * file)
void Templates::ReadFileFun(size_t index, const wchar_t * file)
{
using namespace TemplatesFunctions;
@@ -454,6 +455,7 @@ using namespace TemplatesFunctions;
else
locale.SetLang(Locale::lang_en);
locale.UTF8(config->utf8);
locale.Read(config->locale_dir, config->locale_dir_default);
}
@@ -466,7 +468,7 @@ using namespace TemplatesFunctions;
for(; i != functions->End() ; ++i)
{
const std::string & fun_name = i->first;
const std::wstring & fun_name = i->first;
const size_t index = i->second->id;
if( index < functions->FunctionsSize() )
@@ -493,8 +495,8 @@ using namespace TemplatesFunctions;
ClearPatterns();
ReadFile(pat_index, config->templates_index.c_str());
ReadFile(pat_err_404, "err_404.html");
ReadFile(pat_err_per_denied, "err_per_denied.html");
ReadFile(pat_err_404, L"err_404.html");
ReadFile(pat_err_per_denied, L"err_per_denied.html");
ReadFunctionsTemplates();
index_patterns.ReloadPatterns(locale, locale_filter, false);
@@ -529,16 +531,17 @@ using namespace TemplatesFunctions;
for(i=pmount_tab->begin() ; i!=pmount_tab->end() ; ++i)
{
const Mount & mount = i->second;
int html_id = TemplatesFunctions::system->mounts.MountParHtmlTemplate();
if( mount.param[TemplatesFunctions::system->mounts.MountParHtmlTemplate()].defined )
if( mount.param[html_id].defined )
{
size_t len = mount.param[TemplatesFunctions::system->mounts.MountParHtmlTemplate()].arg.size();
size_t len = mount.param[html_id].arg.size();
size_t a;
// loop through all html_templates() values
for(a=0 ; a<len ; ++a)
{
const std::string & file_name = mount.param[TemplatesFunctions::system->mounts.MountParHtmlTemplate()].arg[a];
const std::wstring & file_name = mount.param[html_id].arg[a];
if( add_pattern )
index_patterns.AddPatternIfNotExists(file_name, locale, locale_filter, false); // file pattern will be unmarked
@@ -569,7 +572,7 @@ using namespace TemplatesFunctions;
return;
Ezc::Pattern * index = 0;
const std::string * index_file_local = 0;
const std::wstring * index_file_local = 0;
if( request->is_item )
{
@@ -585,7 +588,7 @@ using namespace TemplatesFunctions;
if( !index_file_local )
{
const std::string & temp = TemplatesFunctions::system->mounts.pmount->FirstArg(
const std::wstring & temp = TemplatesFunctions::system->mounts.pmount->FirstArg(
TemplatesFunctions::system->mounts.MountParHtmlTemplate() );
if( !temp.empty() )
@@ -600,7 +603,7 @@ using namespace TemplatesFunctions;
if( !index )
index = &patterns[locale.GetLang()][pat_index];
Ezc::Generator generator(request->page, *index, ezc_functions);
Ezc::Generator<TextStream<std::wstring> > generator(request->page, *index, ezc_functions);
generator.Generate();
}
@@ -613,7 +616,7 @@ using namespace TemplatesFunctions;
if( !empty_pars.empty() )
empty_pars.clear();
Ezc::Info info(request->page, empty_pars, empty_string);
Info info(request->page, empty_pars, empty_string);
info.iter = 0;
info.res = false;