Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
8c2e622552
|
@ -9,6 +9,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$context = $this->_helper->getHelper('contextSwitch');
|
||||
$context->addActionContext('version', 'json')
|
||||
->addActionContext('recorded-shows', 'json')
|
||||
->addActionContext('server-timestamp', 'json')
|
||||
->addActionContext('upload-file', 'json')
|
||||
->addActionContext('upload-recorded', 'json')
|
||||
->addActionContext('media-monitor-setup', 'json')
|
||||
|
@ -56,6 +57,12 @@ class ApiController extends Zend_Controller_Action
|
|||
$jsonStr = json_encode(array("version"=>AIRTIME_VERSION));
|
||||
echo $jsonStr;
|
||||
}
|
||||
|
||||
public function serverTimestampAction(){
|
||||
|
||||
$this->view->serverTimestamp = array("timestamp"=>time(), "timezoneOffset"=> date("Z"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows remote client to download requested media file.
|
||||
|
|
|
@ -61,10 +61,23 @@ function makeTimeStamp(date){
|
|||
return timestamp;
|
||||
}
|
||||
|
||||
function adjustDateToServerDate(date, serverTimezoneOffset){
|
||||
//date object stores time in the browser's localtime. We need to artificially shift
|
||||
//it to
|
||||
var timezoneOffset = date.getTimezoneOffset()*60*1000;
|
||||
|
||||
date.setTime(date.getTime() + timezoneOffset + serverTimezoneOffset*1000);
|
||||
|
||||
/* date object has been shifted to artificial UTC time. Now let's
|
||||
* shift it to the server's timezone */
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
function dayClick(date, allDay, jsEvent, view) {
|
||||
var now, today, selected, chosenDate, chosenTime;
|
||||
|
||||
now = new Date();
|
||||
now = adjustDateToServerDate(new Date(), serverTimezoneOffset);
|
||||
|
||||
if(view.name === "month") {
|
||||
today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
var serverTimezoneOffset = 0;
|
||||
|
||||
function closeDialog(event, ui) {
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
$(this).remove();
|
||||
|
@ -292,18 +294,21 @@ function buildEditDialog(json){
|
|||
|
||||
}
|
||||
|
||||
$(window).load(function() {
|
||||
function createFullCalendar(data){
|
||||
|
||||
serverTimezoneOffset = data.serverTimestamp.timezoneOffset;
|
||||
|
||||
var mainHeight = document.documentElement.clientHeight - 200 - 50;
|
||||
|
||||
$('#schedule_calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev, next, today',
|
||||
center: 'title',
|
||||
right: 'agendaDay, agendaWeek, month'
|
||||
},
|
||||
defaultView: 'month',
|
||||
editable: false,
|
||||
allDaySlot: false,
|
||||
left: 'prev, next, today',
|
||||
center: 'title',
|
||||
right: 'agendaDay, agendaWeek, month'
|
||||
},
|
||||
defaultView: 'month',
|
||||
editable: false,
|
||||
allDaySlot: false,
|
||||
axisFormat: 'H:mm',
|
||||
timeFormat: {
|
||||
agenda: 'H:mm{ - H:mm}',
|
||||
|
@ -312,17 +317,25 @@ $(window).load(function() {
|
|||
contentHeight: mainHeight,
|
||||
theme: true,
|
||||
lazyFetching: false,
|
||||
serverTimestamp: parseInt(data.serverTimestamp.timestamp, 10),
|
||||
serverTimezoneOffset: parseInt(data.serverTimestamp.timezoneOffset, 10),
|
||||
|
||||
events: getFullCalendarEvents,
|
||||
events: getFullCalendarEvents,
|
||||
|
||||
//callbacks (in full-calendar-functions.js)
|
||||
//callbacks (in full-calendar-functions.js)
|
||||
viewDisplay: viewDisplay,
|
||||
dayClick: dayClick,
|
||||
eventRender: eventRender,
|
||||
eventAfterRender: eventAfterRender,
|
||||
eventDrop: eventDrop,
|
||||
eventResize: eventResize
|
||||
dayClick: dayClick,
|
||||
eventRender: eventRender,
|
||||
eventAfterRender: eventAfterRender,
|
||||
eventDrop: eventDrop,
|
||||
eventResize: eventResize
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
$(window).load(function() {
|
||||
|
||||
$.ajax({ url: "/Api/server-timestamp/format/json", dataType:"json", success:createFullCalendar
|
||||
, error:function(jqXHR, textStatus, errorThrown){}});
|
||||
});
|
||||
|
||||
|
|
|
@ -2275,7 +2275,7 @@ function BasicView(element, calendar, viewName) {
|
|||
function updateCells(firstTime) {
|
||||
var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating?
|
||||
var month = t.start.getMonth();
|
||||
var today = clearTime(new Date());
|
||||
var today = clearTime(adjustDateToServerDate(new Date(), opt("serverTimezoneOffset")));
|
||||
var cell;
|
||||
var date;
|
||||
var row;
|
||||
|
|
|
@ -297,8 +297,10 @@ class AirtimeInstall
|
|||
public static function SetDefaultTimezone()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
||||
$defaultTimezone = date_default_timezone_get();
|
||||
|
||||
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', 'America/Toronto')";
|
||||
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')";
|
||||
$result = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($result)) {
|
||||
return false;
|
||||
|
|
|
@ -20,8 +20,10 @@ class AirtimeInstall{
|
|||
public static function SetDefaultTimezone()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
||||
$defaultTimezone = date_default_timezone_get();
|
||||
|
||||
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', 'America/Toronto')";
|
||||
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')";
|
||||
$result = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($result)) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue