Skip to content

Commit

Permalink
Merge pull request #4 from StreamsTech/organization-data-backup
Browse files Browse the repository at this point in the history
Front end for multiple layer backup from organization
  • Loading branch information
shahjalalh authored Nov 15, 2017
2 parents 22f4c87 + 153bb5e commit 1089b22
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
11 changes: 0 additions & 11 deletions geonode/analytics/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,13 @@
class MapLoadListAPIView(ListAPIView):
queryset = MapLoad.objects.all()
serializer_class = MapLoadSerializer
# bbox_filter_field = 'map'
# filter_backends = (InBBoxFilter,)

# set permission for admin


class LayerLoadListAPIView(ListAPIView):
queryset = LayerLoad.objects.all()
serializer_class = LayerLoadSerializer
# import pdb;pdb.set_trace()
# bbox_filter_field = 'layer'
# filter_backends = (InBBoxFilter,)

# set permission for admin

Expand Down Expand Up @@ -111,8 +106,6 @@ def post(self, request, format=None):

data = request.data

# import pdb;pdb.set_trace()

layer_load = LayerLoad()
layer_load.user = None if request.user.id is None else request.user
layer_load.layer = Layer.objects.get(id=int(data['layer']))
Expand All @@ -121,8 +114,6 @@ def post(self, request, format=None):
layer_load.ip = str(request.environ['REMOTE_ADDR'])
layer_load.agent = str(request.environ['HTTP_USER_AGENT'])

# import pdb;pdb.set_trace()

try:
layer_load.save()
except (AssertionError, AttributeError) as e:
Expand All @@ -137,8 +128,6 @@ def post(self, request, format=None):

data = request.data

# import pdb;pdb.set_trace()

map_load = MapLoad()
map_load.user = None if request.user.id is None else request.user
map_load.map = Map.objects.get(id=int(data['map']))
Expand Down
9 changes: 9 additions & 0 deletions geonode/front_end/templates/layers/layer_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ <h4 class="panel-title">
{% endfor %}
</ul>
{% endif %}
{% if links_download %}
<ul>
{% for link in links_download %}
<li>
<a href="{{ link.url }}">{% trans link.name %}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-gd"
Expand Down
22 changes: 22 additions & 0 deletions geonode/groups/templates/groups/group_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
</ul>
</div>
</div>
<div class="row">
<div class="col-md-12" >
<div class="message-box"></div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="tab-content activity-style-list">
Expand Down Expand Up @@ -187,6 +192,7 @@ <h3>{% trans "Permissions" %}</h3>

<div class="no-style-list">
<div class="gd-content-body transparent" id="search-content-layers">
<input type="button" class="btn btn-primary pull-right" id="org-layer-download" value="Download Selected">

{% include 'search/_pagination.html' %}
</div>
Expand Down Expand Up @@ -325,6 +331,7 @@ <h3>{% trans "Permissions" %}</h3>
//alert(item.date);
output +='<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">';
output +='<div class="grid-container lmd">';
output +='<div class="checkbox pull-right"><label><input type="checkbox" id="'+item.id+'"></label></div></br>';
output +='<div class="avater">';
output +='<div class="avater-img">';
output +='<a class="avater-img-mid" href="'+item.detail_url+'" target="_self">';
Expand Down Expand Up @@ -1129,6 +1136,20 @@ <h3>{% trans "Permissions" %}</h3>
});
});
</script>
<script>

$('#org-layer-download').click(function(){

if($('input[type="checkbox"]:checked').length == 0){

$('.message-box').append("<div class='alert alert-warning alert-dismissable'><a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a><strong>Warning!</strong> Please select at least one Layer to download!</div>")
}else{
$('.message-box').empty();
$('.message-box').append("<div class='alert alert-info alert-dismissable'><a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a><strong>Info!</strong> An email will be sent to you with download link.</div>")
}
});

</script>
<script type="text/javascript" language="JavaScript">
<!--$(document).ready(function(){-->
<!--$("#qroup_activity").click(function(){-->
Expand All @@ -1150,5 +1171,6 @@ <h3>{% trans "Permissions" %}</h3>
<!--});-->
<!--});-->
</script>

{% endblock extra_script %}

0 comments on commit 1089b22

Please sign in to comment.