version 1.5, 2006/04/10 10:13:01
|
version 1.6, 2006/04/10 11:23:18
|
Line 43 def urlopen(url):
|
Line 43 def urlopen(url):
|
socket.setdefaulttimeout(5) |
socket.setdefaulttimeout(5) |
return ret |
return ret |
|
|
def getParamFromDigilib(path,param): |
|
"""gibt param von dlInfo aus""" |
|
imageUrl=genericDigilib+"/dirInfo-xml.jsp?mo=dir&fn="+path |
|
|
|
zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo (%s) from %s"%(param,imageUrl)) |
|
|
|
try: |
|
dom = NonvalidatingReader.parseUri(imageUrl) |
|
except: |
|
return None |
|
|
|
params=dom.xpath("//dir/%s"%param) |
|
zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo:%s"%params) |
|
|
|
if params: |
|
return getTextFromNode(params[0]) |
|
|
|
|
|
|
|
|
|
Line 111 class documentViewer(Folder):
|
Line 94 class documentViewer(Folder):
|
''' |
''' |
|
|
zLOG.LOG("documentViewer (index)", zLOG.INFO, "mode: %s url:%s start:%s pn:%s"%(mode,url,start,pn)) |
zLOG.LOG("documentViewer (index)", zLOG.INFO, "mode: %s url:%s start:%s pn:%s"%(mode,url,start,pn)) |
print "dlbaseurl:", self.digilibBaseUrl |
|
|
|
if not hasattr(self, 'template'): |
if not hasattr(self, 'template'): |
# create template folder if it doesn't exist |
# create template folder if it doesn't exist |
Line 149 class documentViewer(Folder):
|
Line 131 class documentViewer(Folder):
|
return style |
return style |
|
|
|
|
|
def getParamFromDigilib(self,path,param): |
|
"""gibt param von dlInfo aus""" |
|
imageUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path |
|
|
|
zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo (%s) from %s"%(param,imageUrl)) |
|
|
|
try: |
|
dom = NonvalidatingReader.parseUri(imageUrl) |
|
except: |
|
return None |
|
|
|
params=dom.xpath("//dir/%s"%param) |
|
zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo:%s"%params) |
|
|
|
if params: |
|
return getTextFromNode(params[0]) |
|
|
|
|
def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None): |
def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None): |
"""gets bibliographical info from the index.meta file at url or given by dom""" |
"""gets bibliographical info from the index.meta file at url or given by dom""" |
zLOG.LOG("documentViewer (getbibinfofromindexmeta)", zLOG.INFO,"path: %s"%(path)) |
zLOG.LOG("documentViewer (getbibinfofromindexmeta)", zLOG.INFO,"path: %s"%(path)) |
Line 210 class documentViewer(Folder):
|
Line 210 class documentViewer(Folder):
|
if image and archivePath: |
if image and archivePath: |
image=os.path.join(archivePath,image) |
image=os.path.join(archivePath,image) |
image=image.replace("/mpiwg/online",'') |
image=image.replace("/mpiwg/online",'') |
pt=getParamFromDigilib(image,'size') |
pt=self.getParamFromDigilib(image,'size') |
docinfo['imagePath'] = image |
docinfo['imagePath'] = image |
docinfo['numPages'] = pt |
docinfo['numPages'] = pt |
|
|
Line 235 class documentViewer(Folder):
|
Line 235 class documentViewer(Folder):
|
zLOG.LOG("documentViewer (getdocinfofromimagepath)", zLOG.INFO,"path: %s"%(path)) |
zLOG.LOG("documentViewer (getdocinfofromimagepath)", zLOG.INFO,"path: %s"%(path)) |
if docinfo is None: |
if docinfo is None: |
docinfo = {} |
docinfo = {} |
docinfo['imagePath'] = path |
|
path=path.replace("/mpiwg/online","") |
path=path.replace("/mpiwg/online","") |
pt=getParamFromDigilib(path,'size') |
docinfo['imagePath'] = path |
|
pt=self.getParamFromDigilib(path,'size') |
docinfo['numPages'] = pt |
docinfo['numPages'] = pt |
imageUrl=genericDigilib+"/servlet/Scaler?fn=%s"%path |
imageUrl=self.digilibBaseUrl+"/servlet/Scaler?fn=%s"%path |
docinfo['imageURL'] = imageUrl |
docinfo['imageURL'] = imageUrl |
|
|
docinfo = self.getBibinfoFromIndexMeta(path,docinfo=docinfo) |
docinfo = self.getBibinfoFromIndexMeta(path,docinfo=docinfo) |