--- documentViewer/documentViewer.py 2005/12/18 12:35:02 1.1
+++ documentViewer/documentViewer.py 2005/12/23 14:01:29 1.2
@@ -194,6 +194,39 @@ class documentViewer(ZopePageTemplate):
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumbs.zpt')).__of__(self)
return pt(imageUrl=imageUrl,pt=imagepath[1],start=start)
+ def imagePathThumb(self,path,start=0):
+ """path ist the path to the images it is assumes that the index.meta file is one level higher."""
+
+ path=path.replace("/mpiwg/online","")
+ pt=getParamFromDigilib(path,'pt')
+ imageUrl=genericDigilib+"/servlet/Scaler?fn=%s"%path
+
+ pageT=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumbs.zpt')).__of__(self)
+ return pageT(imageUrl=imageUrl,pt=pt,start=start)
+
+ def headerFromIndexMeta(self,path):
+ """gibt header from index meta out"""
+
+ metaData=self.metadata.main.meta.bib
+ server="http://foxridge.mpiwg-berlin.mpg.de"
+ path="/".join(path.split("/")[0:-1])
+ metaUrl=server+path+"/index.meta"
+
+ dom = NonvalidatingReader.parseUri(metaUrl)
+ type=dom.xpath("//bib/@type")
+ if type and (len(type)>0):
+ type=type[0].value
+ else:
+ type="generic"
+ type=type.replace("-"," ")# wrong typesiin index meta "-" instead of " "
+ hash=metaData.generateMappingForType(type)
+
+ author=getTextFromNode(dom.xpath("//bib/%s"%hash['author'][0])[0])
+ title=getTextFromNode(dom.xpath("//bib/%s"%hash['title'][0])[0])
+ year=getTextFromNode(dom.xpath("//bib/%s"%hash['year'][0])[0])
+
+ return author,title,year
+
def text(self,mode,url,pn):
"""give text"""
if mode=="texttool": #index.meta with texttool information
@@ -234,36 +267,46 @@ class documentViewer(ZopePageTemplate):
list.append(endNode.parentNode)
if p==e:# beide im selben paragraphen
-
- else:
- next=p
- while next!=e:
- print next,e
- list.append(next)
- next=next.nextSibling
-
- for x in list:
- PrettyPrint(x)
-
- return list
-
+ pass
+# else:
+# next=p
+# while next!=e:
+# print next,e
+# list.append(next)
+# next=next.nextSibling
+#
+# for x in list:
+# PrettyPrint(x)
+#
+# return list
+#
def image(self,mode,url,pn):
"""give image out"""
if mode=="texttool": #index.meta with texttool information
(viewerUrl,imagepath,textpath)=parseUrlTextTool(url)
+ if not viewerUrl:
+ viewerUrl=self.imageViewerUrl
url=viewerUrl+"pn=%s&fn=%s"%(pn,imagepath[0])
ret=""""""%url
return url
+ elif mode=="imagepath":
+ url=url.replace("/mpiwg/online","")
+ url=self.imageViewerUrl+"pn=%s&fn=%s"%(pn,url)
+ ret=""""""%url
+ return url
+
def thumbs(self,mode,url,start):
"""give thumbs out"""
if mode=="texttool": #index.meta with texttool information
return self.textToolThumb(url,int(start))
+ elif mode=="imagepath":
+ return self.imagePathThumb(url,int(start))
security.declareProtected('View','index_html')
- def index_html(self,mode,url,start=0,pn=0):
+ def index_html(self,mode,url,start=0,pn=1):
'''
view it
@param mode: defines which type of document is behind url