infopages: allow template tags, some cleaning
[wolnelektury.git] / wolnelektury / templates / catalogue / book_detail.html
1 {% extends "base.html" %}
2 {% load i18n %}
3 {% load catalogue_tags pagination_tags %}
4
5 {% block title %}{{ book.title }} {% trans "on WolneLektury.pl" %}{% endblock %}
6
7 {% block metadescription %}{% book_title book %}. {{ block.super }}{% endblock %}
8
9 {% block bodyid %}book-detail{% endblock %}
10
11 {% block body %}
12     <h1>{% book_title book %}</h1>
13     <form action="{% url search %}" method="get" accept-charset="utf-8" id="search-form">
14         <p>{{ form.q }} <input type="submit" value="{% trans "Search" %}" /> <strong>{% trans "or" %}</strong> <a href="{% url main_page %}">{% trans "return to main page" %}</a></p>
15     </form>
16
17     <div id="books-list">
18         <div id='breadcrumbs'>
19             {% if categories.author %}
20                 {% for tag in categories.author %}
21                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
22                 {% endfor %}
23                 &#187; 
24             {% endif %}
25             {% for parent in parents %}
26                 <a href="{{ parent.get_absolute_url }}">{{ parent }}</a> &#187; 
27             {% endfor %}
28         </div>
29
30         {% if extra_info.license %}
31         <p>{% trans "Work is licensed under " %} <a href="{{ extra_info.license }}">{{ extra_info.license_description }}</a>.</p>
32         {% endif %}
33         <p>{% trans "Based on" %}: {{ extra_info.source_name }}</p>
34         {% if book.has_description %}
35             <div id="description">
36                 <div id='description-long'>{{ book.description|safe }}</div>
37                 <div id='description-short'>{{ book.description|safe|truncatewords_html:30 }}</div>
38             </div>
39             <div id="toggle-description"><p></p></div>
40         {% endif %}
41         <div id="formats">
42             <p class="change-sets">{% trans "Put a book" %} <span><a href="{% url catalogue.views.book_sets book.urlid %}" class="jqm-trigger">{% trans "on the shelf!" %}</a></span></p>
43             <div class="clearboth"></div>
44             <div class="wrap">
45                 {% if book.has_html_file %}
46                     <a class="online" href="{% url book_text book.fileid %}">{% trans "Read online" %}</a>
47                 {% endif %}
48                 <div class="download">
49                     {% if book.pdf_file %}
50                         <a href="{{ book.pdf_file.url }}"><img src="{{ STATIC_URL }}img/pdf.png" title="{% trans "Download PDF" %} &ndash; {% trans "for reading" %} {% trans "and printing using" %} Adobe Reader" %}" alt="{% trans "Download PDF" %}" /></a>
51                     {% endif %}
52                     {% if book.epub_file %}
53                         <a href="{{ book.epub_file.url }}"><img src="{{ STATIC_URL }}img/epub.png" title="{% trans "Download EPUB" %} &ndash; {% trans "for reading" %} {% trans "on mobile devices" %}" alt="{% trans "Download EPUB" %}" /></a>
54                     {% endif %}
55                     {% if book.mobi_file %}
56                         <a href="{{ book.mobi_file.url }}"><img src="{{ STATIC_URL }}img/mobi.png" title="{% trans "Download MOBI" %} &ndash; {% trans "for reading" %} {% trans "on mobile devices" %}" alt="{% trans "Download MOBI" %}" /></a>
57                     {% endif %}
58                     {% if book.txt_file %}
59                         <a href="{{ book.txt_file.url }}"><img src="{{ STATIC_URL }}img/txt.png" title="{% trans "Download TXT" %} &ndash; {% trans "for reading" %} {% trans "on small displays, for example mobile phones" %}" alt="{% trans "Download TXT" %}" /></a>
60                     {% endif %}
61                         
62                     {% if book.pdf_file %}
63                         <br/><a href="#" id="custom-pdf-link">{% trans "Dowload customized PDF" %}</a>.
64                     {% endif %}
65                         <div style="display: none" class="custom-pdf">
66                           <form action="{% url catalogue.views.download_custom_pdf book.fileid %}" method="GET">
67                             {{custom_pdf_form.as_p}}
68                             <input type="submit" value="{% trans "Download" %}"/>
69                           </form>
70                         </div>
71                 </div>
72                 {% if book.has_mp3_file or book.has_ogg_file or book.has_daisy_file %}
73                     <p class="header">
74                         <span class="desc">{% trans "Audiobooks" %}:</span>
75                         <span class="audiotabs">
76                             {% if book.has_mp3_file %}<span class="active" data-format="mp3">MP3</span>{% endif %}
77                             {% if book.has_ogg_file %}<span data-format="ogg">Ogg Vorbis</span>{% endif %}
78                             {% if book.has_daisy_file %}<span data-format="daisy">DAISY</span>{% endif %}
79                         </span>
80                     </p>
81                     <div class="audiobooks">
82                         <img src="{{ STATIC_URL }}img/speaker.png" id="speaker" alt="Speaker icon"/>
83                         {% if book.has_mp3_file %}
84                             <ul class="audiobook-list" id="mp3-files">
85                             {% for media in book.get_mp3 %}
86                                 <li class="mp3Player">
87                                   <a href="{{ media.file.url }}">{{ media.name }}</a><br/>
88                                   {% trans "Artist" %}: {{ media.get_extra_info_value.artist_name }}<br/>
89                                   {% trans "Director"%}: {{ media.get_extra_info_value.director_name }}<br/>
90                                   <object type="application/x-shockwave-flash" style="margin-top: 0.5em" data="{{ STATIC_URL }}player.swf" width="226" height="20">
91                                         <param name="movie" value="{{ STATIC_URL }}player.swf" />
92                                         <param name="bgcolor" value="#ffffff" />
93                                         <param name="FlashVars" value="mp3={{ media.file.url }}&amp;width=226&amp;showvolume=1&amp;bgcolor1=eeeeee&amp;bgcolor2=eeeeee&amp;buttoncolor=666666" />
94                                     </object>
95                                     
96                                 </li>
97                             {% endfor %}
98                             </ul>     
99                         {% endif %}
100
101                         {% if book.has_ogg_file %}
102                             <ul class="audiobook-list" id="ogg-files">
103                             {% for media in book.get_ogg %}
104                                 <li><a href="{{ media.file.url }}">{{ media.name }}</a></li>
105                             {% endfor %}
106                             </ul>
107                         {% endif %}
108                         {% if book.has_daisy_file %}
109                             <ul class="audiobook-list" id="daisy-files">
110                             {% for media in book.get_daisy %}
111                                 <li><a href="{{ media.file.url }}">{{ media.name }}</a></li>
112                             {% endfor %}
113                             </ul>
114                         {% endif %}
115                     </div> <!-- /audiobooks -->
116                     {% if projects|length > 1 %}
117                         <p>{% trans "Audiobooks were prepared as a part of the projects:" %}</p>
118                         <ul>
119                         {% for cs, fb in projects %}
120                             <li>
121                             {% if fb %}
122                                 {% blocktrans %}{{ cs }}, funded by {{ fb }}{% endblocktrans %}
123                             {% else %}
124                                 {{ cs }}
125                             {% endif %}
126                             </li>
127                         {% endfor %}
128                         </ul>
129                     {% else %}
130                         <p>
131                         {% with projects.0.0 as cs %}
132                         {% with projects.0.1 as fb %}
133                             {% if fb %}
134                                 {% blocktrans %}Audiobooks were prepared as a part of the {{ cs }} project funded by {{ fb }}.{% endblocktrans %}
135                             {% else %}
136                                 {% blocktrans %}Audiobooks were prepared as a part of the {{ cs }} project.{% endblocktrans %}
137                             {% endif %}
138                         {% endwith %}
139                         {% endwith %}
140                         </p>
141                     {% endif %}
142                 {% endif %}
143             </div>
144         </div>
145
146         {% if book_children %}
147         {% autopaginate book_children 10 %}
148         <div id="book-children">
149             <ol>
150             {% for book in book_children %}
151                 <li>{{ book.short_html }}</li>
152             {% endfor %}
153             </ol>
154         </div>
155         {% paginate %}
156         {% endif %}
157
158     </div>
159
160     <div id="tags-list">
161         <div id="book-info">
162             <h2>{% trans "Details" %}</h2>
163             <ul>
164                 <li>
165                     {% trans "Author" %}:
166                     {% for tag in categories.author %}
167                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
168                     {% endfor %}
169                 </li>
170                 <li>
171                     {% trans "Epoch" %}:
172                     {% for tag in categories.epoch %}
173                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
174                     {% endfor %}
175                 </li>
176                 <li>
177                     {% trans "Kind" %}:
178                     {% for tag in categories.kind %}
179                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
180                     {% endfor %}
181                 </li>
182                 <li>
183                     {% trans "Genre" %}:
184                     {% for tag in categories.genre %}
185                     <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
186                     {% endfor %}
187                 </li>              
188             </ul>
189             <h2>{% trans "Other resources" %}</h2>
190             <ul>
191                 {% if extra_info.source_url %}
192                 <li><a href="{{ extra_info.source_url }}">{% trans "Source of the book" %}</a></li>
193                 {% endif %}
194                 {% if extra_info.about and not hide_about %}
195                 <li><a href="{{ extra_info.about }}">{% trans "Book on the Editor's Platform" %}</a></li>
196                 {% endif %}
197                 {% if book.gazeta_link %}
198                 <li><a href="{{ book.gazeta_link }}">{% trans "Book description on Lektury.Gazeta.pl" %}</a></li>
199                 {% endif %}
200                 {% if book.wiki_link %}
201                 <li><a href="{{ book.wiki_link }}">{% trans "Book description on Wikipedia" %}</a></li>
202                 {% endif %}
203             </ul>
204             <p><a href="{{ book.xml_file.url }}">{% trans "View XML source" %}</a></p>
205             <p><a href="{% url poem_from_book book.urlid %}">Miksuj ten utwór</a></p>
206         </div>
207         <div id="themes-list">
208             <h2>{% trans "Work's themes " %}</h2>
209             <ul>
210             {% for theme in book_themes %}
211                 <li><a href="{% url book_fragments book.urlid theme.slug %}">{{ theme }} ({{ theme.count }})</a></li>
212             {% endfor %}
213             </ul>
214         </div>
215         <div class="clearboth"></div>
216     </div>
217     <div id="set-window">
218         <div class="header"><a href="#" class="jqmClose">{% trans "Close" %}</a></div>
219         <div class="target">
220             <p><img src="{{ STATIC_URL }}img/indicator.gif" alt="*"/> {% trans "Loading" %}</p>
221         </div>
222     </div>
223 {% endblock %}