update manage places / manage events

This commit is contained in:
rolux 2012-02-20 18:31:26 +00:00
parent a123d4daf7
commit e84a5a6ca9
3 changed files with 16 additions and 1 deletions

View file

@ -40,6 +40,17 @@ def addPlace(request):
existing_names = []
existing_geoname = ''
name = data.pop('name')
if name == '':
_exists = True
name = 'Untitled'
n = 0
while _exists:
_exists = models.Place.objects.filter(defined=True,
name_find__icontains=u'|%s|'%name).count() > 0
if _exists:
name = 'Untitled [%s]' %n
n += 1
names = [name] + data.get('alternativeNames', [])
for name in names:
if models.Place.objects.filter(defined=True,

View file

@ -84,7 +84,9 @@ pandora.ui.eventsDialog = function() {
});
},
events: result.data.items,
hasMatches: true,
height: height,
mode: pandora.site.calendar == 'auto' ? 'add' : 'define',
removeEvent: function(event, callback) {
pandora.api.removeEvent(event, function(result) {
Ox.Request.clearCache(); // fixme: remove

View file

@ -22,6 +22,7 @@ pandora.ui.placesDialog = function(options) {
getMatches: function(names, callback) {
// fixme: the results of this are of course
// not identical to actual place matches
names.length == 0 && callback(0);
var key = pandora.site.layers.filter(function(layer) {
return layer.type == 'place' || layer.hasPlaces;
}).map(function(layer) {
@ -40,6 +41,7 @@ pandora.ui.placesDialog = function(options) {
callback(result.data.items);
});
},
hasMatches: true, // FIXME: getMatches is enough
height: height - 48,
mode: pandora.site.map == 'auto' ? 'add' : 'define',
names: pandora.hasPlacesLayer ? function(callback) {
@ -59,7 +61,7 @@ pandora.ui.placesDialog = function(options) {
callback(result);
});
},
selected: options ? options.id : void 0,
selected: options ? options.id : '',
showControls: pandora.user.ui.showMapControls,
showLabels: pandora.user.ui.showMapLabels,
showTypes: true,