Changeset 516:7d7b639d7be7 in documentViewer for documentViewer.py
- Timestamp:
- Mar 5, 2012, 5:04:49 PM (12 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentViewer.py
r514 r516 184 184 return self.template.fulltextclient.getResultsPage(**args) 185 185 186 def getTextInfo(self, **args): 187 """returns document info from the text server""" 188 return self.template.fulltextclient.getTextInfo(**args) 189 186 190 def getToc(self, **args): 187 191 """loads table of contents and stores XML in docinfo""" … … 480 484 if texttool: 481 485 docinfo = self.getDocinfoFromTexttool(docinfo, texttool) 486 # document info from full text 487 if docinfo.get('textURLPath', None): 488 docinfo = self.getTextInfo(docinfo=docinfo) 482 489 483 490 # bib info … … 510 517 # image path 511 518 if mode != 'texttool': 512 # override image path from texttool with url 519 # override image path from texttool with url TODO: how about mode=auto? 513 520 docinfo['imagePath'] = url.replace('/mpiwg/online/', '', 1) 514 521 … … 517 524 docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + docinfo['imagePath'] 518 525 docinfo = self.getDocinfoFromDigilib(docinfo, docinfo['imagePath']) 526 527 # check numPages 528 if docinfo.get('numPages', 0) == 0: 529 if docinfo.get('numTextPages', 0) > 0: 530 # replace with numTextPages (text-only?) 531 docinfo['numPages'] = docinfo['numTextPages'] 519 532 520 533 logging.debug("documentViewer (getdocinfo) docinfo: keys=%s"%docinfo.keys()) … … 523 536 self.REQUEST.SESSION['docinfo'] = docinfo 524 537 return docinfo 538 525 539 526 540 def getDocinfoFromResource(self, docinfo, resource): … … 699 713 pageinfo['tocMode'] = tocMode 700 714 715 # TODO: unify current and pn! 701 716 current = getInt(current) 702 717 pageinfo['current'] = current … … 716 731 if np == 0: 717 732 # numPages unknown - maybe we can get it from text page 733 logging.warn("getPageInfo: numPages=0 trying getTextPage!") 718 734 if docinfo.get('textURLPath', None): 719 735 # cache text page as well … … 733 749 pageinfo['pageZero'] = pageZero 734 750 pageinfo['pageBatch'] = self.getPageBatch(start=start, rows=rows, cols=cols, pageFlowLtr=pageFlowLtr, pageZero=pageZero, minIdx=1, maxIdx=np) 735 751 # more page parameters 736 752 pageinfo['characterNormalization'] = self.REQUEST.get('characterNormalization','reg') 753 if docinfo.get('pageNumbers'): 754 # get original page numbers 755 pageNumber = docinfo['pageNumbers'].get(current, None) 756 if pageNumber is not None: 757 pageinfo['pageNumberOrig'] = pageNumber['no'] 758 pageinfo['pageNumberOrigNorm'] = pageNumber['non'] 737 759 738 760 # cache search results
Note: See TracChangeset
for help on using the changeset viewer.