users dialog: export selected emails only (if one or more users are selected)
This commit is contained in:
parent
5dc7564b4f
commit
47b181d8cf
1 changed files with 21 additions and 7 deletions
|
@ -525,14 +525,9 @@ pandora.ui.usersDialog = function() {
|
||||||
click: function() {
|
click: function() {
|
||||||
var $button = this;
|
var $button = this;
|
||||||
$button.options({disabled: true});
|
$button.options({disabled: true});
|
||||||
pandora.api.findUsers({
|
getEmailAddresses(function(items) {
|
||||||
query: {conditions: [], operator: '&'},
|
|
||||||
keys: ['email', 'username'],
|
|
||||||
range: [0, numberOfUsers],
|
|
||||||
sort: [{key: 'username', operator: '+'}]
|
|
||||||
}, function(result) {
|
|
||||||
pandora.ui.exportDialog({
|
pandora.ui.exportDialog({
|
||||||
data: result.data.items.filter(function(item) {
|
data: items.filter(function(item) {
|
||||||
return item.email;
|
return item.email;
|
||||||
}).map(function(item) {
|
}).map(function(item) {
|
||||||
return Ox.encodeHTMLEntities(item.username)
|
return Ox.encodeHTMLEntities(item.username)
|
||||||
|
@ -588,6 +583,25 @@ pandora.ui.usersDialog = function() {
|
||||||
that.superClose();
|
that.superClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getEmailAddresses(callback) {
|
||||||
|
pandora.api.findUsers({
|
||||||
|
query: {conditions: [
|
||||||
|
{key: 'level', value: 'guest', operator: '!='},
|
||||||
|
{key: 'level', value: 'robot', operator: '!='}
|
||||||
|
], operator: '&'},
|
||||||
|
keys: ['id', 'username', 'email'],
|
||||||
|
range: [0, 1000000],
|
||||||
|
sort: [{key: 'username', operator: '+'}]
|
||||||
|
}, function(result) {
|
||||||
|
var selected = $list.options('selected');
|
||||||
|
callback(result.data.items.filter(function(user) {
|
||||||
|
return !selected.length || Ox.contains(selected, user.id);
|
||||||
|
}).map(function(user) {
|
||||||
|
return {username: user.username, email: user.email};
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function getFormItemById(id) {
|
function getFormItemById(id) {
|
||||||
var ret;
|
var ret;
|
||||||
Ox.forEach((
|
Ox.forEach((
|
||||||
|
|
Loading…
Reference in a new issue