From 823a14ebda15586f03ff8cc312498b9a82daa673 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 17 Sep 2011 12:16:31 +0000 Subject: [PATCH] fixing a list selection bug --- static/js/pandora/Query.js | 32 +++++++++++++---------------- static/js/pandora/URL.js | 9 ++++---- static/js/pandora/ui/foldersList.js | 3 ++- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/static/js/pandora/Query.js b/static/js/pandora/Query.js index 4989322aa..5305f860e 100644 --- a/static/js/pandora/Query.js +++ b/static/js/pandora/Query.js @@ -221,26 +221,20 @@ pandora.Query = (function() { return { fromString: function(str) { - var data - query = Ox.unserialize(str), - sort = [] - if ('find' in query) { + var query = Ox.unserialize(str), data = parseFind(query.find || ''); - Ox.print(Ox.repeat('-', 120)); - Ox.print('STATE', data); - Ox.print(Ox.repeat('-', 120)); - !pandora.user.ui.lists[data.list] && pandora.UI.set( - ['lists', data.list].join('|'), pandora.site.user.ui.lists[''] - ); - pandora.UI.set({list: data.list}); - pandora.user.ui.find = data.find; - pandora.user.ui.groupsData = data.groups; - Ox.print("PUUGD", pandora.user.ui.groupsData); - pandora.user.ui.query = data.query; - } + Ox.print(Ox.repeat('-', 120)); + Ox.print('STATE', data); + Ox.print(Ox.repeat('-', 120)); + !pandora.user.ui.lists[data.list] && pandora.UI.set( + ['lists', data.list].join('|'), pandora.site.user.ui.lists[''] + ); + pandora.UI.set({list: data.list}); + pandora.user.ui.find = data.find; + pandora.user.ui.groupsData = data.groups; + pandora.user.ui.query = data.query; if ('sort' in query) { - sort = query.sort.split(','); - pandora.UI.set(['lists', pandora.user.ui.list, 'sort'].join('|'), query.sort.split(',').map(function(v) { + pandora.UI.set('lists|' + pandora.user.ui.list + '|sort', query.sort.split(',').map(function(v) { var hasOperator = '+-'.indexOf(v[0]) > -1, key = hasOperator ? v.substr(1) : v, operator = hasOperator ? v[0]/*.replace('+', '')*/ : pandora.getSortOperator(key); @@ -250,9 +244,11 @@ pandora.Query = (function() { }; })); } + /* if ('view' in query) { pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), query.view); } + */ }, /* diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index e811b179c..1775a8c71 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -6,11 +6,7 @@ pandora.URL = (function() { var previousURL = '', regexps = { '^$': function(pathname, search) { - if (!search) { - if (pandora.user.ui.showHome) { - pandora.$ui.home = pandora.ui.home().showScreen(); - } - } else if (/^\?url=/.test(search)) { + if (/^\?url=/.test(search)) { document.location = decodeURIComponent(search.substr(5)); } else { pandora.Query.fromString(search); @@ -18,6 +14,9 @@ pandora.URL = (function() { section: 'items', item: '' }); + if (!search && pandora.user.ui.showHome) { + pandora.$ui.home = pandora.ui.home().showScreen(); + } } }, '^home$': function(pathname, search) { diff --git a/static/js/pandora/ui/foldersList.js b/static/js/pandora/ui/foldersList.js index d3b7c137a..0156df50c 100644 --- a/static/js/pandora/ui/foldersList.js +++ b/static/js/pandora/ui/foldersList.js @@ -356,13 +356,14 @@ pandora.ui.folderList = function(id) { pandora.$ui.list.triggerEvent('paste', data); }, select: function(data) { + //pandora.user.ui.item && pandora.UI.set({item: ''}); if (data.ids.length) { Ox.forEach(pandora.$ui.folderList, function($list, id_) { id != id_ && $list.options('selected', []); }); pandora.URL.set('?find=' + (id == 'volumes' ? 'volume' : 'list') + ':' + data.ids[0]); } else { - pandora.UI.set({list: ''}); + //pandora.UI.set({list: ''}); pandora.URL.set(''); } },