version 1.10.2.1, 2005/07/14 15:12:11
|
version 1.10.2.2, 2005/10/10 08:42:48
|
Line 5 from Products.PageTemplates.PageTemplate
|
Line 5 from Products.PageTemplates.PageTemplate
|
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.ZCatalog.CatalogPathAwareness import CatalogAware |
from Products.ZCatalog.CatalogPathAwareness import CatalogAware |
import os |
import os |
|
import bibliography |
from Globals import package_home |
from Globals import package_home |
|
from Products.PythonScripts.standard import sql_quote |
|
|
def getTemplate(self, tpName): |
def getTemplate(self, tpName): |
"""get a template file either form the instance or from the product""" |
"""get a template file either form the instance or from the product""" |
Line 94 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 95 class MPIWGStaff(CatalogAware,ZSQLExtend
|
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
def edit(self): |
|
"""Edit the pages""" |
|
|
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMPIWGStaff.zpt')).__of__(self) |
|
return pt() |
|
|
|
mainEditFile=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMPIWGStaff_main.zpt')) |
|
|
|
def changeResearch(self,noredirect=None): |
|
"""change the research entries""" |
|
newEntries={} |
|
id_main=self.REQUEST.form['id_main'] |
|
|
|
mainfieldL=self.REQUEST.form['main_fields'].split(",") |
|
mainfield={} |
|
for x in mainfieldL: |
|
tmp=x.split('__') |
|
mainfield[tmp[0]]=tmp[1] |
|
for field in self.REQUEST.form.keys(): |
|
splittedField=field.split("__") |
|
if len(splittedField)<3: |
|
pass #kein datenbank eintrag |
|
|
|
elif splittedField[2]=='new': # store new entries |
|
if not newEntries.has_key(splittedField[0]): |
|
newEntries[splittedField[0]]={} |
|
|
|
newEntries[splittedField[0]][splittedField[1]]=self.REQUEST.form[field] |
|
|
|
else: |
|
query="UPDATE %s "%splittedField[0] |
|
query+="SET %s = '%s' "%(splittedField[1],sql_quote(self.REQUEST.form[field])) |
|
query+="WHERE oid = '%s' "%sql_quote(splittedField[2]) |
|
|
|
self.ZSQLQuery(query) |
|
|
|
|
|
#new entries |
|
for newEntry in newEntries.keys(): |
|
query="INSERT INTO %s "%newEntry |
|
keys=['id_main'] |
|
values=["'"+id_main+"'"] |
|
for key in newEntries[newEntry].keys(): |
|
keys.append(key) |
|
values.append("'"+newEntries[newEntry][key]+"'") |
|
|
|
|
|
keystring=",".join(keys) |
|
|
|
valuestring=",".join(values) |
|
|
|
query+=" (%s) "%keystring |
|
query+="VALUES (%s)"%valuestring |
|
if not (newEntries[newEntry][mainfield[newEntry]].lstrip().rstrip()==""): |
|
self.ZSQLQuery(query) |
|
|
|
if not noredirect: |
|
self.REQUEST.RESPONSE.redirect(self.REQUEST['HTTP_REFERER']) |
|
|
|
def editCV(self,cv=None,oid=None,RESPONSE=None): |
|
"""edit Cv""" |
|
|
|
if (not cv): |
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editCV.zpt')).__of__(self) |
|
return pt() |
|
|
|
query="UPDATE personal_www SET cv ='%s' WHERE oid='%s'" |
|
|
|
self.ZSQLQuery(query%(cv,oid)) |
|
|
|
if RESPONSE: |
|
RESPONSE.redirect("editCV") |
|
|
|
def editAwards(self,awards=None,oid=None,RESPONSE=None): |
|
"""edit a awards""" |
|
|
|
if (not awards): |
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editAwards.zpt')).__of__(self) |
|
return pt() |
|
|
|
query="UPDATE personal_www SET awards ='%s' WHERE oid='%s'" |
|
|
|
self.ZSQLQuery(query%(awards,oid)) |
|
|
|
if RESPONSE: |
|
RESPONSE.redirect("editAwards") |
|
|
|
def editTalks(self): |
|
"""edit talks""" |
|
|
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editTalks.zpt')).__of__(self) |
|
return pt() |
|
|
|
|
|
def editTeaching(self): |
|
"""edit Teaching""" |
|
|
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editTeaching.zpt')).__of__(self) |
|
return pt() |
|
|
|
def editPublications(self): |
|
"""edit the bibliographie""" |
|
|
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editPublications.zpt')).__of__(self) |
|
return pt() |
|
|
|
def changePublications(self): |
|
"""change the publication list""" |
|
|
|
self.changeResearch(noredirect=True) |
|
self.REQUEST.RESPONSE.redirect(self.REQUEST['HTTP_REFERER']) |
|
|
|
|
|
def addPublications(self): |
|
"""add publications""" |
|
|
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addPublications.zpt')).__of__(self) |
|
return pt() |
|
|
|
formatBiblHelp=bibliography.formatBiblHelp |
|
|
|
def sortPriority(self,list): |
|
tmp=[x for x in list] |
|
|
|
def sort(x,y): |
|
try: |
|
xInt=int(x.priority) |
|
except: |
|
xInt=0 |
|
try: |
|
yInt=int(y.priority) |
|
except: |
|
yInt=0 |
|
|
|
return cmp(xInt,yInt) |
|
|
|
tmp.sort(sort) |
|
return tmp |
|
|
|
def deleteField(self,table,oid): |
|
"""delete entry""" |
|
query="DELETE FROM %s WHERE oid = '%s'"%(table,oid) |
|
print "query" |
|
self.ZSQLQuery(query) |
|
self.REQUEST.RESPONSE.redirect(self.REQUEST['HTTP_REFERER']) |
|
|
|
|
def manage_addMPIWGStaffForm(self): |
def manage_addMPIWGStaffForm(self): |