From d91850b1ca4ded46a5c9c68be8b093ed4032ad5f Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Thu, 24 May 2012 18:10:36 +0200 Subject: [PATCH] CC-3877 : Now Playing-> Show manipulation buttons should be disabled for guest user and DJ's who are not assigned to the show --- .../application/controllers/ShowbuilderController.php | 7 +++++-- airtime_mvc/public/js/airtime/showbuilder/builder.js | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index d3e5b5400..b16717bde 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -22,6 +22,10 @@ class ShowbuilderController extends Zend_Controller_Action $request = $this->getRequest(); $baseUrl = $request->getBaseUrl(); + $user = Application_Model_User::GetCurrentUser(); + + $userType = $user->getType(); + $this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );"); $data = Application_Model_Preference::GetValue("library_datatable", true); if ($data != "") { @@ -60,8 +64,7 @@ class ShowbuilderController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript'); - - $user = Application_Model_User::GetCurrentUser(); + $refer_sses = new Zend_Session_Namespace('referrer'); if ($request->isPost()) { diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index a18701239..10110aa78 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -103,9 +103,12 @@ var AIRTIME = (function(AIRTIME){ }; mod.checkCancelButton = function() { - var $current = $sbTable.find(".sb-current-show.sb-allowed"); + var $current = $sbTable.find(".sb-current-show.sb-allowed"), + //this user type should be refactored into a separate users module later + //when there's more time and more JS will need to know user data. + userType = localStorage.getItem('user-type'); - if ($current.length !== 0) { + if ($current.length !== 0 && (userType === 'A' || userType === 'P')) { AIRTIME.button.enableButton("sb-button-cancel"); } else {