Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of git@github.com:GeoNode/geonode into security

Conflicts:
	src/GeoNodePy/geonode/maps/views.py
  • Loading branch information...
commit 582d613a2213e54b847f2957ef3dd78208588623 2 parents b4d1150 + e642c0a
authored July 28, 2010
1  creds
... ...
@@ -0,0 +1 @@
  1
+odsfjlasjfl;sdajf
1  geoserver_token
... ...
@@ -0,0 +1 @@
  1
+HewR1vp@7Iy0_D16PRO-8VuSm4m@RDgC
30  src/GeoNodePy/geonode/maps/views.py
@@ -31,9 +31,9 @@
31 31
 
32 32
 _user, _password = settings.GEOSERVER_CREDENTIALS
33 33
 
34  
-DEFAULT_TITLE = "GeoNode Default Map"
35  
-DEFAULT_ABSTRACT = "This is a demonstration of GeoNode, an application for assembling and publishing web based maps.  After adding layers to the map, use the Save Map button above to contribute your map to the GeoNode community."
36  
-DEFAULT_CONTACT = "For more information, contact OpenGeo at http://opengeo.org/"
  34
+DEFAULT_TITLE = ""
  35
+DEFAULT_ABSTRACT = ""
  36
+DEFAULT_CONTACT = ""
37 37
 
38 38
 _default_map = Map(
39 39
     title=DEFAULT_TITLE, 
@@ -186,6 +186,9 @@ def newmap(request):
186 186
     if request.method == 'GET' and 'copy' in request.GET:
187 187
         mapid = request.GET['copy']
188 188
         map = get_object_or_404(Map,pk=mapid) 
  189
+        map.abstract = DEFAULT_ABSTRACT
  190
+        map.contact = DEFAULT_CONTACT
  191
+        map.title = DEFAULT_TITLE
189 192
         config = map.viewer_json()
190 193
         del config['id']
191 194
     else:
@@ -409,9 +412,7 @@ def edit_map_permissions(request, mapid):
409 412
 
410 413
 @login_required
411 414
 def deletemap(request, mapid):
412  
-    '''
413  
-    '''
414  
-    # XXX transaction?
  415
+    ''' Delete a map, and its constituent layers. '''
415 416
     map = get_object_or_404(Map,pk=mapid) 
416 417
 
417 418
     if not request.user.has_perm('maps.delete_map', obj=map):
@@ -419,12 +420,17 @@ def deletemap(request, mapid):
419 420
             RequestContext(request, {'error_message': 
420 421
                 _("You are not permitted to delete this map.")})), status=401)
421 422
 
422  
-    layers = MapLayer.objects.filter(map=map.id) 
423  
-     
424  
-    map.delete()
425  
-    for layer in layers:
426  
-        layer.delete()
427  
-        return HttpResponseRedirect(reverse('geonode.views.community'))
  423
+    if request.method == 'GET':
  424
+        return render_to_response("maps/map_remove.html", RequestContext(request, {
  425
+            "map": map
  426
+        }))
  427
+    elif request.method == 'POST':
  428
+        layers = map.layer_set.all()
  429
+        for layer in layers:
  430
+            layer.delete()
  431
+        map.delete()
  432
+
  433
+        return HttpResponseRedirect(reverse("data"))
428 434
 
429 435
 def mapdetail(request,mapid): 
430 436
     '''
16  src/GeoNodePy/geonode/templates/maps/map_remove.html
... ...
@@ -0,0 +1,16 @@
  1
+{% extends "page_layout.html" %}
  2
+{% load i18n %}
  3
+
  4
+{% block title %} {{ map.title }} - {{ block.super }} {% endblock %}
  5
+
  6
+{% block main %}
  7
+<h3>{% trans "Are you sure you want to remove"  %} <strong>{{ map.title }}</strong>?</h3>
  8
+
  9
+<form action="/data/{{layer.typename}}?remove" method="POST">
  10
+	{% csrf_token %}
  11
+	<input type="submit" value="{% trans "Yes, I am sure"  %}" />
  12
+</form>
  13
+<form action="/data/{{layer.typename}}" method="GET">
  14
+    <button type="submit">{% trans "No, don't remove it" %}</button>
  15
+</form>
  16
+{% endblock %}

0 notes on commit 582d613

Please sign in to comment.
Something went wrong with that request. Please try again.