--- OSAS/OSA_system/OSAS_Root.py 2004/05/08 21:09:11 1.8 +++ OSAS/OSA_system/OSAS_Root.py 2004/06/23 13:01:14 1.12 @@ -1,10 +1,54 @@ +from OFS.SimpleItem import SimpleItem from time import localtime,strftime from Acquisition import Implicit from OFS.Folder import Folder from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplate import PageTemplate import urllib +import re +class OSAS_ViewerObject(Folder): + """Beschreibung eines Viewers""" + meta_type="OSAS_ViewerObject" + + def __init__(self,id,title,prefix): + """init""" + self.id=id + self.title=title + self.prefix=prefix + + manage_options = Folder.manage_options+( + {'label':'Main Config','action':'changeViewerObjectForm'}, + ) + + def changeViewerObjectForm(self): + """Main configuration""" + pt=PageTemplateFile('Products/OSA_system/zpt/changeViewerObjectForm.zpt').__of__(self) + return pt() + + def changeViewerObject(self,title,prefix): + """Change RootFolderName""" + self.title=title + self.prefix=prefix + + + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + + +def manage_AddOSAS_ViewerObjectForm(self): + """interface for adding the viewer Object""" + pt=PageTemplateFile('Products/OSA_system/zpt/AddOSAS_ViewerObject.zpt').__of__(self) + return pt() + +def manage_AddOSAS_ViewerObject(self,id,title,prefix,RESPONSE=None): + """add the OSAS_root""" + newObj=OSAS_ViewerObject(id,title,prefix) + self._setObject(id,newObj) + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + + class OSAS_Root(Folder,Implicit): """Implicit Folder of the Storage Systems""" def __init__(self,id,RootFolderName,DigILibURL,uploadServletUrl): @@ -20,6 +64,12 @@ class OSAS_Root(Folder,Implicit): {'label':'Main Config','action':'Root_config'}, ) + def getImageViewers(self): + """images""" + viewers=self.ZopeFind(self.standardImageViewer,obj_metatypes=['OSAS_ViewerObject']) + return viewers + + def setDigILibURL(self): """set""" self.DigILibURL="" @@ -51,9 +101,18 @@ class OSAS_Root(Folder,Implicit): def downloadExternalXML(self,index_meta_url,xml_url): """lade xml file""" + xmlneu=urllib.urlopen(xml_url).read() - path=re.sub(self.REQUEST['SERVER_URL'],'',index_meta_url) - fh=file(path) + + path=re.sub(self.REQUEST['SERVER_URL'],'',index_meta_url) + path=re.sub('http://'+self.REQUEST['HTTP_HOST'],'',index_meta_url) + + path=re.sub('http://foxridge.mpiwg-berlin.mpg.de:8080','',path) # falls foxridge als server + path=re.sub('http://foxridge.mpiwg-berlin.mpg.de:8080','',path) # falls foxridge als server + path=re.sub('http://foxridge.mpiwg-berlin.mpg.de','',path) # falls foxridge als server + + + fh=open(path,'w') fh.write(xmlneu) fh.close() return "ok"