fixed: Config::Text() returned a reference to a local variable (std::string)
added: 'static' directory with *.css and images we have a default layout moved: locale from data to templates notification templates have its own locale object added: reload function reloades locale now too added: 'nice' form of item_info in templates git-svn-id: svn://ttmath.org/publicrep/winix/trunk@582 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -21,6 +21,7 @@ namespace TemplatesFunctions
|
||||
TemplatesMisc::Patterns patterns;
|
||||
Ezc::Functions functions;
|
||||
PatternCacher pattern_cacher;
|
||||
Locale locale;
|
||||
LocaleFilter locale_filter;
|
||||
CKEditorGetParser ckeditor_getparser;
|
||||
|
||||
@@ -74,8 +75,8 @@ Ezc::Pattern * p = 0;
|
||||
{
|
||||
if( pat_name_tab[i].fun_code == request.pfunction->code )
|
||||
{
|
||||
// !! data.locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[data.locale.GetLang()][pat_name_tab[i].pat];
|
||||
// !! locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[locale.GetLang()][pat_name_tab[i].pat];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +90,7 @@ void content(Info & i)
|
||||
{
|
||||
Ezc::Pattern * p = 0;
|
||||
|
||||
if( static_cast<size_t>(data.locale.GetLang()) >= patterns.size() )
|
||||
if( static_cast<size_t>(locale.GetLang()) >= patterns.size() )
|
||||
{
|
||||
log << log1 << "Templates: there is no such a language in patterns" << logend;
|
||||
return;
|
||||
@@ -112,20 +113,20 @@ Ezc::Pattern * p = 0;
|
||||
case Error::cant_change_user:
|
||||
case Error::cant_change_group:
|
||||
case Error::cant_change_privileges:
|
||||
// !! data.locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[data.locale.GetLang()][pat_err_per_denied];
|
||||
// !! locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[locale.GetLang()][pat_err_per_denied];
|
||||
break;
|
||||
|
||||
case Error::no_item:
|
||||
case Error::no_function:
|
||||
case Error::unknown_param:
|
||||
// !! data.locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[data.locale.GetLang()][pat_err_404];
|
||||
// !! locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[locale.GetLang()][pat_err_404];
|
||||
break;
|
||||
|
||||
default:
|
||||
// !! data.locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[data.locale.GetLang()][pat_err_others];
|
||||
// !! locale.GetLang() bedzie brane indywidualnie dla kazdego uzytkownika
|
||||
p = &patterns[locale.GetLang()][pat_err_others];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -207,6 +208,8 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("item_user", item_user);
|
||||
functions.Insert("item_date_creation", item_date_creation);
|
||||
functions.Insert("item_date_modification", item_date_modification);
|
||||
functions.Insert("item_date_creation_nice", item_date_creation_nice);
|
||||
functions.Insert("item_date_modification_nice",item_date_modification_nice);
|
||||
functions.Insert("item_dates_equal", item_dates_equal);
|
||||
functions.Insert("item_run", item_run);
|
||||
functions.Insert("item_guest_name", item_guest_name);
|
||||
@@ -238,6 +241,8 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("item_tab_user", item_tab_user);
|
||||
functions.Insert("item_tab_date_creation", item_tab_date_creation);
|
||||
functions.Insert("item_tab_date_modification", item_tab_date_modification);
|
||||
functions.Insert("item_tab_date_creation_nice", item_tab_date_creation_nice);
|
||||
functions.Insert("item_tab_date_modification_nice", item_tab_date_modification_nice);
|
||||
functions.Insert("item_tab_dates_equal", item_tab_dates_equal);
|
||||
functions.Insert("item_tab_run", item_tab_run);
|
||||
|
||||
@@ -359,6 +364,7 @@ void Templates::CreateFunctions()
|
||||
functions.Insert("thread_tab_author", thread_tab_author);
|
||||
functions.Insert("thread_tab_answers", thread_tab_answers);
|
||||
functions.Insert("thread_tab_last_item_date_modification", thread_tab_last_item_date_modification);
|
||||
functions.Insert("thread_tab_last_item_date_modification_nice", thread_tab_last_item_date_modification_nice);
|
||||
functions.Insert("thread_tab_last_item_user", thread_tab_last_item_user);
|
||||
functions.Insert("thread_can_create", thread_can_create);
|
||||
|
||||
@@ -467,45 +473,59 @@ void Templates::CreateFunctions()
|
||||
|
||||
|
||||
|
||||
void Templates::ReadFile(TemplatesFunctions::Pat pat, const char * file)
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
TemplatesMisc::Read(patterns, static_cast<size_t>(pat), locale, locale_filter, file);
|
||||
}
|
||||
|
||||
|
||||
void Templates::ReadTemplates()
|
||||
{
|
||||
using namespace TemplatesFunctions;
|
||||
using namespace TemplatesMisc;
|
||||
|
||||
Locale::Lang lang = Locale::StrToLang(data.locale_str);
|
||||
|
||||
if( lang != Locale::lang_unknown )
|
||||
locale.SetLang(lang);
|
||||
else
|
||||
locale.SetLang(Locale::lang_en);
|
||||
|
||||
locale.Read(data.locale_dir, data.locale_dir_default);
|
||||
|
||||
ClearPatterns();
|
||||
|
||||
Read(patterns, pat_index, locale_filter, "index.html");
|
||||
Read(patterns, pat_err_404, locale_filter, "err_404.html");
|
||||
Read(patterns, pat_err_per_denied, locale_filter, "err_per_denied.html");
|
||||
Read(patterns, pat_fun_cat, locale_filter, "fun_cat.html");
|
||||
Read(patterns, pat_fun_ls, locale_filter, "fun_ls.html");
|
||||
Read(patterns, pat_fun_rm, locale_filter, "fun_rm.html");
|
||||
Read(patterns, pat_fun_emacs, locale_filter, "fun_emacs.html");
|
||||
Read(patterns, pat_fun_mkdir, locale_filter, "fun_mkdir.html");
|
||||
Read(patterns, pat_fun_default, locale_filter, "fun_default.html");
|
||||
Read(patterns, pat_fun_priv, locale_filter, "fun_priv.html");
|
||||
Read(patterns, pat_err_others, locale_filter, "err_others.html");
|
||||
Read(patterns, pat_fun_who, locale_filter, "fun_who.html");
|
||||
Read(patterns, pat_fun_run, locale_filter, "fun_run.html");
|
||||
Read(patterns, pat_fun_last, locale_filter, "fun_last.html");
|
||||
Read(patterns, pat_item_info, locale_filter, "item_info.html");
|
||||
Read(patterns, pat_item_tab_info, locale_filter, "item_tab_info.html");
|
||||
Read(patterns, pat_fun_thread, locale_filter, "fun_thread.html");
|
||||
Read(patterns, pat_fun_createthread,locale_filter, "fun_createthread.html");
|
||||
Read(patterns, pat_dir_last_info, locale_filter, "dir_last_info.html");
|
||||
Read(patterns, pat_fun_reload, locale_filter, "fun_reload.html");
|
||||
Read(patterns, pat_fun_upload, locale_filter, "fun_upload.html");
|
||||
Read(patterns, pat_fun_ticket, locale_filter, "fun_ticket.html");
|
||||
Read(patterns, pat_fun_createticket,locale_filter, "fun_createticket.html");
|
||||
Read(patterns, pat_fun_uptime, locale_filter, "fun_uptime.html");
|
||||
Read(patterns, pat_fun_login, locale_filter, "fun_login.html");
|
||||
/*Read(patterns, pat_fun_mv, locale_filter, "fun_mv.html");
|
||||
Read(patterns, pat_fun_uname, locale_filter, "fun_uname.html");
|
||||
Read(patterns, pat_fun_chmod, locale_filter, "fun_chmod.html");
|
||||
Read(patterns, pat_fun_chown, locale_filter, "fun_chown.html"); */
|
||||
Read(patterns, pat_fun_ckeditor, locale_filter, "fun_ckeditor.html");
|
||||
ReadFile(pat_index, "index.html");
|
||||
ReadFile(pat_err_404, "err_404.html");
|
||||
ReadFile(pat_err_per_denied, "err_per_denied.html");
|
||||
ReadFile(pat_fun_cat, "fun_cat.html");
|
||||
ReadFile(pat_fun_ls, "fun_ls.html");
|
||||
ReadFile(pat_fun_rm, "fun_rm.html");
|
||||
ReadFile(pat_fun_emacs, "fun_emacs.html");
|
||||
ReadFile(pat_fun_mkdir, "fun_mkdir.html");
|
||||
ReadFile(pat_fun_default, "fun_default.html");
|
||||
ReadFile(pat_fun_priv, "fun_priv.html");
|
||||
ReadFile(pat_err_others, "err_others.html");
|
||||
ReadFile(pat_fun_who, "fun_who.html");
|
||||
ReadFile(pat_fun_run, "fun_run.html");
|
||||
ReadFile(pat_fun_last, "fun_last.html");
|
||||
ReadFile(pat_item_info, "item_info.html");
|
||||
ReadFile(pat_item_tab_info, "item_tab_info.html");
|
||||
ReadFile(pat_fun_thread, "fun_thread.html");
|
||||
ReadFile(pat_fun_createthread, "fun_createthread.html");
|
||||
ReadFile(pat_dir_last_info, "dir_last_info.html");
|
||||
ReadFile(pat_fun_reload, "fun_reload.html");
|
||||
ReadFile(pat_fun_upload, "fun_upload.html");
|
||||
ReadFile(pat_fun_ticket, "fun_ticket.html");
|
||||
ReadFile(pat_fun_createticket, "fun_createticket.html");
|
||||
ReadFile(pat_fun_uptime, "fun_uptime.html");
|
||||
ReadFile(pat_fun_login, "fun_login.html");
|
||||
/*ReadFile(pat_fun_mv, "fun_mv.html");
|
||||
ReadFile(pat_fun_uname, "fun_uname.html");
|
||||
ReadFile(pat_fun_chmod, "fun_chmod.html");
|
||||
ReadFile(pat_fun_chown, "fun_chown.html"); */
|
||||
ReadFile(pat_fun_ckeditor, "fun_ckeditor.html");
|
||||
}
|
||||
|
||||
|
||||
@@ -524,10 +544,10 @@ void Templates::Generate()
|
||||
using namespace TemplatesFunctions;
|
||||
|
||||
// !! locale beda w zaleznosci od uzytkownika
|
||||
if( static_cast<size_t>(data.locale.GetLang()) >= patterns.size() )
|
||||
if( static_cast<size_t>(locale.GetLang()) >= patterns.size() )
|
||||
return;
|
||||
|
||||
Ezc::Generator generator(request.page, patterns[data.locale.GetLang()][pat_index], functions);
|
||||
Ezc::Generator generator(request.page, patterns[locale.GetLang()][pat_index], functions);
|
||||
generator.Generate();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user