CC-5317 : Guest user can't see Now playing page

removed the library module completely from page if the user does not have permission to view it.
This commit is contained in:
Naomi Aro 2013-09-24 12:21:04 +02:00
parent 71001480d2
commit 7e96828cdd
3 changed files with 38 additions and 25 deletions

View file

@ -29,22 +29,6 @@ class ShowbuilderController extends Zend_Controller_Action
$userType = $user->getType();
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
$data = Application_Model_Preference::getCurrentLibraryTableSetting();
if (!is_null($data)) {
$libraryTable = json_encode($data);
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
} else {
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
}
$data = Application_Model_Preference::getTimelineDatatableSetting();
if (!is_null($data)) {
$timelineTable = json_encode($data);
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
} else {
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
}
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -57,14 +41,12 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$refer_sses = new Zend_Session_Namespace('referrer');
if ($request->isPost()) {
@ -141,6 +123,28 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->disableLib = $disableLib;
$this->view->showLib = $showLib;
//only include library things on the page if the user can see it.
if (!$disableLib) {
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$data = Application_Model_Preference::getCurrentLibraryTableSetting();
if (!is_null($data)) {
$libraryTable = json_encode($data);
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
} else {
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
}
}
$data = Application_Model_Preference::getTimelineDatatableSetting();
if (!is_null($data)) {
$timelineTable = json_encode($data);
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
} else {
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
}
//populate date range form for show builder.
$now = time();
$from = $request->getParam("from", $now);

View file

@ -178,7 +178,12 @@ var AIRTIME = (function(AIRTIME){
};
mod.checkToolBarIcons = function() {
//library may not be on the page.
if (AIRTIME.library !== undefined) {
AIRTIME.library.checkAddButton();
}
mod.checkSelectButton();
mod.checkTrimButton();
mod.checkDeleteButton();

View file

@ -186,7 +186,11 @@ AIRTIME = (function(AIRTIME) {
AIRTIME.showbuilder.fnServerData.start = oRange.start;
AIRTIME.showbuilder.fnServerData.end = oRange.end;
//the user might not have the library on the page (guest user)
if (AIRTIME.library !== undefined) {
AIRTIME.library.libraryInit();
}
AIRTIME.showbuilder.builderDataTable();
setWidgetSize();