Changeset 83:ec12a2440daa in documentViewer


Ignore:
Timestamp:
Mar 8, 2010, 3:02:33 PM (14 years ago)
Author:
abukhman
Branch:
default
Message:

My last update Bukhman Andrey

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r82 r83  
    1 
    21
    32from OFS.Folder import Folder
     
    1211from Ft.Xml import EMPTY_NAMESPACE, Parse
    1312
     13
    1414import Ft.Xml.XPath
    15 
     15import xmlrpclib
    1616import os.path
    1717import sys
     
    234234            return style
    235235
     236    def getTextLanguage(self,url,docinfo):
     237        docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0])
     238        lang = urlencode({'':docinfo['lang']})
     239        return lang
     240       
    236241       
    237242    def isAccessible(self, docinfo):
     
    425430
    426431        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       
    428439       
    429440    def getDocinfoFromTextTool(self,url,dom=None,docinfo=None):
     
    468479       if imageDirs and (len(imageDirs)>0):
    469480           imageDir=getTextFromNode(imageDirs[0])
     481           
    470482       else:
    471483           # we balk with no image tag / not necessary anymore because textmode is now standard
    472484           #raise IOError("No text-tool info in %s"%(url))
    473485           imageDir=""
    474            docinfo['numPages']=1 # im moment einfach auf eins setzen, navigation ueber die thumbs geht natuerlich nicht
    475        
     486           #xquery="//pb" 
    476487           docinfo['imagePath'] = "" # keine Bilder
    477488           docinfo['imageURL'] = ""
    478 
     489           
    479490       if imageDir and archivePath:
    480491           #print "image: ", imageDir, " archivepath: ", archivePath
     
    505516       if textUrls and (len(textUrls)>0):
    506517           textUrl=getTextFromNode(textUrls[0])
    507            
    508            docinfo['textURLPath'] = textUrl
    509    
     518           docinfo['textURLPath'] = textUrl   
     519       
    510520       presentationUrls=dom.xpath("//texttool/presentation")
    511521       docinfo = self.getBibinfoFromIndexMeta(url,docinfo=docinfo,dom=dom)   # get info von bib tag
     
    519529           else:
    520530               presentationUrl=url + "/" + presentationPath
    521               
     531           docinfo=self.getNumPages('//pb', docinfo) #im moment einfach auf eins setzen, navigation ueber die thumbs geht natuerlich nicht   
    522532           docinfo = self.getBibinfoFromTextToolPresentation(presentationUrl,docinfo=docinfo,dom=dom)
    523533
    524534       docinfo = self.getAuthinfoFromIndexMeta(url,docinfo=docinfo,dom=dom)   # get access info
     535       
    525536       return docinfo
    526537   
     
    609620        pageinfo['end'] = start + grpsize
    610621        if docinfo is not None:
     622           
    611623            np = int(docinfo['numPages'])
    612624            pageinfo['end'] = min(pageinfo['end'], np)
Note: See TracChangeset for help on using the changeset viewer.