--- MPIWGWeb/MPIWGProjects.py 2006/11/08 21:04:23 1.47.2.66 +++ MPIWGWeb/MPIWGProjects.py 2006/12/08 13:54:41 1.47.2.69 @@ -167,14 +167,11 @@ class MPIWGLink(SimpleItem): if RESPONSE is not None: RESPONSE.redirect('manage') - def index_html(self): + def index_html(self,**argv): """index""" - - try: - return self.getObj().pt_render(extra_context={'here':self}) - except: - self.REQUEST.RESPONSE.redirect(self.getObj().absolute_url()) - + + return self.getObj()(extra_context={'here':self},**argv) + def manage_addMPIWGLinkForm(self): """Form for adding link""" @@ -298,6 +295,7 @@ class MPIWGRoot(ZSQLExtendFolder): folders=['MPIWGProject','Folder','ECHO_Navigation'] meta_type='MPIWGRoot' + def harvestProjects(self): """harvest""" folder="/tmp" @@ -1718,10 +1716,15 @@ class MPIWGProject(CatalogAware,Folder): for split in splitted[1:]: tmp=split.split("

") #return repr(splitted[1]) + try: imageURLs.append(tmp[0].split("\"")[1].encode('utf-8')) except: + + try: imageURLs.append(tmp[0].split("src=")[1].split(" ")[0].encode('utf-8')) + except: + imageURLs.append("") split2="

".join(tmp[1:]) @@ -1863,17 +1866,27 @@ class MPIWGProject(CatalogAware,Folder): else: return getattr(publications[-1][1],'place',0) - def deletePublication(self,id,RESPONSE=None): - """delete Publication id""" - self.manage_delObjects([id]) - if RESPONSE: - RESPONSE.redirect('managePublications') - + def deletePublication(self,id,RESPONSE=Nedione): + """delete Publication id""" + self.manage_delObjects([id]) + if RESPONSE: + RESPONSE.redirect('managePublications') + def getImages(self): """get all Images""" + def sort_images(x,y): return cmp(getattr(x[1],'place',0),getattr(y[1],'place',0)) + + if (getattr(self,'imageURL','')!='') or (getattr(self,'imagecap','')!='') : + try: + self.addImage(None,getattr(self,'imagecap',''),RESPONSE=None,filename=getattr(self,'imageURL','')) + except: + pass + self.imageURL='' + self.imagecap='' + images=self.ZopeFind(self,obj_metatypes=['MPIWGProject_image']) images.sort(sort_images) @@ -1903,6 +1916,7 @@ class MPIWGProject(CatalogAware,Folder): return True else: return False + def addImage(self,fileHd,caption,RESPONSE=None,filename=None): """add an MPIWG_Project_image""" @@ -1920,7 +1934,8 @@ class MPIWGProject(CatalogAware,Folder): obj.caption=caption[0:] obj.enabled=True; obj.place=self.getLastImageNumber()+1 - + obj.id=filename + if RESPONSE is not None: RESPONSE.redirect('manageImages') @@ -2312,8 +2327,11 @@ class MPIWGProject(CatalogAware,Folder): try: self.imageURL=tmp[0].split("\"")[1].encode('utf-8') except: + try: self.imageURL=tmp[0].split("src=")[1].split(" ")[0].encode('utf-8') - + except: + self.imageURL="" + split2="

".join(tmp[1:]) text3=splitted[0]+split2 @@ -2342,6 +2360,9 @@ class MPIWGProject(CatalogAware,Folder): #filter image + text5=text5.lstrip().rstrip() #loescher leerzeichen und einzelndes br + if (text5=="
") or (text5=="
"): + text5="" return text5.encode('utf-8') @@ -2462,7 +2483,9 @@ class MPIWGProject(CatalogAware,Folder): setattr(self,x,[self.REQUEST[x].decode('utf-8')]) - self.en.changeHistoricalNames(self.getId(),self.REQUEST['historicalNames'].split("\n")) + + if self.REQUEST.has_key('historicalNames'): + self.en.changeHistoricalNames(self.getId(),self.REQUEST['historicalNames'].split("\n")) if self.REQUEST.has_key('active'): self.setActiveFlag(True)