New: Add timezone string from browser.

This commit is contained in:
Laurent Destailleur 2012-05-15 01:41:12 +02:00
parent e7138bce4e
commit e0b6bee540
4 changed files with 7 additions and 1 deletions

View File

@ -164,7 +164,7 @@ $daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown';
//print $a." ".$b." ".$c." ".$daylight; //print $a." ".$b." ".$c." ".$daylight;
$val=($a>=0?'+':'').$a; $val=($a>=0?'+':'').$a;
$val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')'; $val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
$val.='       '.getServerTimeZoneString().' '.($b>=0?'+':'').$b.' ('.($b>=0?'+':'').($b*3600).')'; $val.='       '.getServerTimeZoneString();
$val.='       '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':yn($daylight)); $val.='       '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':yn($daylight));
print $form->textwithtooltip($val,$txt,2,1,img_info('')); print $form->textwithtooltip($val,$txt,2,1,img_info(''));
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
@ -185,6 +185,7 @@ print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("CompanyHour"
$var=!$var; $var=!$var;
$tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; $tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("ClientTZ").'</td><td>'.($tz?($tz>=0?'+':'').$tz:'').' ('.($tz>=0?'+':'').($tz*60*60).')'; print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("ClientTZ").'</td><td>'.($tz?($tz>=0?'+':'').$tz:'').' ('.($tz>=0?'+':'').($tz*60*60).')';
print ' &nbsp; &nbsp; &nbsp; '.$_SESSION['dol_tz_string'];
print ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '; print ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': ';
if ($_SESSION['dol_dst']>0) print yn(1); if ($_SESSION['dol_dst']>0) print yn(1);
else print yn(0); else print yn(0);

View File

@ -38,10 +38,12 @@ $(document).ready(function () {
} else { } else {
dst = "1"; // daylight savings time is observed dst = "1"; // daylight savings time is observed
} }
var tz=new Date().toTimeString().match(/\(.*\)/);
var dst_first=DisplayDstSwitchDates('first'); var dst_first=DisplayDstSwitchDates('first');
var dst_second=DisplayDstSwitchDates('second'); var dst_second=DisplayDstSwitchDates('second');
//alert(dst); //alert(dst);
$('#tz').val(std_time_offset); // returns TZ $('#tz').val(std_time_offset); // returns TZ
$('#tz_string').val(tz[0].replace('(','').replace(')','')); // returns TZ string
$('#dst_observed').val(dst); // returns if DST is observed on summer $('#dst_observed').val(dst); // returns if DST is observed on summer
$('#dst_first').val(dst_first); // returns DST first switch in year $('#dst_first').val(dst_first); // returns DST first switch in year
$('#dst_second').val(dst_second); // returns DST second switch in year $('#dst_second').val(dst_second); // returns DST second switch in year

View File

@ -63,6 +63,7 @@ $(document).ready(function () {
<input type="hidden" name="loginfunction" value="loginfunction" /> <input type="hidden" name="loginfunction" value="loginfunction" />
<!-- Add fields to send local user information --> <!-- Add fields to send local user information -->
<input type="hidden" name="tz" id="tz" value="" /> <input type="hidden" name="tz" id="tz" value="" />
<input type="hidden" name="tz_string" id="tz_string" value="" />
<input type="hidden" name="dst_observed" id="dst_observed" value="" /> <input type="hidden" name="dst_observed" id="dst_observed" value="" />
<input type="hidden" name="dst_first" id="dst_first" value="" /> <input type="hidden" name="dst_first" id="dst_first" value="" />
<input type="hidden" name="dst_second" id="dst_second" value="" /> <input type="hidden" name="dst_second" id="dst_second" value="" />

View File

@ -383,6 +383,7 @@ if (! defined('NOLOGIN'))
{ {
$dol_authmode=$conf->authmode; // This properties is defined only when logged to say what mode was successfully used $dol_authmode=$conf->authmode; // This properties is defined only when logged to say what mode was successfully used
$dol_tz=$_POST["tz"]; $dol_tz=$_POST["tz"];
$dol_tz_string=$_POST["tz_string"];
$dol_dst=0; $dol_dst=0;
if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) if (isset($_POST["dst_first"]) && isset($_POST["dst_second"]))
{ {
@ -536,6 +537,7 @@ if (! defined('NOLOGIN'))
$_SESSION["dol_login"]=$user->login; $_SESSION["dol_login"]=$user->login;
$_SESSION["dol_authmode"]=isset($dol_authmode)?$dol_authmode:''; $_SESSION["dol_authmode"]=isset($dol_authmode)?$dol_authmode:'';
$_SESSION["dol_tz"]=isset($dol_tz)?$dol_tz:''; $_SESSION["dol_tz"]=isset($dol_tz)?$dol_tz:'';
$_SESSION["dol_tz_string"]=isset($dol_tz_string)?$dol_tz_string:'';
$_SESSION["dol_dst"]=isset($dol_dst)?$dol_dst:''; $_SESSION["dol_dst"]=isset($dol_dst)?$dol_dst:'';
$_SESSION["dol_dst_observed"]=isset($dol_dst_observed)?$dol_dst_observed:''; $_SESSION["dol_dst_observed"]=isset($dol_dst_observed)?$dol_dst_observed:'';
$_SESSION["dol_dst_first"]=isset($dol_dst_first)?$dol_dst_first:''; $_SESSION["dol_dst_first"]=isset($dol_dst_first)?$dol_dst_first:'';