forked from GeoNode/geonode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
document_detail.html
231 lines (206 loc) · 9.42 KB
/
document_detail.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
{% extends "documents/document_base.html" %}
{% load i18n %}
{% load dialogos_tags %}
{% load agon_ratings_tags %}
{% load bootstrap_tags %}
{% load url from future %}
{% load base_tags %}
{% load guardian_tags %}
{% block title %}{{ resource.title }} — {{ block.super }}{% endblock %}
{% block head %}
{% if TWITTER_CARD %}
{% include "base/_resourcebase_twittercard.html" %}
{% endif %}
{% if OPENGRAPH_ENABLED %}
{% include "base/_resourcebase_opengraph.html" %}
{% endif %}
{{ block.super }}
{% endblock %}
{% block body_class %}documents{% endblock %}
{% block body_outer %}
<div class="page-header">
<h2>{{ resource.title }}</h2>
</div>
<div class="row">
<div class="col-md-8">
{% get_obj_perms request.user for resource.get_self_resource as "perms" %}
{% if "download_resourcebase" in perms %}
{% if resource.extension|lower in imgtypes and resource.doc_file %}
<div id="embedded_map">
<a style="text-decoration:none;" href="{% url "document_download" resource.id %}" target="_blank">
<img src="{% url "document_download" resource.id %}" width='500' class="img-responsive" />
</a>
</div>
{% elif resource.doc_file %}
<p><a href="{% url "document_download" resource.id %}" target="_blank">Download the {{ resource }} document</a></p>
{% elif resource.doc_url %}
<p><a href="{{ resource.doc_url }}" target="_blank">Download the {{ resource }} document.</a> <small>({% trans 'External Resource' %})</small></p>
{% endif %}
{% endif %}
<div class="documents-actions">
{% include "_actions.html" %}
</div>
<div class="tab-content">
{% include "base/resourcebase_info_panel.html" %}
{% block social_links %}
{% include "social_links.html" %}
{% endblock %}
<article id="comments" class="tab-pane">
{% include "_comments.html" %}
</article>
<article id="rate" class="tab-pane">
<!-- TODO: Move this to a reusable template snippet -->
{% if request.user.is_authenticated %}
<h4>{% trans "Rate this document" %}</h4>
{% user_rating request.user resource "document" as user_document_rating %}
<div id="user_rating" class="category-layer" data-score="{{user_document_rating}}"></div>
{% endif %}
<h4>{% trans 'Average Rating' %}</h4>
{% overall_rating resource "document" as document_rating %}
{% num_ratings resource as num_votes %}
<div class="overall_rating" style="float:left" data-score="{{ document_rating }}"></div> ({{num_votes}})
<!-- TODO: Add display of who gave what rating based -->
</article>
{% if EXIF_ENABLED and exif_data %}
{% block exif %}
{% include "exif/_exif_document_detail.html" %}
{% endblock %}
{% endif %}
</div>
</div>
<div class="col-md-4">
<ul class="list-group">
{% get_obj_perms request.user for resource.get_self_resource as "perms" %}
<li class="list-group-item">
{% if "download_resourcebase" in perms %}
{% if resource.extension|lower in imgtypes and resource.doc_file %}
<a style="text-decoration:none;" target="_blank" href="{% url "document_download" resource.id %}"><button class="btn btn-primary btn-md btn-block">{% trans "Download Document" %}</button></a>
{% elif resource.doc_file %}
<a style="text-decoration:none;" target="_blank" href="{% url "document_download" resource.id %}"><button class="btn btn-primary btn-md btn-block">{% trans "Download Document" %}</button></a>
{% elif resource.doc_url %}
<a style="text-decoration:none;" target="_blank" href="{{ resource.doc_url }}"><button class="btn btn-primary btn-md btn-block">{% trans "Download Document" %}</button></a>
{% endif %}
{% else %}
{% if request.user.is_authenticated %}
<button class="btn btn-primary btn-md btn-block" id="request-download">{% trans "Request Download" %}</button>
{% endif %}
{% endif %}
</li>
<li class="list-group-item">
<button class="btn btn-primary btn-md btn-block" data-toggle="modal" data-target="#edit-document">{% trans "Edit Document" %}</button>
</li>
<div class="modal fade" id="edit-document" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">{% trans "Edit Document" %}</h4>
</div>
<div class="modal-body">
<div class="row edit-modal">
{% if "change_resourcebase_metadata" in perms %}
<div class="col-sm-3">
<i class="fa fa-list-alt fa-3x"></i>
<h4>{% trans "Metadata" %}</h4>
<a class="btn btn-default btn-block btn-xs" href="{% url "document_metadata" resource.id %}">{% trans "Edit" %}</a>
</div>
{% endif %}
{% if "change_resourcebase" in perms or "delete_resourcebase" in perms %}
<div class="col-sm-3">
<i class="fa fa-file-text-o fa-3x"></i>
<h4>{% trans "Document" %}</h4>
{% if "change_resourcebase" in perms %}
<a class="btn btn-default btn-block btn-xs" href="{% url "document_replace" resource.id %}">{% trans "Replace" %}</a>
{% endif %}
{% if "delete_resourcebase" in perms %}
<a class="btn btn-danger btn-block btn-xs" href="{% url "document_remove" resource.id %}">{% trans "Remove" %}</a>
{% endif %}
</div>
{% endif %}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>
</div>
</div>
<li class="list-group-item">
<button class="btn btn-default btn-md btn-block" data-toggle="modal" data-target="#download-metadata">{% trans "Download Metadata" %}</button>
</li>
<div class="modal fade" id="download-metadata" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">{% trans "Download Metadata" %}</h4>
</div>
<div class="modal-body">
<ul>
{% for link in metadata %}
<li><a href="{{ link.url }}">{{ link.name }}</a></li>
{% endfor %}
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>
</div>
</div>
<li class="list-group-item">
<h4>{% trans "Resource using this document" %}</h4>
{% if layer.maps %}
<p>{% trans "List of resources using this document:" %}</p>
{% endif %}
<ul class="list-unstyled">
{% if related.title %}
<p>{% trans "This document is related to a " %} {{ resource.content_type.name }}</p>
<a href='{{ related.get_absolute_url }}'>{{ related.title }}</a>
{% else %}
<p>{% trans "This document is not related to any maps or layers" %}</p>
{% endif %}
</ul>
</li>
{% if "change_resourcebase_permissions" in perms %}
<li class="list-group-item">
<h4>{% trans "Permissions" %}</h4>
<p>{% trans "Click the button below to change the permissions of this document." %}</p>
<p><a href="#modal_perms" data-toggle="modal" class="btn btn-primary btn-block" data-target="#_permissions">{% trans "Change Document Permissions" %}</a></p>
</li>
{% include "_permissions_form.html" %}
{% endif %}
{% include "base/_resourcebase_contact_snippet.html" %}
</ul>
</div>
</div>
{% endblock %}
{% block extra_script %}
{% if SOCIAL_BUTTONS %}
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
{% endif %}
{% if request.user.is_authenticated %}
{% user_rating_js request.user resource "document" %}
{% else %}
{% overall_rating resource "document" as the_doc_rating %}
{% endif %}
{% include 'rating.html' %}
{% include 'request_download.html' %}
<script type="text/javascript">
{% if SOCIAL_BUTTONS %}
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
{% endif %}
</script>
{% include "_permissions_form_js.html" %}
{% endblock extra_script %}