Merge branch '2.2.x' into devel

Conflicts:
	airtime_mvc/application/controllers/LibraryController.php
	airtime_mvc/application/views/scripts/library/library.phtml
	airtime_mvc/public/js/airtime/showbuilder/builder.js
	airtime_mvc/public/js/airtime/showbuilder/main_builder.js
This commit is contained in:
denise 2012-11-02 12:28:21 -04:00
commit 135aadf16b
56 changed files with 5240 additions and 4806 deletions

View file

@ -14,5 +14,6 @@ function isAudioSupported(mime){
//Note that checking the navigator.mimeTypes value does not work for IE7, but the alternative
//is adding a javascript library to do the work for you, which seems like overkill....
return (!!audio.canPlayType && audio.canPlayType(bMime) != "") ||
(mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined);
(mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
(mime.indexOf("mp4") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined);
}

View file

@ -37,6 +37,11 @@ var AIRTIME = (function(AIRTIME) {
var $nRow = $(nRow);
if (aData.ftype === "audioclip") {
$nRow.addClass("lib-audio");
$image = $nRow.find('td.library_type');
if (!isAudioSupported(aData.mime)) {
$image.html('<span class="ui-icon ui-icon-locked"></span>');
aData.image = '<span class="ui-icon ui-icon-locked"></span>';
}
} else if (aData.ftype === "stream") {
$nRow.addClass("lib-stream");
} else if (aData.ftype === "block") {
@ -64,8 +69,9 @@ var AIRTIME = (function(AIRTIME) {
helper : function() {
var $el = $(this), selected = mod
.getChosenAudioFilesLength(), container, message, li = $("#side_playlist ul[id='spl_sortable'] li:first"), width = li
.width(), height = 55;
.getChosenAudioFilesLength(), container, message, li = $("#side_playlist ul[id='spl_sortable'] li:first"),
width = li.width(), height = 55;
if (width > 798) width = 798;
// dragging an element that has an unselected
// checkbox.

View file

@ -29,6 +29,11 @@ var AIRTIME = (function(AIRTIME) {
if (aData.ftype === "audioclip") {
$nRow.addClass("lib-audio");
$image = $nRow.find('td.library_type');
if (!isAudioSupported(aData.mime)) {
$image.html('<span class="ui-icon ui-icon-locked"></span>');
aData.image = '<span class="ui-icon ui-icon-locked"></span>';
}
} else if (aData.ftype === "stream") {
$nRow.addClass("lib-stream");
} else {

View file

@ -70,7 +70,7 @@ var AIRTIME = (function(AIRTIME) {
};
mod.getChosenAudioFilesLength = function(){
//var files = Object.keys(chosenItems),
// var files = Object.keys(chosenItems),
var files,
$trs,
cItem,
@ -215,7 +215,7 @@ var AIRTIME = (function(AIRTIME) {
mod.removeFromChosen = function($el) {
var id = $el.attr("id");
//used to not keep dragged items selected.
// used to not keep dragged items selected.
if (!$el.hasClass(LIB_SELECTED_CLASS)) {
delete chosenItems[id];
}
@ -252,11 +252,11 @@ var AIRTIME = (function(AIRTIME) {
};
/*
* selects all items which the user can currently see.
* (behaviour taken from gmail)
* selects all items which the user can currently see. (behaviour taken from
* gmail)
*
* by default the items are selected in reverse order
* so we need to reverse it back
* by default the items are selected in reverse order so we need to reverse
* it back
*/
mod.selectCurrentPage = function() {
$.fn.reverse = [].reverse;
@ -276,8 +276,8 @@ var AIRTIME = (function(AIRTIME) {
};
/*
* deselects all items that the user can currently see.
* (behaviour taken from gmail)
* deselects all items that the user can currently see. (behaviour taken
* from gmail)
*/
mod.deselectCurrentPage = function() {
var $inputs = $libTable.find("tbody input:checkbox"),
@ -328,7 +328,7 @@ var AIRTIME = (function(AIRTIME) {
temp,
aMedia = [];
//process selected files/playlists.
// process selected files/playlists.
for (item in aData) {
temp = aData[item];
if (temp !== null && temp.hasOwnProperty('id') ) {
@ -433,36 +433,37 @@ var AIRTIME = (function(AIRTIME) {
oTable = $libTable.dataTable( {
//put hidden columns at the top to insure they can never be visible on the table through column reordering.
// put hidden columns at the top to insure they can never be visible
// on the table through column reordering.
"aoColumns": [
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false } ,
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_checkbox" } ,
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_type" , "iDataSort" : 0 } ,
/* Title */ { "sTitle" : "Title" , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" } ,
/* Creator */ { "sTitle" : "Creator" , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" } ,
/* Album */ { "sTitle" : "Album" , "mDataProp" : "album_title" , "sClass" : "library_album" , "sWidth" : "150px" } ,
/* Bit Rate */ { "sTitle" : "Bit Rate" , "mDataProp" : "bit_rate" , "bVisible" : false , "sClass" : "library_bitrate" , "sWidth" : "80px" },
/* BPM */ { "sTitle" : "BPM" , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" },
/* Composer */ { "sTitle" : "Composer" , "mDataProp" : "composer" , "bVisible" : false , "sClass" : "library_composer" , "sWidth" : "150px" },
/* Conductor */ { "sTitle" : "Conductor" , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" },
/* Copyright */ { "sTitle" : "Copyright" , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" },
/* Encoded */ { "sTitle" : "Encoded By" , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" },
/* Genre */ { "sTitle" : "Genre" , "mDataProp" : "genre" , "bVisible" : false , "sClass" : "library_genre" , "sWidth" : "100px" },
/* ISRC Number */ { "sTitle" : "ISRC" , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" },
/* Label */ { "sTitle" : "Label" , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" },
/* Language */ { "sTitle" : "Language" , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false } ,
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_checkbox" } ,
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_type" , "iDataSort" : 0 } ,
/* Title */ { "sTitle" : "Title" , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" } ,
/* Creator */ { "sTitle" : "Creator" , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" } ,
/* Album */ { "sTitle" : "Album" , "mDataProp" : "album_title" , "sClass" : "library_album" , "sWidth" : "150px" } ,
/* Bit Rate */ { "sTitle" : "Bit Rate" , "mDataProp" : "bit_rate" , "bVisible" : false , "sClass" : "library_bitrate" , "sWidth" : "80px" },
/* BPM */ { "sTitle" : "BPM" , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" },
/* Composer */ { "sTitle" : "Composer" , "mDataProp" : "composer" , "bVisible" : false , "sClass" : "library_composer" , "sWidth" : "150px" },
/* Conductor */ { "sTitle" : "Conductor" , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" },
/* Copyright */ { "sTitle" : "Copyright" , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" },
/* Encoded */ { "sTitle" : "Encoded By" , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" },
/* Genre */ { "sTitle" : "Genre" , "mDataProp" : "genre" , "bVisible" : false , "sClass" : "library_genre" , "sWidth" : "100px" },
/* ISRC Number */ { "sTitle" : "ISRC" , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" },
/* Label */ { "sTitle" : "Label" , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" },
/* Language */ { "sTitle" : "Language" , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
/* Last Modified */ { "sTitle" : "Last Modified" , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" },
/* Last Played */ { "sTitle" : "Last Played " , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" },
/* Length */ { "sTitle" : "Length" , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" } ,
/* Mime */ { "sTitle" : "Mime" , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" },
/* Mood */ { "sTitle" : "Mood" , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" },
/* Owner */ { "sTitle" : "Owner" , "mDataProp" : "owner_id" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
/* Replay Gain */ { "sTitle" : "Replay Gain" , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_replay_gain" , "sWidth" : "80px" },
/* Sample Rate */ { "sTitle" : "Sample Rate" , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" },
/* Track Number */ { "sTitle" : "Track Number" , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" },
/* Upload Time */ { "sTitle" : "Uploaded" , "mDataProp" : "utime" , "sClass" : "library_upload_time" , "sWidth" : "125px" } ,
/* Website */ { "sTitle" : "Website" , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" },
/* Year */ { "sTitle" : "Year" , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" }
/* Last Played */ { "sTitle" : "Last Played " , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" },
/* Length */ { "sTitle" : "Length" , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" } ,
/* Mime */ { "sTitle" : "Mime" , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" },
/* Mood */ { "sTitle" : "Mood" , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" },
/* Owner */ { "sTitle" : "Owner" , "mDataProp" : "owner_id" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
/* Replay Gain */ { "sTitle" : "Replay Gain" , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_replay_gain" , "sWidth" : "80px" },
/* Sample Rate */ { "sTitle" : "Sample Rate" , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" },
/* Track Number */ { "sTitle" : "Track Number" , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" },
/* Upload Time */ { "sTitle" : "Uploaded" , "mDataProp" : "utime" , "sClass" : "library_upload_time" , "sWidth" : "125px" } ,
/* Website */ { "sTitle" : "Website" , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" },
/* Year */ { "sTitle" : "Year" , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" }
],
"bProcessing": true,
@ -472,7 +473,7 @@ var AIRTIME = (function(AIRTIME) {
"bStateSave": true,
"fnStateSaveParams": function (oSettings, oData) {
//remove oData components we don't want to save.
// remove oData components we don't want to save.
delete oData.oSearch;
delete oData.aoSearchCols;
},
@ -499,8 +500,8 @@ var AIRTIME = (function(AIRTIME) {
length,
a = oData.abVisCols;
//putting serialized data back into the correct js type to make
//sure everything works properly.
// putting serialized data back into the correct js type to make
// sure everything works properly.
for (i = 0, length = a.length; i < length; i++) {
if (typeof(a[i]) === "string") {
a[i] = (a[i] === "true") ? true : false;
@ -524,11 +525,12 @@ var AIRTIME = (function(AIRTIME) {
"sAjaxDataProp": "files",
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* The real validation check is done in dataTables.columnFilter.js
* We also need to check it here because datatable is redrawn everytime
* an action is performed in the Library page.
* In order for datatable to redraw the advanced search fields
* MUST all be valid.
/*
* The real validation check is done in
* dataTables.columnFilter.js We also need to check it here
* because datatable is redrawn everytime an action is performed
* in the Library page. In order for datatable to redraw the
* advanced search fields MUST all be valid.
*/
var advSearchFields = $("div#advanced_search").children(':visible');
var advSearchValid = validateAdvancedSearch(advSearchFields);
@ -536,11 +538,11 @@ var AIRTIME = (function(AIRTIME) {
aoData.push( { name: "format", value: "json"} );
aoData.push( { name: "advSearch", value: advSearchValid} );
//push whether to search files/playlists or all.
// push whether to search files/playlists or all.
type = $("#library_display_type").find("select").val();
type = (type === undefined) ? 0 : type;
aoData.push( { name: "type", value: type} );
$.ajax( {
"dataType": 'json',
"type": "POST",
@ -552,30 +554,39 @@ var AIRTIME = (function(AIRTIME) {
"fnRowCallback": AIRTIME.library.fnRowCallback,
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
//add the play function to the library_type td
// add the play function to the library_type td
$(nRow).find('td.library_type').click(function(){
if (aData.ftype === 'playlist' && aData.length !== '0.0'){
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
playlistIndex = $(this).parent().attr('id').substring(3); // remove
// the
// pl_
open_playlist_preview(playlistIndex, 0);
} else if (aData.ftype === 'audioclip') {
open_audio_preview(aData.ftype, aData.audioFile, aData.track_title, aData.artist_name);
if (isAudioSupported(aData.mime)) {
open_audio_preview(aData.ftype, aData.audioFile, aData.track_title, aData.artist_name);
}
} else if (aData.ftype == 'stream') {
open_audio_preview(aData.ftype, aData.audioFile, aData.track_title, aData.artist_name);
} else if (aData.ftype == 'block' && aData.bl_type == 'static') {
blockIndex = $(this).parent().attr('id').substring(3); //remove the bl_
blockIndex = $(this).parent().attr('id').substring(3); // remove
// the
// bl_
open_block_preview(blockIndex, 0);
}
return false;
});
alreadyclicked=false;
//call the context menu so we can prevent the event from propagating.
// call the context menu so we can prevent the event from
// propagating.
$(nRow).find('td:not(.library_checkbox, .library_type)').click(function(e){
var el=$(this);
if (alreadyclicked)
{
alreadyclicked=false; // reset
clearTimeout(alreadyclickedTimeout); // prevent this from happening
clearTimeout(alreadyclickedTimeout); // prevent this
// from
// happening
// do what needs to happen on double click.
$tr = $(el).parent();
@ -587,8 +598,8 @@ var AIRTIME = (function(AIRTIME) {
alreadyclicked=true;
alreadyclickedTimeout=setTimeout(function(){
alreadyclicked=false; // reset when it happens
// do what needs to happen on single click.
// use el instead of $(this) because $(this) is
// do what needs to happen on single click.
// use el instead of $(this) because $(this) is
// no longer the element
el.contextMenu({x: e.pageX, y: e.pageY});
},300); // <-- dblclick tolerance here
@ -596,7 +607,8 @@ var AIRTIME = (function(AIRTIME) {
return false;
});
//add a tool tip to appear when the user clicks on the type icon.
// add a tool tip to appear when the user clicks on the type
// icon.
$(nRow).find("td:not(.library_checkbox, .library_type)").qtip({
content: {
text: "Loading...",
@ -620,7 +632,8 @@ var AIRTIME = (function(AIRTIME) {
},
my: 'left center',
at: 'right center',
viewport: $(window), // Keep the tooltip on-screen at all times
viewport: $(window), // Keep the tooltip on-screen at
// all times
effect: false // Disable positioning animation
},
style: {
@ -638,10 +651,11 @@ var AIRTIME = (function(AIRTIME) {
hide: {event:'mouseout', delay: 50, fixed:true}
});
},
//remove any selected nodes before the draw.
// remove any selected nodes before the draw.
"fnPreDrawCallback": function( oSettings ) {
//make sure any dragging helpers are removed or else they'll be stranded on the screen.
// make sure any dragging helpers are removed or else they'll be
// stranded on the screen.
$("#draggingContainer").remove();
},
"fnDrawCallback": AIRTIME.library.fnDrawCallback,
@ -673,14 +687,32 @@ var AIRTIME = (function(AIRTIME) {
setColumnFilter(oTable);
oTable.fnSetFilteringDelay(350);
var simpleSearchText;
$libContent.on("click", "legend", function(){
$simpleSearch = $libContent.find("#library_display_filter label");
var $fs = $(this).parents("fieldset");
if ($fs.hasClass("closed")) {
$fs.removeClass("closed");
//keep value of simple search for when user switches back to it
simpleSearchText = $simpleSearch.find('input').val();
// clear the simple search text field and reset datatable
$(".dataTables_filter input").val("").keyup();
$simpleSearch.addClass("sp-invisible");
}
else {
//clear the advanced search fields and reset datatable
$(".filter_column input").val("").keyup();
//reset datatable with previous simple search results (if any)
$(".dataTables_filter input").val(simpleSearchText).keyup();
$simpleSearch.removeClass("sp-invisible");
$fs.addClass("closed");
}
});
@ -734,7 +766,7 @@ var AIRTIME = (function(AIRTIME) {
addQtipToSCIcons();
//begin context menu initialization.
// begin context menu initialization.
$.contextMenu({
selector: '#library_display td:not(.library_checkbox)',
trigger: "left",
@ -749,7 +781,7 @@ var AIRTIME = (function(AIRTIME) {
function processMenuItems(oItems) {
//define an add to playlist callback.
// define an add to playlist callback.
if (oItems.pl_add !== undefined) {
var aItems = [];
@ -761,7 +793,7 @@ var AIRTIME = (function(AIRTIME) {
oItems.pl_add.callback = callback;
}
//define an edit callback.
// define an edit callback.
if (oItems.edit !== undefined) {
if (data.ftype === "audioclip") {
@ -785,7 +817,7 @@ var AIRTIME = (function(AIRTIME) {
oItems.edit.callback = callback;
}
//define a play callback.
// define a play callback.
if (oItems.play !== undefined) {
if (oItems.play.mime !== undefined) {
@ -796,23 +828,28 @@ var AIRTIME = (function(AIRTIME) {
callback = function() {
if (data.ftype === 'playlist' && data.length !== '0.0'){
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
playlistIndex = $(this).parent().attr('id').substring(3); // remove
// the
// pl_
open_playlist_preview(playlistIndex, 0);
} else if (data.ftype === 'audioclip' || data.ftype === 'stream') {
open_audio_preview(data.ftype, data.audioFile, data.track_title, data.artist_name);
} else if (data.ftype === 'block') {
blockIndex = $(this).parent().attr('id').substring(3); //remove the pl_
blockIndex = $(this).parent().attr('id').substring(3); // remove
// the
// pl_
open_block_preview(blockIndex, 0);
}
};
oItems.play.callback = callback;
}
//define a delete callback.
// define a delete callback.
if (oItems.del !== undefined) {
//delete through the playlist controller, will reset
//playlist screen if this is the currently edited playlist.
// delete through the playlist controller, will reset
// playlist screen if this is the currently edited
// playlist.
if ((data.ftype === "playlist" || data.ftype === "block") && screen === "playlist") {
callback = function() {
aMedia = [];
@ -846,7 +883,7 @@ var AIRTIME = (function(AIRTIME) {
oItems.del.callback = callback;
}
//define a download callback.
// define a download callback.
if (oItems.download !== undefined) {
callback = function() {
@ -854,11 +891,11 @@ var AIRTIME = (function(AIRTIME) {
};
oItems.download.callback = callback;
}
//add callbacks for Soundcloud menu items.
// add callbacks for Soundcloud menu items.
if (oItems.soundcloud !== undefined) {
var soundcloud = oItems.soundcloud.items;
//define an upload to soundcloud callback.
// define an upload to soundcloud callback.
if (soundcloud.upload !== undefined) {
callback = function() {
@ -869,7 +906,7 @@ var AIRTIME = (function(AIRTIME) {
soundcloud.upload.callback = callback;
}
//define a view on soundcloud callback
// define a view on soundcloud callback
if (soundcloud.view !== undefined) {
callback = function() {
@ -985,7 +1022,8 @@ function addQtipToSCIcons(){
viewport: $(window)
},
show: {
ready: true // Needed to make it show on first mouseover event
ready: true // Needed to make it show on first mouseover
// event
}
});
}
@ -1012,7 +1050,8 @@ function addQtipToSCIcons(){
viewport: $(window)
},
show: {
ready: true // Needed to make it show on first mouseover event
ready: true // Needed to make it show on first mouseover
// event
}
});
}else if($(this).hasClass("sc-error")){
@ -1039,7 +1078,8 @@ function addQtipToSCIcons(){
viewport: $(window)
},
show: {
ready: true // Needed to make it show on first mouseover event
ready: true // Needed to make it show on first mouseover
// event
}
});
}
@ -1093,7 +1133,7 @@ function validateAdvancedSearch(divs) {
}
}
//string fields do not need validation
// string fields do not need validation
if (searchTermType !== "s") {
valid = regExpr.test(searchTerm[i]);
if (!valid) allValid = false;
@ -1101,11 +1141,11 @@ function validateAdvancedSearch(divs) {
addRemoveValidationIcons(valid, $(field), searchTermType);
/* Empty fields should not have valid/invalid indicator
* Range values are considered valid even if only the
* 'From' value is provided. Therefore, if the 'To' value
* is empty but the 'From' value is not empty we need to
* keep the validation icon on screen.
/*
* Empty fields should not have valid/invalid indicator Range values
* are considered valid even if only the 'From' value is provided.
* Therefore, if the 'To' value is empty but the 'From' value is not
* empty we need to keep the validation icon on screen.
*/
} else if (searchTerm[0] === "" && searchTerm[1] !== "" ||
searchTerm[0] === "" && searchTerm[1] === ""){
@ -1141,7 +1181,7 @@ function addRemoveValidationIcons(valid, field, searchTermType) {
if (valid) {
if (!field.closest('div').children(':last-child').hasClass('checked-icon')) {
//remove invalid icon before adding valid icon
// remove invalid icon before adding valid icon
if (field.closest('div').children(':last-child').hasClass('not-available-icon')) {
field.closest('div').children(':last-child').remove();
}
@ -1149,7 +1189,7 @@ function addRemoveValidationIcons(valid, field, searchTermType) {
}
} else {
if (!field.closest('div').children(':last-child').hasClass('not-available-icon')) {
//remove valid icon before adding invalid icon
// remove valid icon before adding invalid icon
if (field.closest('div').children(':last-child').hasClass('checked-icon')) {
field.closest('div').children(':last-child').remove();
}
@ -1158,12 +1198,9 @@ function addRemoveValidationIcons(valid, field, searchTermType) {
}
}
/* Validation types:
* s => string
* i => integer
* n => numeric (positive/negative, whole/decimals)
* t => timestamp
* l => length
/*
* Validation types: s => string i => integer n => numeric (positive/negative,
* whole/decimals) t => timestamp l => length
*/
var validationTypes = {
"album_title" : "s",
@ -1192,7 +1229,7 @@ var validationTypes = {
"owner_id" : "s",
"rating" : "i",
"replay_gain" : "n",
"sample_rate" : "i",
"sample_rate" : "n",
"track_title" : "s",
"track_number" : "i",
"info_url" : "s",

View file

@ -8,14 +8,17 @@ function setSmartBlockEvents() {
/********** ADD CRITERIA ROW **********/
form.find('#criteria_add').live('click', function(){
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last').next();
div.show();
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last');
div.find('.db-logic-label').text('and').show();
div = div.next().show();
div.children().removeAttr('disabled');
div = div.next();
if (div.length === 0) {
$(this).hide();
}
appendAddButton();
appendModAddButton();
removeButtonCheck();
@ -24,7 +27,7 @@ function setSmartBlockEvents() {
/********** ADD MODIFIER ROW **********/
form.find('a[id^="modifier_add"]').live('click', function(){
var criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
//make new modifier row
var newRow = $(this).parent().clone(),
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
@ -285,6 +288,11 @@ function reindexElements() {
var divs = $('#smart-block-form').find('div select[name^="sp_criteria_field"]').parent(),
index = 0,
modIndex = 0;
/* Hide all logic labels
* We will re-add them as each row gets indexed
*/
$('.db-logic-label').text('').hide();
$.each(divs, function(i, div){
if (i > 0 && index < 26) {
@ -292,8 +300,14 @@ function reindexElements() {
* a modifier row
*/
if ($(div).find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
if ($(div).is(':visible')) {
$(div).prev().find('.db-logic-label').text('or').show();
}
modIndex++;
} else {
if ($(div).is(':visible')) {
$(div).prev().find('.db-logic-label').text('and').show();
}
index++;
modIndex = 0;
}
@ -337,8 +351,8 @@ function setupUI() {
*/
var plContents = $('#spl_sortable').children();
var shuffleButton = $('button[id="shuffle_button"]');
if (plContents.text() !== 'Empty playlist') {
if (!plContents.hasClass('spl_empty')) {
if (shuffleButton.hasClass('ui-state-disabled')) {
shuffleButton.removeClass('ui-state-disabled');
shuffleButton.removeAttr('disabled');
@ -384,6 +398,28 @@ function setupUI() {
at: "right center"
},
});
$(".repeat_tracks_help_icon").qtip({
content: {
text: "If your criteria is too strict, Airtime may not be able to fill up the desired smart block length." +
" Hence, if you check this option, tracks will be used more than once."
},
hide: {
delay: 500,
fixed: true
},
style: {
border: {
width: 0,
radius: 4
},
classes: "ui-tooltip-dark ui-tooltip-rounded"
},
position: {
my: "left bottom",
at: "right center"
},
});
}
function enableAndShowExtraField(valEle, index) {

View file

@ -339,11 +339,23 @@ var AIRTIME = (function(AIRTIME){
});
};
mod.jumpToCurrentTrack = function() {
var $scroll = $sbContent.find(".dataTables_scrolling");
var scrolled = $scroll.scrollTop();
var scrollingTop = $scroll.offset().top;
var oTable = $('#show_builder_table').dataTable();
var current = $sbTable.find("."+NOW_PLAYING_CLASS);
var currentTop = current.offset().top;
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
}
mod.builderDataTable = function() {
$sbContent = $('#show_builder');
$lib = $("#library_content"),
$sbTable = $sbContent.find('table');
var isInitialized = false;
oSchedTable = $sbTable.dataTable( {
"aoColumns": [
/* checkbox */ {"mDataProp": "allowed", "sTitle": "", "sWidth": "15px", "sClass": "sb-checkbox"},
@ -357,7 +369,8 @@ var AIRTIME = (function(AIRTIME){
/* cue in */ {"mDataProp": "cuein", "sTitle": "Cue In", "bVisible": false, "sClass": "sb-cue-in"},
/* cue out */ {"mDataProp": "cueout", "sTitle": "Cue Out", "bVisible": false, "sClass": "sb-cue-out"},
/* fade in */ {"mDataProp": "fadein", "sTitle": "Fade In", "bVisible": false, "sClass": "sb-fade-in"},
/* fade out */ {"mDataProp": "fadeout", "sTitle": "Fade Out", "bVisible": false, "sClass": "sb-fade-out"}
/* fade out */ {"mDataProp": "fadeout", "sTitle": "Fade Out", "bVisible": false, "sClass": "sb-fade-out"},
/* Mime */ {"mDataProp" : "mime", "sTitle" : "Mime", "bVisible": false, "sClass": "sb-mime"}
],
"bJQueryUI": true,
@ -537,11 +550,16 @@ var AIRTIME = (function(AIRTIME){
$image = $nRow.find('td.sb-image');
//check if the file exists.
if (aData.image === true) {
$image.html('<img title="Track preview" src="'+baseUrl+'/css/images/icon_audioclip.png"></img>')
$nRow.addClass("lib-audio");
if (!isAudioSupported(aData.mime)) {
$image.html('<span class="ui-icon ui-icon-locked"></span>');
} else {
$image.html('<img title="Track preview" src="'+baseUrl+'/css/images/icon_audioclip.png"></img>')
.click(function() {
open_show_preview(aData.instance, aData.pos);
return false;
});
}
}
else {
$image.html('<span class="ui-icon ui-icon-alert"></span>');
@ -636,6 +654,17 @@ 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
//to jump to the current track
if ($(this).find("."+NOW_PLAYING_CLASS).length > 0) {
mod.jumpToCurrentTrack();
}
}
isInitialized = true;
var wrapperDiv,
markerDiv,
$td,
@ -966,13 +995,18 @@ var AIRTIME = (function(AIRTIME){
"<i class='icon-white icon-cut'></i></button></div>")
.append("<div class='btn-group'>" +
"<button title='Remove selected scheduled items' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
"<i class='icon-white icon-trash'></i></button></div>")
.append("<div class='btn-group'>" +
"<i class='icon-white icon-trash'></i></button></div>");
//if 'Add/Remove content' was chosen from the context menu
//in the Calendar do not append these buttons
if ($(".ui-dialog-content").length === 0) {
$menu.append("<div class='btn-group'>" +
"<button title='Jump to the current playing track' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
"<i class='icon-white icon-step-forward'></i></button></div>")
.append("<div class='btn-group'>" +
"<button title='Cancel current show' class='ui-state-disabled btn btn-small btn-danger' disabled='disabled'>" +
"<i class='icon-white icon-ban-circle'></i></button></div>");
}
$toolbar.append($menu);
$menu = undefined;
@ -1021,7 +1055,7 @@ var AIRTIME = (function(AIRTIME){
if (AIRTIME.button.isDisabled('icon-step-forward', true) === true) {
return;
}
/*
var $scroll = $sbContent.find(".dataTables_scrolling"),
scrolled = $scroll.scrollTop(),
scrollingTop = $scroll.offset().top,
@ -1029,6 +1063,8 @@ var AIRTIME = (function(AIRTIME){
currentTop = current.offset().top;
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
*/
mod.jumpToCurrentTrack();
});
//delete overbooked tracks.
@ -1196,7 +1232,7 @@ var AIRTIME = (function(AIRTIME){
};
}
});
});
};
return AIRTIME;

View file

@ -113,40 +113,179 @@ AIRTIME = (function(AIRTIME) {
}
mod.onReady = function() {
//define module vars.
$lib = $("#library_content");
$builder = $("#show_builder");
$fs = $builder.find('fieldset');
/*
* Icon hover states for search.
*/
$builder.on("mouseenter", ".sb-timerange .ui-button", function(ev) {
$(this).addClass("ui-state-hover");
});
$builder.on("mouseleave", ".sb-timerange .ui-button", function(ev) {
$(this).removeClass("ui-state-hover");
});
$builder.find(dateStartId).datepicker(oBaseDatePickerSettings);
$builder.find(timeStartId).timepicker(oBaseTimePickerSettings);
$builder.find(dateEndId).datepicker(oBaseDatePickerSettings);
$builder.find(timeEndId).timepicker(oBaseTimePickerSettings);
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
AIRTIME.showbuilder.fnServerData.start = oRange.start;
AIRTIME.showbuilder.fnServerData.end = oRange.end;
// define module vars.
$lib = $("#library_content");
$builder = $("#show_builder");
$fs = $builder.find('fieldset');
AIRTIME.library.libraryInit();
AIRTIME.showbuilder.builderDataTable();
setWidgetSize();
$libWrapper = $lib.find("#library_display_wrapper");
$libWrapper.prepend($libClose);
$builder.find('.dataTables_scrolling').css("max-height", widgetHeight - 95);
$builder.on("click", "#sb_submit", showSearchSubmit);
/*
* Icon hover states for search.
*/
$builder.on("mouseenter", ".sb-timerange .ui-button", function(ev) {
$(this).addClass("ui-state-hover");
});
$builder.on("mouseleave", ".sb-timerange .ui-button", function(ev) {
$(this).removeClass("ui-state-hover");
});
$builder.find(dateStartId).datepicker(oBaseDatePickerSettings);
$builder.find(timeStartId).timepicker(oBaseTimePickerSettings);
$builder.find(dateEndId).datepicker(oBaseDatePickerSettings);
$builder.find(timeEndId).timepicker(oBaseTimePickerSettings);
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId,
dateEndId, timeEndId);
AIRTIME.showbuilder.fnServerData.start = oRange.start;
AIRTIME.showbuilder.fnServerData.end = oRange.end;
AIRTIME.library.libraryInit();
AIRTIME.showbuilder.builderDataTable();
setWidgetSize();
$libWrapper = $lib.find("#library_display_wrapper");
$libWrapper.prepend($libClose);
$builder.find('.dataTables_scrolling').css("max-height",
widgetHeight - 95);
$builder.on("click", "#sb_submit", showSearchSubmit);
$builder.on("click", "#sb_edit", function(ev) {
var schedTable = $("#show_builder_table").dataTable();
// reset timestamp to redraw the cursors.
AIRTIME.showbuilder.resetTimestamp();
$lib.show().width(Math.floor(screenWidth * 0.48));
$builder.width(Math.floor(screenWidth * 0.48)).find("#sb_edit")
.remove().end().find("#sb_date_start")
.css("margin-left", 0).end();
schedTable.fnDraw();
$.ajax( {
url : "/usersettings/set-now-playing-screen-settings",
type : "POST",
data : {
settings : {
library : true
},
format : "json"
},
dataType : "json",
success : function() {
}
});
});
$lib.on("click", "#sb_lib_close", function() {
var schedTable = $("#show_builder_table").dataTable();
$lib.hide();
$builder.width(screenWidth).find(".sb-timerange").prepend(
$toggleLib).find("#sb_date_start").css("margin-left", 30)
.end().end();
$toggleLib.removeClass("ui-state-hover");
schedTable.fnDraw();
$.ajax( {
url : "/usersettings/set-now-playing-screen-settings",
type : "POST",
data : {
settings : {
library : false
},
format : "json"
},
dataType : "json",
success : function() {
}
});
});
$builder.find('legend').click(
function(ev, item) {
if ($fs.hasClass("closed")) {
$fs.removeClass("closed");
$builder.find('.dataTables_scrolling').css(
"max-height", widgetHeight - 150);
} else {
$fs.addClass("closed");
// set defaults for the options.
$fs.find('select').val(0);
$fs.find('input[type="checkbox"]').attr("checked",
false);
$builder.find('.dataTables_scrolling').css(
"max-height", widgetHeight - 110);
}
});
// set click event for all my shows checkbox.
$builder.on("click", "#sb_my_shows", function(ev) {
if ($(this).is(':checked')) {
$(ev.delegateTarget).find('#sb_show_filter').val(0);
}
showSearchSubmit();
});
//set select event for choosing a show.
$builder.on("change", '#sb_show_filter', function(ev) {
if ($(this).val() !== 0) {
$(ev.delegateTarget).find('#sb_my_shows')
.attr("checked", false);
}
showSearchSubmit();
});
function checkScheduleUpdates() {
var data = {}, oTable = $('#show_builder_table').dataTable(), fn = oTable
.fnSettings().fnServerData, start = fn.start, end = fn.end;
data["format"] = "json";
data["start"] = start;
data["end"] = end;
data["timestamp"] = AIRTIME.showbuilder.getTimestamp();
data["instances"] = AIRTIME.showbuilder.getShowInstances();
if (fn.hasOwnProperty("ops")) {
data["myShows"] = fn.ops.myShows;
data["showFilter"] = fn.ops.showFilter;
}
$.ajax( {
"dataType" : "json",
"type" : "GET",
"url" : "/showbuilder/check-builder-feed",
"data" : data,
"success" : function(json) {
if (json.update === true) {
oTable.fnDraw();
}
}
});
}
//check if the timeline view needs updating.
setInterval(checkScheduleUpdates, 5 * 1000); //need refresh in milliseconds
};
mod.onResize = function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(setWidgetSize, 100);
};
return AIRTIME;
$builder.on("click","#sb_edit", function (ev){
var schedTable = $("#show_builder_table").dataTable();
@ -280,7 +419,6 @@ AIRTIME = (function(AIRTIME) {
};
return AIRTIME;
} (AIRTIME || {}));
$(document).ready(AIRTIME.builderMain.onReady);