CC-4666: Showbuilder page is dead
-fixed. result of a bad merge
This commit is contained in:
parent
12009e95fc
commit
a201d6f2da
|
@ -1,118 +1,118 @@
|
||||||
AIRTIME = (function(AIRTIME) {
|
AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
var viewport,
|
var viewport,
|
||||||
$lib,
|
$lib,
|
||||||
$libWrapper,
|
$libWrapper,
|
||||||
$builder,
|
$builder,
|
||||||
$fs,
|
$fs,
|
||||||
widgetHeight,
|
widgetHeight,
|
||||||
screenWidth,
|
screenWidth,
|
||||||
resizeTimeout,
|
resizeTimeout,
|
||||||
oBaseDatePickerSettings,
|
oBaseDatePickerSettings,
|
||||||
oBaseTimePickerSettings,
|
oBaseTimePickerSettings,
|
||||||
oRange,
|
oRange,
|
||||||
dateStartId = "#sb_date_start",
|
dateStartId = "#sb_date_start",
|
||||||
timeStartId = "#sb_time_start",
|
timeStartId = "#sb_time_start",
|
||||||
dateEndId = "#sb_date_end",
|
dateEndId = "#sb_date_end",
|
||||||
timeEndId = "#sb_time_end",
|
timeEndId = "#sb_time_end",
|
||||||
$toggleLib = $("<a id='sb_edit' class='btn btn-small' href='#' title='Open library to add or remove content'>Add / Remove Content</a>"),
|
$toggleLib = $("<a id='sb_edit' class='btn btn-small' href='#' title='Open library to add or remove content'>Add / Remove Content</a>"),
|
||||||
$libClose = $('<a />', {
|
$libClose = $('<a />', {
|
||||||
"class": "close-round",
|
"class": "close-round",
|
||||||
"href": "#",
|
"href": "#",
|
||||||
"id": "sb_lib_close"
|
"id": "sb_lib_close"
|
||||||
}),
|
}),
|
||||||
mod;
|
mod;
|
||||||
|
|
||||||
if (AIRTIME.builderMain === undefined) {
|
if (AIRTIME.builderMain === undefined) {
|
||||||
AIRTIME.builderMain = {};
|
AIRTIME.builderMain = {};
|
||||||
}
|
}
|
||||||
mod = AIRTIME.builderMain;
|
mod = AIRTIME.builderMain;
|
||||||
|
|
||||||
oBaseDatePickerSettings = {
|
oBaseDatePickerSettings = {
|
||||||
dateFormat: 'yy-mm-dd',
|
dateFormat: 'yy-mm-dd',
|
||||||
onClick: function(sDate, oDatePicker) {
|
onClick: function(sDate, oDatePicker) {
|
||||||
$(this).datepicker( "setDate", sDate );
|
$(this).datepicker( "setDate", sDate );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
oBaseTimePickerSettings = {
|
oBaseTimePickerSettings = {
|
||||||
showPeriodLabels: false,
|
showPeriodLabels: false,
|
||||||
showCloseButton: true,
|
showCloseButton: true,
|
||||||
showLeadingZero: false,
|
showLeadingZero: false,
|
||||||
defaultTime: '0:00'
|
defaultTime: '0:00'
|
||||||
};
|
};
|
||||||
|
|
||||||
function setWidgetSize() {
|
function setWidgetSize() {
|
||||||
viewport = AIRTIME.utilities.findViewportDimensions();
|
viewport = AIRTIME.utilities.findViewportDimensions();
|
||||||
widgetHeight = viewport.height - 180;
|
widgetHeight = viewport.height - 180;
|
||||||
screenWidth = Math.floor(viewport.width - 40);
|
screenWidth = Math.floor(viewport.width - 40);
|
||||||
|
|
||||||
var libTableHeight = widgetHeight - 130,
|
var libTableHeight = widgetHeight - 130,
|
||||||
builderTableHeight = widgetHeight - 95,
|
builderTableHeight = widgetHeight - 95,
|
||||||
oTable;
|
oTable;
|
||||||
|
|
||||||
if ($fs.is(':visible')) {
|
if ($fs.is(':visible')) {
|
||||||
builderTableHeight = builderTableHeight - 40;
|
builderTableHeight = builderTableHeight - 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the heights of the main widgets.
|
//set the heights of the main widgets.
|
||||||
$builder.height(widgetHeight)
|
$builder.height(widgetHeight)
|
||||||
.find(".dataTables_scrolling")
|
.find(".dataTables_scrolling")
|
||||||
.css("max-height", builderTableHeight)
|
.css("max-height", builderTableHeight)
|
||||||
.end()
|
.end()
|
||||||
.width(screenWidth);
|
.width(screenWidth);
|
||||||
|
|
||||||
$lib.height(widgetHeight)
|
$lib.height(widgetHeight)
|
||||||
.find(".dataTables_scrolling")
|
.find(".dataTables_scrolling")
|
||||||
.css("max-height", libTableHeight)
|
.css("max-height", libTableHeight)
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
if ($lib.filter(':visible').length > 0) {
|
if ($lib.filter(':visible').length > 0) {
|
||||||
|
|
||||||
$lib.width(Math.floor(screenWidth * 0.48));
|
$lib.width(Math.floor(screenWidth * 0.48));
|
||||||
|
|
||||||
$builder.width(Math.floor(screenWidth * 0.48))
|
$builder.width(Math.floor(screenWidth * 0.48))
|
||||||
.find("#sb_edit")
|
.find("#sb_edit")
|
||||||
.remove()
|
.remove()
|
||||||
.end()
|
.end()
|
||||||
.find("#sb_date_start")
|
.find("#sb_date_start")
|
||||||
.css("margin-left", 0)
|
.css("margin-left", 0)
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
oTable = $('#show_builder_table').dataTable();
|
oTable = $('#show_builder_table').dataTable();
|
||||||
oTable.fnDraw();
|
oTable.fnDraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSearchSubmit() {
|
function showSearchSubmit() {
|
||||||
var fn,
|
var fn,
|
||||||
oRange,
|
oRange,
|
||||||
op,
|
op,
|
||||||
oTable = $('#show_builder_table').dataTable();
|
oTable = $('#show_builder_table').dataTable();
|
||||||
|
|
||||||
//reset timestamp value since input values could have changed.
|
//reset timestamp value since input values could have changed.
|
||||||
AIRTIME.showbuilder.resetTimestamp();
|
AIRTIME.showbuilder.resetTimestamp();
|
||||||
|
|
||||||
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
|
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
|
||||||
|
|
||||||
fn = oTable.fnSettings().fnServerData;
|
fn = oTable.fnSettings().fnServerData;
|
||||||
fn.start = oRange.start;
|
fn.start = oRange.start;
|
||||||
fn.end = oRange.end;
|
fn.end = oRange.end;
|
||||||
|
|
||||||
op = $("div.sb-advanced-options");
|
op = $("div.sb-advanced-options");
|
||||||
if (op.is(":visible")) {
|
if (op.is(":visible")) {
|
||||||
|
|
||||||
if (fn.ops === undefined) {
|
if (fn.ops === undefined) {
|
||||||
fn.ops = {};
|
fn.ops = {};
|
||||||
}
|
}
|
||||||
fn.ops.showFilter = op.find("#sb_show_filter").val();
|
fn.ops.showFilter = op.find("#sb_show_filter").val();
|
||||||
fn.ops.myShows = op.find("#sb_my_shows").is(":checked") ? 1 : 0;
|
fn.ops.myShows = op.find("#sb_my_shows").is(":checked") ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
oTable.fnDraw();
|
oTable.fnDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.onReady = function() {
|
mod.onReady = function() {
|
||||||
// define module vars.
|
// define module vars.
|
||||||
$lib = $("#library_content");
|
$lib = $("#library_content");
|
||||||
$builder = $("#show_builder");
|
$builder = $("#show_builder");
|
||||||
|
@ -287,138 +287,6 @@ AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
return AIRTIME;
|
return AIRTIME;
|
||||||
|
|
||||||
$builder.on("click","#sb_edit", function (ev){
|
|
||||||
var schedTable = $("#show_builder_table").dataTable();
|
|
||||||
|
|
||||||
//reset timestamp to redraw the cursors.
|
|
||||||
AIRTIME.showbuilder.resetTimestamp();
|
|
||||||
|
|
||||||
$lib.show()
|
|
||||||
.width(Math.floor(screenWidth * 0.48));
|
|
||||||
|
|
||||||
$builder.width(Math.floor(screenWidth * 0.48))
|
|
||||||
.find("#sb_edit")
|
|
||||||
.remove()
|
|
||||||
.end()
|
|
||||||
.find("#sb_date_start")
|
|
||||||
.css("margin-left", 0)
|
|
||||||
.end();
|
|
||||||
|
|
||||||
schedTable.fnDraw();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: baseUrl+"/usersettings/set-now-playing-screen-settings",
|
|
||||||
type: "POST",
|
|
||||||
data: {settings : {library : true}, format: "json"},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(){}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$lib.on("click", "#sb_lib_close", function() {
|
|
||||||
var schedTable = $("#show_builder_table").dataTable();
|
|
||||||
|
|
||||||
$lib.hide();
|
|
||||||
$builder.width(screenWidth)
|
|
||||||
.find(".sb-timerange")
|
|
||||||
.prepend($toggleLib)
|
|
||||||
.find("#sb_date_start")
|
|
||||||
.css("margin-left", 30)
|
|
||||||
.end()
|
|
||||||
.end();
|
|
||||||
|
|
||||||
$toggleLib.removeClass("ui-state-hover");
|
|
||||||
schedTable.fnDraw();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: baseUrl+"/usersettings/set-now-playing-screen-settings",
|
|
||||||
type: "POST",
|
|
||||||
data: {settings : {library : false}, format: "json"},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(){}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$builder.find('legend').click(function(ev, item){
|
|
||||||
|
|
||||||
if ($fs.hasClass("closed")) {
|
|
||||||
|
|
||||||
$fs.removeClass("closed");
|
|
||||||
$builder.find('.dataTables_scrolling').css("max-height", widgetHeight - 150);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$fs.addClass("closed");
|
|
||||||
|
|
||||||
//set defaults for the options.
|
|
||||||
$fs.find('select').val(0);
|
|
||||||
$fs.find('input[type="checkbox"]').attr("checked", false);
|
|
||||||
$builder.find('.dataTables_scrolling').css("max-height", widgetHeight - 110);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//set click event for all my shows checkbox.
|
|
||||||
$builder.on("click", "#sb_my_shows", function(ev) {
|
|
||||||
|
|
||||||
if ($(this).is(':checked')) {
|
|
||||||
$(ev.delegateTarget).find('#sb_show_filter').val(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
showSearchSubmit();
|
|
||||||
});
|
|
||||||
|
|
||||||
//set select event for choosing a show.
|
|
||||||
$builder.on("change", '#sb_show_filter', function(ev) {
|
|
||||||
|
|
||||||
if ($(this).val() !== 0) {
|
|
||||||
$(ev.delegateTarget).find('#sb_my_shows').attr("checked", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
showSearchSubmit();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function checkScheduleUpdates(){
|
|
||||||
var data = {},
|
|
||||||
oTable = $('#show_builder_table').dataTable(),
|
|
||||||
fn = oTable.fnSettings().fnServerData,
|
|
||||||
start = fn.start,
|
|
||||||
end = fn.end;
|
|
||||||
|
|
||||||
data["format"] = "json";
|
|
||||||
data["start"] = start;
|
|
||||||
data["end"] = end;
|
|
||||||
data["timestamp"] = AIRTIME.showbuilder.getTimestamp();
|
|
||||||
data["instances"] = AIRTIME.showbuilder.getShowInstances();
|
|
||||||
|
|
||||||
if (fn.hasOwnProperty("ops")) {
|
|
||||||
data["myShows"] = fn.ops.myShows;
|
|
||||||
data["showFilter"] = fn.ops.showFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax( {
|
|
||||||
"dataType": "json",
|
|
||||||
"type": "GET",
|
|
||||||
"url": baseUrl+"/showbuilder/check-builder-feed",
|
|
||||||
"data": data,
|
|
||||||
"success": function(json) {
|
|
||||||
if (json.update === true) {
|
|
||||||
oTable.fnDraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
//check if the timeline view needs updating.
|
|
||||||
setInterval(checkScheduleUpdates, 5 * 1000); //need refresh in milliseconds
|
|
||||||
};
|
|
||||||
|
|
||||||
mod.onResize = function() {
|
|
||||||
|
|
||||||
clearTimeout(resizeTimeout);
|
|
||||||
resizeTimeout = setTimeout(setWidgetSize, 100);
|
|
||||||
};
|
|
||||||
|
|
||||||
return AIRTIME;
|
|
||||||
} (AIRTIME || {}));
|
} (AIRTIME || {}));
|
||||||
|
|
||||||
$(document).ready(AIRTIME.builderMain.onReady);
|
$(document).ready(AIRTIME.builderMain.onReady);
|
||||||
|
|
Loading…
Reference in New Issue