version 1.1, 2004/02/04 10:03:33
|
version 1.3, 2004/02/09 08:57:27
|
Line 77 class MPIWGRoot(Folder):
|
Line 77 class MPIWGRoot(Folder):
|
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
def getAllMembers(self): |
|
"""give list of all members""" |
|
ret=[] |
|
|
|
for x in self.members.objectValues('MPIWGStaff'): |
|
print x.title |
|
ret.append(x.title) |
|
|
|
ret.sort() |
|
return ret |
|
|
|
def getUrlFromPerson(self,list): |
|
"""get urls to person list""" |
|
ret=[] |
|
persons=list.split(";") |
|
for person in persons: |
|
|
|
splitted=person.split(",") |
|
if len(splitted)==1: |
|
splitted=person.split(" ") |
|
splittedNew=[re.sub(r'\s(.*)','$1',split) for split in splitted] |
|
if splittedNew[0]=='': |
|
del splittedNew[0] |
|
search=string.join(splittedNew,' AND ') |
|
if not search=='': |
|
proj=self.MembersCatalog({'title':search}) |
|
print search,"PER",person,splittedNew,proj |
|
|
|
if proj: |
|
ret.append("<a href=%s >%s</a>"%(proj[0].absolute_url,person)) |
|
else: |
|
ret.append("%s"%person) |
|
return string.join(ret,";") |
|
|
|
def getProjectsOfMembers(self): |
|
"""give tuple member /projects""" |
|
ret=[] |
|
members=self.getAllMembers() |
|
for x in members: |
|
splitted=x.split(",") |
|
|
|
proj=self.ProjectCatalog({'xdata_01':string.join(splitted,' AND')}) |
|
if proj: |
|
ret.append((x,proj)) |
|
return ret |
def givePersonList(self,name): |
def givePersonList(self,name): |
"""check if person is in personfolder and return list of person objects""" |
"""check if person is in personfolder and return list of person objects""" |
|
|
|
splitted=name.split(",") |
|
if len(splitted)==1: |
|
splitted=name.split(" ") |
|
splittedNew=[re.sub(r'\s(.*)','$1',split) for split in splitted] |
|
if splittedNew[0]=='': |
|
del splittedNew[0] |
|
search=string.join(splittedNew,' AND ') |
|
if not search=='': |
|
proj=self.MembersCatalog({'title':search}) |
|
|
|
if proj: |
splitted=name.split(",") # version nachname, vorname... |
return [[x.lastName,x.firstName] for x in proj] |
if len(splitted)>1: |
|
lastName=splitted[0] |
|
firstName=splitted[1] |
|
else: |
else: |
splitted=name.split(" ") #version vorname irgenwas nachnamae |
return [] |
|
|
lastName=splitted[len(splitted)-1] |
## splitted=name.split(",") # version nachname, vorname... |
firstName=string.join(splitted[0:len(splitted)-1]) |
## if len(splitted)>1: |
|
## lastName=splitted[0] |
|
## firstName=splitted[1] |
|
## else: |
|
## splitted=name.split(" ") #version vorname irgenwas nachnamae |
|
|
objs=[] |
## lastName=splitted[len(splitted)-1] |
|
## firstName=string.join(splitted[0:len(splitted)-1]) |
|
|
print self.members |
## objs=[] |
for x in self.members.__dict__: |
|
obj=getattr(self.members,x) |
|
if hasattr(obj,'lastName') and hasattr(obj,'firstName'): |
|
|
|
if (re.match(".*"+obj.lastName+".*",lastName) or re.match(".*"+lastName+".*",obj.lastName)) and (re.match(obj.firstName+".*",firstName) or re.match(firstName+".*",obj.firstName)): |
#print self.members |
|
## for x in self.members.__dict__: |
|
## obj=getattr(self.members,x) |
|
## if hasattr(obj,'lastName') and hasattr(obj,'firstName'): |
|
|
|
## if (re.match(".*"+obj.lastName+".*",lastName) or re.match(".*"+lastName+".*",obj.lastName)) and (re.match(".*"+obj.firstName+".*",firstName) or re.match(".*"+firstName+".*",obj.firstName)): |
|
|
|
## objs.append((obj,lastName+", "+firstName)) |
|
|
objs.append((obj,lastName+", "+firstName)) |
|
|
|
return objs |
return objs |
|
|
Line 114 class MPIWGRoot(Folder):
|
Line 173 class MPIWGRoot(Folder):
|
for name in splitted: |
for name in splitted: |
|
|
if not (name==""): |
if not (name==""): |
|
try: |
ret[name]=self.givePersonList(name) |
ret[name]=self.givePersonList(name) |
|
except: |
|
"""NOTHIHN""" |
print "RET",ret |
print "RET",ret |
return ret |
return ret |
|
|
Line 124 class MPIWGRoot(Folder):
|
Line 185 class MPIWGRoot(Folder):
|
#print "GCL",fieldname |
#print "GCL",fieldname |
if fieldname=='xdata_01': |
if fieldname=='xdata_01': |
x=self.personCheck(person.getContent(fieldname)) |
x=self.personCheck(person.getContent(fieldname)) |
#print "GCLBACKX",x |
print "GCLBACKX",x |
return x |
return x |
|
|
|
|
Line 155 class MPIWGProject(Folder):
|
Line 216 class MPIWGProject(Folder):
|
|
|
meta_type='MPIWGProject' |
meta_type='MPIWGProject' |
|
|
|
def crossLinker(self): |
|
"""experimental crosslinker""" |
|
splitted=self.WEB_project_description[0].split() |
|
new=[] |
|
for split in splitted: |
|
try: |
|
found=self.DescriptionCatalog({'fulltext':split}) |
|
|
|
if len(found)>1: |
|
|
|
new.append("<a href=%s>%s</a>"%(split,split)) |
|
else: |
|
new.append(split) |
|
except: |
|
new.append(split) |
|
return string.join(new) |
|
|
|
|
|
|
|
|
def generateTemplate(self,RESPONSE=None): |
def generateTemplate(self,RESPONSE=None): |