Run pre-commit on legacy code

This commit is contained in:
jo 2021-10-12 11:17:57 +02:00
parent fea11ac752
commit 83b7e4162e
323 changed files with 6126 additions and 6462 deletions

View file

@ -47,4 +47,4 @@ var AIRTIME = (function(AIRTIME) {
return AIRTIME;
}(AIRTIME || {}));
}(AIRTIME || {}));

View file

@ -8,7 +8,7 @@ function isAudioSupported(mime){
var bMime = null;
if (mime.indexOf("ogg") != -1 || mime.indexOf("vorbis") != -1) {
bMime = 'audio/ogg; codecs="vorbis"';
bMime = 'audio/ogg; codecs="vorbis"';
} else {
bMime = mime;
}
@ -17,8 +17,8 @@ function isAudioSupported(mime){
//file is an mp3 and flash is installed (jPlayer will fall back to flash to play mp3s).
//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) != "") ||
return (!!audio.canPlayType && audio.canPlayType(bMime) != "") ||
(mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
(mime.indexOf("mp4") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
(mime.indexOf("mpeg") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined);
}
}

View file

@ -109,12 +109,12 @@ function getDatatablesStrings(overrideDict) {
}
function adjustDateToServerDate(date, serverTimezoneOffset){
//date object stores time in the browser's localtime. We need to artificially shift
//it to
//date object stores time in the browser's localtime. We need to artificially shift
//it to
var timezoneOffset = date.getTimezoneOffset()*60*1000;
date.setTime(date.getTime() + timezoneOffset + serverTimezoneOffset*1000);
/* date object has been shifted to artificial UTC time. Now let's
* shift it to the server's timezone */
return date;
@ -130,13 +130,13 @@ var _preview_window = null;
*/
function openAudioPreview(p_event) {
p_event.stopPropagation();
var audioFileID = $(this).attr('audioFile');
var objId = $('.obj_id:first').attr('value');
var objType = $('.obj_type:first').attr('value');
var playIndex = $(this).parent().parent().attr('id');
playIndex = playIndex.substring(4); //remove the spl_
if (objType == "playlist") {
open_playlist_preview(objId, playIndex);
} else if (objType == "block") {
@ -161,8 +161,8 @@ function open_audio_preview(type, id) {
function open_playlist_preview(p_playlistID, p_playlistIndex) {
if (p_playlistIndex == undefined) //Use a resonable default.
p_playlistIndex = 0;
if (_preview_window != null && !_preview_window.closed)
_preview_window.playAllPlaylist(p_playlistID, p_playlistIndex);
else
@ -173,7 +173,7 @@ function open_playlist_preview(p_playlistID, p_playlistIndex) {
function open_block_preview(p_blockId, p_blockIndex) {
if (p_blockIndex == undefined) //Use a resonable default.
p_blockIndex = 0;
if (_preview_window != null && !_preview_window.closed)
_preview_window.playBlock(p_blockId, p_blockIndex);
else
@ -190,7 +190,7 @@ function open_block_preview(p_blockId, p_blockIndex) {
function open_show_preview(p_showID, p_showIndex) {
if (_preview_window != null && !_preview_window.closed)
_preview_window.playAllShow(p_showID, p_showIndex);
else
else
openPreviewWindow(baseUrl+'audiopreview/show-preview/showID/'+p_showID+'/showIndex/'+p_showIndex, previewWidth, previewHeight);
_preview_window.focus();
}
@ -268,7 +268,7 @@ function pad(number, length) {
function removeSuccessMsg() {
var $status = $('.success');
$status.fadeOut("slow", function(){$status.empty()});
}

View file

@ -86,4 +86,3 @@ var AIRTIME = (function(AIRTIME) {
return AIRTIME;
}(AIRTIME || {}));

View file

@ -15,27 +15,27 @@ function popup(mylink){
* a javascript date object representing this date. */
function getDateFromString(time){
var date = time.split("-");
if (date.length != 3){
return null;
}
var year = parseInt(date[0], 10);
var month = parseInt(date[1], 10) -1;
var day = parseInt(date[2], 10);
if (isNaN(year) || isNaN(month) || isNaN(day)){
return null;
}
return new Date(year, month, day);
}
function convertSecondsToDaysHoursMinutesSeconds(seconds){
if (seconds < 0)
seconds = 0;
seconds = parseInt(seconds, 10);
var days = parseInt(seconds / 86400);
@ -47,26 +47,26 @@ function convertSecondsToDaysHoursMinutesSeconds(seconds){
var minutes = parseInt(seconds / 60);
seconds -= minutes*60;
return {days:days, hours:hours, minutes:minutes, seconds:seconds};
return {days:days, hours:hours, minutes:minutes, seconds:seconds};
}
/* Takes an input parameter of milliseconds and converts these into
* the format HH:MM:SS */
function convertToHHMMSS(timeInMS){
var time = parseInt(timeInMS);
var hours = parseInt(time / 3600000);
time -= 3600000*hours;
var minutes = parseInt(time / 60000);
time -= 60000*minutes;
var seconds = parseInt(time / 1000);
hours = hours.toString();
minutes = minutes.toString();
seconds = seconds.toString();
if (hours.length == 1)
hours = "0" + hours;
if (minutes.length == 1)
@ -78,37 +78,37 @@ function convertToHHMMSS(timeInMS){
function convertToHHMMSSmm(timeInMS){
var time = parseInt(timeInMS);
var hours = parseInt(time / 3600000);
time -= 3600000*hours;
var minutes = parseInt(time / 60000);
time -= 60000*minutes;
var seconds = parseInt(time / 1000);
time -= 1000*seconds;
var ms = parseInt(time);
hours = hours.toString();
minutes = minutes.toString();
seconds = seconds.toString();
ms = ms.toString();
if (hours.length == 1)
hours = "0" + hours;
if (minutes.length == 1)
minutes = "0" + minutes;
if (seconds.length == 1)
seconds = "0" + seconds;
if (ms.length == 3)
ms = ms.substring(0, 2);
else if (ms.length == 2)
ms = "0" + ms.substring(0,1);
else if (ms.length == 1)
ms = "00";
if (hours == "00")
return minutes + ":" + seconds + "." + ms;
else
@ -117,25 +117,25 @@ function convertToHHMMSSmm(timeInMS){
function convertDateToHHMM(epochTime){
var d = new Date(epochTime);
var hours = d.getUTCHours().toString();
var minutes = d.getUTCMinutes().toString();
if (hours.length == 1)
hours = "0" + hours;
if (minutes.length == 1)
minutes = "0" + minutes;
return hours + ":" + minutes;
}
function convertDateToHHMMSS(epochTime){
var d = new Date(epochTime);
var hours = d.getUTCHours().toString();
var minutes = d.getUTCMinutes().toString();
var seconds = d.getUTCSeconds().toString();
if (hours.length == 1)
hours = "0" + hours;
if (minutes.length == 1)
@ -153,7 +153,7 @@ function convertDateToPosixTime(s){
var date = datetime[0].split("-");
var time = datetime[1].split(":");
var year = date[0];
var month = date[1];
var day = date[2];
@ -230,4 +230,3 @@ function isInView(el) {
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */
);
}

View file

@ -32,7 +32,7 @@ function getContent() {
}
msg += '</ul>';
}
return msg;
}

View file

@ -127,9 +127,9 @@ var AIRTIME = (function(AIRTIME) {
var $toolbar = $(".lib-content .fg-toolbar:first");
mod.createToolbarButtons();
$toolbar.append($menu);
// add to playlist button
$toolbar

View file

@ -388,4 +388,4 @@ var AIRTIME = (function(AIRTIME) {
return AIRTIME;
}(AIRTIME || {}));
}(AIRTIME || {}));

View file

@ -62,12 +62,12 @@ var AIRTIME = (function (AIRTIME) {
$scope.createSmartblock = function () {
// send smarblock creation instruction to API
$.post(
endpoint + "smartblock",
endpoint + "smartblock",
{
csrf_token: $("#csrf").val(),
csrf_token: $("#csrf").val(),
id: $scope.podcast.id,
title: $scope.podcast.title
},
},
function() {
// show success message
var successMsg = $('.active-tab .pc-sb-success')
@ -77,9 +77,9 @@ var AIRTIME = (function (AIRTIME) {
}, 5000);
// save podcast but do not display notification beside save button below
$http.put(endpoint + $scope.podcast.id,
$http.put(endpoint + $scope.podcast.id,
{
csrf_token: $scope.csrf,
csrf_token: $scope.csrf,
podcast: $scope.podcast
})
.success(function () {
@ -596,12 +596,12 @@ var AIRTIME = (function (AIRTIME) {
* Delete one or more podcast episodes.
*
* @param {id:string, type:string}[] data Array of data objects to be deleted
* @param podcastId:string
* @param podcastId:string
*/
mod.deleteSelectedEpisodes = function (data, podcastId) {
$.each(data, function () {
AIRTIME.library.fnDeleteItems(data, podcastId);
});
});
};
/**
@ -825,7 +825,7 @@ var AIRTIME = (function (AIRTIME) {
if (typeof PodcastEpisodeTable === 'undefined') {
_initPodcastEpisodeTable();
}
var podcastEpisodeTableObj = new PodcastEpisodeTable(
domNode, // DOM node to create the table inside.
true, // Enable item selection

View file

@ -4,7 +4,7 @@ $(document).ready(function() {
timeStartId = "#his_time_start",
dateEndId = "#his_date_end",
timeEndId = "#his_time_end";
// set width dynamically
var width = $("#listenerstat_content").width();
width = width * .91;
@ -12,7 +12,7 @@ $(document).ready(function() {
$("#listenerstat_content").find("#legend").width(width);
getDataAndPlot();
listenerstat_content.find("#his_submit").click(function(){
var oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
var start = oRange.start;
@ -61,7 +61,7 @@ function plot(datasets){
firstTimestamp = new Date(8640000000000000);
// smallest
lastTimestamp = new Date(0);
data = [];
if (doAll != null)
{
@ -74,13 +74,13 @@ function plot(datasets){
}
data.push(val);
});
}
}
else
{
$('#legend .legendCB').each(
function(){
if (this.checked)
{
{
data.push(datasets[this.id]);
if (firstTimestamp.getTime() > datasets[this.id].data[0][0].getTime()) {
firstTimestamp = datasets[this.id].data[0][0];
@ -96,10 +96,10 @@ function plot(datasets){
}
);
}
numOfTicks = 10;
tickSize = (lastTimestamp.getTime() - firstTimestamp.getTime())/1000/numOfTicks;
plot = $.plot($("#flot_placeholder"), data, {
yaxis: { min: 0, tickDecimals: 0, color: '#d6d6d6', tickColor: '#d6d6d6' },
xaxis: { mode: "time", timeformat:"%y/%m/%0d %H:%M", tickSize: [tickSize, "second"],
@ -130,7 +130,7 @@ function plot(datasets){
}
}
});
function showTooltip(x, y, contents) {
$('<div id="tooltip">' + contents + '</div>').css( {
position: 'absolute',
@ -149,10 +149,10 @@ function plot(datasets){
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
$("#tooltip").remove();
var y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY,
sprintf($.i18n._("Listener Count on %s: %s"), item.series.label, Math.floor(y)));
}
@ -165,8 +165,8 @@ function plot(datasets){
$('#legend').find("input").click(function(){setTimeout(plotByChoice,100);});
}
plotByChoice(true);
plotByChoice(true);
oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd',
//i18n_months, i18n_days_short are in common.js
@ -176,7 +176,7 @@ function plot(datasets){
$(this).datepicker( "setDate", sDate );
}
};
oBaseTimePickerSettings = {
showPeriodLabels: false,
showCloseButton: true,
@ -186,7 +186,7 @@ function plot(datasets){
hourText: $.i18n._("Hour"),
minuteText: $.i18n._("Minute")
};
listenerstat_content.find(dateStartId).datepicker(oBaseDatePickerSettings);
listenerstat_content.find(timeStartId).timepicker(oBaseTimePickerSettings);
listenerstat_content.find(dateEndId).datepicker(oBaseDatePickerSettings);

View file

@ -124,4 +124,4 @@ function showListenerDataTable() {
} );
},
});
}
}

View file

@ -1,11 +1,11 @@
$(document).ready(function(){
function doNotShowPopup(){
$.get(baseUrl+"Usersettings/donotshowregistrationpopup", {format:"json"});
}
var dialog = $("#register_popup");
dialog.dialog({
autoOpen: false,
width: 500,
@ -30,7 +30,7 @@ $(document).ready(function(){
{
id: "remind_never",
text: $.i18n._("Remind me never"),
"class": "btn",
"class": "btn",
click: function() {
var url =baseUrl+'Usersettings/remindme-never';
$.ajax({
@ -50,23 +50,23 @@ $(document).ready(function(){
}
]
});
var button = $("#help_airtime");
if($("#link_to_terms_and_condition").length > 0 ){
button.removeAttr('disabled').removeClass('ui-state-disabled');
}else{
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
}
dialog.dialog('open');
$('.collapsible-header').live('click',function() {
$(this).next().toggle('fast');
$(this).toggleClass("close");
return false;
}).next().hide();
$("#SupportFeedback").live('click', function(){
var pub = $("#Publicise");
var privacy = $("#Privacy");
@ -95,7 +95,7 @@ $(document).ready(function(){
if( promote.is(":checked")){
$("#public-info").show();
}
$("#Privacy").live('click', function(){
var support = $("#SupportFeedback");
var button = $("#help_airtime");
@ -105,32 +105,32 @@ $(document).ready(function(){
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
}
});
if($("#SupportFeedback").is(':checked') && ($("#Privacy").length == 0 || $("#Privacy").is(':checked'))){
button.removeAttr('disabled').removeClass('ui-state-disabled');
}else{
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
}
$('.toggle legend').live('click',function() {
$('.toggle').toggleClass('closed');
return false;
});
$("#Logo").live('change', function(ev){
var content, res, logoEl;
content = $(this).val();
res = content.match(/(jpg|jpeg|png|gif)$/gi);
logoEl = $("#Logo-element");
//not an accepted image extension.
if (!res) {
var ul, li;
var ul, li;
ul = logoEl.find('.errors');
li = $("<li/>").append($.i18n._("Image must be one of jpg, jpeg, png, or gif"));
//errors ul has already been created.
if (ul.length > 0) {
ul.empty()
@ -142,7 +142,7 @@ $(document).ready(function(){
.find(".errors")
.append(li);
}
$(this).val("");
}
else {
@ -150,7 +150,7 @@ $(document).ready(function(){
}
});
});
function resizeImg(ele, targetWidth, targetHeight){
var img = $(ele);

View file

@ -91,4 +91,3 @@ $(document).ready(function() {
clearTimeout(typingTimer);
});
});

View file

@ -3,18 +3,17 @@ function getRandomIdPlayer(max) {
}
function playerhtml5_insert(settings)
{
atp='';
if(settings.autoplay==true) atp='autoplay';
{
atp='';
if(settings.autoplay==true) atp='autoplay';
if(settings.forceHTTPS==true&&settings.url.indexOf('https')==-1) settings.url=settings.url.replace(/http/g, 'https');
if(settings.replacePort!=''&&settings.replacePort!=false&&settings.replacePort!='false')
if(settings.replacePort!=''&&settings.replacePort!=false&&settings.replacePort!='false')
{
if(settings.replacePortTo!='') settings.replacePortTo=':'+settings.replacePortTo;
if(settings.replacePortTo!='') settings.replacePortTo=':'+settings.replacePortTo;
settings.url=settings.url.replace(':'+settings.replacePort, settings.replacePortTo);
}
if(settings.codec=='mp3') settings.codec='mpeg';
document.getElementById('html5player_skin').innerHTML += '<div id="div_'+settings.elementId+'" style="" ><audio loop controls id="'+settings.elementId+'" src="'+settings.url+'" '+atp+' type="audio/'+settings.codec+'" >'
+'Ihr Browser unterstützt das Element <code>audio</code> nicht.'
+'<\/audio><\/div>';
+'<\/audio><\/div>';
}

View file

@ -3,16 +3,16 @@ var AIRTIME = (function(AIRTIME) {
var $templateDiv;
var $templateList;
var $fileMDList;
if (AIRTIME.itemTemplate === undefined) {
AIRTIME.itemTemplate = {};
}
mod = AIRTIME.itemTemplate;
//config: name, type, filemd, required
function createTemplateLi(config) {
var templateRequired =
var templateRequired =
"<li " +
"data-name='<%= name %>' " +
"data-type='<%= type %>' " +
@ -23,8 +23,8 @@ var AIRTIME = (function(AIRTIME) {
"<span><%= label %></span>" +
"<span><%= type %></span>" +
"</li>";
var templateOptional =
var templateOptional =
"<li " +
"data-name='<%= name %>' " +
"data-type='<%= type %>' " +
@ -36,15 +36,15 @@ var AIRTIME = (function(AIRTIME) {
"<span><%= type %></span>" +
"<span class='template_item_remove'><i class='icon icon-trash'></i></span>" +
"</li>";
var template = (config.required) === true ? templateRequired : templateOptional;
template = _.template(template);
var $li = $(template(config));
return $li;
}
//taken from
//http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
function randomString(len, charSet) {
@ -57,111 +57,111 @@ var AIRTIME = (function(AIRTIME) {
}
return randomString;
}
function addField(config) {
$templateList.append(createTemplateLi(config));
}
function getFieldData($el) {
return {
name: $el.data("name"),
type: $el.data("type"),
label: $el.data("label"),
isFileMd: $el.data("filemd")
};
}
mod.onReady = function() {
$templateDiv = $("#configure_item_template");
$templateList = $(".template_item_list");
$fileMDList = $(".template_file_md");
$fileMDList.on("click", "i.icon-plus", function(){
var $li = $(this).parents("li");
var config = {
name: $li.data("name"),
name: $li.data("name"),
type: $li.data("type"),
label: $li.data("label"),
filemd: true,
filemd: true,
required: false
};
addField(config);
$li.remove();
});
$templateList.sortable();
$templateDiv.on("click", ".template_item_remove", function() {
$(this).parents("li").remove();
});
$templateDiv.on("click", ".template_item_add button", function() {
var $div = $(this).parents("div.template_item_add"),
$input = $div.find("input"),
label = $input.val(),
name;
$input.val("");
//create a string name that will work for all languages.
name = randomString(10);
var config = {
name: name,
label: label,
type: $div.find("select").val(),
filemd: false,
type: $div.find("select").val(),
filemd: false,
required: false
};
addField(config);
});
function updateTemplate(template_id, isDefault) {
var url = baseUrl+"Playouthistorytemplate/update-template/format/json";
var data = {};
var $lis, $li;
var i, len;
var templateName;
templateName = $("#template_name").val();
$lis = $templateList.children();
for (i = 0, len = $lis.length; i < len; i++) {
$li = $($lis[i]);
data[i] = getFieldData($li);
}
$.post(url, {'id': template_id, 'name': templateName, 'fields': data, 'setDefault': isDefault}, function(json) {
var x;
});
}
$templateDiv.on("click", "#template_item_save", function(){
var template_id = $(this).data("template");
updateTemplate(template_id, false);
});
$templateDiv.on("click", "#template_set_default", function() {
var $btn = $(this),
template_id = $btn.data("template"),
template_id = $btn.data("template"),
url = baseUrl+"Playouthistorytemplate/set-template-default/format/json";
$btn.remove();
$.post(url, {id: template_id});
});
};
return AIRTIME;
}(AIRTIME || {}));
$(document).ready(AIRTIME.itemTemplate.onReady);
$(document).ready(AIRTIME.itemTemplate.onReady);

View file

@ -1,90 +1,90 @@
var AIRTIME = (function(AIRTIME) {
var mod;
if (AIRTIME.history === undefined) {
AIRTIME.history = {};
}
mod = AIRTIME.history;
var $historyContentDiv;
var lengthMenu = [[10, 25, 50, 100, 500, -1], [10, 25, 50, 100, 500, $.i18n._("All")]];
var sDom = 'l<"dt-process-rel"r><"H"><"dataTables_scrolling"t><"F"ip>';
var selectedLogItems = {};
var dateStartId = "#his_date_start",
timeStartId = "#his_time_start",
dateEndId = "#his_date_end",
timeEndId = "#his_time_end",
oTableAgg,
oTableItem,
oTableShow,
inShowsTab = false;
function validateTimeRange() {
var oRange,
inputs = $('.his-timerange > input'),
start, end;
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
start = oRange.start;
end = oRange.end;
if (end >= start) {
inputs.removeClass('error');
}
else {
inputs.addClass('error');
}
return {
start: start,
end: end,
isValid: end >= start
};
}
function getSelectedLogItems() {
var items = Object.keys(selectedLogItems);
return items;
}
function addSelectedLogItem($el) {
var id;
$el.addClass("his-selected");
id = $el.data("his-id");
selectedLogItems[id] = "";
}
function removeSelectedLogItem($el) {
var id;
$el.removeClass("his-selected");
id = $el.data("his-id");
delete selectedLogItems[id];
}
function emptySelectedLogItems() {
var $inputs = $historyContentDiv.find(".his_checkbox").find("input");
$inputs.prop('checked', false);
$inputs.parents("tr").removeClass("his-selected");
selectedLogItems = {};
}
function selectCurrentPage(e) {
var $ctx = $(e.currentTarget).parents("div.dataTables_wrapper"),
$inputs = $ctx.find(".his_checkbox").find("input"),
$tr,
$tr,
$input;
$.each($inputs, function(index, input) {
$input = $(input);
$input.prop('checked', true);
@ -92,13 +92,13 @@ var AIRTIME = (function(AIRTIME) {
addSelectedLogItem($tr);
});
}
function deselectCurrentPage(e) {
var $ctx = $(e.currentTarget).parents("div.dataTables_wrapper"),
$inputs = $ctx.find(".his_checkbox").find("input"),
$tr,
$tr,
$input;
$.each($inputs, function(index, input) {
$input = $(input);
$input.prop('checked', false);
@ -106,11 +106,11 @@ var AIRTIME = (function(AIRTIME) {
removeSelectedLogItem($tr);
});
}
function getFileName(ext){
var filename = $("#his_date_start").val()+"_"+$("#his_time_start").val()+"m--"+$("#his_date_end").val()+"_"+$("#his_time_end").val()+"m";
filename = filename.replace(/:/g,"h");
if (ext == "pdf"){
filename = filename+".pdf";
}
@ -119,10 +119,10 @@ var AIRTIME = (function(AIRTIME) {
}
return filename;
}
/* This callback can be used for all history tables */
function fnServerData( sSource, aoData, fnCallback ) {
if (fnServerData.hasOwnProperty("start")) {
aoData.push( { name: "start", value: fnServerData.start} );
}
@ -132,9 +132,9 @@ var AIRTIME = (function(AIRTIME) {
if (fnServerData.hasOwnProperty("instance")) {
aoData.push( { name: "instance_id", value: fnServerData.instance} );
}
aoData.push( { name: "format", value: "json"} );
$.ajax( {
"dataType": 'json',
"type": "GET",
@ -143,12 +143,12 @@ var AIRTIME = (function(AIRTIME) {
"success": fnCallback
} );
}
function createShowAccordSection(config) {
var template,
$el;
template =
template =
"<h3>" +
"<a href='#'>" +
"<span class='show-title'><%= name %></span>" +
@ -163,47 +163,47 @@ var AIRTIME = (function(AIRTIME) {
"<div " +
"data-instance='<%= instance %>' " +
"></div>";
template = _.template(template);
$el = $(template(config));
return $el;
}
//$el is the div in the accordian we should create the table on.
function createShowTable($el) {
var instance = $el.data("instance");
var $table = $("<table/>", {
'cellpadding': "0",
'cellspacing': "0",
'cellpadding': "0",
'cellspacing': "0",
'class': "datatable",
'id': "history_table_show"
});
//assign the retrieval function the show instance id.
fnServerData.instance = instance;
$el.append($table);
$el.css("height", "auto");
oTableShow = itemHistoryTable("history_table_show");
}
function drawShowList(oShows) {
var $showList = $historyContentDiv.find("#history_show_summary"),
i,
len,
i,
len,
$accordSection,
show,
tmp;
$showList
.accordion( "destroy" )
.empty();
for (i = 0, len = oShows.length; i < len; i++) {
show = oShows[i];
tmp = show.starts.split(" ");
$accordSection = createShowAccordSection({
instance: show.instance_id,
name: show.name,
@ -211,10 +211,10 @@ var AIRTIME = (function(AIRTIME) {
startTime: tmp[1],
endTime: show.ends.split(" ").pop()
});
$showList.append($accordSection);
}
$showList.accordion({
animated: false,
create: function( event, ui ) {
@ -232,7 +232,7 @@ var AIRTIME = (function(AIRTIME) {
//changestart: function( event, ui ) {}
});
}
function createToolbarButtons ($el) {
var $menu = $("<div class='btn-toolbar' />");
@ -269,10 +269,10 @@ var AIRTIME = (function(AIRTIME) {
"<i class='icon-white icon-trash'></i>" +
"</button>" +
"</div>");
$el.append($menu);
}
function aggregateHistoryTable() {
var oTable,
$historyTableDiv = $historyContentDiv.find("#history_table_aggregate"),
@ -282,16 +282,16 @@ var AIRTIME = (function(AIRTIME) {
fnRowCallback = function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var editUrl = baseUrl+"playouthistory/edit-file-item/id/"+aData.file_id,
$nRow = $(nRow);
$nRow.data('url-edit', editUrl);
};
columns = JSON.parse(localStorage.getItem('datatables-historyfile-aoColumns'));
oTable = $historyTableDiv.dataTable( {
"aoColumns": columns,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": baseUrl+"playouthistory/file-history-feed",
@ -310,13 +310,13 @@ var AIRTIME = (function(AIRTIME) {
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bAutoWidth": true,
"sDom": sDom,
"sDom": sDom,
});
oTable.fnSetFilteringDelay(350);
return oTable;
}
function itemHistoryTable(id) {
var oTable,
$historyTableDiv = $historyContentDiv.find("#"+id),
@ -325,11 +325,11 @@ var AIRTIME = (function(AIRTIME) {
fnRowCallback,
booleans = {},
i, c;
columns = JSON.parse(localStorage.getItem('datatables-historyitem-aoColumns'));
for (i in columns) {
c = columns[i];
if (c["sDataType"] === "boolean") {
booleans[c["mDataProp"]] = c["sTitle"];
@ -341,22 +341,22 @@ var AIRTIME = (function(AIRTIME) {
deleteUrl = baseUrl+"playouthistory/delete-list-item/id/"+aData.history_id,
emptyCheckBox = String.fromCharCode(parseInt(2610, 16)),
checkedCheckBox = String.fromCharCode(parseInt(2612, 16)),
b,
b,
text,
$nRow = $(nRow);
// add checkbox
$nRow.find('td.his_checkbox').html("<input type='checkbox' name='cb_"+aData.history_id+"'>");
$nRow.data('his-id', aData.history_id);
$nRow.data('url-edit', editUrl);
$nRow.data('url-delete', deleteUrl);
for (b in booleans) {
text = aData[b] ? checkedCheckBox : emptyCheckBox;
text = text + " " + booleans[b];
$nRow.find(".his_"+b).html(text);
}
};
@ -382,16 +382,16 @@ var AIRTIME = (function(AIRTIME) {
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bAutoWidth": true,
"sDom": sDom,
"sDom": sDom,
});
oTable.fnSetFilteringDelay(350);
$toolbar = $historyTableDiv.parents(".dataTables_wrapper").find(".fg-toolbar:first");
createToolbarButtons($toolbar);
return oTable;
}
function showSummaryList(start, end) {
var url = baseUrl+"playouthistory/show-history-feed",
data = {
@ -399,18 +399,18 @@ var AIRTIME = (function(AIRTIME) {
start: start,
end: end
};
$.post(url, data, function(json) {
drawShowList(json);
});
}
mod.onReady = function() {
var oBaseDatePickerSettings,
oBaseTimePickerSettings,
$hisDialogEl,
tabsInit = [
{
initialized: false,
@ -443,105 +443,105 @@ var AIRTIME = (function(AIRTIME) {
{
initialized: false,
initialize: function() {
},
navigate: function() {
},
always: function() {
inShowsTab = true;
var info = getStartEnd();
showSummaryList(info.start, info.end);
emptySelectedLogItems();
}
}
];
//set the locale names for the bootstrap calendar.
$.fn.datetimepicker.dates = {
daysMin: i18n_days_short,
months: i18n_months,
monthsShort: i18n_months_short
};
$historyContentDiv = $("#history_content");
function redrawTables() {
oTableAgg && oTableAgg.fnDraw();
oTableItem && oTableItem.fnDraw();
oTableShow && oTableShow.fnDraw();
}
function removeHistoryDialog() {
$hisDialogEl.dialog("destroy");
$hisDialogEl.remove();
}
function initializeDialog() {
var $startPicker = $hisDialogEl.find('#his_item_starts_datetimepicker'),
$endPicker = $hisDialogEl.find('#his_item_ends_datetimepicker');
$startPicker.datetimepicker();
$endPicker.datetimepicker({
showTimeFirst: true
});
$startPicker.on('changeDate', function(e) {
$endPicker.data('datetimepicker').setLocalDate(e.localDate);
$endPicker.data('datetimepicker').setLocalDate(e.localDate);
});
}
function processDialogHtml($el) {
if (inShowsTab) {
$el.find("#his_choose_instance").remove();
}
return $el
}
function makeHistoryDialog(html) {
$hisDialogEl = $(html);
$hisDialogEl = processDialogHtml($hisDialogEl);
$hisDialogEl.dialog({
$hisDialogEl.dialog({
title: $.i18n._("Edit History Record"),
modal: false,
open: function( event, ui ) {
initializeDialog();
initializeDialog();
},
close: function() {
removeHistoryDialog();
}
});
}
hisSubmit(); // Fixes display bug
/*
* Icon hover states for search.
*/
$historyContentDiv.on("mouseenter", ".his-timerange .ui-button", function(ev) {
$(this).addClass("ui-state-hover");
$(this).addClass("ui-state-hover");
});
$historyContentDiv.on("mouseleave", ".his-timerange .ui-button", function(ev) {
$(this).removeClass("ui-state-hover");
});
oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd',
//i18n_months, i18n_days_short are in common.js
monthNames: i18n_months,
dayNamesMin: i18n_days_short,
onSelect: function(sDate, oDatePicker) {
onSelect: function(sDate, oDatePicker) {
$(this).datepicker( "setDate", sDate );
},
onClose: validateTimeRange
};
oBaseTimePickerSettings = {
showPeriodLabels: false,
showCloseButton: true,
@ -556,28 +556,28 @@ var AIRTIME = (function(AIRTIME) {
$historyContentDiv.find(dateStartId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$historyContentDiv.find(timeStartId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
$historyContentDiv.find(dateEndId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$historyContentDiv.find(timeEndId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
$historyContentDiv.on("click", "#his_create", function(e) {
var url = baseUrl+"playouthistory/edit-list-item/format/json" ;
e.preventDefault();
$.get(url, function(json) {
makeHistoryDialog(json.dialog);
}, "json");
});
@ -639,14 +639,14 @@ var AIRTIME = (function(AIRTIME) {
// Removing extra fields
delete element.checkbox;
delete element.history_id;
delete element.instance_id;
delete element.instance_id;
dd.content[2].table.body.push(Object.values(element));
});
// Make PDF and start download
pdfMake.createPdf(dd).download();
};
});
$historyContentDiv.on("click", "#csv_export", async function(){
// Get date/time from pickers
var startDay = document.querySelector('#his_date_start').value;
@ -687,22 +687,22 @@ var AIRTIME = (function(AIRTIME) {
var csvX = new CSVExport(hisData); // Actual export function
return false // Was part of the demo. Please leave as is.
});
$('body').on("click", ".his_file_cancel, .his_item_cancel", function(e) {
removeHistoryDialog();
});
$('body').on("click", ".his_file_save", function(e) {
e.preventDefault();
var $form = $(this).parents("form");
var data = $form.serializeArray();
var url = baseUrl+"Playouthistory/update-file-item/format/json";
$.post(url, data, function(json) {
//TODO put errors on form.
if (json.error !== undefined) {
//makeHistoryDialog(json.dialog);
@ -711,15 +711,15 @@ var AIRTIME = (function(AIRTIME) {
removeHistoryDialog();
redrawTables();
}
}, "json");
});
$('body').on("click", ".his_item_save", function(e) {
e.preventDefault();
var $form = $(this).parents("form"),
data = $form.serializeArray(),
id = data[0].value,
@ -728,9 +728,9 @@ var AIRTIME = (function(AIRTIME) {
url,
$select = $hisDialogEl.find("#his_instance_select"),
instance;
url = (id === "") ? createUrl : updateUrl;
if (fnServerData.instance !== undefined) {
data.push({
name: "instance_id",
@ -739,17 +739,17 @@ var AIRTIME = (function(AIRTIME) {
}
else if ($select.length > 0) {
instance = $select.val();
if (instance > 0) {
data.push({
name: "instance_id",
value: instance
});
}
}
}
$.post(url, data, function(json) {
if (json.form !== undefined) {
var $newForm = $(json.form);
$newForm = processDialogHtml($newForm);
@ -760,16 +760,16 @@ var AIRTIME = (function(AIRTIME) {
removeHistoryDialog();
redrawTables();
}
}, "json");
});
$historyContentDiv.on("click", ".his_checkbox input", function(e) {
var checked = e.currentTarget.checked,
$tr = $(e.currentTarget).parents("tr");
if (checked) {
addSelectedLogItem($tr);
}
@ -777,7 +777,7 @@ var AIRTIME = (function(AIRTIME) {
removeSelectedLogItem($tr);
}
});
$('body').on("click", "#his_instance_retrieve", function(e) {
var startPicker = $hisDialogEl.find('#his_item_starts'),
endPicker = $hisDialogEl.find('#his_item_ends'),
@ -785,13 +785,13 @@ var AIRTIME = (function(AIRTIME) {
startDate = startPicker.val(),
endDate = endPicker.val(),
data;
data = {
start: startDate,
end: endDate,
format: "json"
};
$.get(url, data, function(json) {
var i,
$select = $('<select/>', {
@ -800,43 +800,43 @@ var AIRTIME = (function(AIRTIME) {
$option,
show;
if (json.length > 0) {
if (json.length > 0) {
for (i = 0; i < json.length; i++) {
show = json[i];
$option = $('<option/>')
.text(show.name)
.attr('value', show.instance_id);
$select.append($option);
}
}
$option = $('<option/>')
.text($.i18n._("No Show"))
.attr('value', 0);
$select.append($option);
$hisDialogEl.find("#his_instance_select").replaceWith($select);
});
});
function getStartEnd() {
function getStartEnd() {
return AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
}
function hisSubmit(){
var fn, info;
info = getStartEnd();
fn = fnServerData;
fn.start = info.start;
fn.end = info.end;
if (inShowsTab) {
showSummaryList(info.start, info.end);
}
@ -848,27 +848,27 @@ var AIRTIME = (function(AIRTIME) {
$historyContentDiv.find("#his_submit").click(function(ev){
hisSubmit();
});
$historyContentDiv.on("click", ".his-select-page", selectCurrentPage);
$historyContentDiv.on("click", ".his-dselect-page", deselectCurrentPage);
$historyContentDiv.on("click", ".his-dselect-all", emptySelectedLogItems);
$historyContentDiv.on("click", "#his_trash", function(ev){
var items = getSelectedLogItems(),
url = baseUrl+"playouthistory/delete-list-items";
$.post(url, {ids: items, format: "json"}, function() {
selectedLogItems = {};
redrawTables();
});
});
$historyContentDiv.find("#his-tabs").tabs({
show: function( event, ui ) {
var href = $(ui.tab).attr("href");
var index = href.split('-').pop();
var tab = tabsInit[index-1];
if (!tab.initialized) {
tab.initialize();
tab.initialized = true;
@ -876,73 +876,73 @@ var AIRTIME = (function(AIRTIME) {
else {
tab.navigate();
}
tab.always();
}
});
// begin context menu initialization.
$.contextMenu({
selector: '#history_content td:not(.his_checkbox)',
trigger: "left",
ignoreRightClick: true,
build: function($el, e) {
var items = {},
callback,
var items = {},
callback,
$tr,
editUrl,
deleteUrl;
$tr = $el.parents("tr");
editUrl = $tr.data("url-edit");
deleteUrl = $tr.data("url-delete");
if (editUrl !== undefined) {
callback = function() {
$.post(editUrl, {format: "json"}, function(json) {
makeHistoryDialog(json.dialog);
}, "json");
};
items["edit"] = {
"name": $.i18n._("Edit"),
"icon": "edit",
"callback": callback
};
}
if (deleteUrl !== undefined) {
callback = function() {
var c = confirm("Delete this entry?");
if (c) {
$.post(deleteUrl, {format: "json"}, function(json) {
redrawTables();
});
}
}
};
items["del"] = {
"name": $.i18n._("Delete"),
"icon": "delete",
"callback": callback
};
}
return {
items: items
};
}
});
};
return AIRTIME;
}(AIRTIME || {}));
$(document).ready(AIRTIME.history.onReady);
$(document).ready(AIRTIME.history.onReady);

View file

@ -1,102 +1,102 @@
var AIRTIME = (function(AIRTIME) {
var mod;
var $historyTemplate;
if (AIRTIME.template === undefined) {
AIRTIME.template = {};
}
mod = AIRTIME.template;
function createItemLi(id, name, configured) {
var editUrl = baseUrl+"Playouthistorytemplate/configure-template/id/"+id;
var defaultUrl = baseUrl+"Playouthistorytemplate/set-template-default/format/json/id/"+id;
var removeUrl = baseUrl+"Playouthistorytemplate/delete-template/format/json/id/"+id;
var itemConfigured =
var itemConfigured =
"<li class='template_configured' data-template='<%= id %>' data-name='<%= name %>'>" +
"<a href='<%= editUrl %>' class='template_name'><%= name %></a>" +
"<i class='icon icon-ok'></i>" +
"</li>";
var item =
var item =
"<li data-template='<%= id %>' data-name='<%= name %>'>" +
"<a href='<%= editUrl %>' class='template_name'><%= name %></a>" +
"<a href='<%= removeUrl %>' class='template_remove'><i class='icon icon-trash'></i></a>" +
"<a href='<%= defaultUrl %>' class='template_default'>" + $.i18n._('Set Default') + "</a>" +
"<a href='<%= defaultUrl %>' class='template_default'>" + $.i18n._('Set Default') + "</a>" +
"</li>";
var template = (configured) === true ? itemConfigured : item;
var template = _.template(template);
var $li = $(template({id: id, name: name, editUrl: editUrl, defaultUrl: defaultUrl, removeUrl: removeUrl}));
return $li;
}
mod.onReady = function() {
$historyTemplate = $("#history_template");
$historyTemplate.on("click", ".template_remove", function(ev) {
ev.preventDefault();
var $a = $(this);
var url = $a.attr("href");
$a.parents("li").remove();
$.post(url, function(){
var x;
});
});
$historyTemplate.on("click", ".template_default", function(ev) {
ev.preventDefault();
var $a = $(this);
var url = $a.attr("href");
var $oldLi, $newLi;
$oldLi = $a.parents("ul").find("li.template_configured");
$newLi = $a.parents("li");
$oldLi.replaceWith(createItemLi($oldLi.data('template'), $oldLi.data('name'), false));
$newLi.replaceWith(createItemLi($newLi.data('template'), $newLi.data('name'), true));
$.post(url, function(){
var x;
});
});
function createTemplate(type) {
var createUrl = baseUrl+"Playouthistorytemplate/create-template";
$.post(createUrl, {format: "json", type: type}, function(json) {
if (json.error !== undefined) {
alert(json.error);
return;
}
window.location.href = json.url;
});
}
$historyTemplate.on("click", "#new_item_template", function() {
createTemplate("item");
});
$historyTemplate.on("click", "#new_file_template", function() {
createTemplate("file");
});
};
return AIRTIME;
}(AIRTIME || {}));
$(document).ready(AIRTIME.template.onReady);
$(document).ready(AIRTIME.template.onReady);

View file

@ -42,7 +42,7 @@ function setWatchedDirEvents() {
$('#storageFolder-ok').click(function(){
var url, chosen;
if(confirm(sprintf($.i18n._("Are you sure you want to change the storage folder?\nThis will remove the files from your %s library!"), PRODUCT_NAME))){
url = baseUrl+"Preference/change-stor-directory";
chosen = $('#storageFolder').val();
@ -57,7 +57,7 @@ function setWatchedDirEvents() {
});
}
else {
$('#storageFolder').val("");
$('#storageFolder').val("");
}
});
@ -77,7 +77,7 @@ function setWatchedDirEvents() {
setWatchedDirEvents();
});
});
$('.selected-item').find('.ui-icon-refresh').click(function(){
var folder = $(this).prev().text();
$.get(baseUrl+"Preference/rescan-watch-directory", {format: "json", dir: folder});
@ -125,5 +125,5 @@ $(document).ready(function() {
show: 'mouseover',
hide: 'mouseout'
});
});

View file

@ -15,7 +15,7 @@ function setConfigureMailServerListener() {
configMailServer.click(function(event){
setMailServerInputReadonly();
});
var msRequiresAuth = $("#msRequiresAuth");
msRequiresAuth.click(function(event){
setMsAuthenticationFieldsReadonly($(this));
@ -57,7 +57,7 @@ function setMailServerInputReadonly() {
var mailServer = $("#mailServer");
var port = $("#port");
var requiresAuthCB = $("#msRequiresAuth");
if (configMailServer.is(':checked')) {
mailServer.removeAttr("readonly");
port.removeAttr("readonly");
@ -67,7 +67,7 @@ function setMailServerInputReadonly() {
port.attr("readonly", "readonly");
requiresAuthCB.parent().hide();
}
setMsAuthenticationFieldsReadonly(requiresAuthCB);
}
@ -102,7 +102,7 @@ function setMsAuthenticationFieldsReadonly(ele) {
var email = $("#email");
var password = $("#ms_password");
var configureMailServer = $("#configureMailServer");
if (ele.is(':checked') && configureMailServer.is(':checked')) {
email.removeAttr("readonly");
password.removeAttr("readonly");
@ -144,7 +144,7 @@ $(document).ready(function() {
$('#pref_save').live('click', function() {
var data = $('#pref_form').serialize();
var url = baseUrl+'Preference/index';
$.post(url, {format: "json", data: data}, function(json){
$('#content').empty().append(json.html);
setTimeout(removeSuccessMsg, 5000);
@ -186,7 +186,7 @@ $(document).ready(function() {
}
showErrorSections();
setMailServerInputReadonly();
setPodcastAutoSmartblockReadonly();
setSystemFromEmailReadonly();

View file

@ -52,7 +52,7 @@ function hideForShoutcast(ele){
div.find("select[id$=data-type]").find("option[value='mp3']").attr('selected','selected');
div.find("select[id$=data-type]").find("option[value='ogg']").attr("disabled","disabled");
div.find("select[id$=data-type]").find("option[value='opus']").attr("disabled","disabled");
restrictOggBitrate(ele, false)
}
@ -116,13 +116,13 @@ function setLiveSourceConnectionOverrideListener(){
$(this).parent().find("div[id$='_dj_connection_url_actions']").show();
event.preventDefault();
});
// set action for "OK" and "X"
var live_dj_actions = $("#live_dj_connection_url_actions");
var live_dj_input = live_dj_actions.parent().find("dd[id$='_source_host-element']").children();
var master_dj_actions = $("#master_dj_connection_url_actions");
var master_dj_input = master_dj_actions.parent().find("dd[id$='_source_host-element']").children();
live_dj_actions.find("#ok").click(function(event){
event.preventDefault();
var url = live_dj_input.val();
@ -132,7 +132,7 @@ function setLiveSourceConnectionOverrideListener(){
$.get(baseUrl+"Preference/set-source-connection-url", {format: "json", type: "livedj", url:encodeURIComponent(url), override: 1});
event.preventDefault();
});
live_dj_actions.find("#reset").click(function(event){
event.preventDefault();
var port = $("#show_source_port").val();
@ -147,7 +147,7 @@ function setLiveSourceConnectionOverrideListener(){
$.get(baseUrl+"Preference/set-source-connection-url", {format: "json", type: "livedj", url:encodeURIComponent(url), override: 0});
event.preventDefault();
});
master_dj_actions.find("#ok").click(function(event){
var url = master_dj_input.val();
master_dj_input.val(url);
@ -156,7 +156,7 @@ function setLiveSourceConnectionOverrideListener(){
$.get(baseUrl+"Preference/set-source-connection-url", {format: "json", type: "masterdj", url:encodeURIComponent(url), override: 1});
event.preventDefault();
});
master_dj_actions.find("#reset").click(function(event){
var port = $("#master_source_port").val();
var mount = $("#master_source_mount").val();
@ -178,25 +178,25 @@ function setupEventListeners() {
$("dd[id=outputStreamURL-element]").each(function(){
rebuildStreamURL($(this));
})
$("input[id$=-host], input[id$=-port], input[id$=-mount]").keyup(function(){
rebuildStreamURL($(this));
});
$("input[id$=-port]").keypress(function(e){
validate($(this),e);
});
$("select[id$=-output]").change(function(){
rebuildStreamURL($(this));
});
if(!$("#output_sound_device").is(':checked')){
$("select[id=output_sound_device_type]").attr('disabled', 'disabled');
}else{
$("select[id=output_sound_device_type]").removeAttr('disabled');
}
$("#output_sound_device").change(function(){
if($(this).is(':checked')){
$("select[id=output_sound_device_type]").removeAttr('disabled');
@ -204,7 +204,7 @@ function setupEventListeners() {
$("select[id=output_sound_device_type]").attr('disabled', 'disabled');
}
});
$("select[id$=data-type]").change(function(){
if($(this).val() == 'ogg'){
restrictOggBitrate($(this), true);
@ -218,7 +218,7 @@ function setupEventListeners() {
restrictOggBitrate($(this), true);
}
});
$("select[id$=data-output]").change(function(){
if($(this).val() == 'shoutcast'){
hideForShoutcast($(this));
@ -226,31 +226,31 @@ function setupEventListeners() {
showForIcecast($(this));
}
});
$("select[id$=data-output]").each(function(){
if($(this).val() == 'shoutcast'){
hideForShoutcast($(this));
}
});
$('.toggle legend').click(function() {
$(this).parent().toggleClass('closed');
return false;
});
$('.collapsible-header').click(function() {
$(this).next().toggle('fast');
$(this).toggleClass("closed");
return false;
});
setLiveSourceConnectionOverrideListener();
showErrorSections();
checkLiquidsoapStatus();
var userManualAnchorOpen = "<a target='_blank' href='" + USER_MANUAL_URL + "'>";
// qtip for help text
$(".override_help_icon").qtip({
content: {
@ -274,7 +274,7 @@ function setupEventListeners() {
at: "right center"
},
});
$(".icecast_metadata_help_icon").qtip({
content: {
text: $.i18n._("Check this option to enable metadata for OGG streams (stream metadata is the track title, artist, and show name that is displayed in an audio player). VLC and mplayer have a serious bug when playing an OGG/VORBIS stream that has metadata information enabled: they will disconnect from the stream after every song. If you are using an OGG stream and your listeners do not require support for these audio players, then feel free to enable this option.")
@ -295,7 +295,7 @@ function setupEventListeners() {
at: "right center"
},
});
$("#auto_transition_help").qtip({
content: {
text: $.i18n._("Check this box to automatically switch off Master/Show source upon source disconnection.")
@ -316,7 +316,7 @@ function setupEventListeners() {
at: "right center"
},
});
$("#auto_switch_help").qtip({
content: {
text: $.i18n._("Check this box to automatically switch on Master/Show source upon source connection.")
@ -337,7 +337,7 @@ function setupEventListeners() {
at: "right center"
},
});
$(".stream_username_help_icon").qtip({
content: {
text: $.i18n._("If your Icecast server expects a username of 'source', this field can be left blank.")
@ -358,7 +358,7 @@ function setupEventListeners() {
at: "right center"
},
});
$(".admin_username_help_icon").qtip({
content: {
text: $.i18n._("This is the admin username and password for Icecast/SHOUTcast to get listener statistics.")
@ -379,7 +379,7 @@ function setupEventListeners() {
at: "right center"
},
});
$(".master_username_help_icon").qtip({
content: {
text: $.i18n._("If your live streaming client does not ask for a username, this field should be 'source'.")
@ -400,14 +400,14 @@ function setupEventListeners() {
at: "right center"
},
});
$(".stream_type_help_icon").qtip({
content: {
text: sprintf(
$.i18n._("Some stream types require extra configuration. Details about enabling %sAAC+ Support%s or %sOpus Support%s are provided."),
"<a target='_blank' href='https://wiki.sourcefabric.org/x/NgPQ'>",
$.i18n._("Some stream types require extra configuration. Details about enabling %sAAC+ Support%s or %sOpus Support%s are provided."),
"<a target='_blank' href='https://wiki.sourcefabric.org/x/NgPQ'>",
"</a>",
"<a target='_blank' href='https://wiki.sourcefabric.org/x/KgPQ'>",
"<a target='_blank' href='https://wiki.sourcefabric.org/x/KgPQ'>",
"</a>")
},
hide: {
@ -460,7 +460,7 @@ function setPseudoAdminPassword(s1, s2, s3, s4) {
function getAdminPasswordStatus() {
$.ajax({ url: baseUrl+'Preference/get-admin-password-status/format/json', dataType:"json", success:function(data){
setPseudoAdminPassword(data.s1, data.s2, data.s3, data.s4);
}});
}});
}
$(document).ready(function() {
@ -481,7 +481,7 @@ $(document).ready(function() {
$('#content').empty().append(json.html);
if (json.valid) {
window.location.reload();
}
}
setupEventListeners();
setSliderForReplayGain();
getAdminPasswordStatus();
@ -496,4 +496,3 @@ $(document).ready(function() {
}
});
});

View file

@ -27,7 +27,7 @@ function openAddShowForm(nowOrFuture) {
$('#schedule-record-rebroadcast').hide();
$('#schedule-show-who').hide();
$('#schedule-show-style').hide();
}
$("#schedule-show-what").show(0, function(){
$add_show_name = $("#add_show_name");
@ -101,18 +101,18 @@ function calculateShowColor() {
//$el is DOM element #add-show-form
//form is the new form contents to append to $el
function redrawAddShowForm($el, form) {
//need to clean up the color picker.
$el.find("#schedule-show-style input").each(function(i, el){
var $input = $(this),
var $input = $(this),
colId = $input.data("colorpickerId");
$("#"+colId).remove();
$input.removeData();
});
$el.empty().append(form);
setAddShowEvents($el);
}
@ -121,7 +121,7 @@ function closeAddShowForm(event) {
event.preventDefault();
var $el = $("#add-show-form");
$el.hide();
windowResize();
@ -146,7 +146,7 @@ function startDpSelect(dateText, inst) {
function endDpSelect(dateText, inst) {
var time, date;
time = dateText.split("-");
date = new Date(time[0], time[1] - 1, time[2]);
@ -187,7 +187,7 @@ function findHosts(request, callback) {
noResult[0]['value'] = $("#add_show_hosts_autocomplete").val();
noResult[0]['label'] = $.i18n._("No result found");
noResult[0]['index'] = null;
$.post(url,
{format: "json", term: search},
@ -202,12 +202,12 @@ function findHosts(request, callback) {
}
function beginEditShow(data){
if (data.show_error == true){
alertShowErrorAndReload();
return false;
}
redrawAddShowForm($("#add-show-form"), data.newForm);
toggleAddShowButton();
openAddShowForm(false);
@ -234,11 +234,11 @@ function hashCode(str) { // java String#hashCode
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
return hash;
}
}
function intToRGB(i){
return (padZeroes(((i>>16)&0xFF).toString(16), 2) +
padZeroes(((i>>8)&0xFF).toString(16), 2)+
return (padZeroes(((i>>16)&0xFF).toString(16), 2) +
padZeroes(((i>>8)&0xFF).toString(16), 2)+
padZeroes((i&0xFF).toString(16), 2)
);
}
@ -302,11 +302,11 @@ function setAddShowEvents(form) {
if(!form.find("#add_show_rebroadcast").attr('checked')) {
form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide();
}
// If we're adding a new show or the show has no logo, hide the "Current Logo" element tree
$("[id^=add_show_logo_current]").toggle(($("#add_show_logo_current").attr("src") !== "")
&& ($(".button-bar.bottom").find(".ui-button-text").text() === "Update show"));
var submitButton = $(".button-bar.bottom").find(".add-show-submit");
$("[id^=add_show_instance_description]").toggle(submitButton.attr("data-action") === "edit-repeating-show-instance");
@ -319,7 +319,7 @@ function setAddShowEvents(form) {
form.find("#add_show_repeats").click(function(){
$(this).blur();
form.find("#schedule-show-when > fieldset:last").toggle();
var checkBoxSelected = false;
var days = form.find("#add_show_day_check-element input").each( function() {
var currentCheckBox = $(this).attr("checked");
@ -327,14 +327,14 @@ function setAddShowEvents(form) {
checkBoxSelected = true;
}
});
if (!checkBoxSelected){
var d = getDateFromString(form.find("#add_show_start_date").attr("value"));
if ( d != null)
form.find("#add_show_day_check-"+d.getDay()).attr('checked', true);
}
//must switch rebroadcast displays
if(form.find("#add_show_rebroadcast").attr('checked')) {
@ -356,13 +356,13 @@ function setAddShowEvents(form) {
}
return false;
}
//only display the warning message if a show is being edited
if ($(".button-bar.bottom").find(".ui-button-text").text() === "Update show") {
if ($(this).attr("checked") && $("#show-link-warning").length === 0) {
$(this).parent().after("<ul id='show-link-warning' class='errors'><li>"+$.i18n._("Warning: All other repetitions of this show will have their contents replaced to match the show you selected 'Edit Show' with.")+"</li></ul>");
}
if (!$(this).attr("checked") && $("#show-link-warning").length !== 0) {
$("#show-link-warning").remove();
}
@ -484,7 +484,7 @@ function setAddShowEvents(form) {
at: "right center"
}
});
form.find(".show_autoplaylist_help_icon").qtip({
content: {
text: $.i18n._("Autoloading playlists' contents are added to shows one hour before the show airs. <a target='_blank' href='http://libretime.org/docs/playlists'>More information</a>")
@ -679,7 +679,7 @@ function setAddShowEvents(form) {
select: autoSelect,
delay: 200
});
form.find("#add_show_hosts_autocomplete").keypress(function(e){
if( e.which == 13 ){
return false;
@ -698,13 +698,13 @@ function setAddShowEvents(form) {
$(this).ColorPickerSetColor(this.value);
}
});
// when an image is uploaded, we want to show it to the user
form.find("#add_show_logo").change(function(event) {
if (this.files && this.files[0]) {
$("#add_show_logo_preview").show();
var reader = new FileReader(); // browser compatibility?
reader.onload = function (e) {
$("#add_show_logo_preview")
.attr('src', e.target.result);
@ -723,14 +723,14 @@ function setAddShowEvents(form) {
$("#add_show_logo_preview").hide();
}
});
form.find("#add_show_logo_current_remove").click(function() {
if (confirm($.i18n._('Are you sure you want to delete the current logo?'))) {
var showId = $("#add_show_id").attr("value");
if (showId && $("#add_show_logo_current").attr("src") !== "") {
var action = '/rest/show-image?csrf_token=' + $('#csrf').val() + '&id=' + showId;
$.ajax({
url: action,
data: '',
@ -743,15 +743,15 @@ function setAddShowEvents(form) {
}
}
});
form.find("#add-show-close").click(closeAddShowForm);
form.find(".add-show-submit").click(function(event) {
event.preventDefault();
var addShowButton = $(this);
$('#schedule-add-show').block({
$('#schedule-add-show').block({
message: null,
applyPlatformOpacityRules: false
});
@ -762,10 +762,10 @@ function setAddShowEvents(form) {
if (form.find("#add_show_record").attr("disabled", true)) {
form.find("#add_show_record").attr("disabled", false);
}
var startDateDisabled = false,
startTimeDisabled = false;
// Similarly, we need to re-enable start date and time if they're disabled
if (form.find("#add_show_start_date").prop("disabled") === true) {
form.find("#add_show_start_date").attr("disabled", false);
@ -780,7 +780,7 @@ function setAddShowEvents(form) {
// We need to notify the application if date and time were disabled
data.push({name: 'start_date_disabled', value: startDateDisabled});
data.push({name: 'start_time_disabled', value: startTimeDisabled});
var hosts = $('#add_show_hosts-element input').map(function() {
if($(this).attr("checked")) {
return $(this).val();
@ -796,7 +796,7 @@ function setAddShowEvents(form) {
var start_date = $("#add_show_start_date").val(),
end_date = $("#add_show_end_date").val(),
action = baseUrl+"Schedule/"+String(addShowButton.attr("data-action"));
var image;
if ($('#add_show_logo')[0] && $('#add_show_logo')[0].files
&& $('#add_show_logo')[0].files[0]) {
@ -805,12 +805,12 @@ function setAddShowEvents(form) {
}
$.ajax({
url: action,
url: action,
data: {format: "json", data: data, hosts: hosts, days: days},
success: function(json) {
if (json.showId && image) { // Successfully added the show, and it contains an image to upload
var imageAction = '/rest/show-image?csrf_token=' + $('#csrf').val() + '&id=' + json.showId;
// perform a second xhttprequest in order to send the show image
$.ajax({
url: imageAction,
@ -823,20 +823,20 @@ function setAddShowEvents(form) {
}
$('#schedule-add-show').unblock();
var $addShowForm = $("#add-show-form");
if (json.form) {
redrawAddShowForm($addShowForm, json.form);
$("#add_show_end_date").val(end_date);
$("#add_show_start_date").val(start_date);
showErrorSections();
} else if (json.edit) {
$("#schedule_calendar").removeAttr("style")
.fullCalendar('render');
$addShowForm.hide();
toggleAddShowButton();
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json){
@ -858,23 +858,23 @@ function setAddShowEvents(form) {
var regDate = new RegExp(/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]$/);
var regTime = new RegExp(/^[0-2][0-9]:[0-5][0-9]$/);
// when start date/time changes, set end date/time to start date/time+1 hr
$('#add_show_start_date, #add_show_start_time').bind('input', 'change', function(){
var startDateString = $('#add_show_start_date').val();
var startTimeString = $('#add_show_start_time').val();
if(regDate.test(startDateString) && regTime.test(startTimeString)){
var startDate = startDateString.split('-');
var startTime = startTimeString.split(':');
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
var endDateString = $('#add_show_end_date_no_repeat').val();
var endTimeString = $('#add_show_end_time').val()
var endDate = endDateString.split('-');
var endTime = endTimeString.split(':');
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
if(startDateTime.getTime() >= endDateTime.getTime()){
var duration = $('#add_show_duration').val();
// parse duration
@ -888,13 +888,13 @@ function setAddShowEvents(form) {
}
endDateTime = new Date(startDateTime.getTime() + time);
}
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2);
$('#add_show_end_date_no_repeat').val(endDateFormat);
$('#add_show_end_time').val(endTimeFormat);
// calculate duration
var startDateTimeString = startDateString + " " + startTimeString;
var endDateTimeString = $('#add_show_end_date_no_repeat').val() + " " + $('#add_show_end_time').val();
@ -907,7 +907,7 @@ function setAddShowEvents(form) {
$('#add_show_end_date_no_repeat, #add_show_end_time').bind('input', 'change', function(){
var endDateString = $('#add_show_end_date_no_repeat').val();
var endTimeString = $('#add_show_end_time').val()
if(regDate.test(endDateString) && regTime.test(endTimeString)){
var startDateString = $('#add_show_start_date').val();
var startTimeString = $('#add_show_start_time').val();
@ -918,7 +918,7 @@ function setAddShowEvents(form) {
var endDate = endDateString.split('-');
var endTime = endTimeString.split(':');
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
if(startDateTime.getTime() > endDateTime.getTime()){
$('#add_show_end_date_no_repeat').css('background-color', '#F49C9C');
$('#add_show_end_time').css('background-color', '#F49C9C');
@ -926,7 +926,7 @@ function setAddShowEvents(form) {
$('#add_show_end_date_no_repeat').css('background-color', '');
$('#add_show_end_time').css('background-color', '');
}
// calculate duration
var startDateTimeString = startDateString + " " + startTimeString;
var endDateTimeString = endDateString + " " + endTimeString;
@ -940,7 +940,7 @@ function setAddShowEvents(form) {
}else{
$('#custom_auth_div').hide()
}
$('#cb_custom_auth').change(function(){
if($(this).attr('checked')){
$('#custom_auth_div').show()
@ -951,17 +951,17 @@ function setAddShowEvents(form) {
function calculateDuration(startDateTime, endDateTime, timezone){
var loadingIcon = $('#icon-loader-small');
loadingIcon.show();
$.post(
baseUrl+"Schedule/calculate-duration",
{startTime: startDateTime, endTime: endDateTime, timezone: timezone},
baseUrl+"Schedule/calculate-duration",
{startTime: startDateTime, endTime: endDateTime, timezone: timezone},
function(data) {
$('#add_show_duration').val(JSON.parse(data));
loadingIcon.hide();
});
}
// Since Zend's setAttrib won't apply through the wrapper, set accept=image/* here
$("#add_show_logo").prop("accept", "image/*");

View file

@ -369,7 +369,7 @@ function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui
}
//Workaround for cases where FullCalendar handles events over DST
//time changes in a different way than Airtime does.
//time changes in a different way than Airtime does.
//(Airtime preserves show duration, FullCalendar doesn't.)
scheduleRefetchEvents(json);

View file

@ -1,23 +1,23 @@
var AIRTIME = (function(AIRTIME){
var mod;
if (AIRTIME.schedule === undefined) {
AIRTIME.schedule = {};
}
mod = AIRTIME.schedule;
return AIRTIME;
}(AIRTIME || {}));
var serverTimezoneOffset = 0;
function closeDialogCalendar(event, ui) {
$el = $(this);
$el.dialog('destroy');
$el.remove();
//need to refetch the events to update scheduled status.
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
}
@ -51,7 +51,7 @@ function confirmCancelRecordedShow(show_instance_id){
function findViewportDimensions() {
var viewportwidth,
viewportheight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use
// window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined') {
@ -70,7 +70,7 @@ function findViewportDimensions() {
viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
viewportheight = document.getElementsByTagName('body')[0].clientHeight;
}
return {
width: viewportwidth,
height: viewportheight-45
@ -189,10 +189,10 @@ function buildScheduleDialog (json, instance_id) {
fnServer.ops.showFilter = 0;
fnServer.ops.showInstanceFilter = instance_id;
fnServer.ops.myShows = 0;
AIRTIME.library.libraryInit();
AIRTIME.showbuilder.builderDataTable();
dialog.dialog('open');
highlightMediaTypeSelector(dialog);
buildTimerange(dialog);
@ -203,15 +203,15 @@ function buildContentDialog (json){
viewport = findViewportDimensions(),
height = viewport.height * 2/3,
width = viewport.width * 4/5;
if (json.show_error == true){
alertShowErrorAndReload();
}
dialog.find("#show_progressbar").progressbar({
value: json.percentFilled
});
dialog.dialog({
autoOpen: false,
title: $.i18n._("Contents of Show") +" '" + json.showTitle + "'",
@ -258,7 +258,7 @@ function createFullCalendar(data){
left: 'prev, next, today',
center: 'title',
right: 'agendaDay, agendaWeek, month'
},
},
defaultView: getTimeScalePreference(data),
slotMinutes: getTimeIntervalPreference(data),
firstDay: data.calendarInit.weekStartDay,
@ -314,7 +314,7 @@ function createFullCalendar(data){
lazyFetching: true,
serverTimestamp: parseInt(data.calendarInit.timestamp, 10),
serverTimezoneOffset: parseInt(data.calendarInit.timezoneOffset, 10),
events: getFullCalendarEvents,
//callbacks (in full-calendar-functions.js)
@ -342,31 +342,31 @@ $(document).ready(function() {
trigger: "left",
ignoreRightClick: true,
className: 'calendar-context-menu',
build: function($el, e) {
var data,
items,
var data,
items,
callback;
data = $el.data("event");
function processMenuItems(oItems) {
//define a schedule callback.
if (oItems.schedule !== undefined) {
callback = function() {
$.post(oItems.schedule.url, {format: "json", id: data.id}, function(json){
buildScheduleDialog(json, data.id);
});
};
oItems.schedule.callback = callback;
}
//define a clear callback.
if (oItems.clear !== undefined) {
callback = function() {
if (confirm($.i18n._("Remove all content?"))) {
$.post(oItems.clear.url, {format: "json", id: data.id}, function(json){
@ -376,13 +376,13 @@ $(document).ready(function() {
};
oItems.clear.callback = callback;
}
//define an edit callback.
if (oItems.edit !== undefined) {
if(oItems.edit.items !== undefined){
var edit = oItems.edit.items;
//edit a single instance
callback = function() {
$.get(edit.instance.url, {format: "json", showId: data.showId, instanceId: data.id, type: "instance"}, function(json){
@ -390,7 +390,7 @@ $(document).ready(function() {
});
};
edit.instance.callback = callback;
//edit this instance and all
callback = function() {
$.get(edit.all.url, {format: "json", showId: data.showId, instanceId: data.id, type: "all"}, function(json){
@ -410,7 +410,7 @@ $(document).ready(function() {
//define a content callback.
if (oItems.content !== undefined) {
callback = function() {
$.get(oItems.content.url, {format: "json", id: data.id}, function(json){
buildContentDialog(json);
@ -418,16 +418,16 @@ $(document).ready(function() {
};
oItems.content.callback = callback;
}
//define a cancel recorded show callback.
if (oItems.cancel_recorded !== undefined) {
callback = function() {
confirmCancelRecordedShow(data.id);
};
oItems.cancel_recorded.callback = callback;
}
//define a view recorded callback.
if (oItems.view_recorded !== undefined) {
callback = function() {
@ -438,23 +438,23 @@ $(document).ready(function() {
};
oItems.view_recorded.callback = callback;
}
//define a cancel callback.
if (oItems.cancel !== undefined) {
callback = function() {
confirmCancelShow(data.id);
};
oItems.cancel.callback = callback;
}
//define a delete callback.
if (oItems.del !== undefined) {
//repeating show multiple delete options
if (oItems.del.items !== undefined) {
var del = oItems.del.items;
//delete a single instance
callback = function() {
$.post(del.single.url, {format: "json", id: data.id}, function(json){
@ -462,15 +462,15 @@ $(document).ready(function() {
});
};
del.single.callback = callback;
//delete this instance and all following instances.
callback = function() {
$.post(del.following.url, {format: "json", id: data.id}, function(json){
scheduleRefetchEvents(json);
});
};
del.following.callback = callback;
del.following.callback = callback;
}
//single show
else {
@ -479,10 +479,10 @@ $(document).ready(function() {
scheduleRefetchEvents(json);
});
};
oItems.del.callback = callback;
oItems.del.callback = callback;
}
}
items = oItems;
}

View file

@ -1,5 +1,5 @@
AIRTIME = (function(AIRTIME) {
var viewport,
$lib,
$libWrapper,
@ -16,23 +16,23 @@ AIRTIME = (function(AIRTIME) {
dateEndId = "#sb_date_end",
timeEndId = "#sb_time_end",
mod;
if (AIRTIME.builderMain === undefined) {
AIRTIME.builderMain = {};
}
mod = AIRTIME.builderMain;
oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd',
//i18n_months, i18n_days_short are in common.js
monthNames: i18n_months,
dayNamesMin: i18n_days_short,
onClick: function(sDate, oDatePicker) {
onClick: function(sDate, oDatePicker) {
$(this).datepicker( "setDate", sDate );
},
onClose: validateTimeRange
};
oBaseTimePickerSettings = {
showPeriodLabels: false,
showCloseButton: true,
@ -43,7 +43,7 @@ AIRTIME = (function(AIRTIME) {
minuteText: $.i18n._("Minute"),
onClose: validateTimeRange
};
function setWidgetSize() {
viewport = AIRTIME.utilities.findViewportDimensions();
widgetHeight = viewport.height - 180;
@ -52,27 +52,27 @@ AIRTIME = (function(AIRTIME) {
var libTableHeight = widgetHeight - 175,
builderTableHeight = widgetHeight - 95,
oTable;
if ($fs.is(':visible')) {
builderTableHeight = builderTableHeight - 40;
}
//set the heights of the main widgets.
$builder//.height(widgetHeight)
.find(".dataTables_scrolling")
//.css("max-height", builderTableHeight)
.end();
//.width(screenWidth);
$lib//.height(widgetHeight)
.find(".dataTables_scrolling")
//.css("max-height", libTableHeight)
.end();
if ($lib.filter(':visible').length > 0) {
//$lib.width(Math.floor(screenWidth * 0.47));
$builder//.width(Math.floor(screenWidth * 0.47))
.find("#sb_edit")
.remove()
@ -80,18 +80,18 @@ AIRTIME = (function(AIRTIME) {
.find("#sb_date_start")
.css("margin-left", 0)
.end();
oTable = $('#show_builder_table').dataTable();
//oTable.fnDraw();
}
}
}
function showSearchSubmit() {
var fn,
op,
oTable = $('#show_builder_table').dataTable(),
check;
check = validateTimeRange();
if (check.isValid) {
@ -204,15 +204,15 @@ AIRTIME = (function(AIRTIME) {
$builder.find(timeStartId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
$builder.find(dateEndId)
.datepicker(oBaseDatePickerSettings)
.blur(validateTimeRange);
$builder.find(timeEndId)
.timepicker(oBaseTimePickerSettings)
.blur(validateTimeRange);
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId,
dateEndId, timeEndId);
@ -223,7 +223,7 @@ AIRTIME = (function(AIRTIME) {
if (AIRTIME.library !== undefined) {
AIRTIME.library.libraryInit();
}
AIRTIME.showbuilder.builderDataTable();
setWidgetSize();

View file

@ -1,6 +1,6 @@
function generatePartitions(partitions){
var rowTemplate =
var rowTemplate =
'<tr class="partition-info">'+
'<td><span class="strong">'+$.i18n._("Disk")+' #%s</span>'+
'<ul id="watched-dir-list-%s">'+
@ -25,7 +25,7 @@ function generatePartitions(partitions){
var spaceUsedGb = sprintf("%01.1f", spaceUsed/Math.pow(2, 30));
var totalSpaceGb = sprintf("%01.1f", totalSpace/Math.pow(2, 30));
var row = sprintf(rowTemplate, i+1, i, spaceUsedGb, totalSpaceGb, percUsed, percUsed);
var tr = $(row);
lastElement.after(tr);
@ -38,7 +38,7 @@ function generatePartitions(partitions){
}
lastElement = tr;
}
}
function success(data, textStatus, jqXHR){
@ -49,14 +49,14 @@ function success(data, textStatus, jqXHR){
if (s) {
var children = $("#"+s.name).children();
$(children[0]).text(s.name);
var status_class = "not-available-icon";
if (s.status == 0){
status_class = "checked-icon";
} else if (s.status == 1) {
status_class = "warning-icon";
}
$($(children[1]).children()[0]).attr("class", status_class);
$(children[2]).text(sprintf('%(days)sd %(hours)sh %(minutes)sm %(seconds)ss', convertSecondsToDaysHoursMinutesSeconds(s.uptime_seconds)));
$(children[3]).text(s.cpu_perc);
@ -71,7 +71,7 @@ function success(data, textStatus, jqXHR){
function updateStatus(getDiskInfo){
$.getJSON( baseUrl+"api/status/format/json/diskinfo/"+getDiskInfo, null, success);
}
$(document).ready(function() {

View file

@ -1,20 +1,20 @@
function populateForm(entries){
//$('#user_details').show();
$('.errors').remove();
$('.success').remove();
if (entries.type === 'S')
{
{
$("#user_details").hide();
$("#user_details_superadmin_message").show();
$('#type').attr('disabled', '1');
} else {
$("#user_details").show();
$("#user_details_superadmin_message").hide();
$('#type').removeAttr('disabled');
$('#type').removeAttr('disabled');
}
$('#user_id').val(entries.id);
$('#login').val(entries.login);
$('#first_name').val(entries.first_name);
@ -24,7 +24,7 @@ function populateForm(entries){
$('#cell_phone').val(entries.cell_phone);
$('#skype').val(entries.skype_contact);
$('#jabber').val(entries.jabber_contact);
if (entries.id.length != 0){
$('#login').attr('readonly', 'readonly');
$('#password').val("xxxxxx");
@ -80,7 +80,7 @@ function rowCallback( nRow, aData, iDisplayIndex ){
$('td:eq(3)', nRow).html( $.i18n._('Super Admin') );
$('td:eq(4)', nRow).html(""); //Disable deleting the super admin
}
return nRow;
}
@ -92,10 +92,10 @@ function populateUserTable() {
"sAjaxSource": baseUrl+"User/get-user-data-table-info/format/json",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},

View file

@ -1,15 +1,15 @@
var AIRTIME = (function(AIRTIME){
var mod;
if (AIRTIME.utilities === undefined) {
AIRTIME.utilities = {};
}
mod = AIRTIME.utilities;
mod.findViewportDimensions = function() {
var viewportwidth,
viewportheight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use
// window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined') {
@ -28,49 +28,49 @@ var AIRTIME = (function(AIRTIME){
viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
viewportheight = document.getElementsByTagName('body')[0].clientHeight;
}
return {
width: viewportwidth,
height: viewportheight
};
};
/*
* Returns an object containing a unix timestamp in seconds for the start/end range
*
*
* @return Object {"start", "end", "range"}
*/
mod.fnGetScheduleRange = function(dateStartId, timeStartId, dateEndId, timeEndId) {
var start,
end,
time;
start = $(dateStartId).val();
start = start === "" ? null : start;
time = $(timeStartId).val();
time = time === "" ? "00:00" : time;
if (start) {
start = start + " " + time;
}
end = $(dateEndId).val();
end = end === "" ? null : end;
time = $(timeEndId).val();
time = time === "" ? "00:00" : time;
if (end) {
end = end + " " + time;
}
return {
start: start,
end: end
};
};
return AIRTIME;
}(AIRTIME || {}));

View file

@ -537,5 +537,3 @@ var AIRTIME = (function(AIRTIME) {
return AIRTIME;
}(AIRTIME || {}));