From 564575d657143712d40cc1a2389756a68c49c1b3 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Mon, 27 Feb 2012 20:14:12 +0100 Subject: [PATCH] CC-3174 : showbuilder fixing timezone calculations if browser/server is different. --- .../controllers/ShowbuilderController.php | 3 ++- .../js/airtime/library/events/library_showbuilder.js | 12 ++++++++++-- airtime_mvc/public/js/airtime/showbuilder/builder.js | 6 +++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 8f10ad4bd..ef8177f7c 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -49,7 +49,8 @@ class ShowbuilderController extends Zend_Controller_Action $this->view->sb_form = $form; - $this->view->headScript()->appendScript("var serverTimezoneOffset = ".date("Z")."; //in seconds"); + $offset = date("Z") * -1; + $this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds"); $this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js','text/javascript'); diff --git a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js index f51e62c1d..822b2f82f 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js @@ -25,13 +25,21 @@ var AIRTIME = (function(AIRTIME){ container, thead = $("#show_builder_table thead"), colspan = thead.find("th").length, - width = thead.find("tr:first").width(); + width = thead.find("tr:first").width(), + message; //if nothing is checked select the dragged item. if (selected.length === 0) { selected = $(this); } + if (selected.length === 1) { + message = "Moving "+selected.length+" Item." + } + else { + message = "Moving "+selected.length+" Items." + } + container = $('
').attr('id', 'draggingContainer') .append('') .find("tr") @@ -40,7 +48,7 @@ var AIRTIME = (function(AIRTIME){ .attr("colspan", colspan) .width(width) .addClass("ui-state-highlight") - .append("Moving "+selected.length+" Items.") + .append(message) .end() .end(); diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 7e55e262b..d82093b96 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -115,10 +115,10 @@ $(document).ready(function() { iTime = oDate.getTime(); //value is in millisec. iTime = Math.round(iTime / 1000); iServerOffset = serverTimezoneOffset; - iClientOffset = oDate.getTimezoneOffset() * 60;//function returns minutes + iClientOffset = oDate.getTimezoneOffset() * -60;//function returns minutes - //adjust for the fact the the Date object is in clent time. - iTime = iTime + iServerOffset + iClientOffset; + //adjust for the fact the the Date object is in client time. + iTime = iTime + iClientOffset + iServerOffset; return iTime; }