From b8b90be6c31ec86071d8c63c301b75ae183c830d Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Wed, 24 Aug 2011 06:32:59 +0000 Subject: [PATCH] some query fixes --- static/js/pandora/ui/findElement.js | 12 ++++++------ static/js/pandora/ui/list.js | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/static/js/pandora/ui/findElement.js b/static/js/pandora/ui/findElement.js index 0607686..e46657c 100644 --- a/static/js/pandora/ui/findElement.js +++ b/static/js/pandora/ui/findElement.js @@ -75,21 +75,21 @@ pandora.ui.findElement = function() { var findInList = pandora.user.ui.list && pandora.$ui.findListSelect.value() == 'list', key = pandora.$ui.findSelect.value(), - condition = { + conditions = data.value ? [{ key: key == 'all' ? '' : key, value: data.value, operator: '' - }; + }] : []; if (findInList) { pandora.user.ui.query = { - conditions: [{ + conditions: Ox.merge([{ key: 'list', value: pandora.user.ui.list, operator: '' - }, condition], + }], conditions), operator: '&' } - findIndex == 0 && pandora.user.ui.query.conditions.reverse(); + data.value && findIndex == 0 && pandora.user.ui.query.conditions.reverse(); } else { if (pandora.user.ui.list) { Ox.forEach(pandora.$ui.folderList, function($list) { @@ -98,7 +98,7 @@ pandora.ui.findElement = function() { pandora.UI.set({list: ''}); } pandora.user.ui.query = { - conditions: [condition], + conditions: conditions, operator: '' } } diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index 9832efe..8ae84a3 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -42,8 +42,8 @@ pandora.ui.list = function() { // fixme: remove view argument id: 'list', items: function(data, callback) { //Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject()) - pandora.api.find($.extend(data, { - query: pandora.Query.toObject() + pandora.api.find(Ox.extend(data, { + query: pandora.user.ui.query }), callback); }, scrollbarVisible: true, @@ -101,7 +101,7 @@ pandora.ui.list = function() { // fixme: remove view argument }, items: function(data, callback) { //Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject()) - pandora.api.find($.extend(data, { + pandora.api.find(Ox.extend(data, { query: pandora.user.ui.query }), callback); }, @@ -149,8 +149,8 @@ pandora.ui.list = function() { // fixme: remove view argument }; }, items: function(data, callback) { - pandora.api.find($.extend(data, { - query: pandora.Query.toObject() + pandora.api.find(Ox.extend(data, { + query: pandora.user.ui.query }), callback); }, keys: ['director', 'duration', 'id', 'posterRatio', 'title', 'year'], @@ -183,7 +183,7 @@ pandora.ui.list = function() { // fixme: remove view argument }; }, items: function(data, callback) { - var itemQuery = pandora.Query.toObject(), + var itemQuery = pandora.user.ui.query, query = {conditions:[]}; //fixme: can this be in pandora.Query? dont just check for subtitles itemQuery.conditions.forEach(function(q) { @@ -284,7 +284,7 @@ pandora.ui.list = function() { // fixme: remove view argument video: function(range, callback) { var callback = arguments[arguments.length - 1], range = arguments.length == 2 ? arguments[0] : null, - itemQuery = pandora.Query.toObject(), + itemQuery = pandora.user.ui.query, query = {conditions:[]}; //fixme: can this be in pandora.Query? dont just check for subtitles itemQuery.conditions.forEach(function(q) { @@ -337,9 +337,9 @@ pandora.ui.list = function() { // fixme: remove view argument element: pandora.$ui.map = Ox.Map({ height: window.innerHeight - pandora.user.ui.showGroups * pandora.user.ui.groupsSize - 61, places: function(data, callback) { - var itemQuery = pandora.Query.toObject(), + var itemQuery = pandora.user.ui.query, query = {conditions:[]}; - return pandora.api.findPlaces($.extend(data, { + return pandora.api.findPlaces(Ox.extend(data, { itemQuery: itemQuery, query: query }), callback); @@ -352,11 +352,11 @@ pandora.ui.list = function() { // fixme: remove view argument if(place && place.id[0] != '_') { pandora.$ui.clips.options({ items: function(data, callback) { - return pandora.api.findAnnotations($.extend(data, { + return pandora.api.findAnnotations(Ox.extend(data, { query: { conditions:[{key: 'place', value: place.id, operator:'='}] }, - itemQuery: pandora.Query.toObject() + itemQuery: pandora.user.ui.query }), callback); } });