CC-3503 : Preserve the state of "Now Playing" screen - whether Library section is open or not

This commit is contained in:
Naomi Aro 2012-03-28 16:14:02 +02:00
parent 03c5daa9e7
commit fe21abf16d
2 changed files with 64 additions and 5 deletions

View File

@ -6,13 +6,32 @@ class UsersettingsController extends Zend_Controller_Action
{ {
/* Initialize action controller here */ /* Initialize action controller here */
$ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('get-library-datatable', 'json') $ajaxContext->addActionContext('get-now-playing-screen-settings', 'json')
->addActionContext('set-now-playing-screen-settings', 'json')
->addActionContext('get-library-datatable', 'json')
->addActionContext('set-library-datatable', 'json') ->addActionContext('set-library-datatable', 'json')
->addActionContext('get-timeline-datatable', 'json') ->addActionContext('get-timeline-datatable', 'json')
->addActionContext('set-timeline-datatable', 'json') ->addActionContext('set-timeline-datatable', 'json')
->initContext(); ->initContext();
} }
public function setNowPlayingScreenSettingsAction() {
$request = $this->getRequest();
$settings = $request->getParam("settings");
$data = serialize($settings);
Application_Model_Preference::SetValue("nowplaying_screen", $data, true);
}
public function getNowPlayingScreenSettingsAction() {
$data = Application_Model_Preference::GetValue("nowplaying_screen", true);
if ($data != "") {
$this->view->settings = unserialize($data);
}
}
public function setLibraryDatatableAction() { public function setLibraryDatatableAction() {
$request = $this->getRequest(); $request = $this->getRequest();

View File

@ -56,6 +56,30 @@ $(document).ready(function(){
AIRTIME.showbuilder.fnServerData.start = oRange.start; AIRTIME.showbuilder.fnServerData.start = oRange.start;
AIRTIME.showbuilder.fnServerData.end = oRange.end; AIRTIME.showbuilder.fnServerData.end = oRange.end;
$.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();
}
}
});
AIRTIME.library.libraryInit(); AIRTIME.library.libraryInit();
AIRTIME.showbuilder.builderDataTable(); AIRTIME.showbuilder.builderDataTable();
@ -92,7 +116,7 @@ $(document).ready(function(){
oTable.fnDraw(); oTable.fnDraw();
}); });
$builder.on("click","#sb_edit", function(ev){ $builder.on("click","#sb_edit", function () {
var schedTable = $("#show_builder_table").dataTable(); var schedTable = $("#show_builder_table").dataTable();
//reset timestamp to redraw the cursors. //reset timestamp to redraw the cursors.
@ -107,9 +131,17 @@ $(document).ready(function(){
.end(); .end();
schedTable.fnDraw(); schedTable.fnDraw();
$.ajax({
url: "/usersettings/set-now-playing-screen-settings",
type: "POST",
data: {settings : {library : true}, format: "json"},
dataType: "json",
success: function(){}
});
}); });
$lib.on("click", "#sb_lib_close", function(ev) { $lib.on("click", "#sb_lib_close", function() {
var schedTable = $("#show_builder_table").dataTable(); var schedTable = $("#show_builder_table").dataTable();
$lib.hide(); $lib.hide();
@ -119,6 +151,14 @@ $(document).ready(function(){
.end(); .end();
schedTable.fnDraw(); schedTable.fnDraw();
$.ajax({
url: "/usersettings/set-now-playing-screen-settings",
type: "POST",
data: {settings : {library : false}, format: "json"},
dataType: "json",
success: function(){}
});
}); });
$builder.find('legend').click(function(ev, item){ $builder.find('legend').click(function(ev, item){