Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
d5efcac452
56 changed files with 1166 additions and 510 deletions
|
@ -65,6 +65,13 @@ function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
|||
type = aData[6].substring(0,2);
|
||||
id = aData[0];
|
||||
|
||||
if(type == "au") {
|
||||
$('td:eq(5)', nRow).html( '<img src="css/images/icon_audioclip.png">' );
|
||||
}
|
||||
else if(type == "pl") {
|
||||
$('td:eq(5)', nRow).html( '<img src="css/images/icon_playlist.png">' );
|
||||
}
|
||||
|
||||
$(nRow).attr("id", type+'_'+id);
|
||||
|
||||
$(nRow).qtip({
|
||||
|
|
|
@ -146,21 +146,21 @@ function submitOnEnter(event) {
|
|||
}
|
||||
}
|
||||
|
||||
function setCueEvents() {
|
||||
function setCueEvents(el) {
|
||||
|
||||
$(".spl_cue_in span:last").blur(changeCueIn);
|
||||
$(".spl_cue_out span:last").blur(changeCueOut);
|
||||
$(el).find(".spl_cue_in span:last").blur(changeCueIn);
|
||||
$(el).find(".spl_cue_out span:last").blur(changeCueOut);
|
||||
|
||||
$(".spl_cue_in span:first, .spl_cue_out span:first")
|
||||
$(el).find(".spl_cue_in span:first, .spl_cue_out span:first")
|
||||
.keydown(submitOnEnter);
|
||||
}
|
||||
|
||||
function setFadeEvents() {
|
||||
function setFadeEvents(el) {
|
||||
|
||||
$(".spl_fade_in span:first").blur(changeFadeIn);
|
||||
$(".spl_fade_out span:first").blur(changeFadeOut);
|
||||
$(el).find(".spl_fade_in span:first").blur(changeFadeIn);
|
||||
$(el).find(".spl_fade_out span:first").blur(changeFadeOut);
|
||||
|
||||
$(".spl_fade_in span:first, .spl_fade_out span:first")
|
||||
$(el).find(".spl_fade_in span:first, .spl_fade_out span:first")
|
||||
.keydown(submitOnEnter);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ function openFadeEditor(event) {
|
|||
.append(json.html)
|
||||
.show();
|
||||
|
||||
setFadeEvents();
|
||||
setFadeEvents(li);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ function openCueEditor(event) {
|
|||
.append(json.html)
|
||||
.show();
|
||||
|
||||
setCueEvents();
|
||||
setCueEvents(li);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -328,36 +328,49 @@ function closeSPL() {
|
|||
$.post(url, noOpenPL);
|
||||
}
|
||||
|
||||
function createPlaylistMetaForm(json) {
|
||||
var submit, form;
|
||||
|
||||
submit = $('<button id="new_playlist_submit">Submit</button>')
|
||||
.button()
|
||||
.click(function(){
|
||||
var url, data;
|
||||
|
||||
url = '/Playlist/metadata/format/json';
|
||||
data = $("#side_playlist form").serialize();
|
||||
|
||||
$.post(url, data, function(json){
|
||||
if(json.form){
|
||||
|
||||
}
|
||||
|
||||
openDiffSPL(json);
|
||||
})
|
||||
});
|
||||
|
||||
form = $(json.form);
|
||||
|
||||
form.find("input, textarea")
|
||||
.keydown(function(event){
|
||||
//enter was pressed
|
||||
if(event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
$("#new_playlist_submit").click();
|
||||
}
|
||||
})
|
||||
|
||||
$("#side_playlist")
|
||||
.empty()
|
||||
.append(form)
|
||||
.append(submit);
|
||||
}
|
||||
|
||||
function newSPL() {
|
||||
var url;
|
||||
|
||||
url = '/Playlist/new/format/json';
|
||||
|
||||
$.post(url, function(json){
|
||||
var submit;
|
||||
|
||||
submit = $('<button>Submit</button>')
|
||||
.button()
|
||||
.click(function(){
|
||||
var url, data;
|
||||
|
||||
url = '/Playlist/metadata/format/json';
|
||||
data = $("#side_playlist form").serialize();
|
||||
|
||||
$.post(url, data, function(json){
|
||||
if(json.form){
|
||||
|
||||
}
|
||||
|
||||
openDiffSPL(json);
|
||||
})
|
||||
});
|
||||
|
||||
$("#side_playlist")
|
||||
.empty()
|
||||
.append(json.form)
|
||||
.append(submit);
|
||||
});
|
||||
$.post(url, createPlaylistMetaForm);
|
||||
}
|
||||
|
||||
function deleteSPL() {
|
||||
|
|
|
@ -60,7 +60,9 @@ function findHosts(request, callback) {
|
|||
function setAddShowEvents() {
|
||||
var start, end;
|
||||
|
||||
$(".tabs").tabs();
|
||||
$("h3").click(function(){
|
||||
$(this).next().toggle();
|
||||
});
|
||||
|
||||
if(!$("#add_show_repeats").attr('checked')) {
|
||||
$("#schedule-show-when > fieldset:last").hide();
|
||||
|
@ -114,6 +116,15 @@ function setAddShowEvents() {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
$("#add-show-close")
|
||||
.button()
|
||||
.click(function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
$("#add-show-form").hide();
|
||||
});
|
||||
|
||||
$("#add-show-submit")
|
||||
.button()
|
||||
.click(function(){
|
||||
|
|
|
@ -23,13 +23,15 @@ function dayClick(date, allDay, jsEvent, view) {
|
|||
|
||||
function viewDisplay( view ) {
|
||||
|
||||
$('.schedule_change_slots').remove();
|
||||
var td = $('.schedule_change_slots').parent();
|
||||
td.prev().remove();
|
||||
td.remove();
|
||||
|
||||
if(view.name === 'agendaDay' || view.name === 'agendaWeek') {
|
||||
|
||||
var calendarEl = this;
|
||||
|
||||
var select = $('<select class="schedule_change_slots"/>')
|
||||
var select = $('<select class="schedule_change_slots input_select"/>')
|
||||
.append('<option value="5">5 min</option>')
|
||||
.append('<option value="10">10 min</option>')
|
||||
.append('<option value="15">15 min</option>')
|
||||
|
|
|
@ -191,6 +191,10 @@ function buildScheduleDialog(json){
|
|||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
function buildEditDialog(json){
|
||||
|
||||
}
|
||||
|
||||
function scheduleRefetchEvents() {
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
|
|
72
public/js/airtime/user/user.js
Normal file
72
public/js/airtime/user/user.js
Normal file
|
@ -0,0 +1,72 @@
|
|||
function populateForm(entries){
|
||||
//$('#user_details').show();
|
||||
|
||||
$('.errors').remove();
|
||||
|
||||
$('#user_id').val(entries.id);
|
||||
$('#login').val(entries.login);
|
||||
$('#first_name').val(entries.first_name);
|
||||
$('#last_name').val(entries.last_name);
|
||||
$('#type').val(entries.type);
|
||||
|
||||
if (entries.id.length != 0){
|
||||
$('#login').attr('readonly', 'readonly');
|
||||
$('#password').val("xxxxxx");
|
||||
} else {
|
||||
$('#login').removeAttr('readonly');
|
||||
$('#password').val("");
|
||||
}
|
||||
}
|
||||
|
||||
function rowClickCallback(row_id){
|
||||
$.ajax({ url: '/User/get-user-data/id/'+ row_id +'/format/json', dataType:"json", success:function(data){
|
||||
populateForm(data.entries);
|
||||
}});
|
||||
}
|
||||
|
||||
function removeUserCallback(row_id, nRow){
|
||||
$.ajax({ url: '/User/remove-user/id/'+ row_id +'/format/json', dataType:"text", success:function(data){
|
||||
var o = $('#users_datatable').dataTable().fnDeleteRow(nRow);
|
||||
}});
|
||||
}
|
||||
|
||||
function rowCallback( nRow, aData, iDisplayIndex ){
|
||||
$(nRow).click(function(){rowClickCallback(aData[0])});
|
||||
$('td:eq(2)', nRow).append( '<span class="ui-icon ui-icon-closethick"></span>').children('span').click(function(e){e.stopPropagation(); removeUserCallback(aData[0], nRow)});
|
||||
|
||||
return nRow;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#users_datatable').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "/User/get-user-data-table-info/format/json",
|
||||
"fnServerData": function ( sSource, aoData, fnCallback ) {
|
||||
$.ajax( {
|
||||
"dataType": 'json',
|
||||
"type": "POST",
|
||||
"url": sSource,
|
||||
"data": aoData,
|
||||
"success": fnCallback
|
||||
} );
|
||||
},
|
||||
"fnRowCallback": rowCallback,
|
||||
"aoColumns": [
|
||||
/* Id */ { "sName": "id", "bSearchable": false, "bVisible": false },
|
||||
/* user name */ { "sName": "login" },
|
||||
/* user type */ { "sName": "type", "bSearchable": false },
|
||||
/* del button */ { "sName": "null as delete", "bSearchable": false, "bSortable": false}
|
||||
],
|
||||
"bJQueryUI": true,
|
||||
"bAutoWidth": false,
|
||||
"bLengthChange": false
|
||||
});
|
||||
|
||||
//$('#user_details').hide();
|
||||
|
||||
var newUser = {login:"", first_name:"", last_name:"", type:"G", id:""};
|
||||
|
||||
$('#add_user_button').click(function(){populateForm(newUser)});
|
||||
|
||||
});
|
1
public/js/playlist/dayview.js
Normal file
1
public/js/playlist/dayview.js
Normal file
|
@ -0,0 +1 @@
|
|||
var viewType = "day";
|
|
@ -3,17 +3,17 @@ var datagridData;
|
|||
|
||||
function getDateText(obj){
|
||||
var str = obj.aData[ obj.iDataColumn ].toString();
|
||||
if (str.indexOf(" ") != -1){
|
||||
return changeTimePrecision(str.substring(0, str.indexOf(" ")));
|
||||
}
|
||||
datetime = str.split(" ");
|
||||
if (datetime.length == 2)
|
||||
return datetime[0];
|
||||
return str;
|
||||
}
|
||||
|
||||
function getTimeText(obj){
|
||||
var str = obj.aData[ obj.iDataColumn ].toString();
|
||||
if (str.indexOf(" ") != -1){
|
||||
return changeTimePrecision(str.substring(str.indexOf(" ")+1));
|
||||
}
|
||||
datetime = str.split(" ");
|
||||
if (datetime.length == 2)
|
||||
return changeTimePrecision(datetime[1]);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -23,16 +23,16 @@ function changeTimePrecisionInit(obj){
|
|||
}
|
||||
|
||||
function changeTimePrecision(str){
|
||||
if (str.indexOf(".") != -1){
|
||||
if (str.length - str.indexOf(".") > 2)
|
||||
var extraLength = str.length - str.indexOf(".") -3;
|
||||
return str.substring(0, str.length - extraLength);
|
||||
}
|
||||
return str;
|
||||
|
||||
var temp = str.split(".")
|
||||
if (temp.length == 2){
|
||||
if (temp[1].length > 2)
|
||||
return temp[0]+"."+temp[1].substr(0, 2);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function notifySongEnd(){
|
||||
//alert("length " + datagridData.rows.length);
|
||||
for (var i=0; i<datagridData.rows.length; i++){
|
||||
if (datagridData.rows[i][0] == "c")
|
||||
datagridData.rows[i][0] = "p";
|
||||
|
@ -45,16 +45,6 @@ function notifySongEnd(){
|
|||
createDataGrid();
|
||||
}
|
||||
|
||||
/*
|
||||
function updateDataGrid(){
|
||||
var table = $('#nowplayingtable');
|
||||
//table.dataTable().fnClearTable();
|
||||
|
||||
for (var i=0; i<datagridData.rows.length; i++){
|
||||
table.dataTable().fnAddData(datagridData.rows[i]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
var columns = [{"sTitle": "type", "bVisible":false},
|
||||
{"sTitle":"Date"},
|
||||
{"sTitle":"Start"},
|
||||
|
@ -83,7 +73,6 @@ function createDataGrid(){
|
|||
"bInfo": false,
|
||||
"bLengthChange": false,
|
||||
"bPaginate": false,
|
||||
"aaData": datagridData.rows,
|
||||
"aoColumns": columns,
|
||||
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
if (aData[aData.length-2] == "t")
|
||||
|
@ -93,41 +82,73 @@ function createDataGrid(){
|
|||
else if (aData[0] == "b")
|
||||
$(nRow).attr("style", "background-color:#EE3B3B");
|
||||
return nRow;
|
||||
}
|
||||
},
|
||||
"bAutoWidth":false
|
||||
} );
|
||||
|
||||
|
||||
}
|
||||
|
||||
var viewType = "now" //"day";
|
||||
var mainLoopRegistered = false;
|
||||
|
||||
function setViewType(type){
|
||||
if (type == 0){
|
||||
viewType = "now";
|
||||
} else {
|
||||
viewType = "day";
|
||||
}
|
||||
init2();
|
||||
function getDateString(){
|
||||
var date0 = $("#datepicker").datepicker("getDate");
|
||||
return (date0.getFullYear() + "-" + (parseInt(date0.getMonth())+1) + "-" + date0.getDate());
|
||||
}
|
||||
|
||||
function init2(){
|
||||
$.ajax({ url: "/Nowplaying/get-data-grid-data/format/json/view/" + viewType, dataType:"json", success:function(data){
|
||||
function getAJAXURL(){
|
||||
var url = "/Nowplaying/get-data-grid-data/format/json/view/"+viewType;
|
||||
|
||||
if (viewType == "day"){
|
||||
url += "/date/" + getDateString();
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
function updateDataTable(){
|
||||
var table = $('#nowplayingtable').dataTable();
|
||||
|
||||
table.fnClearTable(false);
|
||||
table.fnAddData(datagridData.rows, false);
|
||||
table.fnDraw(true);
|
||||
|
||||
}
|
||||
|
||||
function getData(){
|
||||
$.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){
|
||||
datagridData = data.entries;
|
||||
createDataGrid();
|
||||
}});
|
||||
|
||||
updateDataTable();
|
||||
}});
|
||||
}
|
||||
|
||||
function init2(){
|
||||
getData();
|
||||
|
||||
if (typeof registerSongEndListener == 'function' && !registered){
|
||||
registered = true;
|
||||
registerSongEndListener(notifySongEnd);
|
||||
}
|
||||
|
||||
if (!mainLoopRegistered){
|
||||
setTimeout(init2, 5000);
|
||||
mainLoopRegistered = true;
|
||||
}
|
||||
setTimeout(init2, 5000);
|
||||
|
||||
}
|
||||
|
||||
function redirect(url){
|
||||
document.location.href = url;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
init2();
|
||||
|
||||
createDataGrid();
|
||||
if (viewType == "day"){
|
||||
$('#now_view').click(function(){redirect('/Nowplaying/index')});
|
||||
|
||||
$("#datepicker").datepicker({
|
||||
onSelect: function(dateText, inst)
|
||||
{ getData();}});
|
||||
$("#datepicker").datepicker("setDate", new Date());
|
||||
} else {
|
||||
$('#day_view').click(function(){redirect('/Nowplaying/day-view')});
|
||||
}
|
||||
|
||||
init2();
|
||||
});
|
||||
|
|
1
public/js/playlist/nowview.js
Normal file
1
public/js/playlist/nowview.js
Normal file
|
@ -0,0 +1 @@
|
|||
var viewType = "now";
|
|
@ -73,54 +73,60 @@ function nextShowStart(){
|
|||
nextShowPrepare = true;
|
||||
currentShow[0] = nextShow.shift();
|
||||
updatePlaybar();
|
||||
|
||||
//notifySongEndListener();
|
||||
}
|
||||
|
||||
/* Called every "uiUpdateInterval" mseconds. */
|
||||
function updateProgressBarValue(){
|
||||
var showPercentDone = 0;
|
||||
if (currentShow.length > 0){
|
||||
var showPercentDone = (estimatedSchedulePosixTime - currentShow[0].showStartPosixTime)/currentShow[0].showLengthMs*100;
|
||||
showPercentDone = (estimatedSchedulePosixTime - currentShow[0].showStartPosixTime)/currentShow[0].showLengthMs*100;
|
||||
if (showPercentDone < 0 || showPercentDone > 100){
|
||||
showPercentDone = 0;
|
||||
currentShow = new Array();
|
||||
}
|
||||
$('#progress-show').attr("style", "width:"+showPercentDone+"%");
|
||||
}
|
||||
$('#progress-show').attr("style", "width:"+showPercentDone+"%");
|
||||
|
||||
var songPercentDone = 0;
|
||||
if (currentSong.length > 0){
|
||||
songPercentDone = (estimatedSchedulePosixTime - currentSong[0].songStartPosixTime)/currentSong[0].songLengthMs*100;
|
||||
if (songPercentDone < 0 || songPercentDone > 100){
|
||||
songPercentDone = 0;
|
||||
currentSong = new Array();
|
||||
songPercentDone = 0;
|
||||
currentSong = new Array();
|
||||
} else {
|
||||
$('#on-air-info').attr("class", "on-air-info on");
|
||||
$('#progress-show').attr("class", "progress-show");
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
$('#on-air-info').attr("class", "on-air-info off");
|
||||
$('#progress-show').attr("class", "progress-show-red");
|
||||
}
|
||||
$('#progress-bar').attr("style", "width:"+songPercentDone+"%");
|
||||
|
||||
//calculate how much time left to next song if there is any
|
||||
if (nextSongs.length > 0 && nextSongPrepare){
|
||||
var diff = nextSongs[0].songStartPosixTime - estimatedSchedulePosixTime;
|
||||
if (diff < serverUpdateInterval && diff >= 0){
|
||||
if (diff < serverUpdateInterval){
|
||||
|
||||
//sometimes the diff is negative (-100ms for example). Still looking
|
||||
//into why this could sometimes happen.
|
||||
if (diff < 0)
|
||||
diff=0;
|
||||
|
||||
nextSongPrepare = false;
|
||||
setTimeout(newSongStart, diff);
|
||||
} else if (diff < 0 && APPLICATION_ENV == "development"){
|
||||
alert ("Warning: estimatedSchedulePosixTime > songStartPosixTime");
|
||||
alert (estimatedSchedulePosixTime + " " + nextSongs[0].songStartPosixTime);
|
||||
}
|
||||
}
|
||||
|
||||
//calculate how much time left to next show if there is any
|
||||
if (nextShow.length > 0 && nextShowPrepare){
|
||||
var diff = nextShow[0].showStartPosixTime - estimatedSchedulePosixTime;
|
||||
if (diff < serverUpdateInterval && diff >= 0){
|
||||
if (diff < serverUpdateInterval){
|
||||
if (diff < 0)
|
||||
diff=0;
|
||||
|
||||
nextShowPrepare = false;
|
||||
setTimeout(nextShowStart, diff);
|
||||
} else if (diff < 0 && APPLICATION_ENV == "development"){
|
||||
alert ("Warning: estimatedSchedulePosixTime > showStartPosixTime");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +137,7 @@ function updatePlaybar(){
|
|||
/* Column 0 update */
|
||||
$('#previous').empty();
|
||||
$('#prev-length').empty();
|
||||
$('#current').text("Current:");
|
||||
$('#current').html("Current: <span style='color:red; font-weight:bold'>Nothing Scheduled</span>");
|
||||
$('#next').empty();
|
||||
$('#next-length').empty();
|
||||
if (previousSongs.length > 0){
|
||||
|
@ -191,22 +197,13 @@ function calcAdditionalShowData(show){
|
|||
if (show.length > 0){
|
||||
show[0].showStartPosixTime = convertDateToPosixTime(show[0].start_timestamp);
|
||||
show[0].showEndPosixTime = convertDateToPosixTime(show[0].end_timestamp);
|
||||
|
||||
//hack to fix case where show end is next day, but we have it set
|
||||
//as the same day.
|
||||
if (show[0].showEndPosixTime - show[0].showStartPosixTime < 0)
|
||||
show[0].showEndPosixTime += 1000*3600*24;
|
||||
|
||||
show[0].showLengthMs = show[0].showEndPosixTime - show[0].showStartPosixTime;
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(obj){
|
||||
APPLICATION_ENV = obj.env;
|
||||
|
||||
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
|
||||
schedulePosixTime += parseInt(obj.timezoneOffset)*1000;
|
||||
|
||||
|
||||
$('#time-zone').text(obj.timezone);
|
||||
|
||||
previousSongs = obj.previous;
|
||||
|
@ -223,10 +220,10 @@ function parseItems(obj){
|
|||
calcAdditionalShowData(obj.currentShow);
|
||||
calcAdditionalShowData(obj.nextShow);
|
||||
|
||||
if (localRemoteTimeOffset == null){
|
||||
var date = new Date();
|
||||
localRemoteTimeOffset = date.getTime() - schedulePosixTime;
|
||||
}
|
||||
var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime);
|
||||
schedulePosixTime += parseInt(obj.timezoneOffset)*1000;
|
||||
var date = new Date();
|
||||
localRemoteTimeOffset = date.getTime() - schedulePosixTime;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -66,4 +66,4 @@ function initShowListView(){
|
|||
|
||||
$(document).ready(function() {
|
||||
initShowListView();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue