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:
+29
-39
@@ -5,14 +5,13 @@ compress.o: compress.h log.h
|
||||
config.o: config.h ../confparser/confparser.h log.h data.h dirs.h item.h
|
||||
config.o: dircontainer.h users.h user.h ugcontainer.h groups.h group.h
|
||||
config.o: functions.h function.h lastcontainer.h mounts.h mount.h error.h
|
||||
config.o: rebus.h locale.h loadavg.h plugin.h request.h requesttypes.h
|
||||
config.o: session.h done.h thread.h compress.h acceptencodingparser.h
|
||||
config.o: rebus.h loadavg.h plugin.h request.h requesttypes.h session.h
|
||||
config.o: done.h thread.h compress.h acceptencodingparser.h
|
||||
config.o: acceptbaseparser.h htmlfilter.h postmultiparser.h ticket.h
|
||||
config.o: pluginmsg.h misc.h
|
||||
data.o: data.h dirs.h item.h dircontainer.h users.h user.h ugcontainer.h
|
||||
data.o: log.h groups.h group.h functions.h function.h lastcontainer.h
|
||||
data.o: mounts.h mount.h error.h rebus.h locale.h ../confparser/confparser.h
|
||||
data.o: loadavg.h
|
||||
data.o: mounts.h mount.h error.h rebus.h loadavg.h
|
||||
db.o: db.h item.h user.h group.h thread.h error.h log.h dircontainer.h
|
||||
db.o: ugcontainer.h ticket.h misc.h
|
||||
db_itemcolumns.o: db.h item.h user.h group.h thread.h error.h log.h
|
||||
@@ -20,8 +19,7 @@ db_itemcolumns.o: dircontainer.h ugcontainer.h ticket.h
|
||||
dircontainer.o: dircontainer.h item.h log.h
|
||||
dirs.o: dirs.h item.h dircontainer.h error.h log.h db.h user.h group.h
|
||||
dirs.o: thread.h ugcontainer.h ticket.h data.h users.h groups.h functions.h
|
||||
dirs.o: function.h lastcontainer.h mounts.h mount.h rebus.h locale.h
|
||||
dirs.o: ../confparser/confparser.h loadavg.h
|
||||
dirs.o: function.h lastcontainer.h mounts.h mount.h rebus.h loadavg.h
|
||||
done.o: done.h
|
||||
error.o: error.h log.h
|
||||
function.o: function.h item.h
|
||||
@@ -29,10 +27,9 @@ functioncodeparser.o: functioncodeparser.h item.h function.h log.h
|
||||
functionparser.o: functionparser.h requesttypes.h log.h item.h error.h data.h
|
||||
functionparser.o: dirs.h dircontainer.h users.h user.h ugcontainer.h groups.h
|
||||
functionparser.o: group.h functions.h function.h lastcontainer.h mounts.h
|
||||
functionparser.o: mount.h rebus.h locale.h ../confparser/confparser.h
|
||||
functionparser.o: loadavg.h db.h thread.h ticket.h request.h session.h done.h
|
||||
functionparser.o: compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
functionparser.o: htmlfilter.h postmultiparser.h
|
||||
functionparser.o: mount.h rebus.h loadavg.h db.h thread.h ticket.h request.h
|
||||
functionparser.o: session.h done.h compress.h acceptencodingparser.h
|
||||
functionparser.o: acceptbaseparser.h htmlfilter.h postmultiparser.h
|
||||
functions.o: functions.h function.h item.h
|
||||
groups.o: groups.h group.h ugcontainer.h log.h db.h item.h user.h thread.h
|
||||
groups.o: error.h dircontainer.h ticket.h
|
||||
@@ -44,39 +41,36 @@ locale.o: locale.h ../confparser/confparser.h log.h
|
||||
log.o: log.h
|
||||
misc.o: misc.h item.h log.h data.h dirs.h dircontainer.h users.h user.h
|
||||
misc.o: ugcontainer.h groups.h group.h functions.h function.h lastcontainer.h
|
||||
misc.o: mounts.h mount.h error.h rebus.h locale.h ../confparser/confparser.h
|
||||
misc.o: loadavg.h
|
||||
misc.o: mounts.h mount.h error.h rebus.h loadavg.h
|
||||
mount.o: mount.h
|
||||
mountparser.o: mountparser.h mount.h item.h error.h log.h data.h dirs.h
|
||||
mountparser.o: dircontainer.h users.h user.h ugcontainer.h groups.h group.h
|
||||
mountparser.o: functions.h function.h lastcontainer.h mounts.h rebus.h
|
||||
mountparser.o: locale.h ../confparser/confparser.h loadavg.h misc.h
|
||||
mountparser.o: loadavg.h misc.h
|
||||
mounts.o: mounts.h mount.h error.h log.h data.h dirs.h item.h dircontainer.h
|
||||
mounts.o: users.h user.h ugcontainer.h groups.h group.h functions.h
|
||||
mounts.o: function.h lastcontainer.h rebus.h locale.h
|
||||
mounts.o: ../confparser/confparser.h loadavg.h request.h requesttypes.h
|
||||
mounts.o: session.h done.h thread.h compress.h acceptencodingparser.h
|
||||
mounts.o: acceptbaseparser.h htmlfilter.h postmultiparser.h ticket.h
|
||||
mounts.o: mountparser.h db.h
|
||||
mounts.o: function.h lastcontainer.h rebus.h loadavg.h request.h
|
||||
mounts.o: requesttypes.h session.h done.h thread.h compress.h
|
||||
mounts.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
mounts.o: postmultiparser.h ticket.h mountparser.h db.h
|
||||
notify.o: log.h notify.h ../templatesnotify/templatesnotify.h ../core/mount.h
|
||||
notify.o: ../core/locale.h ../confparser/confparser.h ../templates/misc.h
|
||||
notify.o: ../templates/localefilter.h data.h dirs.h item.h dircontainer.h
|
||||
notify.o: users.h user.h ugcontainer.h groups.h group.h functions.h
|
||||
notify.o: function.h lastcontainer.h mounts.h mount.h error.h rebus.h
|
||||
notify.o: locale.h loadavg.h misc.h request.h requesttypes.h session.h done.h
|
||||
notify.o: thread.h compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
notify.o: htmlfilter.h postmultiparser.h ticket.h
|
||||
notify.o: loadavg.h misc.h request.h requesttypes.h session.h done.h thread.h
|
||||
notify.o: compress.h acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
notify.o: postmultiparser.h ticket.h
|
||||
plugin.o: plugin.h request.h requesttypes.h session.h done.h item.h error.h
|
||||
plugin.o: log.h user.h rebus.h function.h thread.h compress.h
|
||||
plugin.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
plugin.o: postmultiparser.h ticket.h data.h dirs.h dircontainer.h users.h
|
||||
plugin.o: ugcontainer.h groups.h group.h functions.h lastcontainer.h mounts.h
|
||||
plugin.o: mount.h locale.h ../confparser/confparser.h loadavg.h pluginmsg.h
|
||||
plugin.o: mount.h loadavg.h pluginmsg.h
|
||||
postmultiparser.o: postmultiparser.h error.h log.h requesttypes.h data.h
|
||||
postmultiparser.o: dirs.h item.h dircontainer.h users.h user.h ugcontainer.h
|
||||
postmultiparser.o: groups.h group.h functions.h function.h lastcontainer.h
|
||||
postmultiparser.o: mounts.h mount.h rebus.h locale.h
|
||||
postmultiparser.o: ../confparser/confparser.h loadavg.h
|
||||
postmultiparser.o: mounts.h mount.h rebus.h loadavg.h
|
||||
rebus.o: log.h rebus.h misc.h item.h
|
||||
request.o: request.h requesttypes.h session.h done.h item.h error.h log.h
|
||||
request.o: user.h rebus.h function.h thread.h compress.h
|
||||
@@ -84,43 +78,39 @@ request.o: acceptencodingparser.h acceptbaseparser.h htmlfilter.h
|
||||
request.o: postmultiparser.h ticket.h getparser.h httpsimpleparser.h
|
||||
request.o: postparser.h cookieparser.h data.h dirs.h dircontainer.h users.h
|
||||
request.o: ugcontainer.h groups.h group.h functions.h lastcontainer.h
|
||||
request.o: mounts.h mount.h locale.h ../confparser/confparser.h loadavg.h
|
||||
request.o: plugin.h pluginmsg.h misc.h db.h
|
||||
request.o: mounts.h mount.h loadavg.h plugin.h pluginmsg.h misc.h db.h
|
||||
requestcontroller.o: requestcontroller.h ../content/content.h ../core/item.h
|
||||
requestcontroller.o: ../templates/templates.h ../templates/patterncacher.h
|
||||
requestcontroller.o: misc.h item.h ../templates/ckeditorgetparser.h
|
||||
requestcontroller.o: ../core/httpsimpleparser.h ../core/log.h
|
||||
requestcontroller.o: ../core/locale.h ../confparser/confparser.h
|
||||
requestcontroller.o: ../core/thread.h ../core/ticket.h ../core/done.h
|
||||
requestcontroller.o: sessionmanager.h sessioncontainer.h session.h done.h
|
||||
requestcontroller.o: error.h log.h user.h rebus.h functionparser.h
|
||||
requestcontroller.o: requesttypes.h data.h dirs.h dircontainer.h users.h
|
||||
requestcontroller.o: ugcontainer.h groups.h group.h functions.h function.h
|
||||
requestcontroller.o: lastcontainer.h mounts.h mount.h locale.h
|
||||
requestcontroller.o: ../confparser/confparser.h loadavg.h request.h thread.h
|
||||
requestcontroller.o: compress.h acceptencodingparser.h acceptbaseparser.h
|
||||
requestcontroller.o: htmlfilter.h postmultiparser.h ticket.h postparser.h
|
||||
requestcontroller.o: httpsimpleparser.h cookieparser.h notify.h
|
||||
requestcontroller.o: ../templatesnotify/templatesnotify.h ../core/mount.h
|
||||
requestcontroller.o: ../core/locale.h ../templates/misc.h
|
||||
requestcontroller.o: lastcontainer.h mounts.h mount.h loadavg.h request.h
|
||||
requestcontroller.o: thread.h compress.h acceptencodingparser.h
|
||||
requestcontroller.o: acceptbaseparser.h htmlfilter.h postmultiparser.h
|
||||
requestcontroller.o: ticket.h postparser.h httpsimpleparser.h cookieparser.h
|
||||
requestcontroller.o: notify.h ../templatesnotify/templatesnotify.h
|
||||
requestcontroller.o: ../core/mount.h ../templates/misc.h
|
||||
requestcontroller.o: ../templates/localefilter.h
|
||||
session.o: session.h done.h item.h error.h log.h user.h rebus.h
|
||||
sessioncontainer.o: sessioncontainer.h session.h done.h item.h error.h log.h
|
||||
sessioncontainer.o: user.h rebus.h data.h dirs.h dircontainer.h users.h
|
||||
sessioncontainer.o: ugcontainer.h groups.h group.h functions.h function.h
|
||||
sessioncontainer.o: lastcontainer.h mounts.h mount.h locale.h
|
||||
sessioncontainer.o: ../confparser/confparser.h loadavg.h
|
||||
sessioncontainer.o: lastcontainer.h mounts.h mount.h loadavg.h
|
||||
sessionmanager.o: sessionmanager.h sessioncontainer.h session.h done.h item.h
|
||||
sessionmanager.o: error.h log.h user.h rebus.h request.h requesttypes.h
|
||||
sessionmanager.o: function.h thread.h compress.h acceptencodingparser.h
|
||||
sessionmanager.o: acceptbaseparser.h htmlfilter.h postmultiparser.h ticket.h
|
||||
sessionmanager.o: data.h dirs.h dircontainer.h users.h ugcontainer.h groups.h
|
||||
sessionmanager.o: group.h functions.h lastcontainer.h mounts.h mount.h
|
||||
sessionmanager.o: locale.h ../confparser/confparser.h loadavg.h
|
||||
sessionmanager.o: sessionparser.h
|
||||
sessionmanager.o: loadavg.h sessionparser.h
|
||||
sessionparser.o: sessionparser.h session.h done.h item.h error.h log.h user.h
|
||||
sessionparser.o: rebus.h sessioncontainer.h data.h dirs.h dircontainer.h
|
||||
sessionparser.o: users.h ugcontainer.h groups.h group.h functions.h
|
||||
sessionparser.o: function.h lastcontainer.h mounts.h mount.h locale.h
|
||||
sessionparser.o: ../confparser/confparser.h loadavg.h
|
||||
sessionparser.o: function.h lastcontainer.h mounts.h mount.h loadavg.h
|
||||
users.o: users.h user.h ugcontainer.h log.h db.h item.h group.h thread.h
|
||||
users.o: error.h dircontainer.h ticket.h
|
||||
|
||||
+7
-8
@@ -91,6 +91,7 @@ bool Config::ReadConfig(bool errors_to_stdout_)
|
||||
|
||||
|
||||
|
||||
|
||||
void Config::AssignValues()
|
||||
{
|
||||
data.log_file = Text("log_file");
|
||||
@@ -151,36 +152,34 @@ void Config::AssignValues()
|
||||
data.locale_dir = Text("locale_dir");
|
||||
data.locale_dir_default = Text("locale_dir_default");
|
||||
|
||||
Locale::Lang lang = Locale::StrToLang(data.locale_str);
|
||||
data.title_separator = Text("title_separator", " / ");
|
||||
|
||||
if( lang != Locale::lang_unknown )
|
||||
data.locale.SetLang(lang);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const std::string & Config::Text(const char * name)
|
||||
std::string Config::Text(const char * name)
|
||||
{
|
||||
return Text(std::string(name), default_str);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const std::string & Config::Text(const char * name, const char * def)
|
||||
std::string Config::Text(const char * name, const char * def)
|
||||
{
|
||||
return Text(std::string(name), std::string(def));
|
||||
}
|
||||
|
||||
|
||||
const std::string & Config::Text(const std::string & name, const std::string & def)
|
||||
std::string Config::Text(const std::string & name, const std::string & def)
|
||||
{
|
||||
ConfParser::Table::iterator i = conf_parser.table.find(name);
|
||||
|
||||
if( i == conf_parser.table.end() )
|
||||
return def;
|
||||
|
||||
return i->second;
|
||||
|
||||
return i->second;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-4
@@ -32,10 +32,9 @@ private:
|
||||
void ShowError();
|
||||
void AssignValues();
|
||||
|
||||
|
||||
const std::string & Text(const char *);
|
||||
const std::string & Text(const char * name, const char * def);
|
||||
const std::string & Text(const std::string & name, const std::string & def);
|
||||
std::string Text(const char * name);
|
||||
std::string Text(const char * name, const char * def);
|
||||
std::string Text(const std::string & name, const std::string & def);
|
||||
|
||||
int Int(const char *);
|
||||
int Int(const char * name, int def);
|
||||
|
||||
+2
-2
@@ -22,7 +22,6 @@
|
||||
#include "lastcontainer.h"
|
||||
#include "mounts.h"
|
||||
#include "rebus.h"
|
||||
#include "locale.h"
|
||||
#include "loadavg.h"
|
||||
|
||||
|
||||
@@ -143,8 +142,9 @@ public:
|
||||
// base_url_static_auth_prefix + base_server
|
||||
std::string base_url_static_auth;
|
||||
|
||||
// separator used in <title> html tag
|
||||
std::string title_separator;
|
||||
|
||||
Locale locale;
|
||||
|
||||
|
||||
// end config members
|
||||
|
||||
@@ -264,6 +264,29 @@ return out.str();
|
||||
}
|
||||
|
||||
|
||||
const char * DateToStr(int year, int month, int day)
|
||||
{
|
||||
static const char * month_letter[] = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII" };
|
||||
static char buffer[100];
|
||||
|
||||
--month;
|
||||
|
||||
if( month < 0 )
|
||||
month = 0;
|
||||
|
||||
if( month > 11 )
|
||||
month = 11;
|
||||
|
||||
if( year == 0 )
|
||||
sprintf(buffer, "%s %02d", month_letter[month], day);
|
||||
else
|
||||
sprintf(buffer, "%02d %s %02d", year, month_letter[month], day);
|
||||
|
||||
// warning: not thread safe (we do not use threads)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
const char * DateToStr(int year, int month, int day, int hour, int min, int sec)
|
||||
{
|
||||
static const char * month_letter[] = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII" };
|
||||
|
||||
@@ -37,6 +37,7 @@ void HtmlEscapeFormTxt(std::ostringstream & out, const std::string & in);
|
||||
std::string HtmlEscape(const std::string & in);
|
||||
std::string HtmlEscapeFormTxt(const std::string & in);
|
||||
|
||||
const char * DateToStr(int year, int month, int day);
|
||||
const char * DateToStr(int year, int month, int day, int hour, int min, int sec);
|
||||
const char * DateToStr(tm * ptm);
|
||||
const char * DateToStr(time_t t);
|
||||
|
||||
+10
-3
@@ -2,7 +2,7 @@
|
||||
* This file is a part of CMSLU -- Content Management System like Unix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2009, Tomasz Sowa
|
||||
* Copyright (c) 2008-2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -138,7 +138,10 @@ Notify::~Notify()
|
||||
|
||||
void Notify::ReadTemplates()
|
||||
{
|
||||
Lock();
|
||||
// we are in the first thread here
|
||||
// the second thread can use our templates and we must Lock()
|
||||
// (the second thread is using Lock() too)
|
||||
Lock();
|
||||
templates_notify.Read();
|
||||
Unlock();
|
||||
}
|
||||
@@ -241,7 +244,11 @@ Users::Iterator i;
|
||||
if( sending )
|
||||
{
|
||||
n.email = i->email;
|
||||
n.lang = data.locale.GetLang(); // !! bedzie osobno dla kazdego uzytkownika
|
||||
n.lang = Locale::StrToLang(data.locale_str);// !! bedzie osobno dla kazdego uzytkownika
|
||||
|
||||
if( n.lang == Locale::lang_unknown )
|
||||
n.lang = Locale::lang_en;
|
||||
|
||||
notify_pool.insert(notify_pool.end(), n);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,6 @@ bool RequestController::Init()
|
||||
data.groups.ReadGroups();
|
||||
data.functions.ReadFunctions();
|
||||
data.mounts.ReadMounts();
|
||||
data.locale.Read(data.locale_dir, data.locale_dir_default); // call it before content.Init()
|
||||
data.rebus.Init();
|
||||
//
|
||||
|
||||
|
||||
Reference in New Issue
Block a user