# HG changeset patch # User casties # Date 1334328916 -7200 # Node ID f8a5f63eafc0c11298d871207b26e83659d934a2 # Parent 652cc8d3f1a9a621911dd2374bdfc46b99cc9231 new viewMode=thumbs. diff -r 652cc8d3f1a9 -r f8a5f63eafc0 SrvTxtUtils.py --- a/SrvTxtUtils.py Thu Apr 12 14:27:37 2012 +0200 +++ b/SrvTxtUtils.py Fri Apr 13 16:55:16 2012 +0200 @@ -11,7 +11,7 @@ import logging -srvTxtUtilsVersion = "1.4" +srvTxtUtilsVersion = "1.4.1" def getInt(number, default=0): """returns always an int (0 in case of problems)""" @@ -37,7 +37,7 @@ except: return s.decode('latin-1') else: - return s + return unicode(s) def utf8ify(s): """encode unicode object or string into byte string in utf-8 representation. @@ -47,7 +47,7 @@ if isinstance(s, str): return s else: - return s.encode('utf-8') + return unicode(s).encode('utf-8') def getText(node, recursive=0): """returns all text content of a node and its subnodes""" diff -r 652cc8d3f1a9 -r f8a5f63eafc0 css/docuviewer.css --- a/css/docuviewer.css Thu Apr 12 14:27:37 2012 +0200 +++ b/css/docuviewer.css Fri Apr 13 16:55:16 2012 +0200 @@ -28,14 +28,14 @@ float:right; } -div.toc-thumbs .thumb { +table.thumbs .thumb { padding: 3px; } -div.toc-thumbs .thumbsel { +table.thumbs .thumbsel { padding: 2px; border: 1px solid blue; } -div.toc-thumbs .thumbcap { +table.thumbs .thumbcap { color: black; } diff -r 652cc8d3f1a9 -r f8a5f63eafc0 documentViewer.py --- a/documentViewer.py Thu Apr 12 14:27:37 2012 +0200 +++ b/documentViewer.py Fri Apr 13 16:55:16 2012 +0200 @@ -123,6 +123,7 @@ viewer_xml = PageTemplateFile('zpt/viewer_xml', globals()) viewer_images = PageTemplateFile('zpt/viewer_images', globals()) viewer_index = PageTemplateFile('zpt/viewer_index', globals()) + viewer_thumbs = PageTemplateFile('zpt/viewer_thumbs', globals()) # available layer types builtinLayers = {'text': ['dict','search','gis','annotator'], 'xml': None, 'images': None, 'index': None} @@ -461,6 +462,14 @@ pt = getattr(self.template, 'info_xml') return pt(docinfo=docinfo) + def getAuthenticatedUser(self, anon=None): + """returns the authenticated user object or None. (ignores Zopes anonymous user)""" + user = getSecurityManager().getUser() + if user is not None and user.getUserName() != "Anonymous User": + return user + else: + return anon + def isAccessible(self, docinfo): """returns if access to the resource is granted""" access = docinfo.get('accessType', None) @@ -471,17 +480,12 @@ elif access is None or access in self.authgroups: # only local access -- only logged in users - user = getSecurityManager().getUser() + user = self.getAuthenticatedUser() logging.debug("documentViewer (accessOK) user=%s ip=%s"%(user,self.REQUEST.getClientAddr())) - if user is not None: - #print "user: ", user - return (user.getUserName() != "Anonymous User") - else: - return False + return (user is not None) logging.error("documentViewer (accessOK) unknown access type %s"%access) return False - def getDocinfo(self, mode, url, tocMode=None): diff -r 652cc8d3f1a9 -r f8a5f63eafc0 zpt/common_template.zpt --- a/zpt/common_template.zpt Thu Apr 12 14:27:37 2012 +0200 +++ b/zpt/common_template.zpt Fri Apr 13 16:55:16 2012 +0200 @@ -7,21 +7,24 @@ + tal:define="viewMode pageinfo/viewMode; + docpath docinfo/textURLPath | nothing; + bib docinfo/bib | nothing; bibType docinfo/bibType | nothing; + formattedLabel python:here.metadataService.getBibFormattedLabel(bibdata=bib);">
- , - , + + , + , + tal:content="string:[no bibliographical information for this document (type ${bibType})]" />
@@ -34,42 +37,77 @@ left python:test(flowLtr,prev,next); right python:test(flowLtr,next,prev); leftest python:test(flowLtr,first,last); rightest python:test(flowLtr,last,first);">
- page |< |< < < - ( []) - of > > >| + page |< |< < < ( [] + ) + of > + > >| >| - + -
- < < + + + < + < > > + + > + > +
+
+ + + +
+ + < + < + + > >
diff -r 652cc8d3f1a9 -r f8a5f63eafc0 zpt/layer_text_annotator.zpt --- a/zpt/layer_text_annotator.zpt Thu Apr 12 14:27:37 2012 +0200 +++ b/zpt/layer_text_annotator.zpt Fri Apr 13 16:55:16 2012 +0200 @@ -23,27 +23,29 @@ tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/store.js"> - + - + - + + + + + + + +
+ +
+
+ +
+
+ +
+ + + + + +
+
+ +
+
+ +
+ +
+ +
+ + + +
+ +
+

Thumbnail display

+
+ +
    +
  • + Rows + +
  • +
  • + Columns + +
  • +
  • + Thumbnail size + +
  • +
+
+
+
+
+ +
+
Sorry, access to this document is restricted.
+
+
+ + +
Sorry, document doesn't exist.
+ + \ No newline at end of file