Mercurial > hg > documentViewer
comparison documentViewer.py @ 625:80a3b1fa5705
more move sslification to only client-visible urls.
| author | casties |
|---|---|
| date | Mon, 15 Dec 2014 17:18:20 +0100 |
| parents | 80a0191ae51c |
| children | 7dafe8283312 |
comparison
equal
deleted
inserted
replaced
| 624:80a0191ae51c | 625:80a3b1fa5705 |
|---|---|
| 516 | 516 |
| 517 # new docinfo | 517 # new docinfo |
| 518 docinfo = {'mode': mode, 'url': url} | 518 docinfo = {'mode': mode, 'url': url} |
| 519 # add self url | 519 # add self url |
| 520 docinfo['viewerUrl'] = self.getDocumentViewerURL() | 520 docinfo['viewerUrl'] = self.getDocumentViewerURL() |
| 521 docinfo['digilibBaseUrl'] = self.digilibBaseUrl | 521 docinfo['digilibBaseUrl'] = sslifyUrl(self.digilibBaseUrl, self, force=True) |
| 522 docinfo['digilibScalerUrl'] = self.digilibScalerUrl | 522 docinfo['digilibScalerUrl'] = sslifyUrl(self.digilibScalerUrl, self, force=True) |
| 523 docinfo['digilibViewerUrl'] = self.digilibViewerUrl | 523 docinfo['digilibViewerUrl'] = sslifyUrl(self.digilibViewerUrl, self, force=True) |
| 524 # get index.meta DOM | 524 # get index.meta DOM |
| 525 docUrl = None | 525 docUrl = None |
| 526 metaDom = None | 526 metaDom = None |
| 527 if mode=="texttool": | 527 if mode=="texttool": |
| 528 # url points to document dir or index.meta | 528 # url points to document dir or index.meta |
| 640 if docinfo.get('numPages', 0) == 0: | 640 if docinfo.get('numPages', 0) == 0: |
| 641 # number of images from digilib | 641 # number of images from digilib |
| 642 if docinfo.get('imagePath', None): | 642 if docinfo.get('imagePath', None): |
| 643 imgpath = docinfo['imagePath'].replace('/mpiwg/online', '', 1) | 643 imgpath = docinfo['imagePath'].replace('/mpiwg/online', '', 1) |
| 644 logging.debug("imgpath=%s"%imgpath) | 644 logging.debug("imgpath=%s"%imgpath) |
| 645 docinfo['imageURL'] = "%s?fn=%s"%(self.digilibScalerUrl, imgpath) | 645 docinfo['imageURL'] = sslifyUrl("%s?fn=%s"%(self.digilibScalerUrl, imgpath), self, force=True) |
| 646 docinfo = self.getDocinfoFromDigilib(docinfo, imgpath) | 646 docinfo = self.getDocinfoFromDigilib(docinfo, imgpath) |
| 647 else: | 647 else: |
| 648 # imagePath still missing? try "./pageimg" | 648 # imagePath still missing? try "./pageimg" |
| 649 imgPath = os.path.join(docUrl, 'pageimg') | 649 imgPath = os.path.join(docUrl, 'pageimg') |
| 650 docinfo = self.getDocinfoFromDigilib(docinfo, imgPath) | 650 docinfo = self.getDocinfoFromDigilib(docinfo, imgPath) |
| 651 if docinfo.get('numPages', 0) > 0: | 651 if docinfo.get('numPages', 0) > 0: |
| 652 # there are pages | 652 # there are pages |
| 653 docinfo['imagePath'] = imgPath | 653 docinfo['imagePath'] = imgPath |
| 654 docinfo['imageURL'] = "%s?fn=%s"%(self.digilibScalerUrl, docinfo['imagePath']) | 654 docinfo['imageURL'] = sslifyUrl("%s?fn=%s"%(self.digilibScalerUrl, docinfo['imagePath']), self, force=True) |
| 655 | 655 |
| 656 # check numPages | 656 # check numPages |
| 657 if docinfo.get('numPages', 0) == 0: | 657 if docinfo.get('numPages', 0) == 0: |
| 658 if docinfo.get('numTextPages', 0) > 0: | 658 if docinfo.get('numTextPages', 0) > 0: |
| 659 # replace with numTextPages (text-only?) | 659 # replace with numTextPages (text-only?) |
