--- MPIWGWeb/MPIWGStaff.py 2008/08/20 06:26:27 1.10.2.42 +++ MPIWGWeb/MPIWGStaff.py 2008/08/26 14:00:42 1.10.2.49 @@ -202,7 +202,7 @@ class MPIWGStaff(CatalogAware,ZSQLExtend if RESPONSE: RESPONSE.redirect(self.REQUEST['HTTP_REFERER']) - + def getPublishImage(self): """publish the image??, default no""" @@ -362,6 +362,7 @@ class MPIWGStaff(CatalogAware,ZSQLExtend return pt() mainEditFile=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMPIWGStaff_main.zpt')) + addPublicationsBib=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addPublicationsBib.zpt')) def getPathStyle(self, path, selected, style=""): """returns a string with the given style + 'sel' if path == selected.""" @@ -372,6 +373,20 @@ class MPIWGStaff(CatalogAware,ZSQLExtend return style + def changeCurrentWork(self,current_work,key,publish="yes",RESPONSE=None): + """change current work""" + + query="UPDATE personal_www SET current_work =%s WHERE key='%s'" + + self.ZSQLQuery(query%(self.ZSQLQuote(current_work),key)) + + query="UPDATE personal_www SET current_work_p =%s WHERE key='%s'" + + self.ZSQLQuery(query%(self.ZSQLQuote(publish),key)) + + if RESPONSE: + RESPONSE.redirect("edit") + security.declareProtected('View management screens','changeResearch') def changeResearch(self,noredirect=None): """change the research entries""" @@ -438,7 +453,78 @@ class MPIWGStaff(CatalogAware,ZSQLExtend if RESPONSE: RESPONSE.redirect("editCV") + + + def getProfile(self): + """get the profile""" + founds=self.ZSQLInlineSearchU(_table='personal_www',key=self.getKey()) + html="""%s""" + if founds.profile and founds.profile != "": + + return html%founds.profile + else: + + return html%self.generateProfileForPerson(founds) + + def editProfile(self,oid=None,RESPONSE=None, kupu=None, preview=None): + """edit Profile, new entry replaces CD, current work and research interests""" + + if (not oid): + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editProfile.zpt')).__of__(self) + return pt() + + + + + if preview: + pass + #TODO: not supported yet + #kupu=preview + # find content of body tags + + start=kupu.find("") + end=kupu.find("") + + newcontent= kupu[start+6:end] + + + + + if preview: + #TODO: not supported yet + if RESPONSE: + RESPONSE.redirect("editProfile") + + #return self.preview(newcontent) + + query="UPDATE personal_www SET profile=%s WHERE oid='%s'" + self.ZSQLQuery(query%(self.ZSQLQuote(newcontent),oid)) + logging.error("PROFILE:"+query%(self.ZSQLQuote(newcontent),oid)) + if RESPONSE: + RESPONSE.redirect("editProfile") + + + def generateProfileForPerson(self,person): + """erzeugt ein automatisches Profil aus den alten Eintraegen CV, Current work, und research interests""" + + ret="" + founds=self.ZSQLInlineSearch(_table='research_interest',key_main=person.key) + if founds: + ret="Research interests:

" + for found in self.sortPriority(founds): + ret+=found.interest+"
" + + + if (person.current_work) and (not person.current_work==""): + ret="Current work:

" + + ret+=person.current_work+"
" + + ret+="
" + ret+=self.formatAscii(person.cv) + + return ret security.declareProtected('View management screens','editDownloads') def editDownloads(self): """editiere die Downloads von der Webseite""" @@ -446,6 +532,14 @@ class MPIWGStaff(CatalogAware,ZSQLExtend pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editDownloads.zpt')).__of__(self) return pt() + security.declareProtected('View management screens','editAdditionalLinks.zpt') + def editAdditionalLinks(self): + """editiere die Downloads von der Webseite""" + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editAdditionalLinks.zpt')).__of__(self) + return pt() + + security.declareProtected('View management screens','editAwards') def editAwards(self,awards=None,oid=None,RESPONSE=None): """edit a awards"""