Mercurial > hg > documentViewer
diff documentViewer.py @ 518:91051b36b9cc
uses xml info from doc-info.xql for table of contents now.
author | casties |
---|---|
date | Mon, 12 Mar 2012 19:01:14 +0100 |
parents | 7d7b639d7be7 |
children | 70c3ae5eac7c |
line wrap: on
line diff
--- a/documentViewer.py Mon Mar 05 19:11:59 2012 +0100 +++ b/documentViewer.py Mon Mar 12 19:01:14 2012 +0100 @@ -256,12 +256,8 @@ if not getattr(self, 'digilibBaseUrl', None): self.digilibBaseUrl = self.findDigilibUrl() or "http://digilib.mpiwg-berlin.mpg.de/digitallibrary" - docinfo = self.getDocinfo(mode=mode,url=url) + docinfo = self.getDocinfo(mode=mode,url=url,tocMode=tocMode) - if tocMode != "thumbs": - # get table of contents - self.getToc(mode=tocMode, docinfo=docinfo) - # auto viewMode: text if there is a text else images if viewMode=="auto": if docinfo.get('textURL', None) or docinfo.get('textURLPath', None): @@ -429,7 +425,7 @@ - def getDocinfo(self, mode, url): + def getDocinfo(self, mode, url, tocMode=None): """returns docinfo depending on mode""" logging.debug("getDocinfo: mode=%s, url=%s"%(mode,url)) # look for cached docinfo in session @@ -483,9 +479,9 @@ texttool = self.metadataService.getTexttoolData(dom=metaDom) if texttool: docinfo = self.getDocinfoFromTexttool(docinfo, texttool) - # document info from full text + # document info (including toc) from full text if docinfo.get('textURLPath', None): - docinfo = self.getTextInfo(docinfo=docinfo) + docinfo = self.getTextInfo(mode=tocMode, docinfo=docinfo) # bib info bib = self.metadataService.getBibData(dom=metaDom) @@ -729,13 +725,11 @@ # get number of pages np = int(docinfo.get('numPages', 0)) if np == 0: - # numPages unknown - maybe we can get it from text page - logging.warn("getPageInfo: numPages=0 trying getTextPage!") - if docinfo.get('textURLPath', None): - # cache text page as well - pageinfo['textPage'] = self.getTextPage(mode=viewLayer, pn=current, docinfo=docinfo, pageinfo=pageinfo) - np = int(docinfo.get('numPages', 0)) - + # try numTextPages + np = docinfo.get('numTextPages', 0) + if np != 0: + docinfo['numPages'] = np + # cache table of contents pageinfo['tocPageSize'] = getInt(self.REQUEST.get('tocPageSize', 30)) pageinfo['numgroups'] = int(np / grpsize)