CC-3822 : NowPlaying-> Time filter is allowing Start_Time be greater than the End_Time

This commit is contained in:
Naomi 2013-05-27 14:37:16 -04:00
parent 63b0d4194a
commit 408ecc530d
3 changed files with 74 additions and 34 deletions

View file

@ -105,6 +105,10 @@ div.sb-timerange input#sb_date_start {
margin-left: 30px;
}
div.sb-timerange input.error {
background-color: rgba(255,0,0,0.2);
}
.sb-starts,
.sb-ends {
text-align: center;

View file

@ -35,7 +35,8 @@ AIRTIME = (function(AIRTIME) {
dayNamesMin: i18n_days_short,
onClick: function(sDate, oDatePicker) {
$(this).datepicker( "setDate", sDate );
}
},
onClose: validateTimeRange
};
oBaseTimePickerSettings = {
@ -90,20 +91,48 @@ AIRTIME = (function(AIRTIME) {
}
}
function validateTimeRange() {
var oRange,
inputs = $('.sb-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 {
if (!inputs.hasClass('error')) {
inputs.addClass('error');
}
}
return {
start: start,
end: end,
isValid: end >= start
};
}
function showSearchSubmit() {
var fn,
oRange,
op,
oTable = $('#show_builder_table').dataTable();
oTable = $('#show_builder_table').dataTable(),
check;
check = validateTimeRange();
if (check.isValid) {
//reset timestamp value since input values could have changed.
AIRTIME.showbuilder.resetTimestamp();
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
fn = oTable.fnSettings().fnServerData;
fn.start = oRange.start;
fn.end = oRange.end;
fn.start = check.start;
fn.end = check.end;
op = $("div.sb-advanced-options");
if (op.is(":visible")) {
@ -117,6 +146,7 @@ AIRTIME = (function(AIRTIME) {
oTable.fnDraw();
}
}
mod.onReady = function() {
// define module vars.
@ -134,10 +164,22 @@ AIRTIME = (function(AIRTIME) {
$(this).removeClass("ui-state-hover");
});
$builder.find(dateStartId).datepicker(oBaseDatePickerSettings);
$builder.find(timeStartId).timepicker(oBaseTimePickerSettings);
$builder.find(dateEndId).datepicker(oBaseDatePickerSettings);
$builder.find(timeEndId).timepicker(oBaseTimePickerSettings);
$builder.find(dateStartId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$builder.find(timeStartId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
$builder.find(dateEndId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$builder.find(timeEndId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId,
dateEndId, timeEndId);

View file

@ -88,19 +88,13 @@ var AIRTIME = (function(AIRTIME){
mod.fnGetScheduleRange = function(dateStart, timeStart, dateEnd, timeEnd) {
var iStart,
iEnd,
iRange,
DEFAULT_RANGE = 60*60*24;
iRange;
iStart = AIRTIME.utilities.fnGetTimestamp(dateStart, timeStart);
iEnd = AIRTIME.utilities.fnGetTimestamp(dateEnd, timeEnd);
iRange = iEnd - iStart;
if (iEnd < iStart) {
iEnd = iStart + DEFAULT_RANGE;
iRange = DEFAULT_RANGE;
}
return {
start: iStart,
end: iEnd,