diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index b20aacd26..0f330b355 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -40,7 +40,7 @@ class Application_Model_Preference $result = Application_Common_Database::prepareAndExecute($sql, $paramMap, - 'column', + Application_Common_Database::COLUMN, PDO::FETCH_ASSOC, $con); diff --git a/airtime_mvc/public/css/showbuilder.css b/airtime_mvc/public/css/showbuilder.css index 0271a9224..370ec3fd1 100644 --- a/airtime_mvc/public/css/showbuilder.css +++ b/airtime_mvc/public/css/showbuilder.css @@ -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; diff --git a/airtime_mvc/public/js/airtime/showbuilder/main_builder.js b/airtime_mvc/public/js/airtime/showbuilder/main_builder.js index 38c3ef05a..517ae1ba0 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/main_builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/main_builder.js @@ -35,7 +35,8 @@ AIRTIME = (function(AIRTIME) { dayNamesMin: i18n_days_short, onClick: function(sDate, oDatePicker) { $(this).datepicker( "setDate", sDate ); - } + }, + onClose: validateTimeRange }; oBaseTimePickerSettings = { @@ -90,32 +91,61 @@ 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(); - - //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; - - op = $("div.sb-advanced-options"); - if (op.is(":visible")) { - - if (fn.ops === undefined) { - fn.ops = {}; - } - fn.ops.showFilter = op.find("#sb_show_filter").val(); - fn.ops.myShows = op.find("#sb_my_shows").is(":checked") ? 1 : 0; + oTable = $('#show_builder_table').dataTable(), + check; + + check = validateTimeRange(); + + if (check.isValid) { + + //reset timestamp value since input values could have changed. + AIRTIME.showbuilder.resetTimestamp(); + + fn = oTable.fnSettings().fnServerData; + fn.start = check.start; + fn.end = check.end; + + op = $("div.sb-advanced-options"); + if (op.is(":visible")) { + + if (fn.ops === undefined) { + fn.ops = {}; + } + fn.ops.showFilter = op.find("#sb_show_filter").val(); + fn.ops.myShows = op.find("#sb_my_shows").is(":checked") ? 1 : 0; + } + + oTable.fnDraw(); } - - oTable.fnDraw(); } mod.onReady = function() { @@ -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); diff --git a/airtime_mvc/public/js/airtime/utilities/utilities.js b/airtime_mvc/public/js/airtime/utilities/utilities.js index 844f91e66..de5a455aa 100644 --- a/airtime_mvc/public/js/airtime/utilities/utilities.js +++ b/airtime_mvc/public/js/airtime/utilities/utilities.js @@ -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, diff --git a/airtime_mvc/public/js/waveformplaylist/playout.js b/airtime_mvc/public/js/waveformplaylist/playout.js index aa8bab9ad..79c5d94c6 100644 --- a/airtime_mvc/public/js/waveformplaylist/playout.js +++ b/airtime_mvc/public/js/waveformplaylist/playout.js @@ -16,8 +16,6 @@ AudioPlayout.prototype.init = function(config) { this.gainNode = undefined; this.destination = this.ac.destination; - this.analyser = this.ac.createAnalyser(); - this.analyser.connect(this.destination); }; AudioPlayout.prototype.getBuffer = function() { @@ -41,7 +39,7 @@ AudioPlayout.prototype.applyFades = function(fades, relPos, now, delay) { duration; this.gainNode && this.gainNode.disconnect(); - this.gainNode = this.ac.createGainNode(); + this.gainNode = this.ac.createGain(); for (id in fades) { @@ -137,7 +135,7 @@ AudioPlayout.prototype.setSource = function(source) { this.source.buffer = this.buffer; this.source.connect(this.gainNode); - this.gainNode.connect(this.analyser); + this.gainNode.connect(this.destination); }; /* diff --git a/airtime_mvc/public/js/waveformplaylist/track.js b/airtime_mvc/public/js/waveformplaylist/track.js index b533f50f9..396989c79 100644 --- a/airtime_mvc/public/js/waveformplaylist/track.js +++ b/airtime_mvc/public/js/waveformplaylist/track.js @@ -176,6 +176,7 @@ TrackEditor.prototype.loadBuffer = function(src) { var that = this, xhr = new XMLHttpRequest(); + xhr.open('GET', src, true); xhr.responseType = 'arraybuffer'; xhr.addEventListener('progress', function(e) { @@ -198,7 +199,6 @@ TrackEditor.prototype.loadBuffer = function(src) { ); }, false); - xhr.open('GET', src, true); xhr.send(); }; diff --git a/python_apps/media-monitor/airtime-media-monitor-init-d b/python_apps/media-monitor/airtime-media-monitor-init-d index ab8e0131a..d059e9389 100755 --- a/python_apps/media-monitor/airtime-media-monitor-init-d +++ b/python_apps/media-monitor/airtime-media-monitor-init-d @@ -2,7 +2,7 @@ ### BEGIN INIT INFO # Provides: airtime-media-monitor -# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Start: $local_fs $remote_fs $network $syslog $all # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 diff --git a/python_apps/pypo/airtime-liquidsoap-init-d b/python_apps/pypo/airtime-liquidsoap-init-d index e15972db4..2fc791ffa 100755 --- a/python_apps/pypo/airtime-liquidsoap-init-d +++ b/python_apps/pypo/airtime-liquidsoap-init-d @@ -2,7 +2,7 @@ ### BEGIN INIT INFO # Provides: airtime-liquidsoap -# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Start: $local_fs $remote_fs $network $syslog $all # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 diff --git a/python_apps/pypo/airtime-playout-init-d b/python_apps/pypo/airtime-playout-init-d index 401b9604c..1d760d43a 100755 --- a/python_apps/pypo/airtime-playout-init-d +++ b/python_apps/pypo/airtime-playout-init-d @@ -2,7 +2,7 @@ ### BEGIN INIT INFO # Provides: airtime-playout -# Required-Start: $local_fs $remote_fs $network $syslog +# Required-Start: $local_fs $remote_fs $network $syslog $all # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6