--- ECHO_content/ECHO_collection.py 2004/05/11 18:24:52 1.82 +++ ECHO_content/ECHO_collection.py 2004/05/12 15:41:55 1.83 @@ -385,7 +385,22 @@ class ECHO_resource(Folder): return self.viewClassification else: return "" - + + def getFullTextXML(self,noredirect=None): + """getFullTextXML""" + try: + fh=urllib.urlopen(self.metalink) + dom=xml.dom.minidom.parse(fh) + texttools=dom.getElementsByTagName('texttool') + text=texttools[0].getElementsByTagName('text') + texturl=getText(text[0].childNodes) + if not noredirect: + self.REQUEST.RESPONSE.redirect(texturl) + else: + return texturl + except: + return None + def getCredits(self): """Ausgabe der credits""" if self.credits: @@ -915,10 +930,13 @@ class ECHO_collection(Folder, Persistent """title""" return self.label.encode('utf-8') + + def createRessourcesFromXMLForm(self): """form""" pt=PageTemplateFile('Products/ECHO_content/zpt/createRessourcesFromXMLForm.zpt').__of__(self) return pt() + def createRessourcesFromXML(self,fileupload): """read an XML file for generating resources""" dom=xml.dom.minidom.parse(fileupload) @@ -1754,7 +1772,29 @@ class ECHO_root(Folder,Persistent,Implic 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""" + print ret + self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml") + self.REQUEST.RESPONSE.write(ret) def manage_addECHO_root(self,id,title,RESPONSE=None): """Add an ECHO_root"""