some query fixes

This commit is contained in:
rolux 2011-08-24 06:32:59 +00:00
parent a8b30f5a48
commit c7ff10ab0e
2 changed files with 17 additions and 17 deletions

View file

@ -75,21 +75,21 @@ pandora.ui.findElement = function() {
var findInList = pandora.user.ui.list var findInList = pandora.user.ui.list
&& pandora.$ui.findListSelect.value() == 'list', && pandora.$ui.findListSelect.value() == 'list',
key = pandora.$ui.findSelect.value(), key = pandora.$ui.findSelect.value(),
condition = { conditions = data.value ? [{
key: key == 'all' ? '' : key, key: key == 'all' ? '' : key,
value: data.value, value: data.value,
operator: '' operator: ''
}; }] : [];
if (findInList) { if (findInList) {
pandora.user.ui.query = { pandora.user.ui.query = {
conditions: [{ conditions: Ox.merge([{
key: 'list', key: 'list',
value: pandora.user.ui.list, value: pandora.user.ui.list,
operator: '' operator: ''
}, condition], }], conditions),
operator: '&' operator: '&'
} }
findIndex == 0 && pandora.user.ui.query.conditions.reverse(); data.value && findIndex == 0 && pandora.user.ui.query.conditions.reverse();
} else { } else {
if (pandora.user.ui.list) { if (pandora.user.ui.list) {
Ox.forEach(pandora.$ui.folderList, function($list) { Ox.forEach(pandora.$ui.folderList, function($list) {
@ -98,7 +98,7 @@ pandora.ui.findElement = function() {
pandora.UI.set({list: ''}); pandora.UI.set({list: ''});
} }
pandora.user.ui.query = { pandora.user.ui.query = {
conditions: [condition], conditions: conditions,
operator: '' operator: ''
} }
} }

View file

@ -42,8 +42,8 @@ pandora.ui.list = function() { // fixme: remove view argument
id: 'list', id: 'list',
items: function(data, callback) { items: function(data, callback) {
//Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject()) //Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject())
pandora.api.find($.extend(data, { pandora.api.find(Ox.extend(data, {
query: pandora.Query.toObject() query: pandora.user.ui.query
}), callback); }), callback);
}, },
scrollbarVisible: true, scrollbarVisible: true,
@ -101,7 +101,7 @@ pandora.ui.list = function() { // fixme: remove view argument
}, },
items: function(data, callback) { items: function(data, callback) {
//Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject()) //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 query: pandora.user.ui.query
}), callback); }), callback);
}, },
@ -149,8 +149,8 @@ pandora.ui.list = function() { // fixme: remove view argument
}; };
}, },
items: function(data, callback) { items: function(data, callback) {
pandora.api.find($.extend(data, { pandora.api.find(Ox.extend(data, {
query: pandora.Query.toObject() query: pandora.user.ui.query
}), callback); }), callback);
}, },
keys: ['director', 'duration', 'id', 'posterRatio', 'title', 'year'], keys: ['director', 'duration', 'id', 'posterRatio', 'title', 'year'],
@ -183,7 +183,7 @@ pandora.ui.list = function() { // fixme: remove view argument
}; };
}, },
items: function(data, callback) { items: function(data, callback) {
var itemQuery = pandora.Query.toObject(), var itemQuery = pandora.user.ui.query,
query = {conditions:[]}; query = {conditions:[]};
//fixme: can this be in pandora.Query? dont just check for subtitles //fixme: can this be in pandora.Query? dont just check for subtitles
itemQuery.conditions.forEach(function(q) { itemQuery.conditions.forEach(function(q) {
@ -284,7 +284,7 @@ pandora.ui.list = function() { // fixme: remove view argument
video: function(range, callback) { video: function(range, callback) {
var callback = arguments[arguments.length - 1], var callback = arguments[arguments.length - 1],
range = arguments.length == 2 ? arguments[0] : null, range = arguments.length == 2 ? arguments[0] : null,
itemQuery = pandora.Query.toObject(), itemQuery = pandora.user.ui.query,
query = {conditions:[]}; query = {conditions:[]};
//fixme: can this be in pandora.Query? dont just check for subtitles //fixme: can this be in pandora.Query? dont just check for subtitles
itemQuery.conditions.forEach(function(q) { itemQuery.conditions.forEach(function(q) {
@ -337,9 +337,9 @@ pandora.ui.list = function() { // fixme: remove view argument
element: pandora.$ui.map = Ox.Map({ element: pandora.$ui.map = Ox.Map({
height: window.innerHeight - pandora.user.ui.showGroups * pandora.user.ui.groupsSize - 61, height: window.innerHeight - pandora.user.ui.showGroups * pandora.user.ui.groupsSize - 61,
places: function(data, callback) { places: function(data, callback) {
var itemQuery = pandora.Query.toObject(), var itemQuery = pandora.user.ui.query,
query = {conditions:[]}; query = {conditions:[]};
return pandora.api.findPlaces($.extend(data, { return pandora.api.findPlaces(Ox.extend(data, {
itemQuery: itemQuery, itemQuery: itemQuery,
query: query query: query
}), callback); }), callback);
@ -352,11 +352,11 @@ pandora.ui.list = function() { // fixme: remove view argument
if(place && place.id[0] != '_') { if(place && place.id[0] != '_') {
pandora.$ui.clips.options({ pandora.$ui.clips.options({
items: function(data, callback) { items: function(data, callback) {
return pandora.api.findAnnotations($.extend(data, { return pandora.api.findAnnotations(Ox.extend(data, {
query: { query: {
conditions:[{key: 'place', value: place.id, operator:'='}] conditions:[{key: 'place', value: place.id, operator:'='}]
}, },
itemQuery: pandora.Query.toObject() itemQuery: pandora.user.ui.query
}), callback); }), callback);
} }
}); });