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 toggleAuthor(name, value) {
19 toggleBooks('input[type=checkbox][name^=' + name + ']', value);
22 function toggleSeries(name, value) {
23 toggleBooks('input[type=checkbox][name^=' + name + '_book]', value);
29 <form action="/download/" method="POST" style="height: 80%">
30 <table style="width: 100%; height: 90%">
33 #set $_ = $getattr($translations, 'ugettext', None) or $translations.gettext
34 #for $column in $columns
35 <td style="text-align: center">$cgi.escape($_($column))</td>
38 #set $columns1 = $len($columns)+1
39 #for $anum, $author in $enumerate($sorted($books_by_author))
42 #set $books = $books_by_author[$author]
44 <td><input type=checkbox name="a${anum+1}_"
45 onClick="toggleAuthor(this.name, this.checked)"></td>
46 <td colspan="${columns1-1}"><b>$author</b></td>
49 #if $book.series != $series
50 #set $series = $book.series
53 <td><input type=checkbox name="a${anum+1}_s${snum}"
54 onClick="toggleSeries(this.name, this.checked)"></td>
55 <td colspan="${columns1-1}"><b>
58 $cgi.escape($series, 1)#slurp
66 <td><input type=checkbox name="a${anum+1}_s${snum}_books" value="$book.id"></td>
67 #for $column in $columns
68 #if $column in ('ser_no', 'size')
69 #set $style = ' style="text-align: right; width: 5ex"'
73 <td$style>$cgi.escape(unicode($getattr($book, $column) or ''))</td>
79 <td colspan="$columns1" style="text-align: center"><input type="submit" value="Скачать"></td>
84 <p>Не найдено ни одной книги!</p>