3 #from m_librarian.translations import translations
5 #attr $title = 'Список книг'
9 <script type="text/javascript" language="Javascript">
11 function toggleBooks(selector, value) {
12 cboxes = document.querySelectorAll(selector);
13 for (var i = 0; i < cboxes.length; i++) {
14 cboxes[i].checked = value;
18 function toggleAll(value) {
19 toggleBooks('input[type=checkbox]', value);
22 function toggleAuthor(name, value) {
23 toggleBooks('input[type=checkbox][name^=' + name + ']', value);
26 function toggleSeries(name, value) {
27 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">$cgi.escape($_($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>
63 $cgi.escape($series, 1)#slurp
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>$cgi.escape(unicode($getattr($book, $column) or ''))</td>
84 <td colspan="$columns1" style="text-align: center"><input type="submit" value="Скачать"></td>
89 <p>Не найдено ни одной книги!</p>