From aca6e995ddac3068f23e37b210ec401b7ccc939a Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 28 Mar 2012 17:29:34 +0200 Subject: [PATCH] CC-3503 : Preserve the state of "Now Playing" screen - whether Library section is open or not --- .../controllers/ShowbuilderController.php | 9 ++++++ .../js/airtime/showbuilder/main_builder.js | 32 ++++++------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 6f61d64f3..59b5b8c12 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -92,6 +92,15 @@ class ShowbuilderController extends Zend_Controller_Action } } + $data = Application_Model_Preference::GetValue("nowplaying_screen", true); + if ($data != "") { + $settings = unserialize($data); + + if ($settings["library"] == "true") { + $this->view->headScript()->appendScript("AIRTIME.showLib = true;"); + } + } + $this->_helper->actionStack('library', 'library'); $this->_helper->actionStack('builder', 'showbuilder'); } diff --git a/airtime_mvc/public/js/airtime/showbuilder/main_builder.js b/airtime_mvc/public/js/airtime/showbuilder/main_builder.js index 4ecbc8040..13c71427f 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/main_builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/main_builder.js @@ -55,30 +55,16 @@ $(document).ready(function(){ oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId); AIRTIME.showbuilder.fnServerData.start = oRange.start; AIRTIME.showbuilder.fnServerData.end = oRange.end; + + if (AIRTIME.showLib === true) { + $lib.show() + .width(Math.floor(screenWidth * 0.5)); - $.ajax({ - url: "/usersettings/get-now-playing-screen-settings", - type: "GET", - data: {format: "json"}, - dataType: "json", - success: function(json){ - var o = json.settings; - - if (o === undefined) { - return; - } - - if (o.library === "true") { - $lib.show() - .width(Math.floor(screenWidth * 0.5)); - - $builder.width(Math.floor(screenWidth * 0.5)) - .find("#sb_edit") - .remove() - .end(); - } - } - }); + $builder.width(Math.floor(screenWidth * 0.5)) + .find("#sb_edit") + .remove() + .end(); + } AIRTIME.library.libraryInit(); AIRTIME.showbuilder.builderDataTable();