2011-07-29 18:37:11 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
2011-10-03 16:38:07 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.ui.placesDialog = function() {
|
2011-08-17 11:39:55 +00:00
|
|
|
var height = Math.round((window.innerHeight - 48) * 0.9),
|
2011-06-02 07:01:29 +00:00
|
|
|
width = Math.round(window.innerWidth * 0.9),
|
2011-10-11 09:17:43 +00:00
|
|
|
$content = Ox.ListMap({
|
|
|
|
height: height - 48,
|
|
|
|
places: function(data, callback) {
|
|
|
|
return pandora.api.findPlaces(Ox.extend({
|
|
|
|
query: {conditions: [], operator: ''}
|
|
|
|
}, data), callback);
|
|
|
|
},
|
|
|
|
addPlace: function(place, callback) {
|
|
|
|
pandora.api.addPlace(place, function(result) {
|
|
|
|
Ox.Request.clearCache(); // fixme: remove
|
|
|
|
callback(result);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
editPlace: function(place, callback) {
|
|
|
|
pandora.api.editPlace(place, function(result) {
|
|
|
|
Ox.Request.clearCache(); // fixme: remove
|
|
|
|
callback(result);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
removePlace: function(place, callback) {
|
|
|
|
pandora.api.removePlace(place, function(result) {
|
|
|
|
Ox.Request.clearCache(); // fixme: remove
|
|
|
|
callback(result);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
showTypes: true,
|
|
|
|
width: width
|
|
|
|
}),
|
2011-06-19 17:49:25 +00:00
|
|
|
that = Ox.Dialog({
|
2011-05-25 19:42:45 +00:00
|
|
|
buttons: [
|
2011-10-11 16:30:06 +00:00
|
|
|
Ox.Button({
|
|
|
|
id: 'manageEvents',
|
|
|
|
title: 'Manage Events...'
|
|
|
|
}).bindEvent({
|
|
|
|
click: function() {
|
|
|
|
// ...
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
{},
|
2011-06-19 17:49:25 +00:00
|
|
|
Ox.Button({
|
2011-05-25 19:42:45 +00:00
|
|
|
id: 'done',
|
|
|
|
title: 'Done'
|
|
|
|
}).bindEvent({
|
|
|
|
click: function() {
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
2011-08-17 11:39:55 +00:00
|
|
|
closeButton: true,
|
2011-10-11 09:17:43 +00:00
|
|
|
content: $content,
|
2011-05-25 19:42:45 +00:00
|
|
|
height: height,
|
2011-08-17 11:39:55 +00:00
|
|
|
maximizeButton: true,
|
|
|
|
minHeight: 256,
|
|
|
|
minWidth: 512,
|
2011-06-02 08:03:41 +00:00
|
|
|
//keys: {enter: 'done', escape: 'done'},
|
2011-05-25 19:42:45 +00:00
|
|
|
padding: 0,
|
|
|
|
title: 'Manage Places',
|
|
|
|
width: width
|
2011-10-11 09:17:43 +00:00
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
resize: function(data) {
|
|
|
|
// data is {width: ..., height: ...}
|
|
|
|
$content.options(data);
|
|
|
|
}
|
2011-05-25 19:42:45 +00:00
|
|
|
});
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|