2 #from m_librarian.translations import translations
4 #attr $title = 'Список книг'
8 <script type="text/javascript" language="Javascript">
10 function toggleBooks(selector, value) {
11 cboxes = document.querySelectorAll(selector);
12 for (var i = 0; i < cboxes.length; i++) {
13 cboxes[i].checked = value;
17 function toggleAll(value) {
18 toggleBooks('input[type=checkbox]', value);
21 function toggleAuthor(name, value) {
22 toggleBooks('input[type=checkbox][name^=' + name + ']', value);
25 function toggleSeries(name, value) {
26 toggleBooks('input[type=checkbox][name^=' + name + '_book]', value);
33 <form action="/download/" method="POST" style="height: 80%">
34 <table style="width: 100%; height: 90%">
36 <td><input type=checkbox name="_toggleAll"
37 onClick="toggleAll(this.checked)"></td>
38 #set $_ = $getattr($translations, 'ugettext', None) or $translations.gettext
39 #for $column in $columns
40 <td style="text-align: center">$_($column)</td>
43 #set $columns1 = $len($columns)+1
44 #for $anum, $author in $enumerate($sorted($books_by_author))
47 #set $books = $books_by_author[$author]
49 <td><input type=checkbox name="a${anum+1}_"
50 onClick="toggleAuthor(this.name, this.checked)"></td>
51 <td colspan="${columns1-1}"><b>$author</b></td>
54 #if $book.series != $series
55 #set $series = $book.series
58 <td><input type=checkbox name="a${anum+1}_s${snum}"
59 onClick="toggleSeries(this.name, this.checked)"></td>
60 <td colspan="${columns1-1}"><b>
71 <td><input type=checkbox name="a${anum+1}_s${snum}_books" value="$book.id"></td>
72 #for $column in $columns
73 #if $column in ('ser_no', 'size')
74 #set $style = ' style="text-align: right; width: 5ex"'
78 <td$style>$unicode($getattr($book, $column) or '')</td>
84 <td colspan="$columns1" style="text-align: center"><input type="submit" value="Скачать"></td>
90 <p>Не найдено ни одной книги!</p>