Convert all time to browser timezone
This commit is contained in:
@@ -33,7 +33,7 @@ class Spot extends Main
|
||||
*/
|
||||
private $oMedia;
|
||||
|
||||
public function __construct($oClassManagement, $sProcessPage)
|
||||
public function __construct($oClassManagement, $sProcessPage, $sTimezone)
|
||||
{
|
||||
$asClasses = array(
|
||||
array('name'=>'feed', 'project'=>true),
|
||||
@@ -41,7 +41,7 @@ class Spot extends Main
|
||||
array('name'=>'media', 'project'=>true),
|
||||
array('name'=>'converter', 'project'=>true)
|
||||
);
|
||||
parent::__construct($oClassManagement, $sProcessPage, $asClasses);
|
||||
parent::__construct($oClassManagement, $sProcessPage, $asClasses, true, $sTimezone);
|
||||
|
||||
$this->oClassManagement->incClass('translator');
|
||||
$this->oLang = new Translator('', 'en');
|
||||
@@ -123,9 +123,7 @@ class Spot extends Main
|
||||
),
|
||||
'consts' => array(
|
||||
'geo_server' => Settings::GEO_SERVER,
|
||||
'modes' => Project::MODES,
|
||||
'site_timezone' => Settings::TIMEZONE
|
||||
)
|
||||
'modes' => Project::MODES )
|
||||
),
|
||||
'index',
|
||||
array(
|
||||
|
||||
@@ -13,6 +13,7 @@ ToolBox::fixGlobalVars(isset($argv)?$argv:array());
|
||||
|
||||
//Available variables
|
||||
$sAction = isset($_REQUEST['a'])?$_REQUEST['a']:'';
|
||||
$sTimezone = isset($_REQUEST['t'])?$_REQUEST['t']:'';
|
||||
$sName = isset($_GET['name'])?$_GET['name']:'';
|
||||
$sContent = isset($_GET['content'])?$_GET['content']:'';
|
||||
$iChunk = isset($_GET['chunk'])?$_GET['chunk']:0;
|
||||
@@ -21,7 +22,7 @@ $sField = isset($_REQUEST['field'])?$_REQUEST['field']:'';
|
||||
$oValue = isset($_REQUEST['value'])?$_REQUEST['value']:'';
|
||||
|
||||
//Initiate class
|
||||
$oSpot = new Spot($oClassManagement, __FILE__);
|
||||
$oSpot = new Spot($oClassManagement, __FILE__, $sTimezone);
|
||||
$oSpot->setProjectId($iProjectId);
|
||||
|
||||
$sResult = '';
|
||||
|
||||
@@ -35,7 +35,7 @@ click_watch = Click to watch video
|
||||
click_zoom = Click to zoom
|
||||
media_count = Media $0 / $1
|
||||
|
||||
city_time = $0 time
|
||||
city_time = $0 Time
|
||||
|
||||
project = Project
|
||||
mode = Mode
|
||||
|
||||
@@ -127,9 +127,9 @@ function initProject(sProjectCodeName){
|
||||
self.setPageTitle(oSpot.vars(['project', 'name']));
|
||||
|
||||
//Timezone difference notice
|
||||
var bSameTZ = (oSpot.consts.site_timezone == oSpot.vars(['project', 'timezone']));
|
||||
self.tmp('site_tz_notice', bSameTZ?'':' ('+getTimeZoneDesc(oSpot.consts.site_timezone)+')');
|
||||
self.tmp('proj_tz_notice', bSameTZ?'':' ('+getTimeZoneDesc(self.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', bSameTime?'':' ('+getTimeZoneDesc(oSpot.consts.timezone)+')');
|
||||
self.tmp('proj_tz_notice', bSameTime?'':' ('+getTimeZoneDesc(self.vars(['project', 'timezone']))+')');
|
||||
|
||||
$.when(
|
||||
//Markers: Spot Messages & Medias
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
* ffprobe (ffmpeg)
|
||||
## To Do List
|
||||
* import/export
|
||||
* Convert all time to browser timezone
|
||||
* Reset zoom on image closing (lightbox)
|
||||
* Optimize mobile image size (lightbox)
|
||||
* Link pic & post
|
||||
@@ -5,7 +5,7 @@ function Spot(asGlobals)
|
||||
this.consts.hash_sep = '-';
|
||||
this.consts.title = 'Spotty';
|
||||
this.consts.default_page = 'project';
|
||||
//this.consts.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
this.consts.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
|
||||
/* Initialization */
|
||||
|
||||
@@ -70,6 +70,7 @@ function Spot(asGlobals)
|
||||
//if(bProcessIcon) self.addBufferIcon();
|
||||
|
||||
oVars['a'] = sAction;
|
||||
oVars['t'] = self.consts.timezone;
|
||||
return $.ajax(
|
||||
{
|
||||
url: self.consts.process_page,
|
||||
|
||||
Reference in New Issue
Block a user