Get Page: %i
\n"%i))
+ faktor=dpi/72.0
+
+ fn=tmpPath+"/%i"%i
+
+ width,height=A4
+ #print image%(width*faktor,height*faktor,i)
+ url=urllib.urlopen(image%(width*faktor,height*faktor,i)).read()
+ fh=file(fn,"w")
+ fh.write(url)
+ fh.close()
+
+
+
+ c.drawImage(fn,0,0,width=width,height=height)
+ c.showPage()
+ c.save()
+ if RESPONSE:
+ RESPONSE.write("
finished
\n")
+
+ if RESPONSE:
+ len=os.stat(tmpZip)[6]
+ downloadUrl=self.absolute_url()+"/downloadPDF"
+ RESPONSE.write("""
The file will be stored for a while, you can download it later, the URL is:
+%s?fn=%s\n"""%(tmpFn,downloadUrl,tmpFn)) + RESPONSE.close() + + + def downloadPDF(self,fn): + """download prepared set""" + filename="/tmp/archivesImageServer/"+fn + namePDF=self.getId()+".pdf" + self.REQUEST.RESPONSE.setHeader("Content-Disposition","""attachement; filename="%s" """%namePDF) + self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream") + len=os.stat(filename)[6] + self.REQUEST.RESPONSE.setHeader("Content-Length",len) + images=file(filename).read() + self.REQUEST.RESPONSE.write(images) + self.REQUEST.RESPONSE.close() - ret+="""
"+label+"
" manage_addECHO_resource(self,id,label.encode('ascii'),label.encode('ascii'),"","","",link.encode('ascii'),"","") return ret - + + security.declarePublic('getImageTag') def getImageTag(self): """GetTag""" try: @@ -1901,6 +1775,20 @@ class ECHO_collection(Folder, Persistent except: return "" + + def addMovie(self,id,title,label,description,contentType,responsible,link,thumbUrl,rawFile,metalink,weight,credits=None,coords=None,RESPONSE=None): + """SSS""" + print "we are here" + if hasattr(self,id): + try: + manage_addECHO_movie(self,id,title,label,description,responsible,link,thumbUrl,rawFile,metalink,weight,credits=None,coords=None,RESPONSE=None) + return "done" + except: + return None + else: + obj=getattr(self,id) + obj.changeECHO_movie_main(metalink,link,rawFile,thumbUrl,title,label,description,contentType,weight=weight) + def addResource(self,id,title,label,description,contentType,responsible,link,metalink,weight,credits=None,coords=None,RESPONSE=None): """SSS""" try: @@ -1923,130 +1811,38 @@ class ECHO_collection(Folder, Persistent except: return "" - def getCollectionTreeXML(self): + def getCollectionTreeXML(self,pwstr=None): """Tree as XML""" - def addPassWd(str): + def addPassWd(str,pwstr=None): """adds a user/passwd to an url""" - txt2=re.sub(r"(http://)(.*?)","\g<1>www:3333@\g<2>",str) + if pwstr: + txt2=re.sub(r"(http://)(.*?)","\g<1>%s@\g<2>"%pwstr,str) + else: + txt2=re.sub(r"(http://)(.*?)","\g<1>www:3333@\g<2>",str) return txt2 - def getCollection(object,depth=0): + def getCollection(object,depth=0,pwstr=None): depth+=1 collections="" for entry in object.__dict__.keys(): element=getattr(object,entry) try: if element.meta_type in ["ECHO_collection","ECHO_group"]: - collections+="