fix bugs with selection of lists in featured lists browser

This commit is contained in:
rolux 2011-11-07 18:17:46 +00:00
parent 2e8fb609bf
commit de0fae53c2
2 changed files with 25 additions and 10 deletions

View file

@ -364,6 +364,11 @@ pandora.ui.folderList = function(id) {
}, },
select: function(data) { select: function(data) {
var list = data.ids.length ? data.ids[0] : ''; var list = data.ids.length ? data.ids[0] : '';
if (list) {
Ox.forEach(pandora.$ui.folderList, function($list, id_) {
id != id_ && $list.options('selected', []);
});
}
pandora.UI.set({ pandora.UI.set({
find: { find: {
conditions: list ? [ conditions: list ? [

View file

@ -573,20 +573,30 @@ pandora.getItemByIdOrTitle = function(str, callback) {
} }
pandora.getListData = function(list) { pandora.getListData = function(list) {
var data = {}; var data = {}, folder;
list = Ox.isUndefined(list) ? pandora.user.ui._list : list; list = Ox.isUndefined(list) ? pandora.user.ui._list : list;
if (list) { if (list) {
Ox.forEach(pandora.$ui.folderList, function($list, id) { Ox.forEach(pandora.$ui.folderList, function($list, id) {
var values = $list.value(list); var ret = true;
if (!Ox.isEmpty(values)) { // for the current list, we have to check in which
data = Ox.extend({ // folder it is selected, since for example, a personal
editable: values.user == pandora.user.username // list may appear again in the featured lists browser
&& values.type == 'static', if (
folder: id list == pandora.user.ui._list
}, values); && $list.options('selected').length
return false; ) {
folder = id;
ret = false;
} else if (!Ox.isEmpty($list.value(list))) {
folder = id
ret = false;
} }
}); });
if (folder) {
data = pandora.$ui.folderList[folder].value(pandora.user.ui._list);
data.editable = data.user == pandora.user.username && data.type == 'static';
data.folder = folder;
}
} }
return data; return data;
}; };