|
|
| version 1.2, 2004/12/23 08:30:56 | version 1.4, 2005/02/11 16:27:01 |
|---|---|
| Line 2 | Line 2 |
| import os.path | import os.path |
| from types import * | from types import * |
| import xml.dom.minidom | import xml.dom.minidom |
| import zLOG | |
| OSASObjectTypes=['OSAS_metaDataFile','OSAS_dir','OSAS_file','OSAS_imageFolder','OSAS_dir_archive','OSAS_file_archive'] | OSASObjectTypes=['OSAS_metaDataFile','OSAS_dir','OSAS_file','OSAS_imageFolder','OSAS_dir_archive','OSAS_file_archive'] |
| OSASExcludedFiles=['TheVolumeSettingsFolder','TheFindByContentFolder'] | OSASExcludedFiles=['TheVolumeSettingsFolder','TheFindByContentFolder'] |
| Line 65 def getMetaInfoFromXML(path,xmlInfo): | Line 66 def getMetaInfoFromXML(path,xmlInfo): |
| # html=html.encode('utf-8','replace')+getBib(bib.childNodes).encode('utf-8','replace') | # html=html.encode('utf-8','replace')+getBib(bib.childNodes).encode('utf-8','replace') |
| return html.encode('utf-8') | |
| def getMetaFile(self,path): | return html |
| """get index.meta and translate it to HTML""" | |
| html=[] | |
| if not os.path.exists(path+"/index.meta"): | |
| return self.getMetaInfoFromIndexMeta(path) | |
| #return "NO_METADATA" | |
| else: | |
| f = os.popen("cat "+path+"/index.meta","r") | |
| lines = f.read() | |
| dom = xml.dom.minidom.parseString(lines) | |
| try: | |
| name=getText(dom.getElementsByTagName("name")[0].childNodes) | |
| except: | |
| name="NOT_DEFINED!!!" | |
| try: | |
| creator=getText(dom.getElementsByTagName("creator")[0].childNodes) | |
| except: | |
| creator="NOT_DEFINED!!!" | |
| try: | |
| creation_date=getText(dom.getElementsByTagName("archive-creation-date")[0].childNodes) | |
| except: | |
| creation_date="NOT_DEFINED!!!" | |
| try: | |
| description=getText(dom.getElementsByTagName("description")[0].childNodes) | |
| except: | |
| description="NOT_DEFINED!!!" | |
| try: | |
| type=getText(dom.getElementsByTagName("content-type")[0].childNodes) | |
| except: | |
| type="" | |
| if type=="scanned document": | |
| html="<h3>Document: "+name+"</h3>" | |
| elif type=="folder": | |
| html="<h3>Folder: "+name+"</h3>" | |
| else: | |
| html="<h3>Document: "+name+"</h3>" | |
| html=html+"<p><i>created by: "+creator+" at: "+creation_date+"</i></p>" | |
| html=html+"<h4>Description</h4><p>"+description+"</p>" | |
| try: | |
| bib = dom.getElementsByTagName("meta")[0].getElementsByTagName("bib")[0] | |
| if bib.attributes.has_key('type'): | |
| html=html+"<h4>Info ("+bib.attributes['type'].value+")</h4>" | |
| else: | |
| html=html+"<h4>Info</h4>" | |
| html=html+getBib(bib.childNodes) | |
| except: | |
| """none""" | |
| # html=html.encode('utf-8','replace')+getBib(bib.childNodes).encode('utf-8','replace') | |
| return html.encode('utf-8') | |
| def getBib(nodelist): | def getBib(nodelist): |
| """ translate bibliographical entries """ | """ translate bibliographical entries """ |