Mercurial > hg > documentViewer
changeset 20:9884703dae70
new modi
author | dwinter |
---|---|
date | Fri, 23 Dec 2005 15:01:29 +0100 |
parents | b337f4cd3b9d |
children | 0af46e75de3c |
files | documentViewer.py zpt/documentViewer_template.zpt |
diffstat | 2 files changed, 63 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/documentViewer.py Sun Dec 18 13:35:02 2005 +0100 +++ b/documentViewer.py Fri Dec 23 15:01:29 2005 +0100 @@ -194,6 +194,39 @@ 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 @@ 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="""<iframe height="100%%" width="100%%" src="%s"/>"""%url return url + elif mode=="imagepath": + url=url.replace("/mpiwg/online","") + url=self.imageViewerUrl+"pn=%s&fn=%s"%(pn,url) + ret="""<iframe height="100%%" width="100%%" src="%s"/>"""%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
--- a/zpt/documentViewer_template.zpt Sun Dec 18 13:35:02 2005 +0100 +++ b/zpt/documentViewer_template.zpt Fri Dec 23 15:01:29 2005 +0100 @@ -1,8 +1,12 @@ <html> <body> -<table border="0" width="100%"> +<tal:x tal:define="header python:here.headerFromIndexMeta(options['url'])"> + +<b tal:content="python:header[0]"/>,<i tal:content="python:header[1]"/>,<i tal:content="python:header[2]"/> +</tal:x> +<table border="0" width="100%" height="100%"> <tr> - <td width="30%"> + <td width="30%" valign="top"> <tal:x replace="structure python:here.thumbs(options['mode'],options['url'],options['start'])"/> </td> <td width="70%">