From 5e8f7d430fb0b76a8993ae52294bbf3b388d922f Mon Sep 17 00:00:00 2001 From: jo Date: Fri, 1 Jul 2022 18:39:02 +0200 Subject: [PATCH] style(legacy): format files --- .../application/forms/SmartBlockCriteria.php | 4 +- legacy/application/models/Block.php | 4 +- legacy/public/js/airtime/library/library.js | 703 +++++++++--------- .../js/airtime/playlist/smart_blockbuilder.js | 323 ++++---- 4 files changed, 517 insertions(+), 517 deletions(-) diff --git a/legacy/application/forms/SmartBlockCriteria.php b/legacy/application/forms/SmartBlockCriteria.php index 415ce031d..289d98c05 100644 --- a/legacy/application/forms/SmartBlockCriteria.php +++ b/legacy/application/forms/SmartBlockCriteria.php @@ -855,9 +855,9 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm if (in_array($d['sp_criteria_modifier'], ['before', 'after', 'between'])) { if (!preg_match('/^[1-9][0-9]*$|0/', $d['sp_criteria_value'])) { $element->addError(_('Only non-negative integer numbers are allowed (e.g 1 or 5) for the text value')); - $isValid = false; - // TODO validate this on numeric input with whatever parsing also do for extra + // TODO validate this on numeric input with whatever parsing also do for extra // if the modifier is before ago or between we skip validation until we confirm format + $isValid = false; } elseif (isset($d['sp_criteria_datetime_select']) && $d['sp_criteria_datetime_select'] == '0') { $element->addError(_('You must select a time unit for a relative datetime.')); $isValid = false; diff --git a/legacy/application/models/Block.php b/legacy/application/models/Block.php index c3c6bc881..781bdbed8 100644 --- a/legacy/application/models/Block.php +++ b/legacy/application/models/Block.php @@ -1688,13 +1688,13 @@ SQL; // need to pull in the current time and subtract the value or figure out how to make it relative $relativedate = new DateTime($spCriteriaValue); $dt = $relativedate->format(DateTime::ISO8601); + // Logging::info($spCriteriaValue); $spCriteriaValue = "{$spCriteria} <= '{$dt}'"; - // Logging::info($spCriteriaValue); } elseif ($spCriteriaModifier == 'after') { $relativedate = new DateTime($spCriteriaValue); $dt = $relativedate->format(DateTime::ISO8601); + // Logging::info($spCriteriaValue); $spCriteriaValue = "{$spCriteria} >= '{$dt}'"; - // Logging::info($spCriteriaValue); } elseif ($spCriteriaModifier == 'between') { $fromrelativedate = new DateTime($spCriteriaValue); $fdt = $fromrelativedate->format(DateTime::ISO8601); diff --git a/legacy/public/js/airtime/library/library.js b/legacy/public/js/airtime/library/library.js index 55fa04412..f5e1f87f2 100644 --- a/legacy/public/js/airtime/library/library.js +++ b/legacy/public/js/airtime/library/library.js @@ -1,4 +1,4 @@ -var AIRTIME = (function(AIRTIME) { +var AIRTIME = (function (AIRTIME) { var mod, libraryInit, oTable, @@ -19,43 +19,43 @@ var AIRTIME = (function(AIRTIME) { // s => string // n => numberic var libraryColumnTypes = { - 0 : "", - "album_title" : "s", - "artist_name" : "s", - "bit_rate" : "n", - "bpm" : "n", - "comments" : "s", - "composer" : "s", - "conductor" : "s", - "copyright" : "s", - "cuein" : "n", - "cueout" : "n", - "description" : "s", - "utime" : "n", - "mtime" : "n", - "lptime" : "n", - "disc_number" : "n", - "encoded_by" : "s", - "genre" : "s", - "isrc_number" : "s", - "label" : "s", - "language" : "s", - "length" : "n", - "lyricist" : "s", - "mime" : "s", - "mood" : "s", - "name" : "s", - "orchestra" : "s", - "rating" : "n", - "sample_rate" : "n", - "track_title" : "s", - "track_num" : "n", - "year" : "n", - "owner_id" : "s", - "info_url" : "s", - "replay_gain" : "n", - "artwork" : "s", - "track_type" : "tt" + 0: "", + "album_title": "s", + "artist_name": "s", + "bit_rate": "n", + "bpm": "n", + "comments": "s", + "composer": "s", + "conductor": "s", + "copyright": "s", + "cuein": "n", + "cueout": "n", + "description": "s", + "utime": "n", + "mtime": "n", + "lptime": "n", + "disc_number": "n", + "encoded_by": "s", + "genre": "s", + "isrc_number": "s", + "label": "s", + "language": "s", + "length": "n", + "lyricist": "s", + "mime": "s", + "mood": "s", + "name": "s", + "orchestra": "s", + "rating": "n", + "sample_rate": "n", + "track_title": "s", + "track_num": "n", + "year": "n", + "owner_id": "s", + "info_url": "s", + "replay_gain": "n", + "artwork": "s", + "track_type": "tt" }; if (AIRTIME.library === undefined) { @@ -92,11 +92,11 @@ var AIRTIME = (function(AIRTIME) { }); mod.DataTableTypeEnum = Object.freeze({ - LIBRARY : "library", - PODCAST : "podcast", + LIBRARY: "library", + PODCAST: "podcast", }); - mod.placeholder = function(mediaType) { + mod.placeholder = function (mediaType) { switch (mediaType) { // TODO: remove duplication in a nice way? case mod.MediaTypeIntegerEnum.FILE: @@ -143,14 +143,14 @@ var AIRTIME = (function(AIRTIME) { END CONFIGURATION ############################################ */ - mod.getChosenItemsLength = function(){ + mod.getChosenItemsLength = function () { var cItem, selected, $trs; // Get visible items and check if any chosenItems are visible $trs = $libTable.find("tr"); - $trs.each(function(i){ + $trs.each(function (i) { for (cItem in chosenItems) { if (cItem === $(this).attr("id")) { visibleChosenItems[cItem] = $(this).data('aData'); @@ -163,18 +163,18 @@ var AIRTIME = (function(AIRTIME) { return selected; }; - mod.getChosenAudioFilesLength = function(){ + mod.getChosenAudioFilesLength = function () { // var files = Object.keys(chosenItems), var files, $trs, cItem, i, length, count = 0, - reAudio=/^(au|st|pl|bl)/ ; + reAudio = /^(au|st|pl|bl)/; // Get visible items and check if any chosenItems are visible $trs = $libTable.find("tr"); - $trs.each(function(i){ + $trs.each(function (i) { for (cItem in chosenItems) { if (cItem === $(this).attr("id")) { visibleChosenItems[cItem] = $(this).data('aData'); @@ -194,7 +194,7 @@ var AIRTIME = (function(AIRTIME) { return count; }; - mod.changeAddButtonText = function($button, btnText) { + mod.changeAddButtonText = function ($button, btnText) { $button.text(btnText); }; @@ -204,17 +204,17 @@ var AIRTIME = (function(AIRTIME) { $menu .append( "
" + - "" + + "" + "
" ).append( "
" + - "" + + "" + "
" ); } @@ -222,38 +222,38 @@ var AIRTIME = (function(AIRTIME) { $menu .append( "
" + - "" + + "" + "
" ).append( "
" + - "" + + "" + "
" ); - if (onDashboard) { - $menu.append( - "
" + - "" + - "
" - ); - } + if (onDashboard) { + $menu.append( + "
" + + "" + + "
" + ); + } }; - mod.createToolbarDropDown = function() { - $('#sb-select-page').click(function(){mod.selectCurrentPage();}); - $('#sb-dselect-page').click(function(){mod.deselectCurrentPage();}); - $('#sb-dselect-all').click(function(){mod.selectNone();}); + mod.createToolbarDropDown = function () { + $('#sb-select-page').click(function () { mod.selectCurrentPage(); }); + $('#sb-dselect-page').click(function () { mod.deselectCurrentPage(); }); + $('#sb-dselect-all').click(function () { mod.selectNone(); }); }; - mod.checkDeleteButton = function() { + mod.checkDeleteButton = function () { var selected = mod.getChosenItemsLength(), check = false; @@ -269,7 +269,7 @@ var AIRTIME = (function(AIRTIME) { } }; - mod.checkEditButton = function() { + mod.checkEditButton = function () { var selected = mod.getChosenItemsLength(), check = false; @@ -285,7 +285,7 @@ var AIRTIME = (function(AIRTIME) { } }; - mod.checkNewButton = function() { + mod.checkNewButton = function () { var selected = $(".media_type_selector.selected").data("selection-id"), check = false; @@ -301,7 +301,7 @@ var AIRTIME = (function(AIRTIME) { } }; - mod.checkPublishButton = function() { + mod.checkPublishButton = function () { var selected = mod.getChosenItemsLength(), mediaType = $(".media_type_selector.selected").data("selection-id"), check = false; @@ -317,7 +317,7 @@ var AIRTIME = (function(AIRTIME) { } }; - mod.checkToolBarIcons = function() { + mod.checkToolBarIcons = function () { AIRTIME.library.checkAddButton(); AIRTIME.library.checkDeleteButton(); AIRTIME.library.checkEditButton(); @@ -325,7 +325,7 @@ var AIRTIME = (function(AIRTIME) { AIRTIME.library.checkPublishButton(); }; - mod.getSelectedData = function() { + mod.getSelectedData = function () { var id, data = [], cItem, @@ -336,7 +336,7 @@ var AIRTIME = (function(AIRTIME) { // Get visible items and check if any chosenItems are visible $trs = $libTable.find("tr"); - $trs.each(function(i){ + $trs.each(function (i) { for (cItem in chosenItems) { if (cItem === $(this).attr("id")) { visibleChosenItems[cItem] = $(this).data('aData'); @@ -353,13 +353,13 @@ var AIRTIME = (function(AIRTIME) { return data; }; - mod.redrawChosen = function() { + mod.redrawChosen = function () { var ids = Object.keys(chosenItems), i, length, $el; for (i = 0, length = ids.length; i < length; i++) { - $el = $libTable.find("#"+ids[i]); + $el = $libTable.find("#" + ids[i]); if ($el.length !== 0) { mod.highlightItem($el); @@ -368,20 +368,20 @@ var AIRTIME = (function(AIRTIME) { } }; - mod.isChosenItem = function($el) { + mod.isChosenItem = function ($el) { var id = $el.attr("id"), item = chosenItems[id]; return item !== undefined; }; - mod.addToChosen = function($el) { + mod.addToChosen = function ($el) { var id = $el.attr("id"); chosenItems[id] = $el.data('aData'); }; - mod.removeFromChosen = function($el) { + mod.removeFromChosen = function ($el) { var id = $el.attr("id"); // used to not keep dragged items selected. @@ -390,27 +390,27 @@ var AIRTIME = (function(AIRTIME) { } }; - mod.checkItem = function($el) { + mod.checkItem = function ($el) { $el.find(".library_checkbox > input").prop('checked', true); $("#super-checkbox").prop("checked", true); }; - mod.uncheckItem = function($el) { + mod.uncheckItem = function ($el) { $el.find(".library_checkbox > input").prop('checked', false); if ($("." + LIB_SELECTED_CLASS).length == 0) { $("#super-checkbox").prop("checked", false); } }; - mod.highlightItem = function($el) { + mod.highlightItem = function ($el) { $el.addClass(LIB_SELECTED_CLASS); }; - mod.unHighlightItem = function($el) { + mod.unHighlightItem = function ($el) { $el.removeClass(LIB_SELECTED_CLASS); }; - mod.selectItem = function($el) { + mod.selectItem = function ($el) { mod.highlightItem($el); mod.addToChosen($el); mod.checkItem($el); @@ -420,15 +420,15 @@ var AIRTIME = (function(AIRTIME) { mod.checkToolBarIcons(); }; - mod.deselectItem = function($el) { + mod.deselectItem = function ($el) { mod.unHighlightItem($el); mod.removeFromChosen($el); mod.uncheckItem($el); mod.checkToolBarIcons(); }; - mod.selectAll = function($els) { - $els.each(function(i, el){ + mod.selectAll = function ($els) { + $els.each(function (i, el) { mod.highlightItem($(el)); mod.addToChosen($(el)); mod.checkItem($(el)); @@ -437,8 +437,8 @@ var AIRTIME = (function(AIRTIME) { mod.checkToolBarIcons(); }; - mod.deselectAll = function($els) { - $els.each(function(i, el){ + mod.deselectAll = function ($els) { + $els.each(function (i, el) { mod.unHighlightItem($(el)); mod.removeFromChosen($(el)); mod.uncheckItem($(el)); @@ -454,7 +454,7 @@ var AIRTIME = (function(AIRTIME) { * by default the items are selected in reverse order so we need to reverse * it back */ - mod.selectCurrentPage = function() { + mod.selectCurrentPage = function () { $.fn.reverse = [].reverse; var $trs = $libTable.find("tbody").find("tr").reverse(); mod.selectAll($trs); @@ -464,22 +464,22 @@ var AIRTIME = (function(AIRTIME) { * deselects all items that the user can currently see. (behaviour taken * from gmail) */ - mod.deselectCurrentPage = function() { + mod.deselectCurrentPage = function () { var $trs = $libTable.find("tr"); mod.deselectAll($trs); }; - mod.selectNone = function() { + mod.selectNone = function () { var $trs = $libTable.find("tr"); chosenItems = {}; mod.deselectAll($trs); }; - mod.fnRedraw = function() { + mod.fnRedraw = function () { oTable.fnStandingRedraw(); }; - mod.fnDeleteItems = function(aMedia, podcastId) { + mod.fnDeleteItems = function (aMedia, podcastId) { //Prevent the user from spamming the delete button while the AJAX request is in progress AIRTIME.button.disableButton("btn-group #sb-delete", false); var openTabObjectIds = $(".obj_id"), @@ -488,23 +488,23 @@ var AIRTIME = (function(AIRTIME) { mediaIds.push(parseInt(aMedia[i].id)); } - openTabObjectIds.each(function(i, el) { + openTabObjectIds.each(function (i, el) { var v = parseInt($(el).val()); if ($.inArray(v, mediaIds) > -1) { AIRTIME.tabs.get($(el).closest(".pl-content").attr("data-tab-id")).close(); } }); - $.post(baseUrl+"library/delete", - {"format": "json", "media": aMedia}, - function(json){ + $.post(baseUrl + "library/delete", + { "format": "json", "media": aMedia }, + function (json) { if (json.message !== undefined) { alert(json.message); } chosenItems = {}; - if (typeof(podcastId) === "undefined") { + if (typeof (podcastId) === "undefined") { oTable.fnStandingRedraw(); } else { AIRTIME.podcast.episodeTables[podcastId].reload(this.podcast_id); @@ -517,7 +517,7 @@ var AIRTIME = (function(AIRTIME) { mod.selectNone(); }; - mod.fnDeleteSelectedItems = function() { + mod.fnDeleteSelectedItems = function () { if (confirm($.i18n._('Are you sure you want to delete the selected item(s)?'))) { var aData = AIRTIME.library.getSelectedData(), item, @@ -530,9 +530,9 @@ var AIRTIME = (function(AIRTIME) { // process selected files/playlists. for (item in aData) { temp = aData[item]; - if (temp !== null && temp.hasOwnProperty('id') ) { - aMedia.push({"id": temp.id, "type": temp.ftype}); - if ( (temp.id == currentObjId && temp.ftype === currentObjType) || + if (temp !== null && temp.hasOwnProperty('id')) { + aMedia.push({ "id": temp.id, "type": temp.ftype }); + if ((temp.id == currentObjId && temp.ftype === currentObjType) || temp.id == currentObjId && temp.ftype === "stream" && currentObjType === "webstream") { closeObj = true; } @@ -555,7 +555,7 @@ var AIRTIME = (function(AIRTIME) { }; - libraryInit = function() { + libraryInit = function () { $libContent = $("#library_content"); @@ -573,46 +573,46 @@ var AIRTIME = (function(AIRTIME) { //IMPORTANT: WHEN ADDING A NEW COLUMN PLEASE CONSULT WITH THE WIKI // https://wiki.sourcefabric.org/display/CC/Adding+a+new+library+datatable+column var cols = [ - /* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false }, - /* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "16px" , "sClass" : "library_checkbox" }, - /* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSortable" : false , "bSearchable" : false , "sWidth" : "16px" , "sClass" : "library_type" , "iDataSort" : 0 }, - /* Artwork */ { "sTitle" : "" , "mDataProp" : "artwork" , "bSortable" : false , "bSearchable" : false , "sWidth" : "28px" , "sClass" : "library_artwork" , "iDataSort" : 0 }, - /* Is Scheduled */ { "sTitle" : $.i18n._("Scheduled") , "mDataProp" : "is_scheduled" , "bVisible" : false , "bSearchable" : false , "sWidth" : "90px" , "sClass" : "library_is_scheduled" }, + /* ftype */ { "sTitle": "", "mDataProp": "ftype", "bSearchable": false, "bVisible": false }, + /* Checkbox */ { "sTitle": "", "mDataProp": "checkbox", "bSortable": false, "bSearchable": false, "sWidth": "16px", "sClass": "library_checkbox" }, + /* Type */ { "sTitle": "", "mDataProp": "image", "bSortable": false, "bSearchable": false, "sWidth": "16px", "sClass": "library_type", "iDataSort": 0 }, + /* Artwork */ { "sTitle": "", "mDataProp": "artwork", "bSortable": false, "bSearchable": false, "sWidth": "28px", "sClass": "library_artwork", "iDataSort": 0 }, + /* Is Scheduled */ { "sTitle": $.i18n._("Scheduled"), "mDataProp": "is_scheduled", "bVisible": false, "bSearchable": false, "sWidth": "90px", "sClass": "library_is_scheduled" }, ///* Is Playlist */ { "sTitle" : $.i18n._("Playlist / Block") , "mDataProp" : "is_playlist" , "bSearchable" : false , "sWidth" : "110px" , "sClass" : "library_is_playlist"} , - /* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" }, - /* Creator */ { "sTitle" : $.i18n._("Creator") , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" }, - /* Album */ { "sTitle" : $.i18n._("Album") , "mDataProp" : "album_title" , "bVisible" : false , "sClass" : "library_album" , "sWidth" : "150px" }, - /* Bit Rate */ { "sTitle" : $.i18n._("Bit Rate") , "mDataProp" : "bit_rate" , "bVisible" : false , "sClass" : "library_bitrate" , "sWidth" : "80px" }, - /* BPM */ { "sTitle" : $.i18n._("BPM") , "mDataProp" : "bpm" , "bVisible" : false , "sClass" : "library_bpm" , "sWidth" : "50px" }, - /* Composer */ { "sTitle" : $.i18n._("Composer") , "mDataProp" : "composer" , "bVisible" : false , "sClass" : "library_composer" , "sWidth" : "150px" }, - /* Conductor */ { "sTitle" : $.i18n._("Conductor") , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" }, - /* Copyright */ { "sTitle" : $.i18n._("Copyright") , "mDataProp" : "copyright" , "bVisible" : false , "sClass" : "library_copyright" , "sWidth" : "125px" }, - /* Cue In */ { "sTitle" : $.i18n._("Cue In") , "mDataProp" : "cuein" , "bVisible" : false , "sClass" : "library_length" , "sWidth" : "80px" }, - /* Cue Out */ { "sTitle" : $.i18n._("Cue Out") , "mDataProp" : "cueout" , "bVisible" : false , "sClass" : "library_length" , "sWidth" : "80px" }, - /* Description */ { "sTitle" : $.i18n._("Description") , "mDataProp" : "description" , "bVisible" : false , "sClass" : "library_description" , "sWidth" : "150px" }, - /* Encoded */ { "sTitle" : $.i18n._("Encoded By") , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" }, - /* Track Type */ { "sTitle" : $.i18n._("Type") , "mDataProp" : "track_type" , "sClass" : "library_track_type" , "sWidth" : "60px" }, - /* Genre */ { "sTitle" : $.i18n._("Genre") , "mDataProp" : "genre" , "sClass" : "library_genre" , "sWidth" : "100px" }, - /* ISRC Number */ { "sTitle" : $.i18n._("ISRC") , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" }, - /* Label */ { "sTitle" : $.i18n._("Label") , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" }, - /* Language */ { "sTitle" : $.i18n._("Language") , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" }, - /* Last Modified */ { "sTitle" : $.i18n._("Last Modified") , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "155px" }, - /* Last Played */ { "sTitle" : $.i18n._("Last Played") , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "155px" }, - /* Length */ { "sTitle" : $.i18n._("Length") , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" }, - /* Mime */ { "sTitle" : $.i18n._("Mime") , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" }, - /* Mood */ { "sTitle" : $.i18n._("Mood") , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" }, - /* Owner */ { "sTitle" : $.i18n._("Owner") , "mDataProp" : "owner_id" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" }, - /* Replay Gain */ { "sTitle" : $.i18n._("Replay Gain") , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_replay_gain" , "sWidth" : "125px" }, - /* Sample Rate */ { "sTitle" : $.i18n._("Sample Rate") , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "125px" }, - /* Track Number */ { "sTitle" : $.i18n._("Track Number") , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "125px" }, - /* Upload Time */ { "sTitle" : $.i18n._("Uploaded") , "mDataProp" : "utime" , "sClass" : "library_upload_time" , "sWidth" : "155px" }, - /* Website */ { "sTitle" : $.i18n._("Website") , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" }, - /* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" } + /* Title */ { "sTitle": $.i18n._("Title"), "mDataProp": "track_title", "sClass": "library_title", "sWidth": "170px" }, + /* Creator */ { "sTitle": $.i18n._("Creator"), "mDataProp": "artist_name", "sClass": "library_creator", "sWidth": "160px" }, + /* Album */ { "sTitle": $.i18n._("Album"), "mDataProp": "album_title", "bVisible": false, "sClass": "library_album", "sWidth": "150px" }, + /* Bit Rate */ { "sTitle": $.i18n._("Bit Rate"), "mDataProp": "bit_rate", "bVisible": false, "sClass": "library_bitrate", "sWidth": "80px" }, + /* BPM */ { "sTitle": $.i18n._("BPM"), "mDataProp": "bpm", "bVisible": false, "sClass": "library_bpm", "sWidth": "50px" }, + /* Composer */ { "sTitle": $.i18n._("Composer"), "mDataProp": "composer", "bVisible": false, "sClass": "library_composer", "sWidth": "150px" }, + /* Conductor */ { "sTitle": $.i18n._("Conductor"), "mDataProp": "conductor", "bVisible": false, "sClass": "library_conductor", "sWidth": "125px" }, + /* Copyright */ { "sTitle": $.i18n._("Copyright"), "mDataProp": "copyright", "bVisible": false, "sClass": "library_copyright", "sWidth": "125px" }, + /* Cue In */ { "sTitle": $.i18n._("Cue In"), "mDataProp": "cuein", "bVisible": false, "sClass": "library_length", "sWidth": "80px" }, + /* Cue Out */ { "sTitle": $.i18n._("Cue Out"), "mDataProp": "cueout", "bVisible": false, "sClass": "library_length", "sWidth": "80px" }, + /* Description */ { "sTitle": $.i18n._("Description"), "mDataProp": "description", "bVisible": false, "sClass": "library_description", "sWidth": "150px" }, + /* Encoded */ { "sTitle": $.i18n._("Encoded By"), "mDataProp": "encoded_by", "bVisible": false, "sClass": "library_encoded", "sWidth": "150px" }, + /* Track Type */ { "sTitle": $.i18n._("Type"), "mDataProp": "track_type", "sClass": "library_track_type", "sWidth": "60px" }, + /* Genre */ { "sTitle": $.i18n._("Genre"), "mDataProp": "genre", "sClass": "library_genre", "sWidth": "100px" }, + /* ISRC Number */ { "sTitle": $.i18n._("ISRC"), "mDataProp": "isrc_number", "bVisible": false, "sClass": "library_isrc", "sWidth": "150px" }, + /* Label */ { "sTitle": $.i18n._("Label"), "mDataProp": "label", "bVisible": false, "sClass": "library_label", "sWidth": "125px" }, + /* Language */ { "sTitle": $.i18n._("Language"), "mDataProp": "language", "bVisible": false, "sClass": "library_language", "sWidth": "125px" }, + /* Last Modified */ { "sTitle": $.i18n._("Last Modified"), "mDataProp": "mtime", "bVisible": false, "sClass": "library_modified_time", "sWidth": "155px" }, + /* Last Played */ { "sTitle": $.i18n._("Last Played"), "mDataProp": "lptime", "bVisible": false, "sClass": "library_modified_time", "sWidth": "155px" }, + /* Length */ { "sTitle": $.i18n._("Length"), "mDataProp": "length", "sClass": "library_length", "sWidth": "80px" }, + /* Mime */ { "sTitle": $.i18n._("Mime"), "mDataProp": "mime", "bVisible": false, "sClass": "library_mime", "sWidth": "80px" }, + /* Mood */ { "sTitle": $.i18n._("Mood"), "mDataProp": "mood", "bVisible": false, "sClass": "library_mood", "sWidth": "70px" }, + /* Owner */ { "sTitle": $.i18n._("Owner"), "mDataProp": "owner_id", "bVisible": false, "sClass": "library_language", "sWidth": "125px" }, + /* Replay Gain */ { "sTitle": $.i18n._("Replay Gain"), "mDataProp": "replay_gain", "bVisible": false, "sClass": "library_replay_gain", "sWidth": "125px" }, + /* Sample Rate */ { "sTitle": $.i18n._("Sample Rate"), "mDataProp": "sample_rate", "bVisible": false, "sClass": "library_sr", "sWidth": "125px" }, + /* Track Number */ { "sTitle": $.i18n._("Track Number"), "mDataProp": "track_number", "bVisible": false, "sClass": "library_track", "sWidth": "125px" }, + /* Upload Time */ { "sTitle": $.i18n._("Uploaded"), "mDataProp": "utime", "sClass": "library_upload_time", "sWidth": "155px" }, + /* Website */ { "sTitle": $.i18n._("Website"), "mDataProp": "info_url", "bVisible": false, "sClass": "library_url", "sWidth": "150px" }, + /* Year */ { "sTitle": $.i18n._("Year"), "mDataProp": "year", "bVisible": false, "sClass": "library_year", "sWidth": "60px" } ]; if (onDashboard) { cols.push( - /* Context Menu */ { "sTitle" : "" , "mDataProp" : "options" , "bSortable" : false , "bSearchable" : false , "sWidth" : "20px", "sClass" : "library_actions" } + /* Context Menu */ { "sTitle": "", "mDataProp": "options", "bSortable": false, "bSearchable": false, "sWidth": "20px", "sClass": "library_actions" } ); } @@ -646,7 +646,7 @@ var AIRTIME = (function(AIRTIME) { $.ajax({ url: baseUrl + "usersettings/set-library-datatable", type: "POST", - data: {settings: oData, format: "json"}, + data: { settings: oData, format: "json" }, dataType: "json" }); @@ -664,7 +664,7 @@ var AIRTIME = (function(AIRTIME) { 'url': baseUrl + 'usersettings/get-library-datatable', 'async': false, // <<< every sane browser will warn that this is not nice 'dataType': 'json', - 'success': function(oData) { + 'success': function (oData) { localStorage.setItem('datatables-library', JSON.stringify(oData)); settings = oData; } @@ -684,7 +684,7 @@ var AIRTIME = (function(AIRTIME) { // 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") { + if (typeof (a[i]) === "string") { a[i] = (a[i] === "true"); } } @@ -693,7 +693,7 @@ var AIRTIME = (function(AIRTIME) { a = oData.ColReorder; if (a) { for (i = 0, length = a.length; i < length; i++) { - if (typeof(a[i]) === "string") { + if (typeof (a[i]) === "string") { a[i] = parseInt(a[i], 10); } } @@ -719,13 +719,13 @@ var AIRTIME = (function(AIRTIME) { var advSearchFields = $("div#advanced_search").children(':visible'); var advSearchValid = validateAdvancedSearch(advSearchFields); var type; - aoData.push({name: "format", value: "json"}); - aoData.push({name: "advSearch", value: advSearchValid}); + aoData.push({ name: "format", value: "json" }); + aoData.push({ name: "advSearch", value: advSearchValid }); // push whether to search files/playlists or all. type = $(".media_type_selector.selected").data("selection-id"); type = (type === undefined) ? AIRTIME.library.MediaTypeIntegerEnum.DEFAULT : type; - aoData.push({name: "type", value: type}); + aoData.push({ name: "type", value: type }); $.ajax({ "dataType": 'json', @@ -749,7 +749,7 @@ var AIRTIME = (function(AIRTIME) { } $libContent.find('.dataTables_filter input[type="text"]') .css('padding-right', $('#advanced-options').find('button').outerWidth()); - if (! ($('#advanced_search input[type="text"]').is(":focus")) ) { + if (!($('#advanced_search input[type="text"]').is(":focus"))) { $libContent.find('.dataTables_filter input[type="text"]').focus(); } }); @@ -763,7 +763,7 @@ var AIRTIME = (function(AIRTIME) { $(nRow).find('td.library_actions') .text("...") .on('click', function (e) { - $(this).contextMenu({x: $(e.target).offset().left, y: $(e.target).offset().top}) + $(this).contextMenu({ x: $(e.target).offset().left, y: $(e.target).offset().top }) }).html("
...
"); if (aData.track_type == null || aData.track_type == undefined || aData.track_type == 0) { @@ -771,35 +771,35 @@ var AIRTIME = (function(AIRTIME) { var type_button = ""; } else { var has_type = true; - var type_button = "
"+aData.track_type+"
"; + var type_button = "
" + aData.track_type + "
"; } $(nRow).find('td.library_track_type') - .on('click', function (e) { + .on('click', function (e) { - $.getJSON( - baseUrl + "api/track-types", - function(json){ + $.getJSON( + baseUrl + "api/track-types", + function (json) { var type_enabled = false; - $.each(json, function(key, value) { + $.each(json, function (key, value) { - if(value['code'] == aData.track_type){ - $("#au_"+aData.id+" td.library_track_type div.library_track_type_btn").qtip({ - overwrite: false, - content: { - text: value['type_name'] - }, - style: { + if (value['code'] == aData.track_type) { + $("#au_" + aData.id + " td.library_track_type div.library_track_type_btn").qtip({ + overwrite: false, + content: { + text: value['type_name'] + }, + style: { classes: 'track-type-tip', widget: true, def: false, position: { - target: $("#au_"+aData.id+" td.library_track_type"), // my target + target: $("#au_" + aData.id + " td.library_track_type"), // my target my: 'bottom center', at: 'top center', adjust: { - x: 50 - } + x: 50 + } }, tip: { height: 5, @@ -807,33 +807,33 @@ var AIRTIME = (function(AIRTIME) { corner: 'bottom left', mimic: 'left' } - }, - show: { + }, + show: { ready: true - }, - hide: { + }, + hide: { delay: 200, fixed: true, - } + } }); type_enabled = true; } }); - if(type_enabled == false && has_type == true){ - alert("This type is disabled."); + if (type_enabled == false && has_type == true) { + alert("This type is disabled."); } - }); + }); - }).html(type_button); + }).html(type_button); } // add audio preview image/button if (aData.ftype === "audioclip") { $(nRow).find('td.library_type').html(''); if (aData.artwork_data) { - $(nRow).find('td.library_artwork').html(''); + $(nRow).find('td.library_artwork').html(''); } else { $(nRow).find('td.library_artwork').html(''); } @@ -902,14 +902,14 @@ var AIRTIME = (function(AIRTIME) { return $libContent.height() - 175; } - function setColumnFilter(oTable){ + function setColumnFilter(oTable) { // TODO : remove this dirty hack once js is refactored - if (!oTable.fnSettings()) { return ; } + if (!oTable.fnSettings()) { return; } var aoCols = oTable.fnSettings().aoColumns; var colsForAdvancedSearch = new Array(); var advanceSearchDiv = $("div#advanced_search"); advanceSearchDiv.empty(); - $.each(aoCols, function(i,ele){ + $.each(aoCols, function (i, ele) { if (ele.bSearchable) { var currentColId = ele._ColReorder_iOrigCol; @@ -925,24 +925,24 @@ var AIRTIME = (function(AIRTIME) { if (ele.bVisible) { advanceSearchDiv.append( - "
" + - "" + - "
" + + "
" + + "" + + "
" + "
"); } else { advanceSearchDiv.append( - "