Merge branch '2.5.x' into cc-5709-airtime-analyzer

Conflicts:
	airtime_mvc/locale/de_DE/LC_MESSAGES/airtime.po
	airtime_mvc/locale/es_ES/LC_MESSAGES/airtime.po
	airtime_mvc/locale/hr_HR/LC_MESSAGES/airtime.po
	airtime_mvc/locale/hu_HU/LC_MESSAGES/airtime.po
	airtime_mvc/locale/sr_RS/LC_MESSAGES/airtime.po
	airtime_mvc/locale/sr_RS@latin/LC_MESSAGES/airtime.po
This commit is contained in:
Naomi 2014-04-23 15:58:39 -04:00
commit fe20cc7f63
59 changed files with 51180 additions and 50667 deletions

View file

@ -14,15 +14,17 @@ $(document).ready(function() {
getDataAndPlot();
listenerstat_content.find("#his_submit").click(function(){
startTimestamp = AIRTIME.utilities.fnGetTimestamp(dateStartId, timeStartId);
endTimestamp = AIRTIME.utilities.fnGetTimestamp(dateEndId, timeEndId);
getDataAndPlot(startTimestamp, endTimestamp);
var oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
var start = oRange.start;
var end = oRange.end;
getDataAndPlot(start, end);
});
});
function getDataAndPlot(startTimestamp, endTimestamp){
// get data
$.get(baseUrl+'Listenerstat/get-data', {startTimestamp: startTimestamp, endTimestamp: endTimestamp}, function(data){
$.get(baseUrl+'Listenerstat/get-data', {start: startTimestamp, end: endTimestamp}, function(data){
out = new Object();
$.each(data, function(mpName, v){
plotData = new Object();

View file

@ -60,6 +60,30 @@ var AIRTIME = (function(AIRTIME) {
oTableShow,
inShowsTab = false;
function validateTimeRange() {
var oRange,
inputs = $('.his-timerange > input'),
start, end;
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
start = oRange.start;
end = oRange.end;
if (end >= start) {
inputs.removeClass('error');
}
else {
inputs.addClass('error');
}
return {
start: start,
end: end,
isValid: end >= start
};
}
function getSelectedLogItems() {
var items = Object.keys(selectedLogItems);
@ -401,13 +425,12 @@ var AIRTIME = (function(AIRTIME) {
return oTable;
}
function showSummaryList() {
function showSummaryList(start, end) {
var url = baseUrl+"playouthistory/show-history-feed",
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId),
data = {
format: "json",
start: oRange.start,
end: oRange.end
start: start,
end: end
};
$.post(url, data, function(json) {
@ -460,7 +483,9 @@ var AIRTIME = (function(AIRTIME) {
},
always: function() {
inShowsTab = true;
showSummaryList();
var info = getStartEnd();
showSummaryList(info.start, info.end);
emptySelectedLogItems();
}
}
@ -544,7 +569,8 @@ var AIRTIME = (function(AIRTIME) {
dayNamesMin: i18n_days_short,
onSelect: function(sDate, oDatePicker) {
$(this).datepicker( "setDate", sDate );
}
},
onClose: validateTimeRange
};
oBaseTimePickerSettings = {
@ -554,13 +580,25 @@ var AIRTIME = (function(AIRTIME) {
showLeadingZero: false,
defaultTime: '0:00',
hourText: $.i18n._("Hour"),
minuteText: $.i18n._("Minute")
minuteText: $.i18n._("Minute"),
onClose: validateTimeRange
};
$historyContentDiv.find(dateStartId).datepicker(oBaseDatePickerSettings);
$historyContentDiv.find(timeStartId).timepicker(oBaseTimePickerSettings);
$historyContentDiv.find(dateEndId).datepicker(oBaseDatePickerSettings);
$historyContentDiv.find(timeEndId).timepicker(oBaseTimePickerSettings);
$historyContentDiv.find(dateStartId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$historyContentDiv.find(timeStartId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
$historyContentDiv.find(dateEndId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$historyContentDiv.find(timeEndId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
$historyContentDiv.on("click", "#his_create", function(e) {
var url = baseUrl+"playouthistory/edit-list-item/format/json" ;
@ -665,17 +703,16 @@ var AIRTIME = (function(AIRTIME) {
});
$('body').on("click", "#his_instance_retrieve", function(e) {
var startPicker = $hisDialogEl.find('#his_item_starts_datetimepicker').data('datetimepicker'),
endPicker = $hisDialogEl.find('#his_item_ends_datetimepicker').data('datetimepicker'),
var startPicker = $hisDialogEl.find('#his_item_starts'),
endPicker = $hisDialogEl.find('#his_item_ends'),
url = baseUrl+"playouthistory/show-history-feed",
startDate = startPicker.getLocalDate(),
endDate = endPicker.getLocalDate(),
getEpochSeconds = AIRTIME.utilities.fnGetSecondsEpoch,
startDate = startPicker.val(),
endDate = endPicker.val(),
data;
data = {
start: getEpochSeconds(startDate),
end: getEpochSeconds(endDate),
start: startDate,
end: endDate,
format: "json"
};
@ -710,18 +747,23 @@ var AIRTIME = (function(AIRTIME) {
});
});
function getStartEnd() {
return AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
}
$historyContentDiv.find("#his_submit").click(function(ev){
var fn,
oRange;
info;
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
info = getStartEnd();
fn = fnServerData;
fn.start = oRange.start;
fn.end = oRange.end;
fn.start = info.start;
fn.end = info.end;
if (inShowsTab) {
showSummaryList();
showSummaryList(info.start, info.end);
}
else {
redrawTables();

View file

@ -46,7 +46,8 @@ AIRTIME = (function(AIRTIME) {
showLeadingZero: false,
defaultTime: '0:00',
hourText: $.i18n._("Hour"),
minuteText: $.i18n._("Minute")
minuteText: $.i18n._("Minute"),
onClose: validateTimeRange
};
function setWidgetSize() {

View file

@ -35,75 +35,39 @@ var AIRTIME = (function(AIRTIME){
};
};
mod.fnGetSecondsEpoch = function(oDate) {
var iTime,
iUserOffset,
iClientOffset;
iTime = oDate.getTime(); //value is in millisec.
iTime = Math.round(iTime / 1000);
iUserOffset = userTimezoneOffset;
iClientOffset = oDate.getTimezoneOffset() * -60;//function returns minutes
//adjust for the fact the the Date object is in client time.
iTime = iTime + iClientOffset + iUserOffset;
return iTime;
};
/*
* Get the schedule range start in unix timestamp form (in seconds).
* defaults to NOW if nothing is selected.
*
* @param String sDatePickerId
*
* @param String sTimePickerId
*
* @return Number iTime
*/
mod.fnGetTimestamp = function(sDateId, sTimeId) {
var date,
time,
temp;
temp = $(sDateId).val();
if ( temp === "") {
return 0;
}
else {
date = temp;
}
time = $(sTimeId).val();
date = date.split("-");
time = time.split(":");
//0 based month in js.
oDate = new Date(date[0], date[1]-1, date[2], time[0], time[1]);
return mod.fnGetSecondsEpoch(oDate);
};
/*
* Returns an object containing a unix timestamp in seconds for the start/end range
*
* @return Object {"start", "end", "range"}
*/
mod.fnGetScheduleRange = function(dateStart, timeStart, dateEnd, timeEnd) {
var iStart,
iEnd,
iRange;
mod.fnGetScheduleRange = function(dateStartId, timeStartId, dateEndId, timeEndId) {
var start,
end,
time;
iStart = AIRTIME.utilities.fnGetTimestamp(dateStart, timeStart);
iEnd = AIRTIME.utilities.fnGetTimestamp(dateEnd, timeEnd);
start = $(dateStartId).val();
start = start === "" ? null : start;
iRange = iEnd - iStart;
time = $(timeStartId).val();
time = time === "" ? "00:00" : time;
if (start) {
start = start + " " + time;
}
end = $(dateEndId).val();
end = end === "" ? null : end;
time = $(timeEndId).val();
time = time === "" ? "00:00" : time;
if (end) {
end = end + " " + time;
}
return {
start: iStart,
end: iEnd,
range: iRange
start: start,
end: end
};
};