2 # GNU MediaGoblin -- federated, autonomous media hosting
3 # Copyright (C)
2011,
2012 MediaGoblin contributors. See AUTHORS.
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.
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.
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
/>.
19 {% extends 'mediagoblin/user_pages/media.html' %}
22 {% block mediagoblin_media %}
25 {% set model_download = request.app.public_store.file_url(
26 media.media_files['original']) %}
27 {% set perspective_view = request.app.public_store.file_url(
28 media.media_files['perspective']) %}
29 {% set top_view = request.app.public_store.file_url(
30 media.media_files['top']) %}
31 {% set side_view = request.app.public_store.file_url(
32 media.media_files['side']) %}
33 {% set front_view = request.app.public_store.file_url(
34 media.media_files['front']) %}
36 <style type=
"text/css">
37 #top_view, #side_view, #front_view, #thingy_view {
41 cursor: inherit!important;
46 {% if media.media_data.file_type ==
"stl" %}
47 <script src=
"{{ request.staticdirect('/js/extlib/thingiview.js/Three.js') }}"></script>
48 <script src=
"{{ request.staticdirect('/js/extlib/thingiview.js/plane.js') }}"></script>
49 <script src=
"{{ request.staticdirect('/js/extlib/thingiview.js/thingiview.js') }}"></script>
53 <script type=
"text/javascript">
54 window.show = function (view_id) {
62 for (var i=
0; i
<ids.length; i+=
1) {
64 var view = document.getElementById(id);
65 view.style.display = id===view_id ?
"block" :
"none";
69 window.show_things = function () {
70 document.getElementById(
"webgl_button").onclick = function () {
73 window.show(
"thingy_view");
74 thingiurlbase =
"{{ request.staticdirect('/js/extlib/thingiview.js') }}";
75 thingiview = new Thingiview(
"thingy_view");
76 thingiview.setObjectColor('#
821543');
77 thingiview.initScene();
78 thingiview.loadSTL(
"{{ model_download }}");
79 thingiview.setRotation(false);
83 <div class=
"media_pane eleven columns">
84 <div class=
"media_image_container">
89 src=
"{{ perspective_view }}"
90 alt=
"{% trans media_title=media.title -%}
91 Image for {{ media_title }}{% endtrans %}" />
96 alt=
"{% trans media_title=media.title -%}
97 Image for {{ media_title }}{% endtrans %}" />
101 src=
"{{ side_view }}"
102 alt=
"{% trans media_title=media.title -%}
103 Image for {{ media_title }}{% endtrans %}" />
107 src=
"{{ front_view }}"
108 alt=
"{% trans media_title=media.title -%}
109 Image for {{ media_title }}{% endtrans %}" />
110 <!--<div id="thingy_view" style="width:640px;height:640px;"></div>-->
111 <div id=
"thingy_view"></div>
115 <div style=
"padding: 4px;">
116 <a class=
"button_action" onclick=
"show('perspective');">
117 {%- trans %}Perspective{% endtrans -%}
119 <a class=
"button_action" onclick=
"show('front_view');">
120 {%- trans %}Front{% endtrans -%}
122 <a class=
"button_action" onclick=
"show('top_view');">
123 {%- trans %}Top{% endtrans -%}
125 <a class=
"button_action" onclick=
"show('side_view');">
126 {%- trans %}Side{% endtrans -%}
128 {% if media.media_data.file_type ==
"stl" %}
129 <a id=
"webgl_button" class=
"button_action"
130 onclick=
"show_things();">
131 {%- trans %}WebGL{% endtrans -%}
135 <a class=
"button_action" href=
"{{ model_download }}"
136 style=
"float:right;">
137 {%- trans %}Download model{% endtrans -%}
145 {% block mediagoblin_sidebar %}
146 <h3>{% trans %}File Format{% endtrans %}
</h3>
147 <p>{{ media.media_data.file_type }}
</p>
148 <h3>{% trans %}Object Height{% endtrans %}
</h3>
149 <p>~{{ media.media_data.height|int }} mm
</p>
150 {% template_hook(
"stl_sideinfo") %}