]> git.phdru.name Git - m_librarian.git/commitdiff
Feat(web): Configure columns for author and book tables
authorOleg Broytman <phd@phdru.name>
Sun, 10 Jun 2018 22:52:26 +0000 (01:52 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 10 Jun 2018 23:31:08 +0000 (02:31 +0300)
docs-ru/news.rst
docs/news.rst
m_librarian/web/app.py
m_librarian/web/views/books_by_author.py
m_librarian/web/views/books_by_author.tmpl
m_librarian/web/views/list_authors.py
m_librarian/web/views/list_authors.tmpl
m_librarian/web/views/list_books.py
m_librarian/web/views/list_books.tmpl
sample/m_librarian.conf

index 558bc5c8334ead8f2efd401e9f8acf6b95fd1d68..39c5ba0bfac95f1969685a46d68ed48a4410e386 100644 (file)
@@ -8,6 +8,8 @@ Version 0.1.4 (2018-05-??)
 
 * Показывать список найденных книг с разбивкой по авторам и сериям.
 
 
 * Показывать список найденных книг с разбивкой по авторам и сериям.
 
+* Конфигурация списка колонок для таблиц авторов и книг.
+
 * Файл конфигурации, все секции и все ключи сделаны необязательными.
 
 * В файле конфигурации подставляются переменные окружения в ключах,
 * Файл конфигурации, все секции и все ключи сделаны необязательными.
 
 * В файле конфигурации подставляются переменные окружения в ключах,
index 8fd1e7b42f82f23a2589ecd6ea02b97b7b51f342..d9dfd7225b5ac4eaade6c56f75c5dbbb3419e410 100644 (file)
@@ -8,6 +8,8 @@ Version 0.1.4 (2018-06-??)
 
 * Use filters from config.
 
 
 * Use filters from config.
 
+* Configure columns for author and book tables.
+
 * Config file, all sections and all key are now completely optional.
 
 * Environment variables are expanded in paths in config file.
 * Config file, all sections and all key are now completely optional.
 
 * Environment variables are expanded in paths in config file.
index 42c5c5a632bee899df2105b1be5c214cd453557c..5d9285e2254912b1f01404d9afaa4cebb41f6489 100644 (file)
@@ -59,11 +59,13 @@ def search_authors_post():
     )]
     authors = search_authors(search_type, case_sensitive, {}, expressions,
                              orderBy=('surname', 'name', 'misc_name'))
     )]
     authors = search_authors(search_type, case_sensitive, {}, expressions,
                              orderBy=('surname', 'name', 'misc_name'))
+    columns = get_config().getlist('columns', 'author', ['fullname'])
     return {
         'authors': list(authors),
         'search_authors': value,
         'search_type': search_type,
         'case_sensitive': case_sensitive,
     return {
         'authors': list(authors),
         'search_authors': value,
         'search_type': search_type,
         'case_sensitive': case_sensitive,
+        'columns': columns,
     }
 
 
     }
 
 
@@ -71,6 +73,7 @@ def search_authors_post():
 @cheetah_view('books_by_author.tmpl')
 def books_by_author(id):
     use_filters = get_config().getint('filters', 'use_in_books_list', 1)
 @cheetah_view('books_by_author.tmpl')
 def books_by_author(id):
     use_filters = get_config().getint('filters', 'use_in_books_list', 1)
+    columns = get_config().getlist('columns', 'book', ['title'])
     if use_filters:
         join_expressions = []
         join_expressions.append(Book.j.authors)
     if use_filters:
         join_expressions = []
         join_expressions.append(Book.j.authors)
@@ -81,6 +84,7 @@ def books_by_author(id):
         return {
             'author': Author.get(id),
             'books': books,
         return {
             'author': Author.get(id),
             'books': books,
+            'columns': columns,
         }
     else:
         return {
         }
     else:
         return {
@@ -88,7 +92,8 @@ def books_by_author(id):
             'books': Book.select(
                 Book.j.authors & (Author.q.id == id),
                 orderBy=['series', 'ser_no', 'title'],
             'books': Book.select(
                 Book.j.authors & (Author.q.id == id),
                 orderBy=['series', 'ser_no', 'title'],
-            )
+            ),
+            'columns': columns,
         }
 
 
         }
 
 
@@ -157,9 +162,11 @@ def search_books_post():
         else:
             books_by_author = books_by_authors[author] = []
         books_by_author.append(book)
         else:
             books_by_author = books_by_authors[author] = []
         books_by_author.append(book)
+    columns = get_config().getlist('columns', 'book', ['title'])
     return {
         'books_by_author': books_by_authors,
         'search_books': value,
         'search_type': search_type,
         'case_sensitive': case_sensitive,
     return {
         'books_by_author': books_by_authors,
         'search_books': value,
         'search_type': search_type,
         'case_sensitive': case_sensitive,
+        'columns': columns,
     }
     }
index b57790cfa0abb20c4a973c1de4826dc4da418a1e..8136ece77d5cff75e5fe5fd7d942a8bf44aee1dd 100644 (file)
@@ -36,10 +36,10 @@ VFN=valueForName
 currentTime=time.time
 __CHEETAH_version__ = '3.1.0'
 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
 currentTime=time.time
 __CHEETAH_version__ = '3.1.0'
 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
-__CHEETAH_genTime__ = 1528661355.623041
-__CHEETAH_genTimestamp__ = 'Sun Jun 10 23:09:15 2018'
+__CHEETAH_genTime__ = 1528670845.131662
+__CHEETAH_genTimestamp__ = 'Mon Jun 11 01:47:25 2018'
 __CHEETAH_src__ = 'books_by_author.tmpl'
 __CHEETAH_src__ = 'books_by_author.tmpl'
-__CHEETAH_srcLastModified__ = 'Sun Jun 10 23:09:14 2018'
+__CHEETAH_srcLastModified__ = 'Mon Jun 11 01:47:23 2018'
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -101,41 +101,48 @@ class books_by_author(layout):
   <table style="width: 100%; height: 90%">
 ''')
             series = None
   <table style="width: 100%; height: 90%">
 ''')
             series = None
-            for book in VFFSL(SL,"books",True): # generated from line 12, col 3
-                if VFFSL(SL,"book.series",True) != VFFSL(SL,"series",True): # generated from line 13, col 3
+            columns1 = VFFSL(SL,"len",False)(VFFSL(SL,"columns",True))+1
+            for book in VFFSL(SL,"books",True): # generated from line 13, col 3
+                if VFFSL(SL,"book.series",True) != VFFSL(SL,"series",True): # generated from line 14, col 3
                     series = VFFSL(SL,"book.series",True)
                     write(u'''  <tr>
                     series = VFFSL(SL,"book.series",True)
                     write(u'''  <tr>
-  <td colspan=2><b><i>
+  <td colspan="''')
+                    _v = VFFSL(SL,"columns1",True) # u'$columns1' on line 17, col 16
+                    if _v is not None: write(_filter(_v, rawExpr=u'$columns1')) # from line 17, col 16.
+                    write(u'''"><b><i>
 ''')
 ''')
-                    if VFFSL(SL,"book.series",True): # generated from line 17, col 3
-                        _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"series",True), 1) # u'$cgi.escape($series, 1)' on line 18, col 1
-                        if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($series, 1)')) # from line 18, col 1.
-                    else: # generated from line 19, col 3
+                    if VFFSL(SL,"book.series",True): # generated from line 18, col 3
+                        _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"series",True), 1) # u'$cgi.escape($series, 1)' on line 19, col 1
+                        if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($series, 1)')) # from line 19, col 1.
+                    else: # generated from line 20, col 3
                         write(u'''\u0412\u043d\u0435 \u0441\u0435\u0440\u0438\u0439''')
                     write(u'''  </i></b></td>
   </tr>
 ''')
                 write(u'''  <tr>
   <td><input type=checkbox name=books value="''')
                         write(u'''\u0412\u043d\u0435 \u0441\u0435\u0440\u0438\u0439''')
                     write(u'''  </i></b></td>
   </tr>
 ''')
                 write(u'''  <tr>
   <td><input type=checkbox name=books value="''')
-                _v = VFFSL(SL,"book.id",True) # u'$book.id' on line 26, col 46
-                if _v is not None: write(_filter(_v, rawExpr=u'$book.id')) # from line 26, col 46.
+                _v = VFFSL(SL,"book.id",True) # u'$book.id' on line 27, col 46
+                if _v is not None: write(_filter(_v, rawExpr=u'$book.id')) # from line 27, col 46.
                 write(u'''"></td>
                 write(u'''"></td>
-  <td>''')
-                _v = VFFSL(SL,"book.ser_no",True) # u'$book.ser_no' on line 27, col 7
-                if _v is not None: write(_filter(_v, rawExpr=u'$book.ser_no')) # from line 27, col 7.
-                write(u''' ''')
-                _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"book.title",True)) # u'$cgi.escape($book.title)' on line 27, col 20
-                if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($book.title)')) # from line 27, col 20.
-                write(u'''</td>
-  </tr>
+''')
+                for column in VFFSL(SL,"columns",True): # generated from line 28, col 3
+                    write(u'''  <td>''')
+                    _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(unicode(VFFSL(SL,"getattr",False)(VFFSL(SL,"book",True), VFFSL(SL,"column",True)) or '')) # u"$cgi.escape(unicode($getattr($book, $column) or ''))" on line 29, col 7
+                    if _v is not None: write(_filter(_v, rawExpr=u"$cgi.escape(unicode($getattr($book, $column) or ''))")) # from line 29, col 7.
+                    write(u'''</td>
+''')
+                write(u'''  </tr>
 ''')
             write(u'''  <tr>
 ''')
             write(u'''  <tr>
-  <td colspan=2 style="text-align: center"><input type="submit" value="\u0421\u043a\u0430\u0447\u0430\u0442\u044c"></td>
+  <td colspan="''')
+            _v = VFFSL(SL,"columns1",True) # u'$columns1' on line 34, col 16
+            if _v is not None: write(_filter(_v, rawExpr=u'$columns1')) # from line 34, col 16.
+            write(u'''" style="text-align: center"><input type="submit" value="\u0421\u043a\u0430\u0447\u0430\u0442\u044c"></td>
   </tr>
   </table>
   </form>
 ''')
   </tr>
   </table>
   </form>
 ''')
-        else: # generated from line 35, col 1
+        else: # generated from line 38, col 1
             write(u'''  <p>\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438!</p>
 ''')
         
             write(u'''  <p>\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438!</p>
 ''')
         
index 61db03c1fe20abefca95d797cc1129ce422a60ca..52a7eb344e6c9d16f5325624e85f850ce3bf5fed 100644 (file)
@@ -9,11 +9,12 @@
   <form action="/download/" method="POST" style="height: 80%">
   <table style="width: 100%; height: 90%">
   #set $series = None
   <form action="/download/" method="POST" style="height: 80%">
   <table style="width: 100%; height: 90%">
   #set $series = None
+  #set $columns1 = $len($columns)+1
   #for $book in $books
   #if $book.series != $series
   #set $series = $book.series
   <tr>
   #for $book in $books
   #if $book.series != $series
   #set $series = $book.series
   <tr>
-  <td colspan=2><b><i>
+  <td colspan="$columns1"><b><i>
   #if $book.series
 $cgi.escape($series, 1)#slurp
   #else
   #if $book.series
 $cgi.escape($series, 1)#slurp
   #else
@@ -24,11 +25,13 @@ $cgi.escape($series, 1)#slurp
   #end if
   <tr>
   <td><input type=checkbox name=books value="$book.id"></td>
   #end if
   <tr>
   <td><input type=checkbox name=books value="$book.id"></td>
-  <td>$book.ser_no $cgi.escape($book.title)</td>
+  #for $column in $columns
+  <td>$cgi.escape(unicode($getattr($book, $column) or ''))</td>
+  #end for
   </tr>
   #end for
   <tr>
   </tr>
   #end for
   <tr>
-  <td colspan=2 style="text-align: center"><input type="submit" value="Скачать"></td>
+  <td colspan="$columns1" style="text-align: center"><input type="submit" value="Скачать"></td>
   </tr>
   </table>
   </form>
   </tr>
   </table>
   </form>
index 5c70204c7f390cbc60e2050012a34ca32f875588..5ee4af0a2c7cdc0c97d116db11d5afe3110668c8 100644 (file)
@@ -25,6 +25,7 @@ from Cheetah.CacheRegion import CacheRegion
 import Cheetah.Filters as Filters
 import Cheetah.ErrorCatchers as ErrorCatchers
 from Cheetah.compat import unicode
 import Cheetah.Filters as Filters
 import Cheetah.ErrorCatchers as ErrorCatchers
 from Cheetah.compat import unicode
+import cgi
 from views.layout import layout
 from views.search_authors_form import search_authors_form
 
 from views.layout import layout
 from views.search_authors_form import search_authors_form
 
@@ -36,10 +37,10 @@ VFN=valueForName
 currentTime=time.time
 __CHEETAH_version__ = '3.1.0'
 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
 currentTime=time.time
 __CHEETAH_version__ = '3.1.0'
 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
-__CHEETAH_genTime__ = 1523134510.111994
-__CHEETAH_genTimestamp__ = 'Sat Apr  7 23:55:10 2018'
+__CHEETAH_genTime__ = 1528670903.492958
+__CHEETAH_genTimestamp__ = 'Mon Jun 11 01:48:23 2018'
 __CHEETAH_src__ = 'list_authors.tmpl'
 __CHEETAH_src__ = 'list_authors.tmpl'
-__CHEETAH_srcLastModified__ = 'Sat Apr  7 23:55:07 2018'
+__CHEETAH_srcLastModified__ = 'Mon Jun 11 01:48:21 2018'
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -72,7 +73,7 @@ class list_authors(layout):
 
 
 
 
 
 
-        ## CHEETAH: generated from #def body at line 4, col 1.
+        ## CHEETAH: generated from #def body at line 5, col 1.
         trans = KWS.get("trans")
         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
             trans = self.transaction # is None unless self.awake() was called
         trans = KWS.get("trans")
         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
             trans = self.transaction # is None unless self.awake() was called
@@ -89,33 +90,38 @@ class list_authors(layout):
         
         write(u'''<h1>\u041f\u043e\u0438\u0441\u043a \u0430\u0432\u0442\u043e\u0440\u043e\u0432</h1>
 ''')
         
         write(u'''<h1>\u041f\u043e\u0438\u0441\u043a \u0430\u0432\u0442\u043e\u0440\u043e\u0432</h1>
 ''')
-        _v = VFFSL(SL,"search_authors_form",False)(searchList=VFFSL(SL,"searchList",True)) # u'$search_authors_form(searchList=$searchList)' on line 7, col 1
-        if _v is not None: write(_filter(_v, rawExpr=u'$search_authors_form(searchList=$searchList)')) # from line 7, col 1.
+        _v = VFFSL(SL,"search_authors_form",False)(searchList=VFFSL(SL,"searchList",True)) # u'$search_authors_form(searchList=$searchList)' on line 8, col 1
+        if _v is not None: write(_filter(_v, rawExpr=u'$search_authors_form(searchList=$searchList)')) # from line 8, col 1.
         write(u'''
 
 <h1>''')
         write(u'''
 
 <h1>''')
-        _v = VFFSL(SL,"title",True) # u'$title' on line 9, col 5
-        if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 9, col 5.
+        _v = VFFSL(SL,"title",True) # u'$title' on line 10, col 5
+        if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 10, col 5.
         write(u'''</h1>
 
 ''')
         write(u'''</h1>
 
 ''')
-        if VFFSL(SL,"authors",True): # generated from line 11, col 1
+        if VFFSL(SL,"authors",True): # generated from line 12, col 1
             write(u'''  <table>
 ''')
             write(u'''  <table>
 ''')
-            for author in VFFSL(SL,"authors",True): # generated from line 13, col 3
+            for author in VFFSL(SL,"authors",True): # generated from line 14, col 3
                 write(u'''  <tr>
                 write(u'''  <tr>
-    <td><a href="/books-by-author/''')
-                _v = VFFSL(SL,"author.id",True) # u'$author.id' on line 15, col 35
-                if _v is not None: write(_filter(_v, rawExpr=u'$author.id')) # from line 15, col 35.
-                write(u'''/">''')
-                _v = VFFSL(SL,"author.fullname",True) # u'$author.fullname' on line 15, col 48
-                if _v is not None: write(_filter(_v, rawExpr=u'$author.fullname')) # from line 15, col 48.
-                write(u'''</a></td>
-  </tr>
+''')
+                for column in VFFSL(SL,"columns",True): # generated from line 16, col 3
+                    write(u'''    <td><a href="/books-by-author/''')
+                    _v = VFFSL(SL,"author.id",True) # u'$author.id' on line 17, col 35
+                    if _v is not None: write(_filter(_v, rawExpr=u'$author.id')) # from line 17, col 35.
+                    write(u'''/">
+    ''')
+                    _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(unicode(VFFSL(SL,"getattr",False)(VFFSL(SL,"author",True), VFFSL(SL,"column",True)) or '')) # u"$cgi.escape(unicode($getattr($author, $column) or ''))" on line 18, col 5
+                    if _v is not None: write(_filter(_v, rawExpr=u"$cgi.escape(unicode($getattr($author, $column) or ''))")) # from line 18, col 5.
+                    write(u'''
+    </a></td>
+''')
+                write(u'''  </tr>
 ''')
             write(u'''  </table>
 ''')
 ''')
             write(u'''  </table>
 ''')
-        else: # generated from line 19, col 1
+        else: # generated from line 24, col 1
             write(u'''  <p>\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440\u0430!</p>
 ''')
         
             write(u'''  <p>\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440\u0430!</p>
 ''')
         
index f7377ba29c5fc835f717d06f8e561fe17883eca1..a872afc8b21b171aa218feadee90da4cb116fbad 100644 (file)
@@ -1,4 +1,5 @@
 #encoding utf-8
 #encoding utf-8
+#import cgi
 #extends views.layout
 #attr $title = 'Список авторов'
 #def body
 #extends views.layout
 #attr $title = 'Список авторов'
 #def body
@@ -12,7 +13,11 @@ $search_authors_form(searchList=$searchList)
   <table>
   #for $author in $authors
   <tr>
   <table>
   #for $author in $authors
   <tr>
-    <td><a href="/books-by-author/$author.id/">$author.fullname</a></td>
+  #for $column in $columns
+    <td><a href="/books-by-author/$author.id/">
+    $cgi.escape(unicode($getattr($author, $column) or ''))
+    </a></td>
+  #end for
   </tr>
   #end for
   </table>
   </tr>
   #end for
   </table>
index 7431a3a9a6e68e0ccf2ad9b62b6502d261de306a..0b2f8c62780b05b1f6292ad3692408393f67ff98 100644 (file)
@@ -36,10 +36,10 @@ VFN=valueForName
 currentTime=time.time
 __CHEETAH_version__ = '3.1.0'
 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
 currentTime=time.time
 __CHEETAH_version__ = '3.1.0'
 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
-__CHEETAH_genTime__ = 1528661355.731921
-__CHEETAH_genTimestamp__ = 'Sun Jun 10 23:09:15 2018'
+__CHEETAH_genTime__ = 1528670845.332275
+__CHEETAH_genTimestamp__ = 'Mon Jun 11 01:47:25 2018'
 __CHEETAH_src__ = 'list_books.tmpl'
 __CHEETAH_src__ = 'list_books.tmpl'
-__CHEETAH_srcLastModified__ = 'Sun Jun 10 23:09:01 2018'
+__CHEETAH_srcLastModified__ = 'Mon Jun 11 01:46:57 2018'
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -98,47 +98,54 @@ class list_books(layout):
   <table style="width: 100%; height: 90%">
 ''')
             series = None
   <table style="width: 100%; height: 90%">
 ''')
             series = None
-            for author in VFFSL(SL,"sorted",False)(VFFSL(SL,"books_by_author",True)): # generated from line 12, col 3
+            columns1 = VFFSL(SL,"len",False)(VFFSL(SL,"columns",True))+1
+            for author in VFFSL(SL,"sorted",False)(VFFSL(SL,"books_by_author",True)): # generated from line 13, col 3
                 books = VFFSL(SL,"books_by_author",True)[VFFSL(SL,"author",True)]
                 books = VFFSL(SL,"books_by_author",True)[VFFSL(SL,"author",True)]
-                for book in VFFSL(SL,"books",True): # generated from line 14, col 5
-                    if VFFSL(SL,"book.series",True) != VFFSL(SL,"series",True): # generated from line 15, col 5
+                for book in VFFSL(SL,"books",True): # generated from line 15, col 5
+                    if VFFSL(SL,"book.series",True) != VFFSL(SL,"series",True): # generated from line 16, col 5
                         series = VFFSL(SL,"book.series",True)
                         write(u'''  <tr>
                         series = VFFSL(SL,"book.series",True)
                         write(u'''  <tr>
-  <td colspan=2><b>
+  <td colspan="''')
+                        _v = VFFSL(SL,"columns1",True) # u'$columns1' on line 19, col 16
+                        if _v is not None: write(_filter(_v, rawExpr=u'$columns1')) # from line 19, col 16.
+                        write(u'''"><b>
   ''')
   ''')
-                        _v = VFFSL(SL,"author",True) # u'$author' on line 19, col 3
-                        if _v is not None: write(_filter(_v, rawExpr=u'$author')) # from line 19, col 3.
+                        _v = VFFSL(SL,"author",True) # u'$author' on line 20, col 3
+                        if _v is not None: write(_filter(_v, rawExpr=u'$author')) # from line 20, col 3.
                         write(u''' \u2014 <i>
 ''')
                         write(u''' \u2014 <i>
 ''')
-                        if VFFSL(SL,"book.series",True): # generated from line 20, col 3
-                            _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"series",True), 1) # u'$cgi.escape($series, 1)' on line 21, col 1
-                            if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($series, 1)')) # from line 21, col 1.
-                        else: # generated from line 22, col 3
+                        if VFFSL(SL,"book.series",True): # generated from line 21, col 3
+                            _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"series",True), 1) # u'$cgi.escape($series, 1)' on line 22, col 1
+                            if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($series, 1)')) # from line 22, col 1.
+                        else: # generated from line 23, col 3
                             write(u'''\u0412\u043d\u0435 \u0441\u0435\u0440\u0438\u0439''')
                         write(u'''  </i></b></td>
   </tr>
 ''')
                     write(u'''  <tr>
   <td><input type=checkbox name=books value="''')
                             write(u'''\u0412\u043d\u0435 \u0441\u0435\u0440\u0438\u0439''')
                         write(u'''  </i></b></td>
   </tr>
 ''')
                     write(u'''  <tr>
   <td><input type=checkbox name=books value="''')
-                    _v = VFFSL(SL,"book.id",True) # u'$book.id' on line 29, col 46
-                    if _v is not None: write(_filter(_v, rawExpr=u'$book.id')) # from line 29, col 46.
+                    _v = VFFSL(SL,"book.id",True) # u'$book.id' on line 30, col 46
+                    if _v is not None: write(_filter(_v, rawExpr=u'$book.id')) # from line 30, col 46.
                     write(u'''"></td>
                     write(u'''"></td>
-  <td>''')
-                    _v = VFFSL(SL,"book.ser_no",True) # u'$book.ser_no' on line 30, col 7
-                    if _v is not None: write(_filter(_v, rawExpr=u'$book.ser_no')) # from line 30, col 7.
-                    write(u''' ''')
-                    _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"book.title",True)) # u'$cgi.escape($book.title)' on line 30, col 20
-                    if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($book.title)')) # from line 30, col 20.
-                    write(u'''</td>
-  </tr>
+''')
+                    for column in VFFSL(SL,"columns",True): # generated from line 31, col 3
+                        write(u'''  <td>''')
+                        _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(unicode(VFFSL(SL,"getattr",False)(VFFSL(SL,"book",True), VFFSL(SL,"column",True)) or '')) # u"$cgi.escape(unicode($getattr($book, $column) or ''))" on line 32, col 7
+                        if _v is not None: write(_filter(_v, rawExpr=u"$cgi.escape(unicode($getattr($book, $column) or ''))")) # from line 32, col 7.
+                        write(u'''</td>
+''')
+                    write(u'''  </tr>
 ''')
             write(u'''  <tr>
 ''')
             write(u'''  <tr>
-  <td colspan=2 style="text-align: center"><input type="submit" value="\u0421\u043a\u0430\u0447\u0430\u0442\u044c"></td>
+  <td colspan="''')
+            _v = VFFSL(SL,"columns1",True) # u'$columns1' on line 38, col 16
+            if _v is not None: write(_filter(_v, rawExpr=u'$columns1')) # from line 38, col 16.
+            write(u'''" style="text-align: center"><input type="submit" value="\u0421\u043a\u0430\u0447\u0430\u0442\u044c"></td>
   </tr>
   </table>
   </form>
 ''')
   </tr>
   </table>
   </form>
 ''')
-        else: # generated from line 39, col 1
+        else: # generated from line 42, col 1
             write(u'''  <p>\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438!</p>
 ''')
         
             write(u'''  <p>\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438!</p>
 ''')
         
index 649922bc8a4917ad96493e8ed4c62e1eb0125054..5822ce20e1f752287d034f8d45adba6fa5885886 100644 (file)
@@ -9,13 +9,14 @@
   <form action="/download/" method="POST" style="height: 80%">
   <table style="width: 100%; height: 90%">
   #set $series = None
   <form action="/download/" method="POST" style="height: 80%">
   <table style="width: 100%; height: 90%">
   #set $series = None
+  #set $columns1 = $len($columns)+1
   #for $author in $sorted($books_by_author)
     #set $books = $books_by_author[$author]
     #for $book in $books
     #if $book.series != $series
     #set $series = $book.series
   <tr>
   #for $author in $sorted($books_by_author)
     #set $books = $books_by_author[$author]
     #for $book in $books
     #if $book.series != $series
     #set $series = $book.series
   <tr>
-  <td colspan=2><b>
+  <td colspan="$columns1"><b>
   $author — <i>
   #if $book.series
 $cgi.escape($series, 1)#slurp
   $author — <i>
   #if $book.series
 $cgi.escape($series, 1)#slurp
@@ -27,12 +28,14 @@ $cgi.escape($series, 1)#slurp
     #end if
   <tr>
   <td><input type=checkbox name=books value="$book.id"></td>
     #end if
   <tr>
   <td><input type=checkbox name=books value="$book.id"></td>
-  <td>$book.ser_no $cgi.escape($book.title)</td>
+  #for $column in $columns
+  <td>$cgi.escape(unicode($getattr($book, $column) or ''))</td>
+  #end for
   </tr>
     #end for
   #end for
   <tr>
   </tr>
     #end for
   #end for
   <tr>
-  <td colspan=2 style="text-align: center"><input type="submit" value="Скачать"></td>
+  <td colspan="$columns1" style="text-align: center"><input type="submit" value="Скачать"></td>
   </tr>
   </table>
   </form>
   </tr>
   </table>
   </form>
index cc8f3f5705b88e8463a53c43a227d63b6564a1ba..9cbf3950572c5a865d2c3810a02cd0b7f06c7844 100644 (file)
@@ -25,6 +25,16 @@ use_in_search_forms = 1
 # Use filters in lists of books
 use_in_books_list = 1
 
 # Use filters in lists of books
 use_in_books_list = 1
 
+[columns]
+# Full list of author columns:
+# columns = surname name misc_name fullname count
+# Default column is fullname
+author = fullname count
+# Full list of book columns:
+# columns = title series ser_no archive file size lib_id deleted date
+# Default column is just title
+book = ser_no title
+
 [download]
 # Download formats:
 # %a - author (one of)
 [download]
 # Download formats:
 # %a - author (one of)