version 1.47.2.46, 2006/01/16 13:46:21
|
version 1.47.2.47, 2006/01/16 15:21:47
|
Line 1413 class MPIWGProject(CatalogAware,Folder):
|
Line 1413 class MPIWGProject(CatalogAware,Folder):
|
|
|
|
|
def copyImageToMargin(self,RESPONSE=None): |
def copyImageToMargin(self,RESPONSE=None): |
#TODO: copy more than one image |
|
"""copy inline images to marginal images""" |
"""copy inline images to marginal images""" |
self.getContent('WEB_project_description',filter='yes') |
|
|
|
filename=self.imageURL.split("/")[-1] |
|
|
#getImages from WEB_project_description |
|
description=self.getContent('WEB_project_description') |
|
|
|
text2=description |
|
splitted=text2.split("""<p class="picture">""") |
|
|
|
imageURLs=[] |
|
imageCaptions=[] |
|
for split in splitted[1:]: |
|
tmp=split.split("</p>") |
|
#return repr(splitted[1]) |
|
try: |
|
imageURLs.append(tmp[0].split("\"")[1].encode('utf-8')) |
|
except: |
|
imageURLs.append(tmp[0].split("src=")[1].split(" ")[0].encode('utf-8')) |
|
|
|
split2="</p>".join(tmp[1:]) |
|
|
|
|
|
splitted=split2.split("""<p class="picturetitle">""") |
|
if len(splitted)>1: |
|
tmp=splitted[1].split("</p>") |
|
imageCaptions.append(tmp[0].encode('utf-8')) |
|
|
|
|
|
else: |
|
#keine caption |
|
|
|
imageCaptions.append("") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#eintragen: |
|
for imageURL in imageURLs: |
|
filename=imageURL.split("/")[-1] |
#lege neues images object an, mit leerem bild |
#lege neues images object an, mit leerem bild |
|
|
if self.ZopeFind(self,obj_ids=[filename]): |
if self.ZopeFind(self,obj_ids=[filename]): |
#existiert das bild schon, dann neueun filenamen |
#existiert das bild schon, dann neuen filenamen |
filename="project_image_"+filename |
filename="project_image_"+filename |
|
|
self.addImage(None,self.imagecap,filename=filename) |
self.addImage(None,imageCaptions[imageURLs.index(imageURL)],filename=filename) |
#hole die bilddaten aus der url |
#hole die bilddaten aus der url |
url=self.absolute_url()+"/"+self.imageURL |
url=self.absolute_url()+"/"+imageURL |
#url=self.absolute_url()+"/"+filename |
#url=self.absolute_url()+"/"+filename |
|
|
try:#relative url |
try:#relative url |