Fixed Copyright Headers
[mediagoblin.git] / mediagoblin / templates / mediagoblin / user_pages / media.html
1 {#
2 # GNU MediaGoblin -- federated, autonomous media hosting
3 # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
14 #
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #}
18 {%- extends "mediagoblin/base.html" %}
19
20 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
21 {% from "mediagoblin/utils/pagination.html" import render_pagination %}
22
23 {% block title %}{{ media.title }} &mdash; {{ super() }}{% endblock %}
24
25 {% block mediagoblin_head %}
26 <!--[if lte IE 8]><link rel="stylesheet"
27 href="{{ request.staticdirect('/extlib/leaflet/leaflet.ie.css') }}" /><![endif]-->
28 <script type="text/javascript"
29 src="{{ request.staticdirect('/js/comment_show.js') }}"></script>
30 <script type="text/javascript"
31 src="{{ request.staticdirect('/js/keyboard_navigation.js') }}"></script>
32
33 {% template_hook("location_head") %}
34 {% template_hook("media_head") %}
35 {% endblock mediagoblin_head %}
36 {% block mediagoblin_content %}
37 <div class="row foot">
38 <p class="eleven columns context">
39 {%- trans user_url=request.urlgen(
40 'mediagoblin.user_pages.user_home',
41 user=media.get_actor.username),
42 username=media.get_actor.username -%}
43 ❖ Browsing media by <a href="{{user_url}}">{{username}}</a>
44 {%- endtrans -%}
45 </p>
46 <div class="five columns">
47 {% include "mediagoblin/utils/prev_next.html" %}
48 </div>
49 </div>
50 <div class="media_pane eleven columns">
51 {% block mediagoblin_media %}
52 <div class="media_image_container">
53 {% set display_media = request.app.public_store.file_url(
54 media.get_display_media()[1]) %}
55 {# if there's a medium file size, that means the medium size
56 # isn't the original... so link to the original!
57 #}
58 {% if media.media_files.has_key('medium') %}
59 <a href="{{ request.app.public_store.file_url(
60 media.media_files['original']) }}">
61 <img class="media_image"
62 src="{{ display_media }}"
63 alt="{% trans media_title=media.title -%}
64 Image for {{ media_title }}{% endtrans %}" />
65 </a>
66 {% else %}
67 <img class="media_image"
68 src="{{ display_media }}"
69 alt="{% trans media_title=media.title -%}
70 Image for {{ media_title }}{% endtrans %}" />
71 {% endif %}
72 </div>
73 {% endblock %}
74 <div class="row head foot">
75 <h2 class="media_title">
76 {{ media.title }}
77 </h2>
78 {% if request.user and
79 (media.actor == request.user.id or
80 request.user.has_privilege('admin')) %}
81 <div class="pull-right" style="padding-top:20px;">
82 {% set edit_url = request.urlgen('mediagoblin.edit.edit_media',
83 user= media.get_actor.username,
84 media_id=media.id) %}
85 <a class="button_action" href="{{ edit_url }}">{% trans %}Edit{% endtrans %}</a>
86 {% set delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete',
87 user= media.get_actor.username,
88 media_id=media.id) %}
89 <a class="button_action button_warning" href="{{ delete_url }}">{% trans %}Delete{% endtrans %}</a>
90 </div>
91 {% endif %}
92 {% autoescape False %}
93 <p>{{ media.description_html }}</p>
94 {% endautoescape %}
95 </div>
96 {% if request.user and request.user.has_privilege('commenter') %}
97 <div class="media_comments">
98 {% if app_config['allow_comments'] %}
99 <a
100 {% if not request.user %}
101 href="{{ request.urlgen('mediagoblin.auth.login') }}?next={{
102 request.base_url|urlencode }}"
103 {% endif %}
104 class="button_action" id="button_addcomment" title="Add a comment">
105 {% trans %}Add a comment{% endtrans %}
106 </a>
107 {% include "mediagoblin/utils/comment-subscription.html" %}
108
109 {% endif %}
110 {% if request.user %}
111 <form action="{{ request.urlgen('mediagoblin.user_pages.media_post_comment',
112 user= media.get_actor.username,
113 media_id=media.id) }}" method="POST" id="form_comment">
114 {{ wtforms_util.render_divs(comment_form) }}
115 <div class="form_submit_buttons">
116 <input type="submit" value="{% trans %}Add this comment{% endtrans %}" class="button_action" />
117 {{ csrf_token }}
118 </div>
119 <input type="hidden" value="{{ request.urlgen('mediagoblin.user_pages.media_preview_comment') }}" id="previewURL" />
120 <input type="hidden" value="{% trans %}Comment Preview{% endtrans %}" id="previewText"/>
121 </form>
122 <div id="comment_preview"></div>
123 {% endif %}
124 <ul style="list-style:none">
125 {% for comment in comments %}
126 {% set comment_object = comment.comment() %}
127 {% set comment_author = comment_object.get_actor %}
128 <li id="comment-{{ comment.id }}"
129 {%- if pagination.active_id == comment.id %}
130 class="comment_wrapper comment_active">
131 <a name="comment" id="comment"></a>
132 {%- else %}
133 class="comment_wrapper">
134 {%- endif %}
135 <div class="comment_author">
136 <img src="{{ request.staticdirect('/images/icon_comment.png') }}" />
137 <a href="{{ request.urlgen('mediagoblin.user_pages.user_home',
138 user=comment_author.username) }}"
139 class="comment_authorlink">
140 {{- comment_author.username -}}
141 </a>
142 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.view_comment',
143 comment=comment.id,
144 user=media.get_actor.username,
145 media=media.slug_or_id) }}#comment"
146 class="comment_whenlink">
147 <span title='{{- comment_object.created.strftime("%I:%M%p %Y-%m-%d") -}}'>
148 {%- trans formatted_time=timesince(comment_object.created) -%}
149 {{ formatted_time }} ago
150 {%- endtrans -%}
151 </span></a>:
152 </div>
153 <div class="comment_content">
154 {% autoescape False -%}
155 {{ comment_object.content_html }}
156 {%- endautoescape %}
157 </div>
158 <div>
159 {% if app_config.allow_reporting %}
160 <a href="{{ request.urlgen('mediagoblin.user_pages.media_home.report_comment',
161 user=media.get_actor.username,
162 media=media.slug_or_id,
163 comment=comment.id) }}">
164 {% trans %}Report{% endtrans %}</a>
165 {% endif %}
166 </div>
167 </li>
168 {% endfor %}
169 </ul>
170 {{ render_pagination(request, pagination,
171 media.url_for_self(request.urlgen)) }}
172 {% else %}
173 <div class="empty_space no_background">
174 {% endif %}
175 </div>
176
177 </div>
178
179
180 <div class="five columns media_sidebar">
181 <h3>{% trans %}Added{% endtrans %}</h3>
182 <p><span title="{{ media.created.strftime("%I:%M%p %Y-%m-%d") }}">
183 {%- trans formatted_time=timesince(media.created) -%}
184 {{ formatted_time }} ago
185 {%- endtrans -%}
186 </span></p>
187
188 {% block mediagoblin_after_added_sidebar %}
189 {% endblock %}
190
191 {% if media.tags %}
192 {% include "mediagoblin/utils/tags.html" %}
193 {% endif %}
194
195 {% include "mediagoblin/utils/collections.html" %}
196
197 {% if app_config.allow_reporting %}
198 {% include "mediagoblin/utils/report.html" %}
199 {% endif %}
200
201 {% include "mediagoblin/utils/license.html" %}
202
203 {% include "mediagoblin/utils/exif.html" %}
204
205 {%- if media.attachment_files|count %}
206 <h3>{% trans %}Attachments{% endtrans %}</h3>
207 <ul>
208 {%- for attachment in media.attachment_files %}
209 <li>
210 <a href="{{ request.app.public_store.file_url(attachment.filepath) }}">
211 {{- attachment.name -}}
212 </a>
213 </li>
214 {%- endfor %}
215 </ul>
216 {%- endif %}
217 {%- if app_config['allow_attachments']
218 and request.user
219 and (media.actor == request.user.id
220 or request.user.has_privilege('admin')) %}
221 {%- if not media.attachment_files|count %}
222 <h3>{% trans %}Attachments{% endtrans %}</h3>
223 {%- endif %}
224 <p>
225 <a href="{{ request.urlgen('mediagoblin.edit.attachments',
226 user=media.get_actor.username,
227 media_id=media.id) }}">
228 {%- trans %}Add attachment{% endtrans -%}
229 </a>
230 </p>
231 {%- endif %}
232 {% template_hook("subtitle_sidebar") %}
233
234 {% block mediagoblin_sidebar %}
235 {% endblock %}
236
237 {%- set model = media %}
238 {% template_hook("location_info") %}
239 {% template_hook("media_sideinfo") %}
240
241 </div><!--end media_sidebar-->
242
243 <div class="clear"></div>
244 {% endblock %}