version 1.41, 2010/02/12 14:33:02
|
version 1.42, 2010/03/08 15:02:33
|
Line 1
|
Line 1
|
|
|
|
|
from OFS.Folder import Folder |
from OFS.Folder import Folder |
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate |
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
Line 11 from Ft.Xml.Domlette import Nonvalidatin
|
Line 10 from Ft.Xml.Domlette import Nonvalidatin
|
from Ft.Xml.Domlette import PrettyPrint, Print |
from Ft.Xml.Domlette import PrettyPrint, Print |
from Ft.Xml import EMPTY_NAMESPACE, Parse |
from Ft.Xml import EMPTY_NAMESPACE, Parse |
|
|
import Ft.Xml.XPath |
|
|
|
|
import Ft.Xml.XPath |
|
import xmlrpclib |
import os.path |
import os.path |
import sys |
import sys |
import cgi |
import cgi |
Line 233 class documentViewer(Folder):
|
Line 233 class documentViewer(Folder):
|
else: |
else: |
return style |
return style |
|
|
|
def getTextLanguage(self,url,docinfo): |
|
docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0]) |
|
lang = urlencode({'':docinfo['lang']}) |
|
return lang |
|
|
|
|
def isAccessible(self, docinfo): |
def isAccessible(self, docinfo): |
"""returns if access to the resource is granted""" |
"""returns if access to the resource is granted""" |
Line 426 class documentViewer(Folder):
|
Line 431 class documentViewer(Folder):
|
return docinfo |
return docinfo |
|
|
|
|
|
def getNumPages(self, xquery, docinfo=None): #New Method 24.02.2010 |
|
text=self.viewerTemplates.query.eval("/mpdl/interface/xquery.xql","document="+ docinfo['textURLPath'] +"&xquery="+str(xquery)) |
|
docinfo['numPages'] = text.count("<pb ") |
|
return docinfo |
|
|
|
|
def getDocinfoFromTextTool(self,url,dom=None,docinfo=None): |
def getDocinfoFromTextTool(self,url,dom=None,docinfo=None): |
"""parse texttool tag in index meta""" |
"""parse texttool tag in index meta""" |
logger("documentViewer (getdocinfofromtexttool)", logging.INFO,"url: %s"%(url)) |
logger("documentViewer (getdocinfofromtexttool)", logging.INFO,"url: %s"%(url)) |
Line 467 class documentViewer(Folder):
|
Line 478 class documentViewer(Folder):
|
imageDirs=dom.xpath("//texttool/image") |
imageDirs=dom.xpath("//texttool/image") |
if imageDirs and (len(imageDirs)>0): |
if imageDirs and (len(imageDirs)>0): |
imageDir=getTextFromNode(imageDirs[0]) |
imageDir=getTextFromNode(imageDirs[0]) |
|
|
else: |
else: |
# we balk with no image tag / not necessary anymore because textmode is now standard |
# we balk with no image tag / not necessary anymore because textmode is now standard |
#raise IOError("No text-tool info in %s"%(url)) |
#raise IOError("No text-tool info in %s"%(url)) |
imageDir="" |
imageDir="" |
docinfo['numPages']=1 # im moment einfach auf eins setzen, navigation ueber die thumbs geht natuerlich nicht |
#xquery="//pb" |
|
|
docinfo['imagePath'] = "" # keine Bilder |
docinfo['imagePath'] = "" # keine Bilder |
docinfo['imageURL'] = "" |
docinfo['imageURL'] = "" |
|
|
Line 504 class documentViewer(Folder):
|
Line 515 class documentViewer(Folder):
|
textUrls=dom.xpath("//texttool/text-url-path") |
textUrls=dom.xpath("//texttool/text-url-path") |
if textUrls and (len(textUrls)>0): |
if textUrls and (len(textUrls)>0): |
textUrl=getTextFromNode(textUrls[0]) |
textUrl=getTextFromNode(textUrls[0]) |
|
|
docinfo['textURLPath'] = textUrl |
docinfo['textURLPath'] = textUrl |
|
|
presentationUrls=dom.xpath("//texttool/presentation") |
presentationUrls=dom.xpath("//texttool/presentation") |
Line 518 class documentViewer(Folder):
|
Line 528 class documentViewer(Folder):
|
presentationUrl=url.replace('index.meta',presentationPath) |
presentationUrl=url.replace('index.meta',presentationPath) |
else: |
else: |
presentationUrl=url + "/" + presentationPath |
presentationUrl=url + "/" + presentationPath |
|
docinfo=self.getNumPages('//pb', docinfo) #im moment einfach auf eins setzen, navigation ueber die thumbs geht natuerlich nicht |
docinfo = self.getBibinfoFromTextToolPresentation(presentationUrl,docinfo=docinfo,dom=dom) |
docinfo = self.getBibinfoFromTextToolPresentation(presentationUrl,docinfo=docinfo,dom=dom) |
|
|
docinfo = self.getAuthinfoFromIndexMeta(url,docinfo=docinfo,dom=dom) # get access info |
docinfo = self.getAuthinfoFromIndexMeta(url,docinfo=docinfo,dom=dom) # get access info |
|
|
return docinfo |
return docinfo |
|
|
|
|
Line 608 class documentViewer(Folder):
|
Line 619 class documentViewer(Folder):
|
pageinfo['start'] = start |
pageinfo['start'] = start |
pageinfo['end'] = start + grpsize |
pageinfo['end'] = start + grpsize |
if docinfo is not None: |
if docinfo is not None: |
|
|
np = int(docinfo['numPages']) |
np = int(docinfo['numPages']) |
pageinfo['end'] = min(pageinfo['end'], np) |
pageinfo['end'] = min(pageinfo['end'], np) |
pageinfo['numgroups'] = int(np / grpsize) |
pageinfo['numgroups'] = int(np / grpsize) |