2011-05-25 19:42:45 +00:00
|
|
|
// 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) {
|
2011-05-29 21:43:33 +00:00
|
|
|
return pandora.api.findPlaces($.extend({
|
2011-05-25 19:42:45 +00:00
|
|
|
query: {conditions: [], operator: ''}
|
2011-05-29 21:43:33 +00:00
|
|
|
}, data), callback);
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
2011-05-29 19:45:31 +00:00
|
|
|
addPlace: function(data, callback) {
|
|
|
|
Ox.print('ADDPLACE', data);
|
2011-05-29 20:01:33 +00:00
|
|
|
pandora.api.addPlace(data.place, function(result) {
|
|
|
|
Ox.Request.clearCache(); // fixme: remove
|
|
|
|
callback(result);
|
|
|
|
});
|
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
2011-05-29 19:45:31 +00:00
|
|
|
editPlace: function(data, callback) {
|
|
|
|
Ox.print('EDITPLACE', data);
|
|
|
|
pandora.api.editPlace(data.place, callback);
|
|
|
|
},
|
|
|
|
removePlace: function(data, callback) {
|
|
|
|
Ox.print('REMOVEPLACE', data);
|
2011-05-29 21:43:33 +00:00
|
|
|
pandora.api.removePlace(data.place, function(result) {
|
|
|
|
Ox.Request.clearCache(); // fixme: remove
|
|
|
|
callback(result);
|
|
|
|
});
|
2011-05-29 19:45:31 +00:00
|
|
|
},
|
|
|
|
width: width
|
2011-05-25 19:42:45 +00:00
|
|
|
}),
|
|
|
|
height: height,
|
|
|
|
keys: {enter: 'done', escape: 'done'},
|
|
|
|
padding: 0,
|
|
|
|
title: 'Manage Places',
|
|
|
|
width: width
|
|
|
|
});
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|