-fixed formatting

This commit is contained in:
denise 2012-09-14 11:18:13 -04:00
parent bb38512bae
commit f581b0536e
1 changed files with 167 additions and 169 deletions

View File

@ -1,4 +1,4 @@
var AIRTIME = (function(AIRTIME){ var AIRTIME = (function(AIRTIME) {
var mod; var mod;
if (AIRTIME.library === undefined) { if (AIRTIME.library === undefined) {
@ -8,37 +8,33 @@ var AIRTIME = (function(AIRTIME){
mod = AIRTIME.library; mod = AIRTIME.library;
mod.checkAddButton = function() { mod.checkAddButton = function() {
var selected = mod.getChosenItemsLength(), var selected = mod.getChosenItemsLength(), $cursor = $('tr.cursor-selected-row'), check = false;
$cursor = $('tr.cursor-selected-row'),
check = false;
//make sure library items are selected and a cursor is selected. // make sure library items are selected and a cursor is selected.
if (selected !== 0 && $cursor.length !== 0) { if (selected !== 0 && $cursor.length !== 0) {
check = true; check = true;
} }
if (check === true) { if (check === true) {
AIRTIME.button.enableButton("lib-button-add"); AIRTIME.button.enableButton("lib-button-add");
} } else {
else {
AIRTIME.button.disableButton("lib-button-add"); AIRTIME.button.disableButton("lib-button-add");
} }
}; };
mod.fnRowCallback = function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
var $nRow = $(nRow); var $nRow = $(nRow);
if (aData.ftype === "audioclip") { if (aData.ftype === "audioclip") {
$nRow.addClass("lib-audio"); $nRow.addClass("lib-audio");
} else if (aData.ftype === "stream"){ } else if (aData.ftype === "stream") {
$nRow.addClass("lib-stream"); $nRow.addClass("lib-stream");
} else { } else {
$nRow.addClass("lib-pl"); $nRow.addClass("lib-pl");
} }
$nRow.attr("id", aData["tr_id"]) $nRow.attr("id", aData["tr_id"]).data("aData", aData).data("screen",
.data("aData", aData) "timeline");
.data("screen", "timeline");
}; };
mod.fnDrawCallback = function fnLibDrawCallback() { mod.fnDrawCallback = function fnLibDrawCallback() {
@ -46,70 +42,66 @@ var AIRTIME = (function(AIRTIME){
mod.redrawChosen(); mod.redrawChosen();
mod.checkToolBarIcons(); mod.checkToolBarIcons();
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream').draggable({ $('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
helper: function(){ .draggable(
{
helper : function() {
var $el = $(this), var $el = $(this), selected = mod
selected = mod.getChosenItemsLength(), .getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
container, .find("th").length, width = thead.find(
thead = $("#show_builder_table thead"), "tr:first").width(), message;
colspan = thead.find("th").length,
width = thead.find("tr:first").width(),
message;
//dragging an element that has an unselected checkbox. // dragging an element that has an unselected
// checkbox.
if (mod.isChosenItem($el) === false) { if (mod.isChosenItem($el) === false) {
selected++; selected++;
} }
if (selected === 1) { if (selected === 1) {
message = "Adding 1 Item."; message = "Adding 1 Item.";
} } else {
else { message = "Adding " + selected + " Items.";
message = "Adding "+selected+" Items.";
} }
container = $('<div/>').attr('id', 'draggingContainer') container = $('<div/>').attr('id',
.append('<tr/>') 'draggingContainer').append('<tr/>')
.find("tr") .find("tr").append('<td/>').find("td")
.append('<td/>') .attr("colspan", colspan).width(width)
.find("td") .addClass("ui-state-highlight").append(
.attr("colspan", colspan) message).end().end();
.width(width)
.addClass("ui-state-highlight")
.append(message)
.end()
.end();
return container; return container;
}, },
cursor: 'pointer', cursor : 'pointer',
connectToSortable: '#show_builder_table' connectToSortable : '#show_builder_table'
}); });
}; };
mod.dblClickAdd = function(data, type) { mod.dblClickAdd = function(data, type) {
var i, var i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
length,
temp,
aMediaIds = [],
aSchedIds = [],
aData = [];
//process selected files/playlists. // process selected files/playlists.
aMediaIds.push({"id": data.id, "type": type}); aMediaIds.push( {
"id" : data.id,
"type" : type
});
$("#show_builder_table tr.cursor-selected-row").each(function(i, el){ $("#show_builder_table tr.cursor-selected-row").each(function(i, el) {
aData.push($(el).prev().data("aData")); aData.push($(el).prev().data("aData"));
}); });
//process selected schedule rows to add media after. // process selected schedule rows to add media after.
for (i=0, length = aData.length; i < length; i++) { for (i = 0, length = aData.length; i < length; i++) {
temp = aData[i]; temp = aData[i];
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp}); aSchedIds.push( {
"id" : temp.id,
"instance" : temp.instance,
"timestamp" : temp.timestamp
});
} }
if(aSchedIds.length == 0){ if (aSchedIds.length == 0) {
alert("Please select a cursor position on timeline."); alert("Please select a cursor position on timeline.");
return false; return false;
} }
@ -123,49 +115,55 @@ var AIRTIME = (function(AIRTIME){
$toolbar $toolbar
.append("<ul />") .append("<ul />")
.find('ul') .find('ul')
.append('<li class="ui-state-default lib-button-select" title="Select"><span class="ui-icon ui-icon-document-b"></span></li>') .append(
.append('<li class="ui-state-default ui-state-disabled lib-button-add" title="Add library items after selected cursors in the timeline"><span class="ui-icon ui-icon-plusthick"></span></li>') '<li class="ui-state-default lib-button-select" title="Select"><span class="ui-icon ui-icon-document-b"></span></li>')
.append('<li class="ui-state-default ui-state-disabled lib-button-delete" title="Delete selected library items"><span class="ui-icon ui-icon-trash"></span></li>'); .append(
'<li class="ui-state-default ui-state-disabled lib-button-add" title="Add library items after selected cursors in the timeline"><span class="ui-icon ui-icon-plusthick"></span></li>')
.append(
'<li class="ui-state-default ui-state-disabled lib-button-delete" title="Delete selected library items"><span class="ui-icon ui-icon-trash"></span></li>');
//add to timeline button // add to timeline button
$toolbar.find('.lib-button-add') $toolbar
.click(function() { .find('.lib-button-add')
.click(
function() {
if (AIRTIME.button.isDisabled('lib-button-add') === true) { if (AIRTIME.button.isDisabled('lib-button-add') === true) {
return; return;
} }
var selected = AIRTIME.library.getSelectedData(), var selected = AIRTIME.library.getSelectedData(), data, i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
data,
i,
length,
temp,
aMediaIds = [],
aSchedIds = [],
aData = [];
//process selected files/playlists. // process selected files/playlists.
for (i = 0, length = selected.length; i < length; i++) { for (i = 0, length = selected.length; i < length; i++) {
data = selected[i]; data = selected[i];
aMediaIds.push({"id": data.id, "type": data.ftype}); aMediaIds.push( {
"id" : data.id,
"type" : data.ftype
});
} }
$("#show_builder_table tr.cursor-selected-row").each(function(i, el){ $("#show_builder_table tr.cursor-selected-row")
.each(function(i, el) {
aData.push($(el).prev().data("aData")); aData.push($(el).prev().data("aData"));
}); });
//process selected schedule rows to add media after. // process selected schedule rows to add media
for (i=0, length = aData.length; i < length; i++) { // after.
for (i = 0, length = aData.length; i < length; i++) {
temp = aData[i]; temp = aData[i];
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp}); aSchedIds.push( {
"id" : temp.id,
"instance" : temp.instance,
"timestamp" : temp.timestamp
});
} }
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds); AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
}); });
//delete from library. // delete from library.
$toolbar.find('.lib-button-delete') $toolbar.find('.lib-button-delete').click(function() {
.click(function() {
if (AIRTIME.button.isDisabled('lib-button-delete') === true) { if (AIRTIME.button.isDisabled('lib-button-delete') === true) {
return; return;