added: winix functions: locale, timezone
changed: time zones -- now we have the daylight saving time
different for each year (start, end)
added: config option: time_zone_id (size_t)
time zone identifier for not logged users
or for newly created accounts
those identifiers you can see in etc/time_zones.conf file
or by using timezone winix function with 'a' parameter (timezone/a) (!!IMPROVE ME NOT IMPLEMENTED YET)
default: 34 (Coordinated Universal Time UTC+00:00)
added: config option: locale_default_id (size_t)
locale for not logged users
or for newly created accounts
added: config option: locale_max_id (size_t)
a maximum value of a locale identifier
default: 100 (maximum: 1000)
each locale files should have its own identifier (in "winix_locale_id" field)
from zero to this value
added: config option: time_zone_max_id (size_t)
maximum value of a time zone identifier
time zones with an id greater than this will be skipped
default: 130 (maximum: 1000)
removed: config option: locale_default
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@852 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -5,13 +5,12 @@ db.o: ../core/misc.h ../core/item.h ../../pikotools/space/space.h
|
||||
db.o: ../../pikotools/date/date.h ../core/requesttypes.h ../core/error.h
|
||||
db.o: ../../pikotools/space/spaceparser.h ../../pikotools/space/space.h
|
||||
db.o: dbitemquery.h ../core/item.h dbitemcolumns.h ../core/user.h
|
||||
db.o: ../core/timezone.h ../core/group.h ../core/dircontainer.h
|
||||
db.o: ../core/ugcontainer.h ../core/log.h ../core/textstream.h
|
||||
db.o: ../core/logmanipulators.h ../core/slog.h ../core/cur.h
|
||||
db.o: ../core/request.h ../core/error.h ../core/config.h ../core/htmlfilter.h
|
||||
db.o: ../templates/htmltextstream.h ../core/session.h ../core/user.h
|
||||
db.o: ../core/plugindata.h ../core/rebus.h ../core/mount.h
|
||||
db.o: ../templates/locale.h ../core/log.h ../core/misc.h
|
||||
db.o: ../core/group.h ../core/dircontainer.h ../core/ugcontainer.h
|
||||
db.o: ../core/log.h ../core/textstream.h ../core/logmanipulators.h
|
||||
db.o: ../core/slog.h ../core/cur.h ../core/request.h ../core/error.h
|
||||
db.o: ../core/config.h ../core/htmlfilter.h ../templates/htmltextstream.h
|
||||
db.o: ../core/session.h ../core/user.h ../core/plugindata.h ../core/rebus.h
|
||||
db.o: ../core/mount.h ../templates/locale.h ../core/log.h ../core/misc.h
|
||||
dbbase.o: dbbase.h dbconn.h dbtextstream.h ../core/textstream.h
|
||||
dbbase.o: ../core/misc.h ../core/item.h ../../pikotools/space/space.h
|
||||
dbbase.o: ../../pikotools/date/date.h ../core/requesttypes.h ../core/error.h
|
||||
|
||||
47
db/db.cpp
47
db/db.cpp
@@ -77,7 +77,7 @@ Error Db::AddUser(User & user, const UserPass & up)
|
||||
{
|
||||
query.Clear();
|
||||
query << R("insert into core.user (login, password, pass_encrypted, super_user, email,"
|
||||
"notify, pass_type, pass_hash_salted, env, aenv, status) values (")
|
||||
"notify, pass_type, pass_hash_salted, env, aenv, status, locale_id, time_zone_id) values (")
|
||||
<< user.name;
|
||||
|
||||
// for safety we put up.pass only if there is not an encrypted version
|
||||
@@ -97,6 +97,8 @@ Error Db::AddUser(User & user, const UserPass & up)
|
||||
<< user.env
|
||||
<< user.aenv
|
||||
<< user.status
|
||||
<< user.locale_id
|
||||
<< user.time_zone_id
|
||||
<< R(");");
|
||||
|
||||
r = AssertQuery(query);
|
||||
@@ -194,6 +196,32 @@ return DoCommand(query);
|
||||
}
|
||||
|
||||
|
||||
Error Db::ChangeUserLocale(long user_id, size_t locale_id)
|
||||
{
|
||||
query.Clear();
|
||||
query << R("update core.user set(locale_id) = (")
|
||||
<< locale_id
|
||||
<< R(") where id = ")
|
||||
<< user_id
|
||||
<< R(";");
|
||||
|
||||
return DoCommand(query);
|
||||
}
|
||||
|
||||
|
||||
Error Db::ChangeUserTimeZone(long user_id, size_t time_zone_id)
|
||||
{
|
||||
query.Clear();
|
||||
query << R("update core.user set(time_zone_id) = (")
|
||||
<< time_zone_id
|
||||
<< R(") where id = ")
|
||||
<< user_id
|
||||
<< R(";");
|
||||
|
||||
return DoCommand(query);
|
||||
}
|
||||
|
||||
|
||||
Error Db::RemoveUser(long user_id)
|
||||
{
|
||||
query.Clear();
|
||||
@@ -1566,7 +1594,8 @@ void Db::GetUsers(UGContainer<User> & user_tab)
|
||||
try
|
||||
{
|
||||
query.Clear();
|
||||
query << R("select id, login, super_user, group_id, email, notify, env, aenv, status"
|
||||
query << R("select id, login, super_user, group_id, email, notify,"
|
||||
" env, aenv, status, locale_id, time_zone_id"
|
||||
" from core.user left outer join core.group_mem on"
|
||||
" core.user.id = core.group_mem.user_id order by id asc;");
|
||||
|
||||
@@ -1584,6 +1613,8 @@ void Db::GetUsers(UGContainer<User> & user_tab)
|
||||
int cenv = AssertColumn(r, "env");
|
||||
int caenv = AssertColumn(r, "aenv");
|
||||
int cstatus = AssertColumn(r, "status");
|
||||
int clocale_id = AssertColumn(r, "locale_id");
|
||||
int ctzone_id = AssertColumn(r, "time_zone_id");
|
||||
|
||||
User u;
|
||||
long last_id = -1;
|
||||
@@ -1595,11 +1626,13 @@ void Db::GetUsers(UGContainer<User> & user_tab)
|
||||
|
||||
if( u.id != last_id )
|
||||
{
|
||||
u.name = AssertValueWide(r, i, cname);
|
||||
u.super_user = AssertValueBool(r, i, csuper_user);
|
||||
u.email = AssertValueWide(r, i, cemail);
|
||||
u.notify = AssertValueInt(r, i, cnotify);
|
||||
u.status = AssertValueInt(r, i, cstatus);
|
||||
u.name = AssertValueWide(r, i, cname);
|
||||
u.super_user = AssertValueBool(r, i, csuper_user);
|
||||
u.email = AssertValueWide(r, i, cemail);
|
||||
u.notify = AssertValueInt(r, i, cnotify);
|
||||
u.status = AssertValueInt(r, i, cstatus);
|
||||
u.locale_id = (size_t)AssertValueInt(r, i, clocale_id);
|
||||
u.time_zone_id = (size_t)AssertValueInt(r, i, ctzone_id);
|
||||
AssertValueSpace(r, i, cenv, u.env);
|
||||
AssertValueSpace(r, i, caenv, u.aenv);
|
||||
|
||||
|
||||
2
db/db.h
2
db/db.h
@@ -51,6 +51,8 @@ public:
|
||||
Error ChangeUserAdminEnv(long user_id, const PT::Space & space);
|
||||
Error ChangeUserStatus(long user_id, int status);
|
||||
Error ChangeUserEmail(long user_id, const std::wstring & email);
|
||||
Error ChangeUserLocale(long user_id, size_t locale_id);
|
||||
Error ChangeUserTimeZone(long user_id, size_t time_zone_id);
|
||||
Error RemoveUser(long user_id);
|
||||
|
||||
Error AddItem(Item & item);
|
||||
|
||||
Reference in New Issue
Block a user