some query fixes
This commit is contained in:
parent
cc4df21897
commit
ab3098f847
4 changed files with 75 additions and 88 deletions
|
|
@ -65,7 +65,8 @@ pandora.ui.group = function(id) {
|
|||
} else {
|
||||
if (index == -1) {
|
||||
index = pandora.user.ui.query.conditions.length;
|
||||
pandora.user.ui.query.operator = '&'
|
||||
pandora.user.ui.query.operator = index ? '&' : '';
|
||||
Ox.print('$$$$$$$$$$$$$$$$$$$', index, pandora.user.ui.query.operator)
|
||||
}
|
||||
if (conditions.length == 0) {
|
||||
pandora.user.ui.query.conditions.splice(index, 1);
|
||||
|
|
@ -82,7 +83,6 @@ pandora.ui.group = function(id) {
|
|||
}
|
||||
}
|
||||
pandora.Query.updateGroups();
|
||||
Ox.print('---------', pandora.user.ui.query, pandora.user.ui.groupsData)
|
||||
pandora.URL.push(pandora.Query.toString());
|
||||
pandora.reloadGroups(i);
|
||||
}
|
||||
|
|
@ -104,55 +104,37 @@ pandora.ui.group = function(id) {
|
|||
i_ = pandora.user.ui.groups.indexOf(id_);
|
||||
if (i_ == -1) {
|
||||
// new group was not part of old group set
|
||||
if (pandora.user.queryGroups[i].query.conditions.length) {
|
||||
if (pandora.user.ui.groupsData[i].selected.length) {
|
||||
// if group with selection gets replaced, reload
|
||||
pandora.user.queryGroups[i].query.conditions = [];
|
||||
pandora.user.ui.query.conditions.splice(pandora.user.ui.groupsData[i].index, 1);
|
||||
pandora.Query.updateGroups();
|
||||
pandora.URL.push(pandora.Query.toString());
|
||||
pandora.reloadGroups(i);
|
||||
}
|
||||
pandora.user.queryGroups[i] = getGroupObject(id_);
|
||||
pandora.user.ui.groups[i] = id_;
|
||||
pandora.UI.set({groups: pandora.user.ui.groups});
|
||||
replaceGroup(i, id_);
|
||||
} else {
|
||||
// swap two existing groups
|
||||
var group = $.extend({}, pandora.user.queryGroups[i]);
|
||||
pandora.user.queryGroups[i] = pandora.user.queryGroups[i_];
|
||||
pandora.user.queryGroups[i_] = group;
|
||||
var groupsData = Ox.clone(pandora.user.ui.groupsData[i]);
|
||||
pandora.user.ui.groupsData[i] = pandora.user.ui.groupsData[i_];
|
||||
pandora.user.ui.groupsData[i_] = groupsData;
|
||||
pandora.user.ui.groups[i] = id_;
|
||||
pandora.user.ui.groups[i_] = id;
|
||||
pandora.UI.set({groups: pandora.user.ui.groups});
|
||||
replaceGroup(i, id_, pandora.user.queryGroups[i].query);
|
||||
replaceGroup(i_, id, pandora.user.queryGroups[i_].query);
|
||||
replaceGroup(i, id_);
|
||||
replaceGroup(i_, id);
|
||||
}
|
||||
function replaceGroup(i, id, query) {
|
||||
// if query is passed, selected items will be derived from it
|
||||
var isOuter = i % 4 == 0;
|
||||
pandora.$ui[isOuter ? 'browser' : 'groupsInnerPanel'].replaceElement(
|
||||
isOuter ? i / 2 : i - 1,
|
||||
pandora.$ui.groups[i] = pandora.ui.group(id, query)
|
||||
pandora.$ui.groups[i] = pandora.ui.group(id)
|
||||
);
|
||||
}
|
||||
})
|
||||
.appendTo(that.$bar.$element);
|
||||
if (!query) {
|
||||
// if query is set, group object has already been taken care of
|
||||
pandora.user.queryGroups[i] = getGroupObject(id);
|
||||
}
|
||||
function getGroupObject(id) {
|
||||
var i = pandora.user.ui.groups.indexOf(id),
|
||||
title = Ox.getObjectById(pandora.site.groups, id).title,
|
||||
width = pandora.getGroupWidth(i, panelWidth);
|
||||
return {
|
||||
id: id,
|
||||
element: that,
|
||||
query: {
|
||||
conditions: [],
|
||||
operator: '|'
|
||||
},
|
||||
size: width.list,
|
||||
title: title
|
||||
};
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue