--- MPIWGWeb/MPIWGProjects.py 2004/09/01 09:35:12 1.24 +++ MPIWGWeb/MPIWGProjects.py 2004/09/30 20:00:40 1.31 @@ -72,6 +72,13 @@ class MPIWGRoot(ZSQLExtendFolder): folders=['MPIWGProject','Folder'] meta_type='MPIWGRoot' + def patchProjects(self,RESPONSE): + """patch""" + projects=self.ZopeFind(self.projects,obj_metatypes=['MPIWGProject']) + for project in projects: + project[1].WEB_project_description[0]=project[1].WEB_project_description[0].replace("/CD/projects/einstein/","") + RESPONSE.write("

%s

\n"%project[0]) + def replaceNotEmpty(self,format,field): """replace not empty""" if field and (not field==''): @@ -79,7 +86,13 @@ class MPIWGRoot(ZSQLExtendFolder): else: return "" + + def redirectIndex_html(self,request): + #return request['URL1']+'/index_html' + return urllib.urlopen(request['URL1']+'/index_html').read() + + def formatBibliography(self,here,found): """format""" return formatBibliography(here,found) @@ -362,14 +375,14 @@ class MPIWGRoot(ZSQLExtendFolder): splitted=line.split(",") - print splitted + # print splitted if not (splitted[0]==""): newObj=MPIWGStaff.MPIWGStaff(splitted[0],splitted[1],splitted[2]) try: project._setObject(splitted[0],newObj) - print "done:",splitted[0] + #print "done:",splitted[0] except: print "not done:",splitted[0] @@ -428,19 +441,19 @@ class MPIWGRoot(ZSQLExtendFolder): def formatElementForOverview(self,element): """format the element for output in overview""" if element[0]==1: #department - print element[3].getContent('xdata_05') + #print element[3].getContent('xdata_05') if element[3].getContent('xdata_05') == "4": - return """

Ind. Research Group II: %s

"""%(element[3].absolute_url(),element[3].getContent('WEB_title')) + return """

Ind. Research Group I: %s

"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) if element[3].getContent('xdata_05') == "5": - return """

Ind. Research Group I: %s

"""%(element[3].absolute_url(),element[3].getContent('WEB_title')) + return """

Ind. Research Group II: %s

"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) - return """

Department %s: %s

"""%(element[3].absolute_url(),element[3].getContent('xdata_05'),element[3].getContent('WEB_title')) + return """

Department %s: %s

"""%(element[3].absolute_url()+"/index.html",element[3].getContent('xdata_05'),element[3].getContent('WEB_title')) elif element[0]==2: #mainprojects - return """

%s

"""%(element[3].absolute_url(),element[3].getContent('WEB_title')) + return """

%s

"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) elif element[0]==3: - return """

%s

"""%(element[3].absolute_url(),element[3].getContent('WEB_title')) + return """

%s

"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) def changePosition(self,treeId,select,RESPONSE=None): """Change Postion Entry""" @@ -524,7 +537,7 @@ class MPIWGRoot(ZSQLExtendFolder): if proj: #ret.append("%s"%(proj[0].absolute_url,person.encode('utf-8'))) - ret.append("%s"%('members/'+proj[0].id,person)) + ret.append("%s"%('members/'+proj[0].id+'/index.html',person)) else: #ret.append("%s"%person.encode('utf-8')) ret.append("%s"%person) @@ -540,7 +553,7 @@ class MPIWGRoot(ZSQLExtendFolder): if len(person)>1: #nicht nur Trennzeichen splitted=person.split(",") if len(splitted)==1: - splitted=person.split(" ") + splitted=person.lstrip().rstrip().split(" ") splittedNew=[re.sub(r'\s(.*)','$1',split) for split in splitted] if splittedNew[0]=='': del splittedNew[0] @@ -555,7 +568,7 @@ class MPIWGRoot(ZSQLExtendFolder): if proj: #ret.append("%s"%(proj[0].absolute_url,person.encode('utf-8'))) - ret.append("%s"%(proj[0].absolute_url,person)) + ret.append("%s"%(proj[0].absolute_url+"/index.html",person)) else: #ret.append("%s"%person.encode('utf-8')) ret.append("%s"%person) @@ -586,14 +599,24 @@ class MPIWGRoot(ZSQLExtendFolder): name = members[0][1].title.decode('utf-8') y=name - splitted=y.split(",") - for s in splitted: - splitNeu.append("\""+s+"\"") + splitted=y.split(",") + #XXXX + splitNeu=["\'"+splitted[1]+" "+splitted[0]+"\'"] + + #for s in splitted: + # splitNeu.append("\""+s+"\"") search=string.join(splitNeu,' AND ') - + proj=self.ProjectCatalog({'xdata_01':search}) + if proj: - proj2=[x for x in proj] + proj2=[] + for x in proj: + + if not((splitted[1]==" Christoph") and (splitted[0]=="Hoffmann") and (str(x.WEB_title).find('Einstein')>0)): + + #print repr(splitted[1]),repr(splitted[0]),repr(x.WEB_title) + proj2.append(x) # proj2.sort(sortP) # ret.append((y,proj2)) else: @@ -619,8 +642,9 @@ class MPIWGRoot(ZSQLExtendFolder): splitted=name.split(",") if len(splitted)==1: - splitted=name.split(" ") - splittedNew=[re.sub(r'\s(.*)','$1',split) for split in splitted] + splitted=name.lstrip().rstrip().split(" ") + splittedNew=[split.lstrip() for split in splitted] + if splittedNew[0]=='': del splittedNew[0] search=string.join(splittedNew,' AND ') @@ -814,6 +838,15 @@ class MPIWGProject(Folder): """nothing""" text2=re.sub(r';([^\s])','; \g<1>',text) + #teste ob ergebnis leer und header dann nehme title + + if (text2=='') and (field=='WEB_project_header'): + return self.getContent('WEB_title') + + #teste ob WEB_project_description und keine führenden p tags + if (len(text2)>4) and (not text2[0:3]=='

') and (field=='WEB_project_description'): + return "

"+text2+"

" + return text2 def show_html(self):