version 1.10, 2004/06/22 06:39:04
|
version 1.20, 2006/02/14 17:42:37
|
Line 1
|
Line 1
|
|
from OFS.SimpleItem import SimpleItem |
from time import localtime,strftime |
from time import localtime,strftime |
from Acquisition import Implicit |
from Acquisition import Implicit |
from OFS.Folder import Folder |
from OFS.Folder import Folder |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.PageTemplate import PageTemplate |
import urllib |
import urllib |
|
import sys |
|
import zLOG |
import re |
import re |
|
import xml.dom.minidom |
|
import os.path |
|
from Globals import package_home |
|
|
|
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(os.path.join(package_home(globals()),'zpt','changeViewerObjectForm.zpt')).__of__(self) |
|
return pt() |
|
|
|
def changeViewerObject(self,title,prefix,RESPONSE=None): |
|
"""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(os.path.join(package_home(globals()),'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): |
class OSAS_Root(Folder,Implicit): |
"""Implicit Folder of the Storage Systems""" |
"""Implicit Folder of the Storage Systems""" |
Line 21 class OSAS_Root(Folder,Implicit):
|
Line 69 class OSAS_Root(Folder,Implicit):
|
{'label':'Main Config','action':'Root_config'}, |
{'label':'Main Config','action':'Root_config'}, |
) |
) |
|
|
|
|
|
|
def setDigILibURL(self): |
def setDigILibURL(self): |
"""set""" |
"""set""" |
self.DigILibURL="" |
self.DigILibURL="" |
|
|
def Root_config(self): |
def Root_config(self): |
"""Main configuration""" |
"""Main configuration""" |
pt=PageTemplateFile('Products/OSA_system/zpt/ConfigOSAS_Root.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','ConfigOSAS_Root.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
def change_OSAS_Root(self,RootFolderName,DigILibURL,uploadServletUrl,RESPONSE=None): |
def change_OSAS_Root(self,RootFolderName,DigILibURL,uploadServletUrl,RESPONSE=None): |
Line 52 class OSAS_Root(Folder,Implicit):
|
Line 102 class OSAS_Root(Folder,Implicit):
|
|
|
def downloadExternalXML(self,index_meta_url,xml_url): |
def downloadExternalXML(self,index_meta_url,xml_url): |
"""lade xml file""" |
"""lade xml file""" |
|
#print "GI" |
|
#print xml_url |
|
try: |
xmlneu=urllib.urlopen(xml_url).read() |
xmlneu=urllib.urlopen(xml_url).read() |
|
except: |
|
zLOG.LOG("OSASRoot (downloadExternalXML)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2]) |
|
zLOG.LOG("OSASRoot (downloadExternalXML)", zLOG.INFO,xml_url) |
|
return "error" |
|
try: |
|
dom=xml.dom.minidom.parseString(xmlneu) |
|
except: |
|
print "Error" |
|
return repr(xml_url) |
|
return "error" |
|
|
path=re.sub(self.REQUEST['SERVER_URL'],'',index_meta_url) |
path=re.sub(self.REQUEST['SERVER_URL'],'',index_meta_url) |
path=re.sub('http://foxridge.mpiwg-berlin.mpg.de:8080','',path) # falls foxridge als server |
path=re.sub('http://'+self.REQUEST['HTTP_HOST'],'',index_meta_url) |
path=re.sub('http://foxridge.mpiwg-berlin.mpg.de','',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.rz-berlin.mpg.de:8080','',path) # falls foxridge als server |
|
path=re.sub('http://foxridge.rz-berlin.mpg.de','',path) # falls foxridge als server |
|
|
|
path=re.sub('http://foxridge.mpiwg-berlin.mpg.de','',path) # falls foxridge als server |
|
path=re.sub('http://content.mpiwg-berlin.mpg.de','',path) # falls content als server |
|
path=re.sub('http://vision.mpiwg-berlin.mpg.de','',path) # falls vision als server |
|
path=re.sub('http://echo.mpiwg-berlin.mpg.de','',path) # falls echo |
|
# path=re.sub('//','/',path) # falls echo |
fh=open(path,'w') |
fh=open(path,'w') |
|
zLOG.LOG("OSAS",zLOG.INFO,path) |
fh.write(xmlneu) |
fh.write(xmlneu) |
fh.close() |
fh.close() |
return "ok" |
return "ok" |
|
|
|
|
def manage_AddOSAS_RootForm(self): |
def manage_AddOSAS_RootForm(self): |
"""interface for adding the OSAS_root""" |
"""interface for adding the OSAS_root""" |
pt=PageTemplateFile('Products/OSA_system/zpt/AddOSAS_Root.zpt').__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','AddOSAS_Root.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
def manage_AddOSAS_Root(self,id,RootFolderName,DigILibURL,uploadServletUrl,RESPONSE=None): |
def manage_AddOSAS_Root(self,id,RootFolderName,DigILibURL,uploadServletUrl,RESPONSE=None): |