CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.
This commit is contained in:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
331
airtime_mvc/public/js/airtime/schedule/add-show.js
Normal file
331
airtime_mvc/public/js/airtime/schedule/add-show.js
Normal file
|
@ -0,0 +1,331 @@
|
|||
/**
|
||||
*
|
||||
* Schedule Dialog creation methods.
|
||||
*
|
||||
*/
|
||||
|
||||
//dateText mm-dd-yy
|
||||
function startDpSelect(dateText, inst) {
|
||||
var time, date;
|
||||
|
||||
time = dateText.split("-");
|
||||
date = new Date(time[0], time[1] - 1, time[2]);
|
||||
|
||||
$("#add_show_end_date").datepicker("option", "minDate", date);
|
||||
$('input[name^="add_show_rebroadcast_absolute_date"]').datepicker("option", "minDate", date);
|
||||
}
|
||||
|
||||
function endDpSelect(dateText, inst) {
|
||||
var time, date;
|
||||
|
||||
time = dateText.split("-");
|
||||
date = new Date(time[0], time[1] - 1, time[2]);
|
||||
|
||||
$("#add_show_start_date").datepicker( "option", "maxDate", date);
|
||||
}
|
||||
|
||||
function createDateInput(el, onSelect) {
|
||||
var date;
|
||||
|
||||
el.datepicker({
|
||||
minDate: new Date(),
|
||||
onSelect: onSelect,
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
}
|
||||
|
||||
function autoSelect(event, ui) {
|
||||
|
||||
$("#add_show_hosts-"+ui.item.value).attr("checked", "checked");
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function findHosts(request, callback) {
|
||||
var search, url;
|
||||
|
||||
url = "/User/get-hosts";
|
||||
search = request.term;
|
||||
|
||||
$.post(url,
|
||||
{format: "json", term: search},
|
||||
|
||||
function(json) {
|
||||
callback(json.hosts);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function setAddShowEvents() {
|
||||
|
||||
var form = $("#add-show-form");
|
||||
|
||||
form.find("h3").click(function(){
|
||||
$(this).next().toggle();
|
||||
});
|
||||
|
||||
if(!form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#schedule-show-when > fieldset:last").hide();
|
||||
$("#add_show_rebroadcast_relative").hide();
|
||||
}
|
||||
else {
|
||||
$("#add_show_rebroadcast_absolute").hide();
|
||||
}
|
||||
|
||||
if(!form.find("#add_show_record").attr('checked')) {
|
||||
form.find("#add_show_rebroadcast").hide();
|
||||
}
|
||||
|
||||
if(!form.find("#add_show_rebroadcast").attr('checked')) {
|
||||
form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide();
|
||||
}
|
||||
|
||||
form.find("#add_show_repeats").click(function(){
|
||||
$(this).blur();
|
||||
form.find("#schedule-show-when > fieldset:last").toggle();
|
||||
|
||||
//must switch rebroadcast displays
|
||||
if(form.find("#add_show_rebroadcast").attr('checked')) {
|
||||
|
||||
if($(this).attr('checked')){
|
||||
form.find("#add_show_rebroadcast_absolute").hide();
|
||||
form.find("#add_show_rebroadcast_relative").show();
|
||||
}
|
||||
else {
|
||||
form.find("#add_show_rebroadcast_absolute").show();
|
||||
form.find("#add_show_rebroadcast_relative").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.find("#add_show_record").click(function(){
|
||||
$(this).blur();
|
||||
form.find("#add_show_rebroadcast").toggle();
|
||||
});
|
||||
|
||||
form.find("#add_show_rebroadcast").click(function(){
|
||||
$(this).blur();
|
||||
if($(this).attr('checked') && !form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#add_show_rebroadcast_absolute").show();
|
||||
}
|
||||
else if($(this).attr('checked') && form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#add_show_rebroadcast_relative").show();
|
||||
}
|
||||
else {
|
||||
form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide();
|
||||
}
|
||||
});
|
||||
|
||||
form.find("#add_show_repeat_type").change(function(){
|
||||
if($(this).val() == 2) {
|
||||
form.find("#add_show_day_check-label, #add_show_day_check-element").hide();
|
||||
}
|
||||
else {
|
||||
form.find("#add_show_day_check-label, #add_show_day_check-element").show();
|
||||
}
|
||||
});
|
||||
|
||||
form.find("#add_show_day_check-label").addClass("block-display");
|
||||
form.find("#add_show_day_check-element").addClass("block-display clearfix");
|
||||
form.find("#add_show_day_check-element label").addClass("wrapp-label");
|
||||
form.find("#add_show_day_check-element br").remove();
|
||||
|
||||
function endDateVisibility(){
|
||||
if(form.find("#add_show_no_end").is(':checked')){
|
||||
form.find("#add_show_end_date").hide();
|
||||
} else {
|
||||
form.find("#add_show_end_date").show();
|
||||
}
|
||||
}
|
||||
endDateVisibility();
|
||||
form.find("#add_show_no_end").click(endDateVisibility);
|
||||
|
||||
createDateInput(form.find("#add_show_start_date"), startDpSelect);
|
||||
createDateInput(form.find("#add_show_end_date"), endDpSelect);
|
||||
|
||||
form.find("#add_show_start_time").timepicker({
|
||||
amPmText: ['', '']
|
||||
});
|
||||
form.find("#add_show_duration").timepicker({
|
||||
amPmText: ['', ''],
|
||||
defaultTime: '01:00'
|
||||
});
|
||||
|
||||
form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({
|
||||
minDate: new Date(),
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
form.find('input[name^="add_show_rebroadcast_time"]').timepicker({
|
||||
amPmText: ['', ''],
|
||||
defaultTime: ''
|
||||
});
|
||||
|
||||
form.find(".add_absolute_rebroadcast_day").click(function(){
|
||||
var li = $(this).prev().find("li:visible:last").next();
|
||||
|
||||
li.show();
|
||||
li = li.next();
|
||||
if(li.length === 0) {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
|
||||
form.find('a[id^="remove_rebroadcast"]').click(function(){
|
||||
var list = $(this).parent().parent();
|
||||
var li_num = $(this).parent().index();
|
||||
var num = list.find("li").length;
|
||||
var count = num - li_num;
|
||||
|
||||
var curr = $(this).parent();
|
||||
var next = curr.next();
|
||||
|
||||
for(var i=0; i<=count; i++) {
|
||||
var date = next.find('[name^="add_show_rebroadcast_date"]').val();
|
||||
curr.find('[name^="add_show_rebroadcast_date"]').val(date);
|
||||
var time = next.find('[name^="add_show_rebroadcast_time"]').val();
|
||||
curr.find('[name^="add_show_rebroadcast_time"]').val(time);
|
||||
|
||||
curr = next;
|
||||
next = curr.next();
|
||||
}
|
||||
|
||||
list.find("li:visible:last")
|
||||
.find('[name^="add_show_rebroadcast_date"]')
|
||||
.val('')
|
||||
.end()
|
||||
.find('[name^="add_show_rebroadcast_time"]')
|
||||
.val('')
|
||||
.end()
|
||||
.hide();
|
||||
|
||||
list.next().show();
|
||||
});
|
||||
|
||||
form.find("#add_show_hosts_autocomplete").autocomplete({
|
||||
source: findHosts,
|
||||
select: autoSelect,
|
||||
delay: 200
|
||||
});
|
||||
|
||||
form.find("#schedule-show-style input").ColorPicker({
|
||||
onChange: function (hsb, hex, rgb, el) {
|
||||
$(el).val(hex);
|
||||
},
|
||||
onSubmit: function(hsb, hex, rgb, el) {
|
||||
$(el).val(hex);
|
||||
$(el).ColorPickerHide();
|
||||
},
|
||||
onBeforeShow: function () {
|
||||
$(this).ColorPickerSetColor(this.value);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
form.find("#add-show-close")
|
||||
.click(function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
var y = $("#schedule_calendar").width();
|
||||
var z = $("#schedule-add-show").width();
|
||||
|
||||
$("#schedule_calendar").width(y+z+50)
|
||||
.fullCalendar('render');
|
||||
|
||||
$("#add-show-form").hide();
|
||||
$.get("/Schedule/get-form", {format:"json"}, function(json){
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(json.form);
|
||||
|
||||
setAddShowEvents();
|
||||
});
|
||||
makeAddShowButton();
|
||||
});
|
||||
|
||||
form.find(".add-show-submit")
|
||||
.click(function(event){
|
||||
var addShowButton = $(this);
|
||||
if (!addShowButton.hasClass("disabled")){
|
||||
addShowButton.addClass("disabled");
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var data = $("form").serializeArray();
|
||||
|
||||
var hosts = $('#add_show_hosts-element input').map(function() {
|
||||
if($(this).attr("checked")) {
|
||||
return $(this).val();
|
||||
}
|
||||
}).get();
|
||||
|
||||
var days = $('#add_show_day_check-element input').map(function() {
|
||||
if($(this).attr("checked")) {
|
||||
return $(this).val();
|
||||
}
|
||||
}).get();
|
||||
|
||||
var start_date = $("#add_show_start_date").val();
|
||||
var end_date = $("#add_show_end_date").val();
|
||||
|
||||
$.post("/Schedule/add-show", {format: "json", data: data, hosts: hosts, days: days}, function(json){
|
||||
addShowButton.removeClass("disabled");
|
||||
if(json.form) {
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(json.form);
|
||||
|
||||
setAddShowEvents();
|
||||
|
||||
$("#add_show_end_date").val(end_date);
|
||||
$("#add_show_start_date").val(start_date);
|
||||
showErrorSections();
|
||||
}
|
||||
else {
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(json.newForm);
|
||||
|
||||
setAddShowEvents();
|
||||
scheduleRefetchEvents();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showErrorSections() {
|
||||
|
||||
if($("#schedule-show-what .errors").length > 0) {
|
||||
$("#schedule-show-what").show();
|
||||
}
|
||||
if($("#schedule-show-when .errors").length > 0) {
|
||||
$("#schedule-show-when").show();
|
||||
}
|
||||
if($("#schedule-show-who .errors").length > 0) {
|
||||
$("#schedule-show-who").show();
|
||||
}
|
||||
if($("#schedule-show-style .errors").length > 0) {
|
||||
$("#schedule-show-style").show();
|
||||
}
|
||||
if($("#add_show_rebroadcast_absolute .errors").length > 0) {
|
||||
$("#schedule-record-rebroadcast").show();
|
||||
$("#add_show_rebroadcast_absolute").show();
|
||||
}
|
||||
if($("#add_show_rebroadcast_relative .errors").length > 0) {
|
||||
$("#schedule-record-rebroadcast").show();
|
||||
$("#add_show_rebroadcast_relative").show();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
//setAddShowEvents();
|
||||
});
|
||||
|
||||
$(window).load(function() {
|
||||
|
||||
setAddShowEvents();
|
||||
});
|
|
@ -0,0 +1,275 @@
|
|||
/**
|
||||
*
|
||||
* Full Calendar callback methods.
|
||||
*
|
||||
*/
|
||||
|
||||
function scheduleRefetchEvents() {
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
|
||||
function openAddShowForm() {
|
||||
|
||||
if(($("#add-show-form").length == 1) && ($("#add-show-form").css('display')=='none')) {
|
||||
$("#add-show-form").show();
|
||||
var y = $("#schedule_calendar").width();
|
||||
var z = $("#schedule-add-show").width();
|
||||
$("#schedule_calendar").width(y-z-50);
|
||||
$("#schedule_calendar").fullCalendar('render');
|
||||
}
|
||||
}
|
||||
|
||||
function makeAddShowButton(){
|
||||
$('.fc-header-left')
|
||||
.append('<span class="fc-header-space"></span>')
|
||||
.append('<span class="fc-button"><a href="#" class="add-button"><span class="add-icon"></span>Show</a></span>')
|
||||
.find('span.fc-button:last > a')
|
||||
.click(function(){
|
||||
openAddShowForm();
|
||||
removeAddShowButton();
|
||||
});
|
||||
}
|
||||
|
||||
function removeAddShowButton(){
|
||||
var aTag = $('.fc-header-left')
|
||||
.find("span.fc-button:last > a");
|
||||
|
||||
var span = aTag.parent();
|
||||
span.prev().remove();
|
||||
span.remove();
|
||||
}
|
||||
|
||||
function beginEditShow(data){
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(data.newForm);
|
||||
|
||||
removeAddShowButton();
|
||||
setAddShowEvents();
|
||||
openAddShowForm();
|
||||
}
|
||||
|
||||
function makeTimeStamp(date){
|
||||
var sy, sm, sd, h, m, s, timestamp;
|
||||
sy = date.getFullYear();
|
||||
sm = date.getMonth() + 1;
|
||||
sd = date.getDate();
|
||||
h = date.getHours();
|
||||
m = date.getMinutes();
|
||||
s = date.getSeconds();
|
||||
|
||||
timestamp = sy+"-"+ sm +"-"+ sd +" "+ h +":"+ m +":"+ s;
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
function dayClick(date, allDay, jsEvent, view) {
|
||||
var now, today, selected, chosenDate, chosenTime;
|
||||
|
||||
now = new Date();
|
||||
|
||||
if(view.name === "month") {
|
||||
today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||
}
|
||||
else {
|
||||
today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes());
|
||||
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
||||
}
|
||||
|
||||
if(selected >= today) {
|
||||
var addShow = $('.add-button');
|
||||
|
||||
//remove the +show button if it exists.
|
||||
if(addShow.length == 1){
|
||||
var span = $(addShow).parent();
|
||||
$(span).prev().remove();
|
||||
$(span).remove();
|
||||
}
|
||||
|
||||
chosenDate = selected.getFullYear();
|
||||
|
||||
var month = selected.getMonth() + 1;
|
||||
if(month < 10) {
|
||||
chosenDate = chosenDate+'-0'+month;
|
||||
}
|
||||
else {
|
||||
chosenDate = chosenDate+'-'+month;
|
||||
}
|
||||
|
||||
var day = selected.getDate();
|
||||
if(day < 10) {
|
||||
chosenDate = chosenDate+'-0'+day;
|
||||
}
|
||||
else {
|
||||
chosenDate = chosenDate+'-'+day;
|
||||
}
|
||||
|
||||
var min = selected.getMinutes();
|
||||
var hours = selected.getHours();
|
||||
if(min < 10){
|
||||
chosenTime = hours+":0"+min;
|
||||
}
|
||||
else {
|
||||
chosenTime = hours+":"+min;
|
||||
}
|
||||
|
||||
$("#add_show_start_date").val(chosenDate);
|
||||
$("#add_show_end_date").datepicker("option", "minDate", chosenDate);
|
||||
$("#add_show_end_date").val(chosenDate);
|
||||
$("#add_show_start_time").val(chosenTime);
|
||||
$("#schedule-show-when").show();
|
||||
|
||||
openAddShowForm();
|
||||
}
|
||||
}
|
||||
|
||||
function viewDisplay( view ) {
|
||||
|
||||
if(view.name === 'agendaDay' || view.name === 'agendaWeek') {
|
||||
|
||||
var calendarEl = this;
|
||||
|
||||
var select = $('<select class="schedule_change_slots input_select"/>')
|
||||
.append('<option value="1">1m</option>')
|
||||
.append('<option value="5">5m</option>')
|
||||
.append('<option value="10">10m</option>')
|
||||
.append('<option value="15">15m</option>')
|
||||
.append('<option value="30">30m</option>')
|
||||
.append('<option value="60">60m</option>')
|
||||
.change(function(){
|
||||
var slotMin = $(this).val();
|
||||
var opt = view.calendar.options;
|
||||
var date = $(calendarEl).fullCalendar('getDate');
|
||||
|
||||
opt.slotMinutes = parseInt(slotMin);
|
||||
opt.events = getFullCalendarEvents;
|
||||
opt.defaultView = view.name;
|
||||
|
||||
//re-initialize calendar with new slotmin options
|
||||
$(calendarEl)
|
||||
.fullCalendar('destroy')
|
||||
.fullCalendar(opt)
|
||||
.fullCalendar( 'gotoDate', date );
|
||||
});
|
||||
|
||||
var topLeft = $(view.element).find("table.fc-agenda-days > thead th:first");
|
||||
|
||||
select.width(topLeft.width())
|
||||
.height(topLeft.height());
|
||||
|
||||
topLeft.empty()
|
||||
.append(select);
|
||||
|
||||
var slotMin = view.calendar.options.slotMinutes;
|
||||
$('.schedule_change_slots option[value="'+slotMin+'"]').attr('selected', 'selected');
|
||||
}
|
||||
|
||||
if(($("#add-show-form").length == 1) && ($("#add-show-form").css('display')=='none') && ($('.fc-header-left > span').length == 5)) {
|
||||
makeAddShowButton();
|
||||
}
|
||||
}
|
||||
|
||||
function eventRender(event, element, view) {
|
||||
|
||||
//only put progress bar on shows that aren't being recorded.
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) {
|
||||
var div = $('<div/>');
|
||||
div
|
||||
.height('5px')
|
||||
.width('95%')
|
||||
.css('margin-top', '1px')
|
||||
.css('margin-left', 'auto')
|
||||
.css('margin-right', 'auto')
|
||||
.progressbar({
|
||||
value: event.percent
|
||||
});
|
||||
|
||||
$(element).find(".fc-event-content").append(div);
|
||||
}
|
||||
|
||||
//add the record/rebroadcast icons if needed.
|
||||
|
||||
//record icon (only if not on soundcloud, will always be true for future events)
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -1) {
|
||||
|
||||
$(element).find(".fc-event-time").before('<span class="small-icon recording"></span>');
|
||||
}
|
||||
if(view.name === 'month' && event.record === 1 && event.soundcloud_id === -1) {
|
||||
|
||||
$(element).find(".fc-event-title").after('<span class="small-icon recording"></span>');
|
||||
}
|
||||
//rebroadcast icon
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.rebroadcast === 1) {
|
||||
|
||||
$(element).find(".fc-event-time").before('<span class="small-icon rebroadcast"></span>');
|
||||
}
|
||||
if(view.name === 'month' && event.rebroadcast === 1) {
|
||||
|
||||
$(element).find(".fc-event-title").after('<span class="small-icon rebroadcast"></span>');
|
||||
}
|
||||
//soundcloud icon
|
||||
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id !== -1 && event.record === 1) {
|
||||
|
||||
$(element).find(".fc-event-time").before('<span class="small-icon soundcloud"></span>');
|
||||
}
|
||||
if(view.name === 'month' && event.soundcloud_id !== -1 && event.record === 1) {
|
||||
|
||||
$(element).find(".fc-event-title").after('<span class="small-icon soundcloud"></span>');
|
||||
}
|
||||
}
|
||||
|
||||
function eventAfterRender( event, element, view ) {
|
||||
|
||||
$(element)
|
||||
.jjmenu("click",
|
||||
[{get:"/Schedule/make-context-menu/format/json/id/#id#"}],
|
||||
{id: event.id},
|
||||
{xposition: "mouse", yposition: "mouse"});
|
||||
}
|
||||
|
||||
function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
|
||||
var url;
|
||||
|
||||
url = '/Schedule/move-show/format/json';
|
||||
|
||||
$.post(url,
|
||||
{day: dayDelta, min: minuteDelta, showInstanceId: event.id},
|
||||
function(json){
|
||||
if(json.error) {
|
||||
alert(json.error);
|
||||
revertFunc();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) {
|
||||
var url;
|
||||
|
||||
url = '/Schedule/resize-show/format/json';
|
||||
|
||||
$.post(url,
|
||||
{day: dayDelta, min: minuteDelta, showInstanceId: event.id},
|
||||
function(json){
|
||||
if(json.error) {
|
||||
alert(json.error);
|
||||
revertFunc();
|
||||
}
|
||||
|
||||
scheduleRefetchEvents();
|
||||
});
|
||||
}
|
||||
|
||||
function getFullCalendarEvents(start, end, callback) {
|
||||
var url, start_date, end_date;
|
||||
|
||||
start_date = makeTimeStamp(start);
|
||||
end_date = makeTimeStamp(end);
|
||||
|
||||
url = '/Schedule/event-feed';
|
||||
|
||||
var d = new Date();
|
||||
|
||||
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){
|
||||
callback(json.events);
|
||||
});
|
||||
}
|
273
airtime_mvc/public/js/airtime/schedule/schedule.js
Normal file
273
airtime_mvc/public/js/airtime/schedule/schedule.js
Normal file
|
@ -0,0 +1,273 @@
|
|||
/**
|
||||
*
|
||||
* Schedule Dialog creation methods.
|
||||
*
|
||||
*/
|
||||
|
||||
function closeDialog(event, ui) {
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
$(this).remove();
|
||||
}
|
||||
|
||||
|
||||
function setScheduleDialogHtml(json) {
|
||||
var dt;
|
||||
|
||||
dt = $('#schedule_playlists').dataTable();
|
||||
dt.fnDraw();
|
||||
|
||||
$("#schedule_playlist_chosen")
|
||||
.empty()
|
||||
.append(json.chosen);
|
||||
|
||||
$("#show_time_filled").empty().append(json.timeFilled);
|
||||
$("#show_progressbar").progressbar( "value" , json.percentFilled );
|
||||
|
||||
var showFilled = $("#show_time_filled").text().split('.')[0];
|
||||
var showLength = $("#show_length").text();
|
||||
|
||||
if (showFilled > showLength){
|
||||
$("#show_time_warning").text("Shows longer than their scheduled time will be cut off by a following show.");
|
||||
} else {
|
||||
$("#show_time_warning").empty();
|
||||
}
|
||||
}
|
||||
|
||||
function setScheduleDialogEvents(dialog) {
|
||||
|
||||
dialog.find(".ui-icon-triangle-1-e").click(function(){
|
||||
var span = $(this);
|
||||
|
||||
if(span.hasClass("ui-icon-triangle-1-s")) {
|
||||
span
|
||||
.removeClass("ui-icon-triangle-1-s")
|
||||
.addClass("ui-icon ui-icon-triangle-1-e");
|
||||
|
||||
$(this).parent().parent().find(".group_list").hide();
|
||||
}
|
||||
else if(span.hasClass("ui-icon-triangle-1-e")) {
|
||||
span
|
||||
.removeClass("ui-icon-triangle-1-e")
|
||||
.addClass("ui-icon ui-icon-triangle-1-s");
|
||||
|
||||
$(this).parent().parent().find(".group_list").show();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.find(".ui-icon-close").click(function(){
|
||||
var groupId, url;
|
||||
|
||||
groupId = $(this).parent().parent().attr("id").split("_").pop();
|
||||
url = '/Schedule/remove-group';
|
||||
|
||||
$.post(url,
|
||||
{format: "json", groupId: groupId},
|
||||
function(json){
|
||||
var dialog = $("#schedule_playlist_dialog");
|
||||
|
||||
setScheduleDialogHtml(json);
|
||||
setScheduleDialogEvents(dialog);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
var id = "pl_" + aData[0];
|
||||
|
||||
$(nRow).attr("id", id);
|
||||
|
||||
return nRow;
|
||||
}
|
||||
|
||||
function addDtPlaylistEvents() {
|
||||
|
||||
$('#schedule_playlists tbody tr')
|
||||
.draggable({
|
||||
helper: 'clone'
|
||||
});
|
||||
}
|
||||
|
||||
function dtDrawCallback() {
|
||||
addDtPlaylistEvents();
|
||||
}
|
||||
|
||||
function makeScheduleDialog(dialog, json) {
|
||||
|
||||
dialog.find('#schedule_playlists').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
"sAjaxSource": "/Schedule/find-playlists/format/json",
|
||||
"fnServerData": function ( sSource, aoData, fnCallback ) {
|
||||
$.ajax( {
|
||||
"dataType": 'json',
|
||||
"type": "POST",
|
||||
"url": sSource,
|
||||
"data": aoData,
|
||||
"success": fnCallback
|
||||
} );
|
||||
},
|
||||
"fnRowCallback": dtRowCallback,
|
||||
"fnDrawCallback": dtDrawCallback,
|
||||
"aoColumns": [
|
||||
/* Id */ { "sName": "pl.id", "bSearchable": false, "bVisible": false },
|
||||
/* Description */ { "sName": "pl.description", "bVisible": false },
|
||||
/* Name */ { "sName": "pl.name" },
|
||||
/* Creator */ { "sName": "pl.creator" },
|
||||
/* Length */ { "sName": "plt.length" },
|
||||
/* Editing */ { "sName": "sub.login" }
|
||||
],
|
||||
"aaSorting": [[2,'asc']],
|
||||
"sPaginationType": "full_numbers",
|
||||
"bJQueryUI": true,
|
||||
"bAutoWidth": false
|
||||
});
|
||||
|
||||
//classes added for Vladimir's styles.css
|
||||
dialog.find("#schedule_playlists_length select").addClass('input_select');
|
||||
dialog.find("#schedule_playlists_filter input").addClass('input_text auto-search');
|
||||
|
||||
dialog.find("#schedule_playlist_chosen")
|
||||
.append(json.chosen)
|
||||
.droppable({
|
||||
drop: function(event, ui) {
|
||||
var pl_id, url, search;
|
||||
|
||||
search = $("#schedule_playlist_search").val();
|
||||
pl_id = $(ui.helper).attr("id").split("_").pop();
|
||||
|
||||
url = '/Schedule/schedule-show/format/json';
|
||||
|
||||
$.post(url,
|
||||
{plId: pl_id, search: search},
|
||||
function(json){
|
||||
var dialog = $("#schedule_playlist_dialog");
|
||||
|
||||
setScheduleDialogHtml(json);
|
||||
setScheduleDialogEvents(dialog);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
dialog.find("#show_progressbar").progressbar({
|
||||
value: json.percentFilled
|
||||
});
|
||||
|
||||
setScheduleDialogEvents(dialog);
|
||||
}
|
||||
|
||||
function confirmCancelShow(show_instance_id){
|
||||
if(confirm('Erase current show and stop playback?')){
|
||||
var url = "/Schedule/cancel-current-show/id/"+show_instance_id;
|
||||
$.ajax({
|
||||
url: url,
|
||||
success: function(data){scheduleRefetchEvents();}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function uploadToSoundCloud(show_instance_id){
|
||||
|
||||
var url = "/Schedule/upload-to-sound-cloud";
|
||||
var span = $(window.triggerElement).find(".recording");
|
||||
|
||||
span.removeClass("recording")
|
||||
.addClass("progress");
|
||||
|
||||
$.post(url,
|
||||
{id: show_instance_id, format: "json"},
|
||||
function(data){
|
||||
if(data.error) {
|
||||
span.removeClass("progress")
|
||||
.addClass("recording");
|
||||
|
||||
alert(data.error);
|
||||
return;
|
||||
}
|
||||
scheduleRefetchEvents();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function buildContentDialog(json){
|
||||
var dialog = $(json.dialog);
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: 'Show Contents',
|
||||
width: 1100,
|
||||
height: 500,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
}}
|
||||
});
|
||||
|
||||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
function buildScheduleDialog(json){
|
||||
var dialog;
|
||||
|
||||
if(json.error) {
|
||||
alert(json.error);
|
||||
return;
|
||||
}
|
||||
|
||||
dialog = $(json.dialog);
|
||||
makeScheduleDialog(dialog, json);
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: 'Schedule Playlist',
|
||||
width: 1100,
|
||||
height: 500,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}}
|
||||
});
|
||||
|
||||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
function buildEditDialog(json){
|
||||
|
||||
}
|
||||
|
||||
$(window).load(function() {
|
||||
var mainHeight = document.documentElement.clientHeight - 200 - 50;
|
||||
|
||||
$('#schedule_calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev, next, today',
|
||||
center: 'title',
|
||||
right: 'agendaDay, agendaWeek, month'
|
||||
},
|
||||
defaultView: 'month',
|
||||
editable: false,
|
||||
allDaySlot: false,
|
||||
axisFormat: 'H:mm',
|
||||
timeFormat: {
|
||||
agenda: 'H:mm{ - H:mm}',
|
||||
month: 'H:mm{ - H:mm}'
|
||||
},
|
||||
contentHeight: mainHeight,
|
||||
theme: true,
|
||||
lazyFetching: false,
|
||||
|
||||
events: getFullCalendarEvents,
|
||||
|
||||
//callbacks (in full-calendar-functions.js)
|
||||
viewDisplay: viewDisplay,
|
||||
dayClick: dayClick,
|
||||
eventRender: eventRender,
|
||||
eventAfterRender: eventAfterRender,
|
||||
eventDrop: eventDrop,
|
||||
eventResize: eventResize
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue