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.get_display_media(media.media_files)) %}
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 {
42 <script src=
"{{ request.staticdirect('/js/thingiview.js/Three.js') }}"></script>
43 <script src=
"{{ request.staticdirect('/js/thingiview.js/plane.js') }}"></script>
44 <script src=
"{{ request.staticdirect('/js/thingiview.js/thingiview.js') }}"></script>
47 <script type=
"text/javascript">
49 window.show = function (view_id) {
57 for (var i=
0; i
<ids.length; i+=
1) {
59 var view = document.getElementById(id);
60 view.style.display = id===view_id ?
"block" :
"none";
64 window.show_things = function () {
65 document.getElementById(
"webgl_button").onclick = function () {
68 window.show(
"thingy_view");
69 thingiurlbase =
"{{ request.staticdirect('/js/thingiview.js') }}";
70 thingiview = new Thingiview(
"thingy_view");
71 thingiview.setObjectColor('#
821543');
72 thingiview.initScene();
73 thingiview.loadSTL(
"{{ model_download }}");
74 thingiview.setRotation(false);
81 src=
"{{ perspective_view }}"
82 alt=
"{% trans media_title=media.title -%}
83 Image for {{ media_title }}{% endtrans %}" />
88 alt=
"{% trans media_title=media.title -%}
89 Image for {{ media_title }}{% endtrans %}" />
94 alt=
"{% trans media_title=media.title -%}
95 Image for {{ media_title }}{% endtrans %}" />
99 src=
"{{ front_view }}"
100 alt=
"{% trans media_title=media.title -%}
101 Image for {{ media_title }}{% endtrans %}" />
102 <div id=
"thingy_view" style=
"width:640px;height:640px;"></div>
105 <div style=
"padding: 4px;">
106 <a class=
"button_action" onclick=
"show('perspective');"
107 title=
"{%- trans %}Toggle Rotate{% endtrans -%}">
108 {%- trans %}Perspective{% endtrans -%}
110 <a class=
"button_action" onclick=
"show('front_view');"
111 title=
"{%- trans %}Front{% endtrans -%}">
112 {%- trans %}Front{% endtrans -%}
114 <a class=
"button_action" onclick=
"show('top_view');"
115 title=
"{%- trans %}Top{% endtrans -%}">
116 {%- trans %}Top{% endtrans -%}
118 <a class=
"button_action" onclick=
"show('side_view');"
119 title=
"{%- trans %}Side{% endtrans -%}">
120 {%- trans %}Side{% endtrans -%}
122 <a id=
"webgl_button" class=
"button_action"
123 onclick=
"show_things();"
124 title=
"{%- trans %}WebGL{% endtrans -%}">
125 {%- trans %}WebGL{% endtrans -%}
128 <a class=
"button_action" href=
"{{ model_download }}"
129 title=
"{%- trans %}Download{% endtrans -%}"
130 style=
"float:right;">
131 {%- trans %}Download model{% endtrans -%}
138 {% block mediagoblin_sidebar %}
141 <li>width: {{media.media_data.width}} mm
</li>
142 <li>depth: {{media.media_data.depth}} mm
</li>
143 <li>height: {{media.media_data.height}} mm
</li>
144 <li>cx: {{media.media_data.center_x}} mm
</li>
145 <li>cy: {{media.media_data.center_y}} mm
</li>
146 <li>cz: {{media.media_data.center_z}} mm
</li>