CC-5450 : Refactor Media Management (Classes/DB) in Airtime
saving column displays for all datatables in the library.
This commit is contained in:
parent
7fee696014
commit
636dba3db1
|
@ -9,7 +9,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('contents-feed', 'json')
|
||||
$ajaxContext
|
||||
->addActionContext('delete', 'json')
|
||||
->addActionContext('duplicate', 'json')
|
||||
->addActionContext('delete-group', 'json')
|
||||
|
@ -17,7 +17,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
->addActionContext('get-file-metadata', 'html')
|
||||
->addActionContext('upload-file-soundcloud', 'json')
|
||||
->addActionContext('get-upload-to-soundcloud-status', 'json')
|
||||
->addActionContext('set-num-entries', 'json')
|
||||
->addActionContext('edit-file-md', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
@ -320,19 +319,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
$newPl->setName(sprintf(_("Copy of %s"), $originalPl->getName()));
|
||||
}
|
||||
|
||||
public function contentsFeedAction()
|
||||
{
|
||||
$params = $this->getRequest()->getParams();
|
||||
|
||||
# terrible name for the method below. it does not only search files.
|
||||
$r = Application_Model_StoredFile::searchLibraryFiles($params);
|
||||
|
||||
$this->view->sEcho = $r["sEcho"];
|
||||
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
||||
$this->view->iTotalRecords = $r["iTotalRecords"];
|
||||
$this->view->files = $r["aaData"];
|
||||
}
|
||||
|
||||
public function editFileMdAction()
|
||||
{
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
|
|
@ -8,8 +8,12 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$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('get-audio-datatable', 'json')
|
||||
->addActionContext('set-audio-datatable', 'json')
|
||||
->addActionContext('get-webstream-datatable', 'json')
|
||||
->addActionContext('set-webstream-datatable', 'json')
|
||||
->addActionContext('get-playlist-datatable', 'json')
|
||||
->addActionContext('set-playlist-datatable', 'json')
|
||||
->addActionContext('get-timeline-datatable', 'json')
|
||||
->addActionContext('set-timeline-datatable', 'json')
|
||||
->addActionContext('remindme', 'json')
|
||||
|
@ -34,21 +38,44 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$this->view->settings = $data;
|
||||
}
|
||||
}
|
||||
|
||||
public function setLibraryDatatableAction()
|
||||
|
||||
public function setAudioDatatableAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
Application_Model_Preference::setCurrentLibraryTableSetting($settings);
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
Application_Model_Preference::setAudioTableSetting($settings);
|
||||
}
|
||||
|
||||
public function getLibraryDatatableAction()
|
||||
|
||||
public function getAudioDatatableAction()
|
||||
{
|
||||
$data = Application_Model_Preference::getCurrentLibraryTableSetting();
|
||||
if (!is_null($data)) {
|
||||
$this->view->settings = $data;
|
||||
}
|
||||
$this->view->settings = Application_Model_Preference::getAudioTableSetting();
|
||||
}
|
||||
|
||||
public function setWebstreamDatatableAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
Application_Model_Preference::setWebstreamTableSetting($settings);
|
||||
}
|
||||
|
||||
public function getWebstreamDatatableAction()
|
||||
{
|
||||
$this->view->settings = Application_Model_Preference::getWebstreamTableSetting();
|
||||
}
|
||||
|
||||
public function setPlaylistDatatableAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
Application_Model_Preference::setPlaylistTableSetting($settings);
|
||||
}
|
||||
|
||||
public function getPlaylistDatatableAction()
|
||||
{
|
||||
$this->view->settings = Application_Model_Preference::getPlaylistTableSetting();
|
||||
}
|
||||
|
||||
public function setTimelineDatatableAction()
|
||||
|
|
|
@ -1290,17 +1290,41 @@ class Application_Model_Preference
|
|||
{
|
||||
return self::getOrderingMap("library_datatable");
|
||||
}
|
||||
|
||||
public static function setCurrentLibraryTableSetting($settings)
|
||||
|
||||
public static function setAudioTableSetting($settings)
|
||||
{
|
||||
$data = serialize($settings);
|
||||
self::setValue("library_datatable", $data, true);
|
||||
$data = serialize($settings);
|
||||
self::setValue("audio_datatable", $data, true);
|
||||
}
|
||||
|
||||
public static function getCurrentLibraryTableSetting()
|
||||
|
||||
public static function getAudioTableSetting()
|
||||
{
|
||||
$data = self::getValue("library_datatable", true);
|
||||
return ($data != "") ? unserialize($data) : null;
|
||||
$data = self::getValue("audio_datatable", true);
|
||||
return ($data != "") ? unserialize($data) : null;
|
||||
}
|
||||
|
||||
public static function setWebstreamTableSetting($settings)
|
||||
{
|
||||
$data = serialize($settings);
|
||||
self::setValue("webstream_datatable", $data, true);
|
||||
}
|
||||
|
||||
public static function getWebstreamTableSetting()
|
||||
{
|
||||
$data = self::getValue("webstream_datatable", true);
|
||||
return ($data != "") ? unserialize($data) : null;
|
||||
}
|
||||
|
||||
public static function setPlaylistTableSetting($settings)
|
||||
{
|
||||
$data = serialize($settings);
|
||||
self::setValue("playlist_datatable", $data, true);
|
||||
}
|
||||
|
||||
public static function getPlaylistTableSetting()
|
||||
{
|
||||
$data = self::getValue("playlist_datatable", true);
|
||||
return ($data != "") ? unserialize($data) : null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
|
||||
$mdDialog.dialog({
|
||||
//autoOpen: false,
|
||||
title: $.i18n._("Edit Metadata"),
|
||||
width: 460,
|
||||
height: 660,
|
||||
|
@ -120,6 +119,63 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"data": aoData,
|
||||
"success": fnCallback
|
||||
} );
|
||||
},
|
||||
//save the tables based on tableId
|
||||
"bStateSave": true,
|
||||
"fnStateSaveParams": function (oSettings, oData) {
|
||||
// remove oData components we don't want to save.
|
||||
delete oData.oSearch;
|
||||
delete oData.aoSearchCols;
|
||||
},
|
||||
"fnStateSave": function (oSettings, oData) {
|
||||
localStorage.setItem('datatables-'+ config.settings, JSON.stringify(oData));
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl+"usersettings/set-"+ config.settings,
|
||||
type: "POST",
|
||||
data: {settings : oData, format: "json"},
|
||||
dataType: "json"
|
||||
});
|
||||
|
||||
colReorderMap = oData.ColReorder;
|
||||
},
|
||||
"fnStateLoad": function fnLibStateLoad(oSettings) {
|
||||
var settings = localStorage.getItem('datatables-'+ config.settings);
|
||||
|
||||
try {
|
||||
return JSON.parse(settings);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
"fnStateLoadParams": function (oSettings, oData) {
|
||||
var i,
|
||||
length,
|
||||
a = oData.abVisCols;
|
||||
|
||||
if (a) {
|
||||
// putting serialized data back into the correct js type to make
|
||||
// sure everything works properly.
|
||||
for (i = 0, length = a.length; i < length; i++) {
|
||||
if (typeof(a[i]) === "string") {
|
||||
a[i] = (a[i] === "true") ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a = oData.ColReorder;
|
||||
if (a) {
|
||||
for (i = 0, length = a.length; i < length; i++) {
|
||||
if (typeof(a[i]) === "string") {
|
||||
a[i] = parseInt(a[i], 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oData.iEnd = parseInt(oData.iEnd, 10);
|
||||
oData.iLength = parseInt(oData.iLength, 10);
|
||||
oData.iStart = parseInt(oData.iStart, 10);
|
||||
oData.iCreate = parseInt(oData.iCreate, 10);
|
||||
},
|
||||
"oLanguage": datatables_dict,
|
||||
"aLengthMenu": [[5, 10, 15, 20, 25, 50, 100], [5, 10, 15, 20, 25, 50, 100]],
|
||||
|
@ -345,7 +401,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
},
|
||||
localColumns: "datatables-audiofile-aoColumns",
|
||||
tableId: "audio_table",
|
||||
source: baseUrl+"media/audio-file-feed"
|
||||
source: baseUrl+"media/audio-file-feed",
|
||||
settings: "audio-datatable"
|
||||
},
|
||||
"lib_webstreams": {
|
||||
initialized: false,
|
||||
|
@ -360,7 +417,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
},
|
||||
localColumns: "datatables-webstream-aoColumns",
|
||||
tableId: "webstream_table",
|
||||
source: baseUrl+"media/webstream-feed"
|
||||
source: baseUrl+"media/webstream-feed",
|
||||
settings: "webstream-datatable"
|
||||
},
|
||||
"lib_playlists": {
|
||||
initialized: false,
|
||||
|
@ -375,7 +433,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
},
|
||||
localColumns: "datatables-playlist-aoColumns",
|
||||
tableId: "playlist_table",
|
||||
source: baseUrl+"media/playlist-feed"
|
||||
source: baseUrl+"media/playlist-feed",
|
||||
settings: "playlist-datatable"
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -393,7 +452,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
id: tab.tableId,
|
||||
columns: columns,
|
||||
prop: tab.dataprop,
|
||||
source: tab.source
|
||||
source: tab.source,
|
||||
settings: tab.settings
|
||||
});
|
||||
|
||||
mod.setupToolbar(ui.panel.id);
|
||||
|
|
Loading…
Reference in New Issue