Convert all time to browser timezone

This commit is contained in:
2019-10-19 21:04:22 +02:00
parent 36dee241fa
commit 29106b7e04
6 changed files with 12 additions and 13 deletions

View File

@@ -33,7 +33,7 @@ class Spot extends Main
*/ */
private $oMedia; private $oMedia;
public function __construct($oClassManagement, $sProcessPage) public function __construct($oClassManagement, $sProcessPage, $sTimezone)
{ {
$asClasses = array( $asClasses = array(
array('name'=>'feed', 'project'=>true), array('name'=>'feed', 'project'=>true),
@@ -41,7 +41,7 @@ class Spot extends Main
array('name'=>'media', 'project'=>true), array('name'=>'media', 'project'=>true),
array('name'=>'converter', 'project'=>true) array('name'=>'converter', 'project'=>true)
); );
parent::__construct($oClassManagement, $sProcessPage, $asClasses); parent::__construct($oClassManagement, $sProcessPage, $asClasses, true, $sTimezone);
$this->oClassManagement->incClass('translator'); $this->oClassManagement->incClass('translator');
$this->oLang = new Translator('', 'en'); $this->oLang = new Translator('', 'en');
@@ -123,9 +123,7 @@ class Spot extends Main
), ),
'consts' => array( 'consts' => array(
'geo_server' => Settings::GEO_SERVER, 'geo_server' => Settings::GEO_SERVER,
'modes' => Project::MODES, 'modes' => Project::MODES )
'site_timezone' => Settings::TIMEZONE
)
), ),
'index', 'index',
array( array(

View File

@@ -13,6 +13,7 @@ ToolBox::fixGlobalVars(isset($argv)?$argv:array());
//Available variables //Available variables
$sAction = isset($_REQUEST['a'])?$_REQUEST['a']:''; $sAction = isset($_REQUEST['a'])?$_REQUEST['a']:'';
$sTimezone = isset($_REQUEST['t'])?$_REQUEST['t']:'';
$sName = isset($_GET['name'])?$_GET['name']:''; $sName = isset($_GET['name'])?$_GET['name']:'';
$sContent = isset($_GET['content'])?$_GET['content']:''; $sContent = isset($_GET['content'])?$_GET['content']:'';
$iChunk = isset($_GET['chunk'])?$_GET['chunk']:0; $iChunk = isset($_GET['chunk'])?$_GET['chunk']:0;
@@ -21,7 +22,7 @@ $sField = isset($_REQUEST['field'])?$_REQUEST['field']:'';
$oValue = isset($_REQUEST['value'])?$_REQUEST['value']:''; $oValue = isset($_REQUEST['value'])?$_REQUEST['value']:'';
//Initiate class //Initiate class
$oSpot = new Spot($oClassManagement, __FILE__); $oSpot = new Spot($oClassManagement, __FILE__, $sTimezone);
$oSpot->setProjectId($iProjectId); $oSpot->setProjectId($iProjectId);
$sResult = ''; $sResult = '';

View File

@@ -35,7 +35,7 @@ click_watch = Click to watch video
click_zoom = Click to zoom click_zoom = Click to zoom
media_count = Media $0 / $1 media_count = Media $0 / $1
city_time = $0 time city_time = $0 Time
project = Project project = Project
mode = Mode mode = Mode

View File

@@ -127,9 +127,9 @@ function initProject(sProjectCodeName){
self.setPageTitle(oSpot.vars(['project', 'name'])); self.setPageTitle(oSpot.vars(['project', 'name']));
//Timezone difference notice //Timezone difference notice
var bSameTZ = (oSpot.consts.site_timezone == oSpot.vars(['project', 'timezone'])); var bSameTime = ((new Date()).toLocaleString([], {timeZone: oSpot.consts.timezone}) == (new Date()).toLocaleString([], {timeZone: oSpot.vars(['project', 'timezone'])}));
self.tmp('site_tz_notice', bSameTZ?'':' ('+getTimeZoneDesc(oSpot.consts.site_timezone)+')'); self.tmp('site_tz_notice', bSameTime?'':' ('+getTimeZoneDesc(oSpot.consts.timezone)+')');
self.tmp('proj_tz_notice', bSameTZ?'':' ('+getTimeZoneDesc(self.vars(['project', 'timezone']))+')'); self.tmp('proj_tz_notice', bSameTime?'':' ('+getTimeZoneDesc(self.vars(['project', 'timezone']))+')');
$.when( $.when(
//Markers: Spot Messages & Medias //Markers: Spot Messages & Medias

View File

@@ -6,7 +6,6 @@
* ffprobe (ffmpeg) * ffprobe (ffmpeg)
## To Do List ## To Do List
* import/export * import/export
* Convert all time to browser timezone
* Reset zoom on image closing (lightbox) * Reset zoom on image closing (lightbox)
* Optimize mobile image size (lightbox) * Optimize mobile image size (lightbox)
* Link pic & post * Link pic & post

View File

@@ -5,7 +5,7 @@ function Spot(asGlobals)
this.consts.hash_sep = '-'; this.consts.hash_sep = '-';
this.consts.title = 'Spotty'; this.consts.title = 'Spotty';
this.consts.default_page = 'project'; this.consts.default_page = 'project';
//this.consts.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; this.consts.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
/* Initialization */ /* Initialization */
@@ -69,7 +69,8 @@ function Spot(asGlobals)
bProcessIcon = bProcessIcon || false; bProcessIcon = bProcessIcon || false;
//if(bProcessIcon) self.addBufferIcon(); //if(bProcessIcon) self.addBufferIcon();
oVars['a'] = sAction; oVars['a'] = sAction;
oVars['t'] = self.consts.timezone;
return $.ajax( return $.ajax(
{ {
url: self.consts.process_page, url: self.consts.process_page,