version 1.183, 2004/10/27 14:53:00
|
version 1.184, 2004/10/27 15:58:15
|
Line 1011 class ECHO_resource(Folder,Persistent):
|
Line 1011 class ECHO_resource(Folder,Persistent):
|
def createImageUrl(self,pn=1): |
def createImageUrl(self,pn=1): |
"""create ImageUrl""" |
"""create ImageUrl""" |
|
|
|
|
resourcepath=readFieldFromXML(self.metalink,'resource','archive-path').replace('/mpiwg/online','') |
resourcepath=readFieldFromXML(self.metalink,'resource','archive-path').replace('/mpiwg/online','') |
|
|
digiliburlprefix=readFieldFromXML(self.metalink,'texttool','digiliburlprefix') |
digiliburlprefix=readFieldFromXML(self.metalink,'texttool','digiliburlprefix') |
images=readFieldFromXML(self.metalink,'texttool','image') |
images=readFieldFromXML(self.metalink,'texttool','image') |
|
|
|
|
|
if (not resourcepath) or (not digiliburlprefix) or (not images): |
|
zLOG.LOG("ECHO (createImageUrl)",zLOG.ERROR,"Cannot create ImageUrl for %s"%self.absolute_url()) |
|
return None |
|
|
if not digiliburlprefix: digiliburlprefix="http://echo.mpiwg-berlin.mpg.de/zogilib?" |
if not digiliburlprefix: digiliburlprefix="http://echo.mpiwg-berlin.mpg.de/zogilib?" |
|
|
if (not images) or (not resourcepath): return None |
if (not images) or (not resourcepath): return None |
Line 1028 class ECHO_resource(Folder,Persistent):
|
Line 1034 class ECHO_resource(Folder,Persistent):
|
resourcepath=readFieldFromXML(self.metalink,'resource','archive-path') |
resourcepath=readFieldFromXML(self.metalink,'resource','archive-path') |
if (not presentationXML) or (not resourcepath): |
if (not presentationXML) or (not resourcepath): |
if RESPONSE: |
if RESPONSE: |
RESPONSE.write("Error: %s"%self.getId()) |
RESPONSE.write("Error: %s\n"%self.getId()) |
else: |
else: |
return None,self.getId() |
return None,self.absolute_url() |
|
|
print os.path.join(resourcepath,presentationXML) |
try: |
fh=file(os.path.join(resourcepath,presentationXML),'w') |
fh=file(os.path.join(resourcepath,presentationXML),'w') |
fh.write("""<info> |
fh.write("""<info> |
<author></author> |
<author></author> |
Line 1042 class ECHO_resource(Folder,Persistent):
|
Line 1048 class ECHO_resource(Folder,Persistent):
|
</info>"""%self.title) |
</info>"""%self.title) |
fh.close() |
fh.close() |
return 1,self.getId() |
return 1,self.getId() |
|
except: |
|
if RESPONSE: |
|
RESPONSE.write("Error: %s\n"%self.getId()) |
|
else: |
|
return None,self.absolute_url() |
|
|
|
|
def setStartPage(self,startpage=None,RESPONSE=None): |
def setStartPage(self,startpage=None,RESPONSE=None): |
"""set start page, if no startpage defined use the generic one of the resource""" |
"""set start page, if no startpage defined use the generic one of the resource""" |
Line 1183 class ECHO_resource(Folder,Persistent):
|
Line 1195 class ECHO_resource(Folder,Persistent):
|
"""getFullTextXML; gives the FullText as an XML Document, and <error></error> if somthing goes wrong.""" |
"""getFullTextXML; gives the FullText as an XML Document, and <error></error> if somthing goes wrong.""" |
|
|
try: |
try: |
zLOG.LOG("ECHO Fulltext",zLOG.INFO,"open %s"%self.metalink) |
#zLOG.LOG("ECHO Fulltext",zLOG.INFO,"open %s"%self.metalink) |
fh=ECHO_helpers.urlopen(self.metalink) |
fh=ECHO_helpers.urlopen(self.metalink) |
zLOG.LOG("ECHO Fulltext",zLOG.INFO,"opened %s"%self.metalink) |
#zLOG.LOG("ECHO Fulltext",zLOG.INFO,"opened %s"%self.metalink) |
dom=xml.dom.minidom.parse(fh) |
dom=xml.dom.minidom.parse(fh) |
texttools=dom.getElementsByTagName('texttool') |
texttools=dom.getElementsByTagName('texttool') |
text=texttools[0].getElementsByTagName('text') |
text=texttools[0].getElementsByTagName('text') |
texturl=getText(text[0].childNodes) |
texturl=getText(text[0].childNodes) |
|
|
zLOG.LOG("ECHO Fulltext",zLOG.INFO,"found %s"%texturl) |
#zLOG.LOG("ECHO Fulltext",zLOG.INFO,"found %s"%texturl) |
fh.close() |
fh.close() |
zLOG.LOG("ECHO Fulltext",zLOG.INFO,"closed fh") |
#zLOG.LOG("ECHO Fulltext",zLOG.INFO,"closed fh") |
#keine url |
#keine url |
if not (texturl.split(":")[0] in ['http','ftp','file']): |
if not (texturl.split(":")[0] in ['http','ftp','file']): |
if not noredirect: |
if not noredirect: |
Line 2224 class ECHO_collection(Folder, Persistent
|
Line 2236 class ECHO_collection(Folder, Persistent
|
author and date werden leer!!! |
author and date werden leer!!! |
""" |
""" |
|
|
resources=self.ZopeFind(self,obj_metatypes=['ECHO_resource','ECHO_collection']) |
|
|
resources=self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1) |
|
|
|
|
for resource in resources: |
for resource in resources: |
if resource[1].meta_type=="ECHO_collection": |
|
|
|
resource[1].copyTitleToInfoXMLFolder(RESPONSE) |
|
else: |
|
ret,txt=resource[1].copyTitleToInfoXML() |
ret,txt=resource[1].copyTitleToInfoXML() |
if (not ret) and RESPONSE: |
if (not ret) and RESPONSE: |
RESPONSE.write("error: %s\n"%txt) |
RESPONSE.write("error: %s\n"%txt) |
if ret and RESPONSE: |
if ret and RESPONSE: |
RESPONSE.write("ok: %s\n"%txt) |
RESPONSE.write("ok: %s\n"%txt) |
|
|
zLOG.LOG("ECHO",zLOG.INFO,txt) |
#zLOG.LOG("ECHO (copyTitleToInfoXMLFolder)",zLOG.INFO,txt) |
if RESPONSE is not None: |
if RESPONSE is not None: |
|
RESPONSE.write("done!\n") |
|
RESPONSE.close() |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
def copySearchFields(self,RESPONSE=None): |
def copySearchFields(self,RESPONSE=None): |