CC-3174 : showbuilder

fixing timezone calculations if browser/server is different.
This commit is contained in:
Naomi Aro 2012-02-27 20:14:12 +01:00
parent 28759a2d34
commit 564575d657
3 changed files with 15 additions and 6 deletions

View File

@ -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');

View File

@ -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 = $('<div/>').attr('id', 'draggingContainer')
.append('<tr/>')
.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();

View File

@ -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;
}