CC-4954: Please make Library page remember the status per user
-done
This commit is contained in:
parent
9715a9ad6d
commit
d1301ff676
5 changed files with 72 additions and 4 deletions
|
@ -77,6 +77,17 @@ class LibraryController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get user settings and determine if we need to hide
|
||||||
|
// or show the playlist editor
|
||||||
|
$showPlaylist = false;
|
||||||
|
$data = Application_Model_Preference::getLibraryScreenSettings();
|
||||||
|
if (!is_null($data)) {
|
||||||
|
if ($data["playlist"] == "true") {
|
||||||
|
$showLib = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->view->showPlaylist = $showPlaylist;
|
||||||
|
|
||||||
$formatter = new LengthFormatter($obj->getLength());
|
$formatter = new LengthFormatter($obj->getLength());
|
||||||
$this->view->length = $formatter->format();
|
$this->view->length = $formatter->format();
|
||||||
$this->view->type = $obj_sess->type;
|
$this->view->type = $obj_sess->type;
|
||||||
|
|
|
@ -15,6 +15,7 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
->addActionContext('remindme', 'json')
|
->addActionContext('remindme', 'json')
|
||||||
->addActionContext('remindme-never', 'json')
|
->addActionContext('remindme-never', 'json')
|
||||||
->addActionContext('donotshowregistrationpopup', 'json')
|
->addActionContext('donotshowregistrationpopup', 'json')
|
||||||
|
->addActionContext('set-library-screen-settings', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$settings = $request->getParam("settings");
|
$settings = $request->getParam("settings");
|
||||||
|
|
||||||
Application_Model_Preference::setTimelineDatatableSetting($settings);
|
Application_Model_Preference::setTimelineDatatableSetting($settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,4 +93,11 @@ class UsersettingsController extends Zend_Controller_Action
|
||||||
// unset session
|
// unset session
|
||||||
Zend_Session::namespaceUnset('referrer');
|
Zend_Session::namespaceUnset('referrer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setLibraryScreenSettingsAction()
|
||||||
|
{
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$settings = $request->getParam("settings");
|
||||||
|
Application_Model_Preference::setLibraryScreenSettings($settings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1262,7 +1262,19 @@ class Application_Model_Preference
|
||||||
$data = self::getValue("nowplaying_screen", true);
|
$data = self::getValue("nowplaying_screen", true);
|
||||||
return ($data != "") ? unserialize($data) : null;
|
return ($data != "") ? unserialize($data) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function setLibraryScreenSettings($settings)
|
||||||
|
{
|
||||||
|
$data = serialize($settings);
|
||||||
|
self::setValue("library_screen", $data, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLibraryScreenSettings()
|
||||||
|
{
|
||||||
|
$data = self::getValue("library_screen", true);
|
||||||
|
return ($data != "") ? unserialize($data) : null;
|
||||||
|
}
|
||||||
|
|
||||||
public static function SetEnableReplayGain($value) {
|
public static function SetEnableReplayGain($value) {
|
||||||
self::setValue("enable_replay_gain", $value, false);
|
self::setValue("enable_replay_gain", $value, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,14 @@
|
||||||
<?php echo $this->render('library/library.phtml') ?>
|
<?php echo $this->render('library/library.phtml') ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="side_playlist" class="pl-content ui-widget ui-widget-content block-shadow omega-block padded" style="height:697px; width:720px;">
|
<?php
|
||||||
|
if ($this->showPlaylist) {
|
||||||
|
$display = "";
|
||||||
|
} else {
|
||||||
|
$display = "display:none";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div id="side_playlist" class="pl-content ui-widget ui-widget-content block-shadow omega-block padded" style="height:697px; width:720px;<?php echo $display?>">
|
||||||
<?php if ($this->type == 'block') {
|
<?php if ($this->type == 'block') {
|
||||||
echo $this->render('playlist/smart-block.phtml');
|
echo $this->render('playlist/smart-block.phtml');
|
||||||
} else if ($this->type == 'playlist') {
|
} else if ($this->type == 'playlist') {
|
||||||
|
|
|
@ -12,7 +12,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
viewport,
|
viewport,
|
||||||
$lib,
|
$lib,
|
||||||
$pl,
|
$pl,
|
||||||
$togglePl = $("<a id='pl_edit' class='btn btn-small' href='#' title='"+$.i18n._("Open playlist")+"'>"+$.i18n._("Open Playlist")+"</a>"),
|
$togglePl = $("<button id='pl_edit' class='btn btn-small' href='#' title='"+$.i18n._("Open Playlist Editor")+"'>"+$.i18n._("Open Playlist Editor")+"</button>"),
|
||||||
widgetHeight,
|
widgetHeight,
|
||||||
resizeTimeout,
|
resizeTimeout,
|
||||||
width;
|
width;
|
||||||
|
@ -720,12 +720,35 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
$lib.on("click", "#pl_edit", function() {
|
$lib.on("click", "#pl_edit", function() {
|
||||||
openPlaylistPanel();
|
openPlaylistPanel();
|
||||||
|
$.ajax( {
|
||||||
|
url : baseUrl+"usersettings/set-library-screen-settings",
|
||||||
|
type : "POST",
|
||||||
|
data : {
|
||||||
|
settings : {
|
||||||
|
playlist : true
|
||||||
|
},
|
||||||
|
format : "json"
|
||||||
|
},
|
||||||
|
dataType : "json"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$pl.on("click", "#lib_pl_close", function() {
|
$pl.on("click", "#lib_pl_close", function() {
|
||||||
var screenWidth = Math.floor(viewport.width - 40);
|
var screenWidth = Math.floor(viewport.width - 40);
|
||||||
$pl.hide();
|
$pl.hide();
|
||||||
$lib.width(screenWidth).find("#library_display_length").append($togglePl.show());
|
$lib.width(screenWidth).find("#library_display_length").append($togglePl.show());
|
||||||
|
|
||||||
|
$.ajax( {
|
||||||
|
url : baseUrl+"usersettings/set-library-screen-settings",
|
||||||
|
type : "POST",
|
||||||
|
data : {
|
||||||
|
settings : {
|
||||||
|
playlist : false
|
||||||
|
},
|
||||||
|
format : "json"
|
||||||
|
},
|
||||||
|
dataType : "json"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#save_button').live("click", function(event){
|
$('#save_button').live("click", function(event){
|
||||||
|
@ -1099,12 +1122,18 @@ var AIRTIME = (function(AIRTIME){
|
||||||
mod.onReady = function() {
|
mod.onReady = function() {
|
||||||
$lib = $("#library_content");
|
$lib = $("#library_content");
|
||||||
$pl = $("#side_playlist");
|
$pl = $("#side_playlist");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setWidgetSize();
|
setWidgetSize();
|
||||||
|
|
||||||
AIRTIME.library.libraryInit();
|
AIRTIME.library.libraryInit();
|
||||||
AIRTIME.playlist.init();
|
AIRTIME.playlist.init();
|
||||||
|
|
||||||
|
if ($pl.is(':hidden')) {
|
||||||
|
$lib.find("#library_display_length").append($togglePl.show());
|
||||||
|
}
|
||||||
|
|
||||||
$pl.find(".ui-icon-alert").qtip({
|
$pl.find(".ui-icon-alert").qtip({
|
||||||
content: {
|
content: {
|
||||||
text: $.i18n._("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore.")
|
text: $.i18n._("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore.")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue