forked from 0x2620/pandora
update manage places / manage events
This commit is contained in:
parent
a123d4daf7
commit
e84a5a6ca9
3 changed files with 16 additions and 1 deletions
|
@ -40,6 +40,17 @@ def addPlace(request):
|
||||||
existing_names = []
|
existing_names = []
|
||||||
existing_geoname = ''
|
existing_geoname = ''
|
||||||
name = data.pop('name')
|
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', [])
|
names = [name] + data.get('alternativeNames', [])
|
||||||
for name in names:
|
for name in names:
|
||||||
if models.Place.objects.filter(defined=True,
|
if models.Place.objects.filter(defined=True,
|
||||||
|
|
|
@ -84,7 +84,9 @@ pandora.ui.eventsDialog = function() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
events: result.data.items,
|
events: result.data.items,
|
||||||
|
hasMatches: true,
|
||||||
height: height,
|
height: height,
|
||||||
|
mode: pandora.site.calendar == 'auto' ? 'add' : 'define',
|
||||||
removeEvent: function(event, callback) {
|
removeEvent: function(event, callback) {
|
||||||
pandora.api.removeEvent(event, function(result) {
|
pandora.api.removeEvent(event, function(result) {
|
||||||
Ox.Request.clearCache(); // fixme: remove
|
Ox.Request.clearCache(); // fixme: remove
|
||||||
|
|
|
@ -22,6 +22,7 @@ pandora.ui.placesDialog = function(options) {
|
||||||
getMatches: function(names, callback) {
|
getMatches: function(names, callback) {
|
||||||
// fixme: the results of this are of course
|
// fixme: the results of this are of course
|
||||||
// not identical to actual place matches
|
// not identical to actual place matches
|
||||||
|
names.length == 0 && callback(0);
|
||||||
var key = pandora.site.layers.filter(function(layer) {
|
var key = pandora.site.layers.filter(function(layer) {
|
||||||
return layer.type == 'place' || layer.hasPlaces;
|
return layer.type == 'place' || layer.hasPlaces;
|
||||||
}).map(function(layer) {
|
}).map(function(layer) {
|
||||||
|
@ -40,6 +41,7 @@ pandora.ui.placesDialog = function(options) {
|
||||||
callback(result.data.items);
|
callback(result.data.items);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
hasMatches: true, // FIXME: getMatches is enough
|
||||||
height: height - 48,
|
height: height - 48,
|
||||||
mode: pandora.site.map == 'auto' ? 'add' : 'define',
|
mode: pandora.site.map == 'auto' ? 'add' : 'define',
|
||||||
names: pandora.hasPlacesLayer ? function(callback) {
|
names: pandora.hasPlacesLayer ? function(callback) {
|
||||||
|
@ -59,7 +61,7 @@ pandora.ui.placesDialog = function(options) {
|
||||||
callback(result);
|
callback(result);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
selected: options ? options.id : void 0,
|
selected: options ? options.id : '',
|
||||||
showControls: pandora.user.ui.showMapControls,
|
showControls: pandora.user.ui.showMapControls,
|
||||||
showLabels: pandora.user.ui.showMapLabels,
|
showLabels: pandora.user.ui.showMapLabels,
|
||||||
showTypes: true,
|
showTypes: true,
|
||||||
|
|
Loading…
Reference in a new issue