version 1.10.2.61, 2008/09/12 15:54:49
|
version 1.10.2.64, 2008/12/17 08:02:19
|
Line 7 from OFS.Folder import Folder
|
Line 7 from OFS.Folder import Folder
|
from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder |
from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.PageTemplate import PageTemplate |
|
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate |
from Products.ZCatalog.CatalogPathAwareness import CatalogAware |
from Products.ZCatalog.CatalogPathAwareness import CatalogAware |
from Products.versionedFile.extVersionedFile import extVersionedFileFolder |
from Products.versionedFile.extVersionedFile import extVersionedFileFolder |
|
from AccessControl import getSecurityManager |
|
|
import os |
import os |
import logging |
import logging |
Line 33 def logger(txt,method,txt2):
|
Line 35 def logger(txt,method,txt2):
|
departmentList="Renn\nRheinberger\nDaston\nKlein\nSibum\nIT\nInstitut\nBibliothek" |
departmentList="Renn\nRheinberger\nDaston\nKlein\nSibum\nIT\nInstitut\nBibliothek" |
|
|
|
|
def getTemplate(self, tpName): |
|
"""get a template file either form the instance or from the product""" |
|
ext=self.ZopeFind(self.aq_parent,obj_ids=[tpName]) |
|
if ext: |
|
pt = getattr(self,ext[0][1].getId()) |
|
else: |
|
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/'+tpName)).__of__(self) |
|
assert(pt) |
|
return pt |
|
|
|
def createNewDBEntry(self,publish_the_data,key,name,vorname,title,position,e_mail,e_mail_p,date_from,date_to,abteilung,heimat_inst,funded_by="",e_mail2="",txt="",txt_p="no",stay_at_mpiwg="",group="",web_object_created="no",current_work=""): |
def createNewDBEntry(self,publish_the_data,key,name,vorname,title,position,e_mail,e_mail_p,date_from,date_to,abteilung,heimat_inst,funded_by="",e_mail2="",txt="",txt_p="no",stay_at_mpiwg="",group="",web_object_created="no",current_work=""): |
"""lege person in der datenbank an""" |
"""lege person in der datenbank an""" |
Line 129 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 123 class MPIWGStaff(CatalogAware,ZSQLExtend
|
res = self.ZSQLQuery(query) |
res = self.ZSQLQuery(query) |
|
|
if res and res[0].count>0: |
if res and res[0].count>0: |
|
|
return True |
return True |
else: |
else: |
|
|
return False |
return False |
|
|
|
|
Line 163 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 159 class MPIWGStaff(CatalogAware,ZSQLExtend
|
"""change PublicationSelectionMode""" |
"""change PublicationSelectionMode""" |
|
|
self.publicationSelectionMode=publicationSelectionMode |
self.publicationSelectionMode=publicationSelectionMode |
|
self.ZCacheable_invalidate() |
if RESPONSE: |
if RESPONSE: |
self.redirect(RESPONSE,"editPublications") |
self.redirect(RESPONSE,"editPublications") |
|
|
Line 196 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 192 class MPIWGStaff(CatalogAware,ZSQLExtend
|
|
|
def changeDownloads(self,cv_pdf=None,cv_publish=None,publications_pdf=None,publications_publish=None,RESPONSE=None): |
def changeDownloads(self,cv_pdf=None,cv_publish=None,publications_pdf=None,publications_publish=None,RESPONSE=None): |
""""change the downloadable files""" |
""""change the downloadable files""" |
|
self.ZCacheable_invalidate() |
if not hasattr(self,'downloadableFiles'): |
if not hasattr(self,'downloadableFiles'): |
|
|
extFolder = extVersionedFileFolder() |
extFolder = extVersionedFileFolder() |
Line 299 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 295 class MPIWGStaff(CatalogAware,ZSQLExtend
|
manage_options = Folder.manage_options+( |
manage_options = Folder.manage_options+( |
{'label':'Edit','action':'changeMPIWGStaffForm'}, |
{'label':'Edit','action':'changeMPIWGStaffForm'}, |
{'label':'Change Publications Special','action':'changePublications_specialForm'}, |
{'label':'Change Publications Special','action':'changePublications_specialForm'}, |
) |
) + Cacheable.manage_options |
|
|
|
__manager_id = "ramCache" |
def __init__(self,id, lastName,firstName,key): |
def __init__(self,id, lastName,firstName,key): |
"""init""" |
"""init""" |
self.id=id |
self.id=id |
Line 343 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 340 class MPIWGStaff(CatalogAware,ZSQLExtend
|
|
|
def index_html(self): |
def index_html(self): |
"""show homepage""" |
"""show homepage""" |
|
|
|
bound_names={} |
|
request = self.REQUEST |
|
if request is not None: |
|
response = request.response |
|
if not response.headers.has_key('content-type'): |
|
response.setHeader('content-type', 'text/html') |
|
|
|
security = getSecurityManager() |
|
bound_names['user'] = security.getUser() |
|
|
|
# Retrieve the value from the cache. |
|
keyset = None |
|
if self.ZCacheable_isCachingEnabled(): |
|
|
|
# Prepare a cache key. |
|
keyset = {'here': self} |
|
|
|
result = self.ZCacheable_get(keywords=keyset) |
|
|
|
if result is not None: |
|
# Got a cached value. |
|
return result |
|
|
pt = getTemplate(self, "members_main") |
pt = getTemplate(self, "members_main") |
return pt() |
# Execute the template in a new security context. |
|
security.addContext(self) |
|
|
|
try: |
|
result = pt.pt_render(extra_context=bound_names) |
|
if keyset is not None: |
|
# Store the result in the cache. |
|
self.ZCacheable_set(result, keywords=keyset) |
|
|
|
return result |
|
finally: |
|
security.removeContext(self) |
|
|
|
|
|
|
def changePublications_specialForm(self): |
def changePublications_specialForm(self): |
"""Priority publications manual field""" |
"""Priority publications manual field""" |
Line 353 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 387 class MPIWGStaff(CatalogAware,ZSQLExtend
|
|
|
def changePublications_special(self,usePublicationsSpecial=None,specialPublicationsField=None,RESPONSE=None): |
def changePublications_special(self,usePublicationsSpecial=None,specialPublicationsField=None,RESPONSE=None): |
"""change publications special params""" |
"""change publications special params""" |
|
self.ZCacheable_invalidate() |
if usePublicationsSpecial: |
if usePublicationsSpecial: |
self.usePublicationsSpecial=True |
self.usePublicationsSpecial=True |
|
|
Line 388 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 423 class MPIWGStaff(CatalogAware,ZSQLExtend
|
security.declareProtected('View management screens','changeMPIWGStaff') |
security.declareProtected('View management screens','changeMPIWGStaff') |
def changeMPIWGStaff(self,lastName,firstName,key=None,RESPONSE=None): |
def changeMPIWGStaff(self,lastName,firstName,key=None,RESPONSE=None): |
"""change it""" |
"""change it""" |
|
self.ZCacheable_invalidate() |
self.title="%s, %s"%(lastName,firstName) |
self.title="%s, %s"%(lastName,firstName) |
self.lastName=lastName |
self.lastName=lastName |
self.firstName=firstName |
self.firstName=firstName |
Line 461 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 497 class MPIWGStaff(CatalogAware,ZSQLExtend
|
query="UPDATE personal_www SET current_work_p =%s WHERE key='%s'" |
query="UPDATE personal_www SET current_work_p =%s WHERE key='%s'" |
|
|
self.ZSQLQuery(query%(self.ZSQLQuote(publish),key)) |
self.ZSQLQuery(query%(self.ZSQLQuote(publish),key)) |
|
self.ZCacheable_invalidate() |
if RESPONSE: |
if RESPONSE: |
self.redirect(RESPONSE,"edit") |
self.redirect(RESPONSE,"edit") |
|
|
security.declareProtected('View management screens','changeResearch') |
security.declareProtected('View management screens','changeResearch') |
def changeResearch(self,noredirect=None,RESPONSE=None): |
def changeResearch(self,noredirect=None,RESPONSE=None): |
"""change the research entries""" |
"""change the research entries""" |
|
self.ZCacheable_invalidate() |
newEntries={} |
newEntries={} |
key_main=self.REQUEST.form['key_main'] |
key_main=self.REQUEST.form['key_main'] |
|
|
Line 526 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 563 class MPIWGStaff(CatalogAware,ZSQLExtend
|
return pt() |
return pt() |
|
|
query="UPDATE personal_www SET cv =%s WHERE oid='%s'" |
query="UPDATE personal_www SET cv =%s WHERE oid='%s'" |
|
self.ZCacheable_invalidate() |
self.ZSQLQuery(query%(self.ZSQLQuote(cv),oid)) |
self.ZSQLQuery(query%(self.ZSQLQuote(cv),oid)) |
|
|
if RESPONSE: |
if RESPONSE: |
Line 553 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 590 class MPIWGStaff(CatalogAware,ZSQLExtend
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editProfile.zpt')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editProfile.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
|
self.ZCacheable_invalidate() |
|
|
|
|
if preview: |
if preview: |
Line 627 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 664 class MPIWGStaff(CatalogAware,ZSQLExtend
|
if (not oid): |
if (not oid): |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editAwards.zpt')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editAwards.zpt')).__of__(self) |
return pt() |
return pt() |
|
self.ZCacheable_invalidate() |
query="UPDATE personal_www SET awards =%s WHERE oid='%s'" |
query="UPDATE personal_www SET awards =%s WHERE oid='%s'" |
|
|
self.ZSQLQuery(query%(self.ZSQLQuote(awards),oid)) |
self.ZSQLQuery(query%(self.ZSQLQuote(awards),oid)) |
Line 658 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 695 class MPIWGStaff(CatalogAware,ZSQLExtend
|
security.declareProtected('View management screens','editMainData') |
security.declareProtected('View management screens','editMainData') |
def editMainData(self,REQUEST=None,RESPONSE=None): |
def editMainData(self,REQUEST=None,RESPONSE=None): |
"""edit main data""" |
"""edit main data""" |
|
self.ZCacheable_invalidate() |
argv=REQUEST.form |
argv=REQUEST.form |
|
|
if not argv.has_key('last_name'): |
if not argv.has_key('last_name'): |
Line 723 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 760 class MPIWGStaff(CatalogAware,ZSQLExtend
|
|
|
def changeSortingMode(self,sortingMode,RESPONSE=None,REQUEST=None): |
def changeSortingMode(self,sortingMode,RESPONSE=None,REQUEST=None): |
"""change sorting mode""" |
"""change sorting mode""" |
|
self.ZCacheable_invalidate() |
self.sortingMode=sortingMode |
self.sortingMode=sortingMode |
|
|
if RESPONSE and REQUEST: |
if RESPONSE and REQUEST: |
Line 748 class MPIWGStaff(CatalogAware,ZSQLExtend
|
Line 786 class MPIWGStaff(CatalogAware,ZSQLExtend
|
def changePublications(self,RESPONSE=None): |
def changePublications(self,RESPONSE=None): |
"""change the publication list""" |
"""change the publication list""" |
self.changeResearch(noredirect=True) |
self.changeResearch(noredirect=True) |
|
self.ZCacheable_invalidate() |
#self.updatePublicationDB(personId=self.getDBId()) |
#self.updatePublicationDB(personId=self.getDBId()) |
self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) |
self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) |
|
|