# HG changeset patch # User casties # Date 1345645538 -7200 # Node ID 6cdc31e9ed8ec10b1991409790222b19c369c550 # Parent dbaa7dce60a53d9dc812df6c12ab3cf3292a155a fixed problem with dict-mode in default view. added configurable footer and logo in site_template.pt diff -r dbaa7dce60a5 -r 6cdc31e9ed8e css/docuviewer.css --- a/css/docuviewer.css Tue Aug 21 13:28:35 2012 +0200 +++ b/css/docuviewer.css Wed Aug 22 16:25:38 2012 +0200 @@ -252,7 +252,10 @@ font-size: 14px; line-height: 1.3; } - +div.col.main div.content.text div.emptyPage { + font-family: Verdana,Arial,sans-serif; + font-size: 12px; +} /* * search results */ @@ -325,8 +328,6 @@ display: none; } - - /* * thumbnail overview */ @@ -337,3 +338,23 @@ div.col.main table.thumbs td { text-align: center; } + +/* + * footer + */ +div.footer { + max-width: 68em; + margin-top: 1em; + border-top: 1px solid silver; + margin-left: 28px; + margin-right: 28px; + text-align: center; +} +div.footer div.content { + font-size: 10px; + color: grey; +} +div.footer div.content a:link, +div.footer div.content a:visited { + color: grey; +} \ No newline at end of file diff -r dbaa7dce60a5 -r 6cdc31e9ed8e documentViewer.py --- a/documentViewer.py Tue Aug 21 13:28:35 2012 +0200 +++ b/documentViewer.py Wed Aug 22 16:25:38 2012 +0200 @@ -260,11 +260,11 @@ security.declareProtected('View','index_html') def index_html(self,url,mode="texttool",viewMode="auto",viewLayer=None,tocMode="thumbs",start=1,pn=1): """ - view page + show page @param url: url which contains display information @param mode: defines how to access the document behind url @param viewMode: 'images': display images, 'text': display text, 'xml': display xml, default is 'auto' - @param viewLayer: sub-type of viewMode, e.g. 'dict' for viewMode='text' + @param viewLayer: sub-type of viewMode, e.g. layer 'dict' for viewMode='text' @param tocMode: type of 'table of contents' for navigation (thumbs, text, figures, none) """ @@ -278,14 +278,19 @@ if not getattr(self, 'digilibBaseUrl', None): self.digilibBaseUrl = self.findDigilibUrl() or "http://digilib.mpiwg-berlin.mpg.de/digitallibrary" + # docinfo: information about document (cached) docinfo = self.getDocinfo(mode=mode,url=url,tocMode=tocMode) + # userinfo: user settings (cached) + userinfo = self.getUserinfo() + # auto viewMode: text if there is a text else images if viewMode=="auto": if docinfo.get('textURLPath', None): # docinfo.get('textURL', None) not implemented yet viewMode = "text" - if viewLayer is None: + if viewLayer is None and 'viewLayer' not in userinfo: + # use layer dict as default viewLayer = "dict" else: viewMode = "images" @@ -295,7 +300,11 @@ viewMode = "text" viewLayer = "dict" - pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, viewMode=viewMode, viewLayer=viewLayer, tocMode=tocMode) + # safe viewLayer in userinfo + userinfo['viewLayer'] = viewLayer + + # pageinfo: information about page (not cached) + pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, userinfo=userinfo, viewMode=viewMode, viewLayer=viewLayer, tocMode=tocMode) # get template /template/viewer_$viewMode pt = getattr(self.template, 'viewer_%s'%viewMode, None) @@ -494,6 +503,20 @@ return False + def getUserinfo(self): + """returns userinfo object""" + logging.debug("getUserinfo") + userinfo = {} + # look for cached userinfo in session + if self.REQUEST.SESSION.has_key('userinfo'): + userinfo = self.REQUEST.SESSION['userinfo'] + # check if its still current? + else: + # store in session + self.REQUEST.SESSION['userinfo'] = userinfo + + return userinfo + def getDocinfo(self, mode, url, tocMode=None): """returns docinfo depending on mode""" logging.debug("getDocinfo: mode=%s, url=%s"%(mode,url)) @@ -771,7 +794,7 @@ return docinfo - def getPageinfo(self, current=None, start=None, rows=None, cols=None, docinfo=None, viewMode=None, viewLayer=None, tocMode=None): + def getPageinfo(self, current=None, start=None, rows=None, cols=None, docinfo=None, userinfo=None, viewMode=None, viewLayer=None, tocMode=None): """returns pageinfo with the given parameters""" logging.debug("getPageInfo(current=%s, start=%s, rows=%s, cols=%s, viewMode=%s, viewLayer=%s, tocMode=%s)"%(current,start,rows,cols,viewMode,viewLayer,tocMode)) pageinfo = {} diff -r dbaa7dce60a5 -r 6cdc31e9ed8e version.txt --- a/version.txt Tue Aug 21 13:28:35 2012 +0200 +++ b/version.txt Wed Aug 22 16:25:38 2012 +0200 @@ -1,1 +1,1 @@ -DocumentViewer 2.2.0 \ No newline at end of file +DocumentViewer 2.2.2 \ No newline at end of file diff -r dbaa7dce60a5 -r 6cdc31e9ed8e zpt/common_template.zpt --- a/zpt/common_template.zpt Tue Aug 21 13:28:35 2012 +0200 +++ b/zpt/common_template.zpt Wed Aug 22 16:25:38 2012 +0200 @@ -11,8 +11,8 @@ docpath docinfo/textURLPath | nothing; bib docinfo/bib | nothing; bibType docinfo/bibType | nothing; formattedLabel python:here.metadataService.getBibFormattedLabel(bibdata=bib);"> - + + + + +
Sorry, document doesn't exist.
+ + + + \ No newline at end of file diff -r dbaa7dce60a5 -r 6cdc31e9ed8e zpt/viewer_text.zpt --- a/zpt/viewer_text.zpt Tue Aug 21 13:28:35 2012 +0200 +++ b/zpt/viewer_text.zpt Wed Aug 22 16:25:38 2012 +0200 @@ -14,7 +14,7 @@