--- documentViewer/documentViewer.py 2010/10/05 12:25:32 1.101 +++ documentViewer/documentViewer.py 2010/10/11 12:45:15 1.115 @@ -401,9 +401,11 @@ class documentViewer(Folder): regpath = regexp.match(url) if (regpath==None): return "" - + logging.debug("(getDomFromIndexMeta): URLXAXA: %s"%regpath.group(2)) return ("/mpiwg/online/"+regpath.group(1)+"/"+regpath.group(2)) + + def getIndexMetaUrl(self,url): """returns utr of index.meta document at url""" @@ -532,6 +534,28 @@ class documentViewer(Folder): return docinfo + + def getNameFromIndexMeta(self,path,docinfo=None,dom=None,cut=0): + """gets name info from the index.meta file at path or given by dom""" + if docinfo is None: + docinfo = {} + + if dom is None: + for x in range(cut): + path=getParentDir(path) + dom = self.getDomFromIndexMeta(path) + + #docinfo['indexMetaPath']=self.getIndexMetaPath(path); + + #result= dom.xpath("//result/resultPage") + #docinfo['numPages']=int(getTextFromNode(result[0])) + + #result =dom.xpath("//name") + docinfo['name']=getTextFromNode(dom.xpath("/resource/name")[0]) + logging.debug("documentViewer docinfo[name] %s"%docinfo[name]) + + #logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype) + return docinfo def getDocinfoFromTextTool(self, url, dom=None, docinfo=None): """parse texttool tag in index meta""" @@ -615,10 +639,11 @@ class documentViewer(Folder): docinfo['textURLPath'] = textUrl if not docinfo['imagePath']: # text-only, no page images - docinfo = self.getTextPages(docinfo) + docinfo = self.getNumTextPages(docinfo) presentationUrls = dom.xpath("//texttool/presentation") docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom) # get info von bib tag + docinfo = self.getNameFromIndexMeta(url, docinfo=docinfo, dom=dom) if presentationUrls and (len(presentationUrls) > 0): # ueberschreibe diese durch presentation informationen # presentation url ergiebt sich ersetzen von index.meta in der url der fuer die Metadaten