Changeset 20:9884703dae70 in documentViewer
- Timestamp:
- Dec 23, 2005, 2:01:29 PM (18 years ago)
- Branch:
- default
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
documentViewer.py
r0 r20 195 195 return pt(imageUrl=imageUrl,pt=imagepath[1],start=start) 196 196 197 def imagePathThumb(self,path,start=0): 198 """path ist the path to the images it is assumes that the index.meta file is one level higher.""" 199 200 path=path.replace("/mpiwg/online","") 201 pt=getParamFromDigilib(path,'pt') 202 imageUrl=genericDigilib+"/servlet/Scaler?fn=%s"%path 203 204 pageT=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumbs.zpt')).__of__(self) 205 return pageT(imageUrl=imageUrl,pt=pt,start=start) 206 207 def headerFromIndexMeta(self,path): 208 """gibt header from index meta out""" 209 210 metaData=self.metadata.main.meta.bib 211 server="http://foxridge.mpiwg-berlin.mpg.de" 212 path="/".join(path.split("/")[0:-1]) 213 metaUrl=server+path+"/index.meta" 214 215 dom = NonvalidatingReader.parseUri(metaUrl) 216 type=dom.xpath("//bib/@type") 217 if type and (len(type)>0): 218 type=type[0].value 219 else: 220 type="generic" 221 type=type.replace("-"," ")# wrong typesiin index meta "-" instead of " " 222 hash=metaData.generateMappingForType(type) 223 224 author=getTextFromNode(dom.xpath("//bib/%s"%hash['author'][0])[0]) 225 title=getTextFromNode(dom.xpath("//bib/%s"%hash['title'][0])[0]) 226 year=getTextFromNode(dom.xpath("//bib/%s"%hash['year'][0])[0]) 227 228 return author,title,year 229 197 230 def text(self,mode,url,pn): 198 231 """give text""" … … 235 268 236 269 if p==e:# beide im selben paragraphen 237 238 else:239 next=p240 while next!=e:241 print next,e242 list.append(next)243 next=next.nextSibling244 245 for x in list:246 PrettyPrint(x)247 248 return list249 270 pass 271 # else: 272 # next=p 273 # while next!=e: 274 # print next,e 275 # list.append(next) 276 # next=next.nextSibling 277 # 278 # for x in list: 279 # PrettyPrint(x) 280 # 281 # return list 282 # 250 283 def image(self,mode,url,pn): 251 284 """give image out""" 252 285 if mode=="texttool": #index.meta with texttool information 253 286 (viewerUrl,imagepath,textpath)=parseUrlTextTool(url) 287 if not viewerUrl: 288 viewerUrl=self.imageViewerUrl 254 289 url=viewerUrl+"pn=%s&fn=%s"%(pn,imagepath[0]) 255 290 ret="""<iframe height="100%%" width="100%%" src="%s"/>"""%url 256 291 return url 292 elif mode=="imagepath": 293 url=url.replace("/mpiwg/online","") 294 url=self.imageViewerUrl+"pn=%s&fn=%s"%(pn,url) 295 ret="""<iframe height="100%%" width="100%%" src="%s"/>"""%url 296 return url 297 257 298 258 299 def thumbs(self,mode,url,start): … … 260 301 if mode=="texttool": #index.meta with texttool information 261 302 return self.textToolThumb(url,int(start)) 303 elif mode=="imagepath": 304 return self.imagePathThumb(url,int(start)) 262 305 263 306 security.declareProtected('View','index_html') 264 307 265 308 266 def index_html(self,mode,url,start=0,pn= 0):309 def index_html(self,mode,url,start=0,pn=1): 267 310 ''' 268 311 view it -
zpt/documentViewer_template.zpt
r17 r20 1 1 <html> 2 2 <body> 3 <table border="0" width="100%"> 3 <tal:x tal:define="header python:here.headerFromIndexMeta(options['url'])"> 4 5 <b tal:content="python:header[0]"/>,<i tal:content="python:header[1]"/>,<i tal:content="python:header[2]"/> 6 </tal:x> 7 <table border="0" width="100%" height="100%"> 4 8 <tr> 5 <td width="30%" >9 <td width="30%" valign="top"> 6 10 <tal:x replace="structure python:here.thumbs(options['mode'],options['url'],options['start'])"/> 7 11 </td>
Note: See TracChangeset
for help on using the changeset viewer.