add export dialog; use it in manage places/events/users

This commit is contained in:
rolux 2013-08-14 18:22:12 +00:00
commit e1913a1d05
4 changed files with 125 additions and 27 deletions

View file

@ -517,43 +517,29 @@ pandora.ui.usersDialog = function() {
}),
{},
Ox.Button({
title: Ox._('Export E-Mail Addresses')
title: Ox._('Export E-Mail Addresses...')
})
.css({margin: '4px 4px 4px 0'})
.bindEvent({
click: function() {
var $button = this;
$button.options({disabled: true});
pandora.api.findUsers({
query: {conditions: [], operator: '&'},
keys: ['email', 'username'],
range: [0, numberOfUsers],
sort: [{key: 'username', operator: '+'}]
}, function(result) {
var $dialog = Ox.Dialog({
buttons: [
Ox.Button({
title: Ox._('Close')
})
.bindEvent({
click: function() {
$dialog.close();
}
})
],
content: Ox.Element()
.addClass('OxSelectable')
.css({margin: '16px'})
.html(
result.data.items.filter(function(item) {
return item.email;
}).map(function(item) {
return Ox.encodeHTMLEntities(item.username)
+ ' <' + item.email + '>';
}).join(', ')
),
removeOnClose: true,
title: Ox._('E-Mail Addresses')
})
.open();
pandora.ui.exportDialog({
data: result.data.items.filter(function(item) {
return item.email;
}).map(function(item) {
return Ox.encodeHTMLEntities(item.username)
+ ' <' + item.email + '>';
}).join(', '),
title: Ox._('E-Mail Addresses')
}).open();
$button.options({disabled: false});
});
}
}),