"""
+ """
- for partner in partners:
- ret+="""\n"""%(partner.getId(),unicode(partner.title,'utf-8','replace'))
+ for partner in partners:
+ ret+="""\n"""%(partner.getId(),partner.title)
return ret+"\n"
@@ -3007,106 +3629,121 @@ class ECHO_root(Folder,Persistent,Implic
return ret
def getResourcesHTML(self,viewerType=None,filter=None):
- """gebe all ressourcen aus"""
+ """gebe all ressourcen aus"""
+
+ def sortHTML(x,y):
+ return cmp(x[1].title,y[1].title)
+
+ ret="""Resources in ECHO"""
+
+ resources = self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1)
+ ret+="""Found %i resources
"""%len(resources)
+ resources.sort(sortHTML)
+ for resource in resources:
+ echo_url=resource[1].absolute_url()
+
+ if hasattr(resource[1],'title'):
+ title=resource[1].title
+ else:
+ title="None"
+ if filter:
+ if re.search(filter,title):
+ ret+="""\n
%s
"""%(echo_url,title)
+ else:
+ ret+="""\n%s
"""%(echo_url,title)
- def sortHTML(x,y):
- return cmp(x[1].title,y[1].title)
-
- ret="""Resources in ECHO"""
-
- resources = self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1)
- ret+="""Found %i resources
"""%len(resources)
- resources.sort(sortHTML)
- for resource in resources:
- echo_url=resource[1].absolute_url()
-
- if hasattr(resource[1],'title'):
- title=resource[1].title
- else:
- title="None"
- if filter:
- if re.search(filter,title):
- ret+="""\n
%s
"""%(echo_url,title)
- else:
- ret+="""\n%s
"""%(echo_url,title)
-
- ret +="""\n"""
-
- #self.REQUEST.RESPONSE.setHeader("Content-Type", "text/html")
- #self.REQUEST.RESPONSE.write(ret)
- return ret
+ ret +="""\n"""
+
+ #self.REQUEST.RESPONSE.setHeader("Content-Type", "text/html")
+ #self.REQUEST.RESPONSE.write(ret)
+ return ret
def getResourcesXML(self,viewerType=None,filter=None):
- """gebe all ressourcen aus"""
- ret="""
- """
- for resource in self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1):
-
- echo_url=resource[1].absolute_url()
- if hasattr(resource[1],'link'):
- viewer_url=resource[1].link
- else:
- viewer_url="NO URL"
- if filter:
- if re.search(filter,viewer_url):
- ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?'))
- else:
- ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?'))
- ret +="""\n"""
-
- self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml")
- self.REQUEST.RESPONSE.write(ret)
+ """gebe all ressourcen aus"""
+ ret="""
+ """
+ for resource in self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1):
+
+ echo_url=resource[1].absolute_url()
+ if hasattr(resource[1],'link'):
+ viewer_url=resource[1].link
+ else:
+ viewer_url="NO URL"
+ if filter:
+ if re.search(filter,viewer_url):
+ ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?'))
+ else:
+ ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?'))
+ ret +="""\n"""
+
+ self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml")
+ self.REQUEST.RESPONSE.write(ret)
def getFullTextsXML(self,viewerType=None,filter=None):
- """gebe all ressourcen aus"""
- ret="""
- """
- for resource in self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1):
-
- echo_url=resource[1].absolute_url()
- if resource[1].getFullTextXML(noredirect="yes"):
- if hasattr(resource[1],'link'):
- viewer_url=echo_url+"/getFullTextXML"
- else:
- viewer_url="NO URL"
- if filter:
- if re.search(filter,viewer_url):
- ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?'))
- else:
- ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?'))
- ret +="""\n"""
-
-
- self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml")
- self.REQUEST.RESPONSE.write(ret)
+ """gebe all ressourcen aus"""
+ ret="""
+ """
+ for resource in self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1):
+
+ echo_url=resource[1].absolute_url()
+ if resource[1].getFullTextXML(noredirect="yes"):
+ if hasattr(resource[1],'link'):
+ viewer_url=echo_url+"/getFullTextXML"
+ else:
+ viewer_url="NO URL"
+ if filter:
+ if re.search(filter,viewer_url):
+ ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?'))
+ else:
+ ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?'))
+ ret +="""\n"""
+
+
+ self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml")
+ self.REQUEST.RESPONSE.write(ret)
def getMetaDatasXML(self,viewerType=None,filter=None):
- """gebe all ressourcen aus"""
- ret="""
- """
- for resource in self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1):
-
- echo_url=resource[1].absolute_url()
-
- if hasattr(resource[1],'link'):
- meta_url=echo_url+"/getMetaDataXML"
- else:
- meta_url="NO_URL"
-
- if filter and not re.search(filter,viewer_url):
- continue
-
- ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(meta_url,safe='/:?'))
-
- ret +="""\n"""
-
-
- self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml")
- self.REQUEST.RESPONSE.write(ret)
+ """gebe all ressourcen aus"""
+ # check if the request's host part was OK
+ http_host = self.REQUEST['HTTP_HOST']
+ host_port = self.REQUEST['SERVER_PORT']
+ fix_host = None
+ if http_host and http_host.rfind(host_port) == -1:
+ print "HTTP_HOST needs fixing!"
+ fix_host = http_host + ":" + host_port
+
+ ret="""
+ """
+ for resource in self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1):
+
+ echo_url=resource[1].absolute_url()
+ if fix_host:
+ #print "replacing ", http_host, " by ", fix_host
+ echo_url = string.replace(echo_url, http_host, fix_host, 1)
+
+ if hasattr(resource[1],'link'):
+ meta_url=echo_url+"/getMetaDataXML"
+ else:
+ meta_url="NO_URL"
+
+ if filter and not re.search(filter,viewer_url):
+ continue
+
+ #modificationDate=time.strptime(str(resource[1].bobobase_modification_time()),"%Y/%m/%d %H:%M:%S %Z")
+
+ modificationDate=resource[1].bobobase_modification_time().strftime("%Y/%m/%d %H:%M:%S")
-
- def findPartners(self):
+ ret+="""\n"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(meta_url,safe='/:?'),modificationDate)
+
+
+ ret +="""\n"""
+
+ self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml")
+ self.REQUEST.RESPONSE.write(ret)
+
+
+ def findPartners(self):
"""find all partners in partners"""
par=self.ZopeFind(self.partners, obj_metatypes='ECHO_partner')
return par
@@ -3121,9 +3758,52 @@ class ECHO_root(Folder,Persistent,Implic
""" find partners from ID"""
par=self.ZopeFind(self.partners, obj_ids=[id])
return par
-
-
+ def getInstitutionFromID(self,id):
+ """ find institution from id """
+ inst=self.ZopeFind(self.institutions, obj_ids=[id])
+ return inst
+
+ def updateResourceCatalog(self,REQUEST,RESPONSE):
+ """update ressource catalog"""
+ catalog=getattr(self,'resourceCatalog',None)
+ if not catalog:
+ return """No resourceCatalog available
"""
+
+ else:
+ class element:
+ def __init__(self,group,name):
+ self.group=group
+ self.name=name
+ catalog.manage_delObjects('author splitter')
+ #elements=[element('Stop Words',""" Don't remove stop words' """),element('Word Splitter','ECHO author splitter')]
+ elements=[element('Word Splitter','ECHO author splitter')]
+ manage_addLexicon(catalog,id="author splitter",elements=elements)
+
+ return catalog.manage_catalogReindex(REQUEST,RESPONSE,'manage_main')
+
+
+ def checkMetaDataLinks(self,correct=None):
+ """check all metadatalinks and if correct is set change the servername to content.mpiwg-berlin.mpg.de"""
+
+ self.REQUEST.RESPONSE.write("")
+ for resource in self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1):
+ metalink=resource[1].metalink
+
+ try:
+ url=urllib.urlopen(metalink)
+ except:
+
+ self.REQUEST.RESPONSE.write("ERROR (opening %s):"%resource[1].absolute_url() +" -- %s %s
"%sys.exc_info()[0:2])
+ self.REQUEST.RESPONSE.write("-----------%s"%metalink)
+
+ if correct:
+ urlparsed=[x for x in urlparse.urlparse(metalink)]
+ urlparsed[1]="content.mpiwg-berlin.mpg.de"
+ neu=urlparse.urlunparse(urlparsed)
+ resource[1].metalink=neu[0:]
+ self.REQUEST.RESPONSE.write("----------changed to:%s)"%neu)
+
def manage_addECHO_root(self,id,title,RESPONSE=None):
"""Add an ECHO_root"""
self._setObject(id,ECHO_root(id,title))
@@ -3133,43 +3813,43 @@ def manage_addECHO_root(self,id,title,RE
def manage_addECHO_rootForm(self):
"""Nothing yet"""
- pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_root.zpt').__of__(self)
+ pt=zptFile(self, 'zpt/AddECHO_root.zpt')
return pt()
-class ECHO_copyrightType(Folder):
- """copyright typ"""
+class ECHO_copyrightType(Folder,ECHO_basis):
+ """copyright typ"""
- meta_type="ECHO_copyrightType"
-
- def __init__(self,id,title,label,url):
- """init"""
- self.id=id
- self.title=title
- self.label=label
- self.url=url
+ meta_type="ECHO_copyrightType"
+
+ def __init__(self,id,title,label,url):
+ """init"""
+ self.id=id
+ self.title=title
+ self.label=label
+ self.url=url
- manage_options = Folder.manage_options+(
+ manage_options = Folder.manage_options+(
{'label':'Main Config','action':'ECHO_copyrightType_config_mainForm'},
- )
+ )
- def ECHO_copyrightType_config_mainForm(self):
- """change form"""
- pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_copyrightType').__of__(self)
- pt.content_type="text/html"
- return pt()
-
- def ECHO_copyrightType_config_main(self,title,label,url,RESPONSE=None):
- """change"""
- self.title=title
- self.label=label
- self.url=url
+ def ECHO_copyrightType_config_mainForm(self):
+ """change form"""
+ pt=zptFile(self, 'zpt/ChangeECHO_copyrightType')
+ pt.content_type="text/html"
+ return pt()
+
+ def ECHO_copyrightType_config_main(self,title,label,url,RESPONSE=None):
+ """change"""
+ self.title=title
+ self.label=label
+ self.url=url
- if RESPONSE is not None:
- RESPONSE.redirect('manage_main')
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
def manage_addECHO_copyrightTypeForm(self):
"""Form for adding a ressource"""
- pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_copyrightTypeForm.zpt').__of__(self)
+ pt=zptFile(self, 'zpt/AddECHO_copyrightTypeForm.zpt')
return pt()
@@ -3185,62 +3865,320 @@ def manage_addECHO_copyrightType(self,id
-class ECHO_partner(Image,Persistent):
- """ECHO Partner"""
- meta_type="ECHO_partner"
+class ECHO_linkList(ZopePageTemplate,ECHO_basis):
+ """LinkList Objekt"""
+ meta_type="ECHO_linkList"
- def __init__(self, id, title,url, file, copyrightType, person, email, country, color, content_type='', precondition=''):
+ _default_content_fn = os.path.join(package_home(globals()), 'html/ECHO_pageTemplateDefault.html')
+
+ manage_options = ZopePageTemplate.manage_options+(
+ {'label':'Main Config','action':'changeECHO_linkListWeightForm'},
+ )
+
+ def content_html(self):
+ """content_html"""
+ return ECHO_basis.content_html(self,'pageTemplate')
+
+ def changeECHO_linkListWeightForm(self):
+ """change"""
+ pt=zptFile(self, 'zpt/ChangeECHO_linkListTemplate.zpt')
+ return pt()
+
+ def changeECHO_linkListWeight(self,contentType,label,RESPONSE=None):
+ """change"""
+ self.contentType=contentType
+ self.label=label
+
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
+
+ def getLabel(self):
+ if hasattr(self,'label'):
+ return self.label.encode('utf-8')
+ else:
+ return 0
+
+ def getcontentType(self):
+ """get contentType"""
+ if hasattr(self,'contentType'):
+ return self.contentType
+ else:
+ return 0
+
+ def __init__(self, id, label, title=None, text=None, contentType=None):
+ self.id = str(id)
+ self.title=title
+ self.label=label
+ self.ZBindings_edit(self._default_bindings)
+ if text is None:
+ text = ''
+ self.pt_edit(text, contentType)
+
+
+
+
+def manage_addECHO_linkListForm(self):
+ """Form for adding"""
+ pt=zptFile(self, 'zpt/AddECHO_linkListTemplate.zpt')
+ return pt()
+
+
+def manage_addECHO_linkList(self, id, label,contentType=0,title=None, text=None,
+ REQUEST=None, submit=None):
+ """Add a LinkList with optional file content."""
+
+ id = str(id)
+ if REQUEST is None:
+ self._setObject(id, ECHO_linkList(id, label, text))
+ ob = getattr(self, id)
+ setattr(ob,'contentType',contentType)
+ if title:
+ ob.pt_setTitle(title)
+ return ob
+ else:
+ file = REQUEST.form.get('file')
+ headers = getattr(file, 'headers', None)
+ if (headers is None) or (not file.filename):
+ zpt = ECHO_linkList(id, file)
+ else:
+ zpt = ECHO_linkList(id, label,'', file, headers.get('contentType'))
+
+ self._setObject(id, zpt)
+ ob = getattr(self, id)
+ if title:
+ ob.pt_setTitle(title)
+
+ try:
+ u = self.DestinationURL()
+ except AttributeError:
+ u = REQUEST['URL1']
+
+ if submit == " Add and Edit ":
+ u = "%s/%s" % (u, urllib.quote(id))
+ REQUEST.RESPONSE.redirect(u+'/manage_main')
+ return ''
+
+
+class ECHO_support(Folder,ECHO_basis):
+ """gefoerdert durch"""
+ meta_type="ECHO_support"
+
+
+
+ def __init__(self,id,institutions=None):
+ """init"""
+ self.id=id
+ self.title=''
+ self.institutions=toList(institutions)
+
+ def getSupporter(self):
+ """return institutions"""
+ if self.institutions:
+ return self.institutions
+ else:
+ return []
+
+ manage_options = Folder.manage_options+(
+ {'label':'Main Config','action':'ECHO_support_configForm'},
+ )
+
+ def ECHO_support_configForm(self):
+ """change form"""
+ pt=zptFile(self, 'zpt/ChangeECHO_support')
+ pt.content_type="text/html"
+ return pt()
+
+ def ECHO_support_config(self,institutions=None,RESPONSE=None):
+ """change"""
+ self.institutions=toList(institutions)
+
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
+
+
+def manage_addECHO_supportForm(self):
+ """Form for adding"""
+ pt=zptFile(self, 'zpt/AddECHO_support.zpt')
+ return pt()
+
+def manage_addECHO_support(self, id,institutions=None,RESPONSE=None):
+ """add the copyright"""
+
+ meta_type="ECHO_support"
+
+
+ self._setObject(id, ECHO_support(id,institutions))
+
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
+
+# ECHO - owner of original
+class ECHO_ownerOriginal(Folder,ECHO_basis):
+ """besitzer des originals"""
+ meta_type="ECHO_ownerOriginal"
+ security=ClassSecurityInfo()
+
+
+ def __init__(self,id,institutions=None):
+ """init"""
+ self.id=id
+ self.title=''
+ self.institutions=toList(institutions)
+
+ security.declarePublic('getOwner')
+ def getOwner(self):
+ """return institutions"""
+ if self.institutions:
+ return self.institutions
+ else:
+ return []
+
+ manage_options = Folder.manage_options+(
+ {'label':'Main Config','action':'ECHO_ownerOriginal_configForm'},
+ )
+
+ def ECHO_ownerOriginal_configForm(self):
+ """change form"""
+ pt=zptFile(self, 'zpt/ChangeECHO_ownerOriginal')
+ pt.content_type="text/html"
+ return pt()
+
+ def ECHO_ownerOriginal_config(self,institutions=None,RESPONSE=None):
+ """change"""
+ self.institutions=toList(institutions)
+
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
+
+
+def manage_addECHO_ownerOriginalForm(self):
+ """Form for adding"""
+ pt=zptFile(self, 'zpt/AddECHO_ownerOriginal.zpt')
+ return pt()
+
+def manage_addECHO_ownerOriginal(self, id,institutions=None,RESPONSE=None):
+ """add the copyright"""
+
+ meta_type="ECHO_ownerOriginal"
+
+
+ self._setObject(id, ECHO_ownerOriginal(id,institutions))
+
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
+
+# --------------------------------------------------------------------------------
+
+# ECHO - digitized copy by
+class ECHO_digiCopyBy(Folder,ECHO_basis):
+ """besitzer des originals"""
+ meta_type="ECHO_digiCopyBy"
+ security=ClassSecurityInfo()
+
+
+ def __init__(self,id,institutions=None):
+ """init"""
+ self.id=id
+ self.title=''
+ self.institutions=toList(institutions)
+
+ security.declarePublic('getDigiCopyBy')
+ def getDigiCopyBy(self):
+ """return institutions"""
+ if self.institutions:
+ return self.institutions
+ else:
+ return []
+
+ manage_options = Folder.manage_options+(
+ {'label':'Main Config','action':'ECHO_digiCopyBy_configForm'},
+ )
+
+ def ECHO_digiCopyBy_configForm(self):
+ """change form"""
+ pt=zptFile(self, 'zpt/ChangeECHO_digiCopyBy')
+ pt.content_type="text/html"
+ return pt()
+
+ def ECHO_digiCopyBy_config(self,institutions=None,RESPONSE=None):
+ """change"""
+ self.institutions=toList(institutions)
+
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
+
+
+def manage_addECHO_digiCopyByForm(self):
+ """Form for adding"""
+ pt=zptFile(self, 'zpt/AddECHO_digiCopyBy.zpt')
+ return pt()
+
+def manage_addECHO_digiCopyBy(self, id,institutions=None,RESPONSE=None):
+ """add the copyright"""
+
+ meta_type="ECHO_digiCopyBy"
+
+
+ self._setObject(id, ECHO_digiCopyBy(id,institutions))
+
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')
+
+# --------------------------------------------------------------------------------
+
+class ECHO_institution(Image,Persistent,ECHO_basis):
+ """ECHO Institution"""
+
+ meta_type="ECHO_institution"
+
+ def __init__(self, id, title,url, file, person, email, country, content_type='', precondition=''):
self.__name__=id
self.title=title
self.url=url
self.person=person
self.email=email
self.country=country
- self.color=color
self.precondition=precondition
- self.copyrightType=copyrightType
data, size = self._read_data(file)
content_type=self._get_content_type(file, data, id, content_type)
self.update_data(data, content_type, size)
manage_options = Image.manage_options+(
- {'label':'Partner Information','action':'ECHO_partner_config'},
+ {'label':'Institution Information','action':'ECHO_institution_config'},
)
- def changeECHO_partner(self,url,copyrightType,person, email, country, color, RESPONSE=None):
+ def changeECHO_institution(self,url,person, email, country,RESPONSE=None):
"""Change main information"""
self.url=url
self.person=person
self.email=email
self.country=country
- self.color=color
- self.copyrightType=copyrightType
if RESPONSE is not None:
RESPONSE.redirect('manage_main')
- def ECHO_partner_config(self):
+ def ECHO_institution_config(self):
"""Main configuration"""
if not hasattr(self,'url'):
self.url=""
- pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_partner.zpt').__of__(self)
+ pt=zptFile(self, 'zpt/ChangeECHO_institution.zpt')
return pt()
-manage_addECHO_partnerForm=DTMLFile('dtml/ECHO_partnerAdd',globals(),
- Kind='ECHO_partner',kind='ECHO_partner')
+manage_addECHO_institutionForm=DTMLFile('dtml/ECHO_institutionAdd',globals(),
+ Kind='ECHO_institution',kind='ECHO_institution')
-def manage_addECHO_partner(self, id, url, person, email, country, color, file=None, copyrightType='', title='', precondition='', content_type='',
+def manage_addECHO_institution(self, id, url, person, email, country, file=None, title='', precondition='', content_type='',
REQUEST=None):
"""
- Add a new ECHO_partner object.
+ Add a new ECHO_institution object.
- Creates a new ECHO_partner object 'id' with the contents of 'file'.
+ Creates a new ECHO_institution object 'id' with the contents of 'file'.
Based on Image.manage_addImage
"""
@@ -3254,7 +4192,7 @@ def manage_addECHO_partner(self, id, url
self=self.this()
# First, we create the image without data:
- self._setObject(id, ECHO_partner(id,title,url,'',copyrightType, person, email, country, color, content_type, precondition))
+ self._setObject(id, ECHO_institution(id,title,url,'', person, email, country, content_type, precondition))
# Now we "upload" the data. By doing this in two steps, we
# can use a database trick to make the upload more efficient.
@@ -3269,4 +4207,87 @@ def manage_addECHO_partner(self, id, url
REQUEST.RESPONSE.redirect('%s/manage_main' % url)
return id
+def repairCoords(self):
+ """updates map coordinates to new MapArea objects"""
+ msg = ""
+ for cols in self.ZopeFind(self, obj_metatypes=['ECHO_collection','ECHO_resource'], search_sub=1):
+ col = cols[1]
+ if not hasattr(col, 'coords'):
+ continue
+ print "fixing: ", col.id
+ msg += "fixing: "+col.id+"\n"
+ coords = col.coords
+ if len(coords) > 0:
+ # delete old MapAreas
+ for areas in self.ZopeFind(col, obj_metatypes=['MapArea']):
+ #area = areas[1]
+ id = areas[0]
+ print " deleting: ", id
+ msg += " deleting: "+id+"\n"
+ col._delObject(id)
+ # add new MapAreas
+ areacnt = 0
+ for coord in coords:
+ if len(coord) < 4:
+ continue
+ type = col.viewClassification
+ if type == 'view point':
+ type = 'arrow'
+ if type is None:
+ if len(coord) > 4:
+ type = 'arrow'
+ else:
+ type = 'area'
+ newid = "a%02d"%areacnt
+ areacnt += 1
+ area = MapArea(newid, coord, type=type)
+ print " adding: ", newid
+ msg += " adding: "+newid+"\n"
+ col.addMapArea(area)
+ msg += "\nDone!"
+ return msg
+
+from ECHO_Nav import ECHO_navigation
+
+class ECHO_main(ECHO_root,ECHO_navigation):
+ """echo main object combines ECHO_root and ECHO_navigation"""
+
+ meta_type="ECHO_main"
+
+ def __init__(self,id,title):
+ """init"""
+ self.id=id
+ self.title=title
+ self.pathToHierarchy="/"+self.id # hierarchie always starts with the object.
+ self.displayedMetaTypes=displayTypes
+
+
+ manage_options = Folder.manage_options+(
+ {'label':'Main Config','action':'ECHO_navigationConfigForm'},
+ {'label':'Cache','action':'ECHO_cacheManageForm'},
+ {'label':'Main Config','action':'ECHO_copyright_configForm'},
+ {'label':'Reload Metadata','action':'reloadMetaDataFromStorageWarning'},
+ {'label':'Change Weights','action':'changeWeights'},
+ {'label':'Generate from RDF','action':'generateFromRDFForm'},
+ {'label':'update Resource Catalog','action':'updateResourceCatalog'},
+ {'label':'Copy MD for indexing and search','action':'copySearchFields'},
+ )
+
+
+def manage_addECHO_mainForm(self):
+ """Form for adding"""
+ pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','AddECHO_main.zpt')).__of__(self)
+ return pt()
+def manage_addECHO_main(self,id,title,RESPONSE=None):
+ """Add an ECHO_main"""
+ self._setObject(id,ECHO_main(id,title))
+
+ obj=self._getOb(id)
+ text=file(os.path.join(package_home(globals()),'zpt','main_template')).read()
+
+ manage_addPageTemplate(obj,'main_template',text=text)
+
+
+ if RESPONSE is not None:
+ RESPONSE.redirect('manage_main')