Merge branch 'saas-dev' into saas-landing-page

Conflicts:
	airtime_mvc/application/controllers/ApiController.php
	airtime_mvc/application/views/scripts/embed/player.phtml
This commit is contained in:
drigato 2015-05-28 13:25:18 -04:00
commit 8f8b0b7f4d
46 changed files with 1033 additions and 348 deletions

View file

@ -1788,7 +1788,7 @@ ul.errors {
width:278px;
}
ul.errors li {
ul.errors li, .warning {
color:#902d2d;
font-size:11px;
padding:2px 4px;
@ -1798,6 +1798,11 @@ ul.errors li {
list-style: none;
}
.warning-label {
font-size: medium;
text-align: center;
}
div.success{
color:#3B5323;
font-size:11px;
@ -2255,14 +2260,9 @@ dd.radio-inline-list, .preferences dd.radio-inline-list, .stream-config dd.radio
.radio-inline-list label {
margin-right:12px;
}
.preferences.simple-formblock dd.block-display {
width: 100%;
}
.preferences.simple-formblock dd.block-display select, .stream-config.simple-formblock dd.block-display select {
width: 100%;
}
.preferences dd.block-display .input_select, .stream-config dd.block-display .input_select {
.preferences.simple-formblock dd.block-display,
.preferences.simple-formblock dd.block-display select, .stream-config.simple-formblock dd.block-display select,
.preferences dd.block-display .input_select, .stream-config dd.block-display .input_select {
width: 100%;
}
.preferences dd.block-display .input_text_area, .preferences dd.block-display .input_text
@ -2284,6 +2284,15 @@ dd.radio-inline-list, .preferences dd.radio-inline-list, .stream-config dd.radio
margin-bottom: 4px;
}
.preferences #Logo-img-container {
margin-top: 30px;
}
.centered {
margin: 0 auto;
display: block;
}
#show_time_info {
font-size:12px;
height:30px;
@ -3248,3 +3257,7 @@ dd .stream-status {
padding-bottom: 0px;
padding-top: 13px;
}
.enable-tunein {
font-weight:bold;
}

View file

@ -395,7 +395,6 @@ function getScheduleFromServer(){
parseSourceStatus(data.source_status);
parseSwitchStatus(data.switch_status);
showName = data.show_name;
setTimeout(getScheduleFromServer, serverUpdateInterval);
}, error:function(jqXHR, textStatus, errorThrown){}});
}
@ -456,8 +455,8 @@ var stream_window = null;
function init() {
//begin producer "thread"
getScheduleFromServer();
setInterval(getScheduleFromServer, serverUpdateInterval);
//begin consumer "thread"
secondsTimer();

View file

@ -213,3 +213,21 @@ function resizeToMaxHeight(ele, targetHeight){
img.css("width", newWidth+"px");
}
}
/* From http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport/#7557433 */
function isInView(el) {
//special bonus for those using jQuery
if (typeof jQuery === "function" && el instanceof jQuery) {
el = el[0];
}
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */
);
}

View file

@ -8,20 +8,31 @@ var AIRTIME = (function(AIRTIME) {
mod = AIRTIME.library;
mod.checkAddButton = function() {
var selected = mod.getChosenItemsLength(), $cursor = $('tr.cursor-selected-row'), check = false;
var selected = mod.getChosenItemsLength(), $cursor = $('tr.sb-selected'), check = false,
shows = $('tr.sb-header'), current = $('tr.sb-current-show'),
cursorText = $.i18n._('Add to next show');
// make sure library items are selected and a cursor is selected.
if (selected !== 0 && $cursor.length !== 0) {
if (selected !== 0) {
check = true;
}
if (shows.length === 0) {
check = false;
}
if (check === true) {
AIRTIME.button.enableButton("btn-group #library-plus", false);
} else {
AIRTIME.button.disableButton("btn-group #library-plus", false);
}
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), ' '+$.i18n._('Add to selected show'));
if ($cursor.length !== 0) {
cursorText = $.i18n._('Add before selected items');
} else if (current.length !== 0) {
cursorText = $.i18n._('Add to current show');
}
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), ' '+ cursorText);
};
mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
@ -98,7 +109,7 @@ var AIRTIME = (function(AIRTIME) {
"type" : type
});
$("#show_builder_table tr.cursor-selected-row").each(function(i, el) {
$("#show_builder_table tr.sb-selected").each(function(i, el) {
aData.push($(el).prev().data("aData"));
});
@ -113,12 +124,35 @@ var AIRTIME = (function(AIRTIME) {
}
if (aSchedIds.length == 0) {
alert($.i18n._("Please select a cursor position on timeline."));
return false;
addToCurrentOrNext(aSchedIds);
}
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
};
function addToCurrentOrNext(arr) {
var el;
// Get the show instance id of the first non-data row (id = 0)
// The second last row in the table with that instance id is the
// last schedule item for the first show. (This is important for
// the Now Playing screen if multiple shows are in view).
el = $("[si_id="+$("#0").attr("si_id")+"]");
var temp = el.eq(-2).data("aData");
arr.push({
"id" : temp.id,
"instance" : temp.instance,
"timestamp" : temp.timestamp
});
if (!isInView(el)) {
$('.dataTables_scrolling.sb-padded').animate({
scrollTop: el.offset().top
}, 0);
}
return arr;
}
mod.setupLibraryToolbar = function() {
var $toolbar = $(".lib-content .fg-toolbar:first");
@ -146,7 +180,7 @@ var AIRTIME = (function(AIRTIME) {
});
}
$("#show_builder_table tr.cursor-selected-row")
$("#show_builder_table tr.sb-selected")
.each(function(i, el) {
aData.push($(el).prev().data("aData"));
});
@ -161,6 +195,10 @@ var AIRTIME = (function(AIRTIME) {
"timestamp" : temp.timestamp
});
}
if (aSchedIds.length == 0) {
addToCurrentOrNext(aSchedIds);
}
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
});

View file

@ -109,7 +109,7 @@ var AIRTIME = (function(AIRTIME) {
mod.changeAddButtonText = function($button, btnText) {
$button.text(btnText);
}
};
mod.createToolbarButtons = function() {
$menu = $("<div class='btn-toolbar' />");
@ -135,7 +135,7 @@ var AIRTIME = (function(AIRTIME) {
"<i class='icon-white icon-trash'></i>" +
"</button>" +
"</div>");
}
};
mod.createToolbarDropDown = function() {
$('#sb-select-page').click(function(){mod.selectCurrentPage();});
@ -530,12 +530,14 @@ var AIRTIME = (function(AIRTIME) {
},
"fnStateSave": function (oSettings, oData) {
localStorage.setItem('datatables-library', JSON.stringify(oData));
/*
$.ajax({
url: baseUrl+"usersettings/set-library-datatable",
type: "POST",
data: {settings : oData, format: "json"},
dataType: "json"
});
*/
colReorderMap = oData.ColReorder;
},
@ -890,7 +892,6 @@ var AIRTIME = (function(AIRTIME) {
}
});
checkImportStatus();
checkLibrarySCUploadStatus();
addQtipToSCIcons();

View file

@ -1,18 +1,13 @@
function showErrorSections() {
if($("#soundcloud-settings .errors").length > 0) {
$("#soundcloud-settings").show();
$(window).scrollTop($("#soundcloud-settings .errors").position().top);
}
if($("#email-server-settings .errors").length > 0) {
$("#email-server-settings").show();
$(window).scrollTop($("#email-server-settings .errors").position().top);
}
if($("#livestream-settings .errors").length > 0) {
$("#livestream-settings").show();
$(window).scrollTop($("#livestream-settings .errors").position().top);
}
var selector = $("[id$=-settings]");
selector.each(function(i) {
var el = $(this);
var errors = el.find(".errors");
if (errors.length > 0) {
el.show();
$(window).scrollTop(errors.position().top);
}
});
}
function setConfigureMailServerListener() {
@ -63,6 +58,30 @@ function setMailServerInputReadonly() {
setMsAuthenticationFieldsReadonly(requiresAuthCB);
}
function setTuneInSettingsListener() {
var enableTunein = $("#enable_tunein");
enableTunein.click(function(event){
setTuneInSettingsReadonly();
});
}
function setTuneInSettingsReadonly() {
var enableTunein = $("#enable_tunein");
var stationId = $("#tunein_station_id");
var partnerKey = $("#tunein_partner_key");
var partnerId = $("#tunein_partner_id");
if (enableTunein.is(':checked')) {
stationId.removeAttr("readonly");
partnerKey.removeAttr("readonly");
partnerId.removeAttr("readonly");
} else {
stationId.attr("readonly", "readonly");
partnerKey.attr("readonly", "readonly");
partnerId.attr("readonly", "readonly");
}
}
/*
* Enable/disable mail server authentication fields
*/
@ -120,6 +139,14 @@ function removeLogo() {
location.reload();
}
function deleteAllFiles() {
var resp = confirm($.i18n._("Are you sure you want to delete all the tracks in your library?"))
if (resp) {
$.post(baseUrl+'Preference/delete-all-files', function(json){});
location.reload();
}
}
$(document).ready(function() {
$('.collapsible-header').live('click',function() {
@ -128,6 +155,10 @@ $(document).ready(function() {
return false;
}).next().hide();
if ($("#tunein-settings").find(".errors").length > 0) {
$(".collapsible-content#tunein-settings").show();
}
/* No longer using AJAX for this form. Zend + our code makes it needlessly hard to deal with. -- Albert
$('#pref_save').live('click', function() {
var data = $('#pref_form').serialize();
@ -151,4 +182,6 @@ $(document).ready(function() {
setConfigureMailServerListener();
setEnableSystemEmailsListener();
setCollapsibleWidgetJsCode();
setTuneInSettingsReadonly();
setTuneInSettingsListener();
});

View file

@ -360,13 +360,7 @@ function windowResize() {
}
function preloadEventFeed () {
var url = baseUrl+'Schedule/event-feed-preload';
var d = new Date();
$.post(url, {format: "json", cachep: d.getTime()}, function(json){
calendarEvents = json.events;
createFullCalendar({calendarInit: calendarPref});
});
createFullCalendar({calendarInit: calendarPref});
}
var initialLoad = true;

View file

@ -312,7 +312,7 @@ function createFullCalendar(data){
],
contentHeight: mainHeight,
theme: true,
lazyFetching: false,
lazyFetching: true,
serverTimestamp: parseInt(data.calendarInit.timestamp, 10),
serverTimezoneOffset: parseInt(data.calendarInit.timezoneOffset, 10),

View file

@ -278,7 +278,8 @@ var AIRTIME = (function(AIRTIME){
oSchedTable.fnDraw();
mod.enableUI();
$("#library_content").find("#library_display").dataTable().fnStandingRedraw();
//Unneccessary reload of the library pane after moving tracks in the showbuilder pane.
//$("#library_content").find("#library_display").dataTable().fnStandingRedraw();
};
mod.getSelectedCursors = function() {
@ -398,13 +399,20 @@ var AIRTIME = (function(AIRTIME){
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
}
mod.builderDataTable = function() {
$sbContent = $('#show_builder');
$lib = $("#library_content"),
$sbTable = $sbContent.find('table');
var isInitialized = false;
var emptyNode = document.createElement('div');
var lockedPreviewIcon = document.createElement('span');
lockedPreviewIcon.setAttribute('class', 'ui-icon ui-icon-locked');
var previewIcon = document.createElement('img');
previewIcon.setAttribute('src', baseUrl+'css/images/icon_audioclip.png');
previewIcon.setAttribute('title', $.i18n._("Track preview"));
oSchedTable = $sbTable.dataTable( {
"aoColumns": [
/* checkbox */ {"mDataProp": "allowed", "sTitle": "", "sWidth": "15px", "sClass": "sb-checkbox"},
@ -429,6 +437,7 @@ var AIRTIME = (function(AIRTIME){
"bServerSide": true,
"bInfo": false,
"bAutoWidth": false,
"bDeferRender": true,
"bStateSave": true,
"fnStateSaveParams": function (oSettings, oData) {
@ -439,13 +448,14 @@ var AIRTIME = (function(AIRTIME){
"fnStateSave": function fnStateSave(oSettings, oData) {
localStorage.setItem('datatables-timeline', JSON.stringify(oData));
/*
$.ajax({
url: baseUrl+"usersettings/set-timeline-datatable",
type: "POST",
data: {settings : oData, format: "json"},
dataType: "json"
});
});*/
},
"fnStateLoad": function fnBuilderStateLoad(oSettings) {
var settings = localStorage.getItem('datatables-timeline');
@ -466,7 +476,8 @@ var AIRTIME = (function(AIRTIME){
a[i] = (a[i] === "true") ? true : false;
}
}
/*
a = oData.ColReorder;
if (a) {
for (i = 0, length = a.length; i < length; i++) {
@ -474,7 +485,7 @@ var AIRTIME = (function(AIRTIME){
a[i] = parseInt(a[i], 10);
}
}
}
}*/
oData.iCreate = parseInt(oData.iCreate, 10);
},
@ -494,8 +505,13 @@ var AIRTIME = (function(AIRTIME){
headerIcon;
fnPrepareSeparatorRow = function fnPrepareSeparatorRow(sRowContent, sClass, iNodeIndex) {
//Albert:
//$(nRow.children[iNodeIndex]).replaceWith(emptyNode);
$node = $(nRow.children[iNodeIndex]);
$node.html(sRowContent);
$node.attr('colspan',100);
for (i = iNodeIndex + 1, length = nRow.children.length; i < length; i = i+1) {
$node = $(nRow.children[i]);
@ -504,6 +520,7 @@ var AIRTIME = (function(AIRTIME){
}
$nRow.addClass(sClass);
};
if (aData.header === true) {
@ -576,7 +593,9 @@ var AIRTIME = (function(AIRTIME){
$nRow.find('td').removeClass();
$node = $(nRow.children[0]);
$node.html('');
if ($node) {
$node.empty();
}
sSeparatorHTML = '<span>'+$.i18n._("Show Empty")+'</span>';
cl = cl + " sb-empty odd";
@ -592,24 +611,32 @@ var AIRTIME = (function(AIRTIME){
sSeparatorHTML = '<span>'+$.i18n._("Recording From Line In")+'</span>';
cl = cl + " sb-record odd";
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
}
else {
//add the play function if the file exists on disk.
$image = $nRow.find('td.sb-image');
$image.empty();
//check if the file exists.
if (aData.image === true) {
$nRow.addClass("lib-audio");
if (!isAudioSupported(aData.mime)) {
$image.html('<span class="ui-icon ui-icon-locked"></span>');
//$image.html('<span class="ui-icon ui-icon-locked"></span>');
$image.append(lockedPreviewIcon);
} else {
/*
$image.html('<img title="'+$.i18n._("Track preview")+'" src="'+baseUrl+'css/images/icon_audioclip.png"></img>')
.click(function() {
open_show_preview(aData.instance, aData.pos);
return false;
});*/
$image.append(previewIcon.cloneNode(false));
$image.click(function() {
open_show_preview(aData.instance, aData.pos);
return false;
});
}
}
else {
@ -625,13 +652,13 @@ var AIRTIME = (function(AIRTIME){
hide: 'mouseout'
});
}
$node = $(nRow.children[0]);
if (aData.allowed === true && aData.scheduled >= 1 && aData.linked_allowed) {
$node.html('<input type="checkbox" name="'+aData.id+'"></input>');
}
else {
$node.html('');
$node.empty();
}
}
@ -705,7 +732,6 @@ var AIRTIME = (function(AIRTIME){
$("#draggingContainer").remove();
},
"fnDrawCallback": function fnBuilderDrawCallback(oSettings, json) {
var isInitialized = false;
if (!isInitialized) {
//when coming to 'Now Playing' page we want the page
@ -730,7 +756,8 @@ var AIRTIME = (function(AIRTIME){
heights = [];
clearTimeout(mod.timeout);
/*
//only create the cursor arrows if the library is on the page.
if ($lib.length > 0 && $lib.filter(":visible").length > 0) {
@ -775,18 +802,18 @@ var AIRTIME = (function(AIRTIME){
$tr = $table.find("tr[id="+cursorIds[i]+"][si_id="+showInstanceIds[i]+"]");
}
/* If the currently playing track's cursor is selected,
* and that track is deleted, the cursor position becomes
* unavailble. We have to check the position is available
* before re-highlighting it.
*/
//If the currently playing track's cursor is selected,
//and that track is deleted, the cursor position becomes
//unavailble. We have to check the position is available
// before re-highlighting it.
//
if ($tr.find(".sb-checkbox").children().hasClass("innerWrapper")) {
mod.selectCursor($tr);
/* If the selected cursor is the footer row we need to
* explicitly select it because that row does not have
* innerWrapper class
*/
// If the selected cursor is the footer row we need to
//explicitly select it because that row does not have
// innerWrapper class
//
} else if ($tr.hasClass("sb-footer")) {
mod.selectCursor($tr);
}
@ -801,8 +828,9 @@ var AIRTIME = (function(AIRTIME){
}
$parent.append($table);
}
*/
//order of importance of elements for setting the next timeout.
elements = [
$sbTable.find("tr."+NOW_PLAYING_CLASS),
@ -826,6 +854,7 @@ var AIRTIME = (function(AIRTIME){
break;
}
}
mod.checkToolBarIcons();
},
@ -957,9 +986,9 @@ var AIRTIME = (function(AIRTIME){
//item was reordered.
else {
ui.item
.empty()
.after(draggingContainer.html());
//ui.item
// .empty()
// .after(draggingContainer.html());
aItemData.push(ui.item.data("aData"));
fnMove();
@ -968,9 +997,10 @@ var AIRTIME = (function(AIRTIME){
return {
placeholder: "sb-placeholder ui-state-highlight",
forcePlaceholderSize: true,
//forcePlaceholderSize: true,
distance: 10,
helper: function(event, item) {
helper:
function(event, item) {
var selected = mod.getSelectedData(NOW_PLAYING_CLASS),
thead = $("#show_builder_table thead"),
colspan = thead.find("th").length,
@ -985,23 +1015,34 @@ var AIRTIME = (function(AIRTIME){
}
if (selected.length === 1) {
message = $.i18n._("Moving 1 Item");
}
else {
message = sprintf($.i18n._("Moving %s Items"), selected.length);
}
draggingContainer = $('<tr/>')
.addClass('sb-helper')
.append('<td/>')
.find("td")
message = sprintf($.i18n._("Moving %s"), selected[0].title);
//draggingContainer = item; //Default DataTables drag and drop
draggingContainer = $('<tr/>')
.addClass('sb-helper')
.append('<td/>')
.find("td")
.attr("colspan", colspan)
.width(width)
.height(height)
.addClass("ui-state-highlight")
.append(message)
.end();
}
else {
message = sprintf($.i18n._("Moving %s Items"), selected.length);
draggingContainer = $('<tr/>')
.addClass('sb-helper')
.append('<td/>')
.find("td")
.attr("colspan", colspan)
.width(width)
.height(height)
.addClass("ui-state-highlight")
.append(message)
.end();
}
helperData = selected;
return draggingContainer;

View file

@ -168,7 +168,7 @@ AIRTIME = (function(AIRTIME) {
$builder.find(dateStartId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$builder.find(timeStartId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
@ -328,10 +328,10 @@ AIRTIME = (function(AIRTIME) {
setTimeout(checkScheduleUpdates, 5000);
}
});
}
//check if the timeline view needs updating.
checkScheduleUpdates();
//check if the timeline view needs updating.
setTimeout(checkScheduleUpdates, 5000);
}
};
mod.onResize = function() {