CC-3174 : showbuilder
removing old scheduling method code to avoid confusion.
This commit is contained in:
parent
2aae318a5a
commit
0ba3049528
9 changed files with 30 additions and 400 deletions
|
@ -26,155 +26,8 @@ function checkShowLength(json) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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 );
|
||||
|
||||
checkShowLength(json);
|
||||
}
|
||||
|
||||
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){
|
||||
if(json.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
}
|
||||
var dialog = $("#schedule_playlist_dialog");
|
||||
|
||||
setScheduleDialogHtml(json);
|
||||
setScheduleDialogEvents(dialog);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
var id = "pl_" + aData['id'];
|
||||
|
||||
$(nRow).attr("id", id);
|
||||
|
||||
return nRow;
|
||||
}
|
||||
|
||||
function addDtPlaylistEvents() {
|
||||
|
||||
$('#schedule_playlists tbody tr')
|
||||
.draggable({
|
||||
helper: 'clone'
|
||||
});
|
||||
}
|
||||
|
||||
function dtDrawCallback() {
|
||||
addDtPlaylistEvents();
|
||||
}
|
||||
|
||||
function makeScheduleDialog(dialog, json) {
|
||||
if(json.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
}
|
||||
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 */ {"sTitle": "ID", "sName": "pl.id", "bSearchable": false, "bVisible": false, "mDataProp": "id"},
|
||||
/* Description */ {"sTitle": "Description", "sName": "pl.description", "bSearchable": false, "bVisible": false, "mDataProp": "description"},
|
||||
/* Name */ {"sTitle": "Title", "sName": "pl.name", "mDataProp": "name"},
|
||||
/* Creator */ {"sTitle": "Creator", "sName": "pl.creator", "mDataProp": "creator"},
|
||||
/* Length */ {"sTitle": "Length", "sName": "plt.length", "mDataProp": "length"},
|
||||
/* Editing */ {"sTitle": "Editing", "sName": "sub.login", "mDataProp": "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){
|
||||
if(json.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
}
|
||||
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?')){
|
||||
if (confirm('Erase current show and stop playback?')){
|
||||
var url = "/Schedule/cancel-current-show/id/"+show_instance_id;
|
||||
$.ajax({
|
||||
url: url,
|
||||
|
@ -184,7 +37,7 @@ function confirmCancelShow(show_instance_id){
|
|||
}
|
||||
|
||||
function confirmCancelRecordedShow(show_instance_id){
|
||||
if(confirm('Erase current show and stop recording?')){
|
||||
if (confirm('Erase current show and stop recording?')){
|
||||
var url = "/Schedule/cancel-current-show/id/"+show_instance_id;
|
||||
$.ajax({
|
||||
url: url,
|
||||
|
@ -214,45 +67,42 @@ function uploadToSoundCloud(show_instance_id){
|
|||
}
|
||||
}
|
||||
|
||||
function buildContentDialog(json){
|
||||
if(json.show_error == true){
|
||||
function buildContentDialog (json){
|
||||
var dialog = $(json.dialog),
|
||||
viewportwidth,
|
||||
viewportheight,
|
||||
height,
|
||||
width;
|
||||
|
||||
if (json.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
}
|
||||
var dialog = $(json.dialog);
|
||||
|
||||
|
||||
dialog.find("#show_progressbar").progressbar({
|
||||
value: json.percentFilled
|
||||
});
|
||||
|
||||
var viewportwidth;
|
||||
var viewportheight;
|
||||
|
||||
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use
|
||||
// window.innerWidth and window.innerHeight
|
||||
|
||||
if (typeof window.innerWidth != 'undefined') {
|
||||
viewportwidth = window.innerWidth, viewportheight = window.innerHeight;
|
||||
}
|
||||
|
||||
// IE6 in standards compliant mode (i.e. with a valid doctype as the first
|
||||
// line in the document)
|
||||
|
||||
else if (typeof document.documentElement != 'undefined'
|
||||
&& typeof document.documentElement.clientWidth != 'undefined'
|
||||
&& document.documentElement.clientWidth != 0) {
|
||||
viewportwidth = document.documentElement.clientWidth;
|
||||
viewportheight = document.documentElement.clientHeight;
|
||||
}
|
||||
|
||||
// older versions of IE
|
||||
|
||||
else {
|
||||
viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
|
||||
viewportheight = document.getElementsByTagName('body')[0].clientHeight;
|
||||
}
|
||||
|
||||
var height = viewportheight * 2/3;
|
||||
var width = viewportwidth * 4/5;
|
||||
height = viewportheight * 2/3;
|
||||
width = viewportwidth * 4/5;
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
|
@ -269,37 +119,6 @@ function buildContentDialog(json){
|
|||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
function buildScheduleDialog(json){
|
||||
var dialog;
|
||||
if(json.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
}
|
||||
if(json.error) {
|
||||
alert(json.error);
|
||||
return;
|
||||
}
|
||||
|
||||
dialog = $(json.dialog);
|
||||
makeScheduleDialog(dialog, json);
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: 'Schedule Media',
|
||||
width: 1100,
|
||||
height: 550,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}}
|
||||
});
|
||||
|
||||
dialog.dialog('open');
|
||||
checkShowLength(json);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use user preference for time scale; defaults to month if preference was never set
|
||||
*/
|
||||
|
@ -412,7 +231,6 @@ $(document).ready(function() {
|
|||
//define a content callback.
|
||||
if (oItems.content !== undefined) {
|
||||
|
||||
//delete a single instance
|
||||
callback = function() {
|
||||
$.get(oItems.content.url, {format: "json", id: data.id}, function(json){
|
||||
buildContentDialog(json);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue