Changeset 83:ec12a2440daa in documentViewer
- Timestamp:
- Mar 8, 2010, 3:02:33 PM (15 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentViewer.py
r82 r83 1 2 1 3 2 from OFS.Folder import Folder … … 12 11 from Ft.Xml import EMPTY_NAMESPACE, Parse 13 12 13 14 14 import Ft.Xml.XPath 15 15 import xmlrpclib 16 16 import os.path 17 17 import sys … … 234 234 return style 235 235 236 def getTextLanguage(self,url,docinfo): 237 docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0]) 238 lang = urlencode({'':docinfo['lang']}) 239 return lang 240 236 241 237 242 def isAccessible(self, docinfo): … … 425 430 426 431 return docinfo 427 432 433 434 def getNumPages(self, xquery, docinfo=None): #New Method 24.02.2010 435 text=self.viewerTemplates.query.eval("/mpdl/interface/xquery.xql","document="+ docinfo['textURLPath'] +"&xquery="+str(xquery)) 436 docinfo['numPages'] = text.count("<pb ") 437 return docinfo 438 428 439 429 440 def getDocinfoFromTextTool(self,url,dom=None,docinfo=None): … … 468 479 if imageDirs and (len(imageDirs)>0): 469 480 imageDir=getTextFromNode(imageDirs[0]) 481 470 482 else: 471 483 # we balk with no image tag / not necessary anymore because textmode is now standard 472 484 #raise IOError("No text-tool info in %s"%(url)) 473 485 imageDir="" 474 docinfo['numPages']=1 # im moment einfach auf eins setzen, navigation ueber die thumbs geht natuerlich nicht 475 486 #xquery="//pb" 476 487 docinfo['imagePath'] = "" # keine Bilder 477 488 docinfo['imageURL'] = "" 478 489 479 490 if imageDir and archivePath: 480 491 #print "image: ", imageDir, " archivepath: ", archivePath … … 505 516 if textUrls and (len(textUrls)>0): 506 517 textUrl=getTextFromNode(textUrls[0]) 507 508 docinfo['textURLPath'] = textUrl 509 518 docinfo['textURLPath'] = textUrl 519 510 520 presentationUrls=dom.xpath("//texttool/presentation") 511 521 docinfo = self.getBibinfoFromIndexMeta(url,docinfo=docinfo,dom=dom) # get info von bib tag … … 519 529 else: 520 530 presentationUrl=url + "/" + presentationPath 521 531 docinfo=self.getNumPages('//pb', docinfo) #im moment einfach auf eins setzen, navigation ueber die thumbs geht natuerlich nicht 522 532 docinfo = self.getBibinfoFromTextToolPresentation(presentationUrl,docinfo=docinfo,dom=dom) 523 533 524 534 docinfo = self.getAuthinfoFromIndexMeta(url,docinfo=docinfo,dom=dom) # get access info 535 525 536 return docinfo 526 537 … … 609 620 pageinfo['end'] = start + grpsize 610 621 if docinfo is not None: 622 611 623 np = int(docinfo['numPages']) 612 624 pageinfo['end'] = min(pageinfo['end'], np)
Note: See TracChangeset
for help on using the changeset viewer.