CC-5788 : Library Cleanup
sorting out event clash from register.js fixing datatables so that things are always loaded and initialized properly.
This commit is contained in:
parent
9bfdf5e68f
commit
7990d6a71c
|
@ -51,15 +51,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$view->headScript()->appendScript("var baseUrl = '$baseUrl'");
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
if (!is_null($user)){
|
||||
$userType = $user->getType();
|
||||
} else {
|
||||
$userType = "";
|
||||
}
|
||||
$view->headScript()->appendScript("var userType = '$userType';");
|
||||
|
||||
}
|
||||
|
||||
protected function _initHeadLink()
|
||||
|
|
|
@ -177,13 +177,13 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
//only include library things on the page if the user can see it.
|
||||
if (!$disableLib) {
|
||||
|
||||
//set media columns for display of data.
|
||||
$mediaService = new Application_Service_MediaService();
|
||||
$this->view->headScript()->appendScript($mediaService->createLibraryColumnsJavascript());
|
||||
$this->view->headScript()->appendScript($mediaService->createLibraryColumnSettingsJavascript());
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/lib_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/lib_separate_table.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
||||
//set media columns for display of data.
|
||||
$mediaService = new Application_Service_MediaService();
|
||||
$this->view->headScript()->appendScript($mediaService->createLibraryColumnsJavascript());
|
||||
$this->view->headScript()->appendScript($mediaService->createLibraryColumnSettingsJavascript());
|
||||
}
|
||||
|
||||
$data = Application_Model_Preference::getTimelineDatatableSetting();
|
||||
|
|
|
@ -104,7 +104,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
});
|
||||
|
||||
$( "#open_playlist" ).click(function() {
|
||||
$("#open_playlist").click(function() {
|
||||
$(".jp-playlist").toggleClass("open");
|
||||
$(this).toggleClass("selected");
|
||||
});
|
||||
|
|
|
@ -209,9 +209,23 @@ var AIRTIME = (function(AIRTIME) {
|
|||
mod.checkToolBarIcons();
|
||||
}
|
||||
|
||||
function stackTrace() {
|
||||
var err = new Error();
|
||||
console.log(err.stack);
|
||||
}
|
||||
|
||||
function libraryNeedSave(oData) {
|
||||
var settings = getCurrentDatatableSettings();
|
||||
|
||||
//This will happen when we have nothing saved in cc_pref for this table.
|
||||
if (settings["abVisCols"] === undefined || settings["ColReorder"] === undefined) {
|
||||
|
||||
settings["abVisCols"] = oData.abVisCols;
|
||||
settings["ColReorder"] = oData.ColReorder;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (settings["abVisCols"].join() === oData.abVisCols.join()
|
||||
&& settings["ColReorder"].join() === oData.ColReorder.join()) {
|
||||
return false;
|
||||
|
@ -223,7 +237,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
function createDatatable(config) {
|
||||
var key = "datatables-"+config.type+"-aoColumns",
|
||||
columns = JSON.parse(localStorage.getItem(key)),
|
||||
abVisible,
|
||||
i, len,
|
||||
searchConfig;
|
||||
|
||||
|
@ -250,7 +263,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
//save the tables based on tableId
|
||||
"bStateSave": true,
|
||||
"fnStateSaveParams": function (oSettings, oData) {
|
||||
// remove oData components we don't want to save.
|
||||
|
||||
// remove oData components we don't want to save.
|
||||
delete oData.oSearch;
|
||||
delete oData.aoSearchCols;
|
||||
},
|
||||
|
@ -272,12 +286,13 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
try {
|
||||
return JSON.parse(settings);
|
||||
} catch (e) {
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
"fnStateLoadParams": function (oSettings, oData) {
|
||||
var i,
|
||||
var i,
|
||||
length,
|
||||
a = oData.abVisCols,
|
||||
settings = getCurrentDatatableSettings();
|
||||
|
@ -301,10 +316,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
settings["ColReorder"] = a.slice(0);
|
||||
|
||||
//abVisible indices belong to the original column order.
|
||||
//use to fix up advanced search.
|
||||
abVisible = oData.abVisCols;
|
||||
|
||||
oData.iEnd = parseInt(oData.iEnd, 10);
|
||||
oData.iLength = parseInt(oData.iLength, 10);
|
||||
oData.iStart = parseInt(oData.iStart, 10);
|
||||
|
@ -348,11 +359,10 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
"fnInitComplete": function(oSettings, json) {
|
||||
var $panel = $(table[0]).parents("div.ui-tabs-panel");
|
||||
var settings = getCurrentDatatableSettings();
|
||||
|
||||
//fnStateLoadParams will have already run.
|
||||
//fix up advanced search from saved settings.
|
||||
for (i = 0, len = abVisible.length; i < len; i++) {
|
||||
setAdvancedSearchColumnDisplay(i, abVisible[i], config.type);
|
||||
for (i = 0, len = settings.abVisCols.length; i < len; i++) {
|
||||
setAdvancedSearchColumnDisplay(i, settings.abVisCols[i], config.type);
|
||||
}
|
||||
|
||||
table.columnFilter({
|
||||
|
@ -360,10 +370,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
sPlaceHolder: "head:before"
|
||||
});
|
||||
|
||||
//append a search button
|
||||
//$panel.find(".dataTables_filter").append('<button class="btn btn-small btn-search" type="button">Search</button>');
|
||||
|
||||
//only search on enter.
|
||||
//search on enter.
|
||||
$panel.on("keypress", ".advanced_search input", function(e) {
|
||||
if (e.which === 13) {
|
||||
table.fnDraw();
|
||||
|
@ -708,11 +715,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
});
|
||||
|
||||
$library.on("click", "legend", function() {
|
||||
var $fs = $(this).parents("fieldset");
|
||||
$library.on("click", "legend", function() {
|
||||
var $fs = $(this).parents("fieldset");
|
||||
|
||||
$fs.toggleClass("closed");
|
||||
});
|
||||
$fs.toggleClass("closed");
|
||||
});
|
||||
|
||||
$library.on("click", "#lib_new_webstream", function(e) {
|
||||
var url = baseUrl+"webstream/new/format/json";
|
||||
|
|
|
@ -112,8 +112,8 @@ $(document).ready(function(){
|
|||
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
|
||||
}
|
||||
|
||||
$('.toggle legend').live('click',function() {
|
||||
$('.toggle').toggleClass('closed');
|
||||
$('#register_popup .toggle legend').live('click',function() {
|
||||
$('#register_popup .toggle').toggleClass('closed');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
@ -370,9 +370,19 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
function builderNeedSave(oData) {
|
||||
var settings = currentDatatablesSettings;
|
||||
|
||||
if (currentDatatablesSettings["abVisCols"].join() === oData.abVisCols.join()
|
||||
&& currentDatatablesSettings["ColReorder"].join() === oData.ColReorder.join()) {
|
||||
//This will happen when we have nothing saved in cc_pref for this table.
|
||||
if (settings["abVisCols"] === undefined || settings["ColReorder"] === undefined) {
|
||||
|
||||
settings["abVisCols"] = oData.abVisCols;
|
||||
settings["ColReorder"] = oData.ColReorder;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (settings["abVisCols"].join() === oData.abVisCols.join()
|
||||
&& settings["ColReorder"].join() === oData.ColReorder.join()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -434,9 +444,12 @@ var AIRTIME = (function(AIRTIME){
|
|||
"fnStateLoad": function fnBuilderStateLoad(oSettings) {
|
||||
var settings = localStorage.getItem('datatables-timeline');
|
||||
|
||||
if (settings !== "") {
|
||||
try {
|
||||
return JSON.parse(settings);
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
"fnStateLoadParams": function (oSettings, oData) {
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
var properties = $.extend(defaults, options);
|
||||
|
||||
function _fnColumnIndex(iColumnIndex) {
|
||||
var s = oTable.fnSettings(),
|
||||
order = s.oLoadedState.ColReorder,
|
||||
index = order.indexOf(iColumnIndex);
|
||||
var colOrder = new $.fn.dataTable.ColReorder(oTable);
|
||||
var order = colOrder.fnOrder();
|
||||
var index = order.indexOf(iColumnIndex);
|
||||
|
||||
//iColumnIndex is the original column index.
|
||||
//to match the rest of the data sent to the server it must give
|
||||
|
|
Loading…
Reference in New Issue