Fix quick timezone selection

- Now updates all open apps, not just the currently active one.
- Fixed AJAX change did not stay changed
This commit is contained in:
nathangray 2016-06-08 16:02:10 -06:00
parent fa6ecf8176
commit 578ded52b8
3 changed files with 8 additions and 21 deletions

View File

@ -857,12 +857,16 @@ var fw_base = (function(){ "use strict"; return Class.extend(
tzSelection: function(_tz)
{
//Perform an AJAX request to tell server
var req = egw.json('EGroupware\Api\Framework\Ajax::ajax_tz_selection',[_tz],null,null,false); // false = synchron
var req = egw.json('EGroupware\\Api\\Framework\\Ajax::ajax_tz_selection',[_tz],null,null,false); // false = synchron
req.sendRequest();
if (this.activeApp.browser)
// Reload apps so they can use the new setting
for (var app in this.applications)
{
this.activeApp.browser.reload();
if (this.applications[app].browser)
{
this.applications[app].browser.reload();
}
}
},

View File

@ -234,8 +234,6 @@ class Egw extends Egw\Base
// init the translation class, necessary as own wakeup would run before our's
Translation::init(isset($GLOBALS['egw_info']['flags']['load_translations']) ? $GLOBALS['egw_info']['flags']['load_translations'] : true);
$this->unset_datetime();
// verify the session
$GLOBALS['egw']->verify_session();
$GLOBALS['egw']->check_app_rights();
@ -243,14 +241,6 @@ class Egw extends Egw\Base
$this->load_optional_classes();
}
/**
* Unsetting datetime object, so time gets updated
*/
function unset_datetime()
{
unset($this->datetime);
}
/**
* load optional classes by mentioning them in egw_info[flags][enable_CLASS_class] => true
*

View File

@ -521,20 +521,13 @@ class Preferences
*/
function check_set_tz_offset()
{
$prefs =& $GLOBALS['egw_info']['user']['preferences']['common'];
$prefs =& $this->data['common'];
if (!empty($prefs['tz']))
{
DateTime::setUserPrefs($prefs['tz'],$prefs['dateformat'],$prefs['timeformat']);
// set the old preference for compatibilty with old code
$prefs['tz_offset'] = DateTime::tz_offset_s()/3600;
//echo "<p>".__METHOD__."() tz=$prefs[tz] --> tz_offset=$prefs[tz_offset]</p>\n";
// ToDo: get rid of that
if (isset($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof egw))
{
$GLOBALS['egw']->unset_datetime(); // to force an update
}
}
}