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()
|
||||
|
@ -105,10 +96,10 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
$view->headScript()->appendFile($baseUrl.'locale/general-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'locale/datatables-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$view->headScript()->appendScript("$.i18n.setDictionary(general_dict)");
|
||||
|
||||
|
||||
$view->headScript()->appendFile($baseUrl.'js/timepicker/jquery-ui-timepicker-addon.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
|
||||
|
||||
|
||||
$view->headScript()->appendScript("var baseUrl='$baseUrl'");
|
||||
|
||||
//These timezones are needed to adjust javascript Date objects on the client to make sense to the user's set timezone
|
||||
|
@ -133,7 +124,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
$view->headScript()->appendFile($baseUrl.'js/tipsy/jquery.tipsy.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$view->headScript()->appendFile($baseUrl.'js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
|
||||
//scripts for the jPlayer preview bar.
|
||||
$view->headScript()->appendFile($baseUrl.'js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'js/airtime/audiopreview/jPlayerWindow.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
|
|
@ -18,32 +18,32 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
->addActionContext('context-menu', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
||||
private function getStartEnd()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
||||
$utcTimezone = new DateTimeZone("UTC");
|
||||
$utcNow = new DateTime("now", $utcTimezone);
|
||||
|
||||
|
||||
$start = $request->getParam("start");
|
||||
$end = $request->getParam("end");
|
||||
|
||||
|
||||
if (empty($start) || empty($end)) {
|
||||
$startsDT = clone $utcNow;
|
||||
$endsDT = clone $utcNow;
|
||||
$endsDT->add(new DateInterval("P1D"));
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
try {
|
||||
$startsDT = new DateTime($start, $userTimezone);
|
||||
$startsDT->setTimezone($utcTimezone);
|
||||
|
||||
|
||||
$endsDT = new DateTime($end, $userTimezone);
|
||||
$endsDT->setTimezone($utcTimezone);
|
||||
|
||||
|
||||
if ($startsDT > $endsDT) {
|
||||
throw new Exception("start greater than end");
|
||||
}
|
||||
|
@ -51,14 +51,14 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
Logging::info($e->getMessage());
|
||||
|
||||
|
||||
$startsDT = clone $utcNow;
|
||||
$startsDT->sub(new DateInterval("P1D"));
|
||||
$endsDT = clone $utcNow;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return array($startsDT, $endsDT);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colVis.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
|
||||
$refer_sses = new Zend_Session_Namespace('referrer');
|
||||
|
||||
if ($request->isPost()) {
|
||||
|
@ -167,7 +167,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
}
|
||||
$this->view->disableLib = $disableLib;
|
||||
$this->view->showLib = $showLib;
|
||||
|
||||
|
||||
//TODO remove this when it's implemented.
|
||||
$disableLib = false;
|
||||
$showLib = true;
|
||||
|
@ -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();
|
||||
|
@ -195,7 +195,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
list($startsDT, $endsDT) = $this->getStartEnd();
|
||||
|
||||
|
||||
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
|
||||
$startsDT->setTimezone($userTimezone);
|
||||
$endsDT->setTimezone($userTimezone);
|
||||
|
@ -261,7 +261,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone());
|
||||
|
||||
|
||||
$start = $instance->getDbStarts(null);
|
||||
$start->setTimezone($displayTimeZone);
|
||||
$end = $instance->getDbEnds(null);
|
||||
|
@ -287,7 +287,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$instances = $request->getParam("instances", array());
|
||||
|
||||
list($startsDT, $endsDT) = $this->getStartEnd();
|
||||
|
||||
|
||||
$opts = array("myShows" => $my_shows, "showFilter" => $show_filter);
|
||||
$showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts);
|
||||
|
||||
|
@ -300,7 +300,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
public function builderFeedAction()
|
||||
{
|
||||
$current_time = time();
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$show_filter = intval($request->getParam("showFilter", 0));
|
||||
$show_instance_filter = intval($request->getParam("showInstanceFilter", 0));
|
||||
|
|
|
@ -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,22 +359,18 @@ 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({
|
||||
aoColumns: searchConfig,
|
||||
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,8 +444,11 @@ 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