cablegates/static/js/pandora/ui/placesDialog.js
2011-05-30 11:06:28 +02:00

52 lines
2 KiB
JavaScript

// vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.placesDialog = function() {
var height = Math.round(document.height * 0.8),
width = Math.round(document.width * 0.8),
that = new Ox.Dialog({
buttons: [
new Ox.Button({
id: 'done',
title: 'Done'
}).bindEvent({
click: function() {
that.close();
}
})
],
content: app.$ui.placesElement = new Ox.ListMap({
height: height - 48,
places: function(data, callback) {
return pandora.api.findPlaces($.extend({
query: {conditions: [], operator: ''}
}, data), callback);
},
addPlace: function(place, callback) {
Ox.print('ADDPLACE', place);
pandora.api.addPlace(place, function(result) {
Ox.Request.clearCache(); // fixme: remove
callback(result);
});
},
editPlace: function(place, callback) {
Ox.print('EDITPLACE', place);
pandora.api.editPlace(place, callback);
},
removePlace: function(place, callback) {
Ox.print('REMOVEPLACE', place);
pandora.api.removePlace(place, function(result) {
Ox.Request.clearCache(); // fixme: remove
callback(result);
});
},
width: width
}),
height: height,
keys: {enter: 'done', escape: 'done'},
padding: 0,
title: 'Manage Places',
width: width
});
return that;
};