# HG changeset patch # User casties # Date 1360263039 -3600 # Node ID ddf6c1a27a4bfbb9c8dea640bf795c074ca78ec9 # Parent 1f2760ed3efe2e8d49f9ad21869593fe28bca589 new version with main_template and css in product. diff -r 1f2760ed3efe -r ddf6c1a27a4b MPIWGRoot.py --- a/MPIWGRoot.py Wed Jan 30 11:47:21 2013 +0100 +++ b/MPIWGRoot.py Thu Feb 07 19:50:39 2013 +0100 @@ -1,40 +1,36 @@ from Products.PageTemplates.PageTemplateFile import PageTemplateFile -from Products.PageTemplates.PageTemplate import PageTemplate -from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate +from App.ImageFile import ImageFile + from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder from Products.ZCatalog.CatalogPathAwareness import CatalogAware from OFS.Image import Image from Globals import package_home import urllib -import MPIWGStaff import string import re import os from types import * import logging -import xmlhelper # Methoden zur Verwaltung der projekt xml from OFS.SimpleItem import SimpleItem from OFS.Folder import Folder -from Products.ZSQLMethods.SQL import SQLConnectionIDs from AccessControl import ClassSecurityInfo -from bibliography import * import time import xml.dom.minidom import sys import transaction - -#from Ft.Xml.XPath import Evaluate -#from Ft.Xml.XPath.Context import Context -#from Ft.Xml.Domlette import NonvalidatingReader,PrettyPrint, Print -#from Ft.Xml import EMPTY_NAMESPACE import copy -import updatePersonalWWW -import MPIWGStaff -from MPIWGHelper import * from BeautifulSoup import BeautifulSoup, Comment from ZODB import FileStorage, DB from ZEO import ClientStorage + +from MPIWGHelper import * +import updatePersonalWWW +from bibliography import * +import MPIWGStaff +from SrvTxtUtils import getInt, utf8ify, refreshingImageFileIndexHtml + + def sortWeight(x,y): x1=int(getattr(x[1],'weight','0')) y1=int(getattr(y[1],'weight','0')) @@ -47,6 +43,16 @@ _v_harvestCache=None meta_type='MPIWGRoot' + manage_options = Folder.manage_options+( + {'label':'Update personal homepages','action':'updatePersonalwww_html'}, + {'label':'Reindex catalogs','action':'reindexCatalogs'}, + {'label':'Main config','action':'changeMPIWGRootForm'}, + {'label':'add e-mails','action':'showNewDBEntries'}, + #{'label':'update the institutsbibliography','action':'updateInstitutsbiliography'}, + #{'label':'Edit Historical Persons','action':'editHistoricalPersonsForm'}, + #{'label':'Store Historical Persons','action':'storeHistoricalPersons'}, + ) + fieldLabels={'WEB_title':'WEB_Title', 'xdata_01':'Responsible Scientists', 'xdata_02':'Department', @@ -72,18 +78,14 @@ # types of objects that show up in navigation nav_meta_types = ['MPIWGTemplate','MPIWGLink','MPIWGFolder'] - manage_options = Folder.manage_options+( - {'label':'Update personal homepages','action':'updatePersonalwww_html'}, - {'label':'Reindex catalogs','action':'reindexCatalogs'}, - {'label':'Main config','action':'changeMPIWGRootForm'}, - {'label':'add e-mails','action':'showNewDBEntries'}, - #{'label':'update the institutsbibliography','action':'updateInstitutsbiliography'}, - #{'label':'Edit Historical Persons','action':'editHistoricalPersonsForm'}, - #{'label':'Store Historical Persons','action':'storeHistoricalPersons'}, - ) - - - + # + # templates + # + main_template = PageTemplateFile('zpt/www/main_template', globals()) + mpiwg_css = ImageFile('css/mpiwg.css', globals()) + # make docuviewer_css refreshable for development + mpiwg_css.index_html = refreshingImageFileIndexHtml + def decode(self,str): """decoder""" diff -r 1f2760ed3efe -r ddf6c1a27a4b MPIWGStaff.py --- a/MPIWGStaff.py Wed Jan 30 11:47:21 2013 +0100 +++ b/MPIWGStaff.py Thu Feb 07 19:50:39 2013 +0100 @@ -4,7 +4,6 @@ # TODO: wird username gebraucht? from OFS.Folder import Folder -from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplate import PageTemplate from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate @@ -12,9 +11,11 @@ from Products.versionedFile.extVersionedFile import extVersionedFileFolder from AccessControl import getSecurityManager +from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder +from Products.ZDBInterface.ZDBInterfaceFolder import ZDBInterfaceFolder + import os import logging -import bibliography import email from Globals import package_home from Products.PythonScripts.standard import sql_quote @@ -22,12 +23,13 @@ from AccessControl import ClassSecurityInfo import time import logging -import email import re from OFS.Cache import Cacheable import urllib2 import transaction + import SrvTxtUtils +import bibliography from MPIWGHelper import * #ersetzt logging @@ -633,7 +635,7 @@ def getProfile(self): """get the profile""" - self.REQUEST.RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT') + self.REQUEST.RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT') founds=self.ZSQLInlineSearchU(_table='personal_www',key=self.getKeyUTF8()) html="""%s""" @@ -997,8 +999,32 @@ self._setObject(id,newObj) - if RESPONSE is not None: self.redirect(RESPONSE,'manage_main') +class MPIWGStaffFolder(ZDBInterfaceFolder): + """Folder of staff objects""" + + meta_type="MPIWGStaffFolder" + security=ClassSecurityInfo() + + def index_html(self,REQUEST,RESPONSE): + """show homepage""" + logging.debug("MPIWGStaffFolder: index_html!") + return REQUEST + +def manage_addMPIWGStaffFolderForm(self): + """form for adding the project""" + pt=PageTemplateFile('zpt/addMPIWGStaffFolderForm', globals()).__of__(self) + return pt() + +def manage_addMPIWGStaffFolder(self,id,title,RESPONSE=None): + """add it""" + newObj=MPIWGStaffFolder(id,title) + + self._setObject(id,newObj) + + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + diff -r 1f2760ed3efe -r ddf6c1a27a4b MPIWGStaff.py_old --- a/MPIWGStaff.py_old Wed Jan 30 11:47:21 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,996 +0,0 @@ -"""This file contains the classes for the organization of the staff""" -# TODO: pruefe ob die id der einzelnen tabellen, wie id in publications noch benutzt werden -# TODO: pruefe ob die bibliographischen felder in publications noch benutzt werden -# TODO: wird username gebraucht? - -from OFS.Folder import Folder -from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder -from Products.PageTemplates.PageTemplateFile import PageTemplateFile -from Products.PageTemplates.PageTemplate import PageTemplate -from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate -from Products.ZCatalog.CatalogPathAwareness import CatalogAware -from Products.versionedFile.extVersionedFile import extVersionedFileFolder -from AccessControl import getSecurityManager - -import os -import logging -import bibliography -import email -from Globals import package_home -from Products.PythonScripts.standard import sql_quote -from types import * -from AccessControl import ClassSecurityInfo -import time -import logging -import email -import re -from OFS.Cache import Cacheable -import urllib2 -import transaction -import SrvTxtUtils - -from MPIWGHelper import * -#ersetzt logging -def logger(txt,method,txt2): - """logging""" - logging.info(txt+ txt2) - -departmentList="Renn\nRheinberger\nDaston\nKlein\nSibum\nIT\nInstitut\nBibliothek" -coneService="http://127.0.0.1:8280/MetaDataManagerRestlet/cone/" # kann in MPIWGRoot konfiguriert werden. - - - -def createNewDBEntry(self,publish_the_data,key,name,vorname,titles_new,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""" - - if date_to=="": # wenn date_to leer - date_to="date_none" - - if date_from=="": # wenn date_fromleer - date_from="date_none" - msg="" - #test ob id schon existiert - if self.ZSQLQuery("select key from personal_www where key='%s'"%id): - return False,"ERROR:key%s already exists"%key - - #eintragen - columnlist="""publish_the_data,key,last_name,first_name,titles_new,status,e_mail,e_mail_p,date_from,date_to,department,home_inst,funded_by,e_mail2,date_stay_at_mpiwg,web_object_created,"group",current_work,current_work_p """ - insertTuple=(publish_the_data,key,name,vorname,titles_new,position,e_mail,e_mail_p,date_from,date_to,abteilung,heimat_inst,funded_by,e_mail2,stay_at_mpiwg,web_object_created,group,current_work,"yes") - - insert=[] - for element in insertTuple: - if element=="date_none": # date_none eintrag wird zu null uebersetzt - insert.append('null') - else: - insert.append("%s"%self.ZSQLQuote(element)) - - insertStr=",".join(insert) - queryStr="INSERT INTO personal_www (%s) VALUES (%s)"%(columnlist,insertStr) - self.ZSQLQuery("SET DATESTYLE TO 'German'") - self.ZSQLQuery(queryStr) - logging.info("QQQQ %s:"%queryStr) - #currentwork - #if not (current_work==""): - # queryStr="INSERT INTO current_work (key_main,current,publish) VALUES ('%s',%s,'%s')"%(key,self.ZSQLQuote(current_work),"yes") - - # self.ZSQLQuery(queryStr) - - return True,msg -class MPIWGStaff(CatalogAware,ZSQLExtendFolder,Cacheable): - """Staff""" - - meta_type="MPIWGStaff" - default_catalog='MembersCatalog' - departmentList=departmentList - #_v_cone=None; - security=ClassSecurityInfo() - - def redirect(self,RESPONSE,url): - """mache ein redirect mit einem angehaengten time stamp um ein reload zu erzwingen""" - - timeStamp=time.time() - - if url.find("?")>-1: #giebt es schon parameter - addStr="&time=%s" - else: - addStr="?time=%s" - - RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT') - logging.error(email.Utils.formatdate()+' GMT') - RESPONSE.redirect(url+addStr%timeStamp) - - def getKeyUTF8(self): - """get db_key utf8""" - logging.debug("KEY - MPIWGStaff:"+self.getKey()) - logging.debug("KEY - MPIWGStaff:"+utf8ify(self.getKey())) - - return utf8ify(self.getKey()) - - def setKey(self,key): - """set key""" - self.key=key - - def getKey(self): - """get database key""" - if hasattr(self,'key'): - #logging.error("SAVED KEY:%s"%self.key) - return unicodify(self.key.lower()) - #return self.key.lower() - - #fuer alt faelle ohne key - #logging.error("NEW KEY:%s"%(self.firstName+'_'+self.lastName).lower().replace(' ','')) - return (self.firstName+'_'+self.lastName).lower().replace(' ','') - - def getConnectionObj(self): - """returns connection id (from root)""" - try: - root = self.getMPIWGRoot() - return root.getConnectionObj() - except: - return self.en.getConnectionObj() - - def isPublished(self): - """gib publications status aus der datenbank aus""" - key=self.getKey() - query="select count(publish_the_data) from personal_www where lower(key)='%s' and publish_the_data='yes'"%key - - res = self.ZSQLQuery(query) - - if res and res[0].count>0: - return True - else: - return False - - - - def updateDBEntry(self,publish_the_data,date_from,date_to,DBid=None,stay_at_mpiwg="",position="",abteilung=""): - """zpddatedb""" - if not DBid: - DBid=self.getDBId() - - - self.ZSQLQuery("SET DATESTYLE TO 'German'") - - test=self.ZSQLQuery("select id from personal_www where id='%s' "%DBid) - - - if test and (len(test)>0): #dataset exists - logger("MPIWG Web",logging.INFO,'UPDATE: _table="personal_www",_identify="id=%s"'%DBid+',publish_the_data=%s'%publish_the_data+',date_from=%s'%date_from+',date_to=%s'%date_to+',stay_at_mpiwg=%s'%stay_at_mpiwg+',position=%s'%position) - self.ZSQLChange(_table="personal_www",_identify="id=%s"%DBid,publish_the_data=publish_the_data, - date_from=date_from, - date_to=date_to,stay_at_mpiwg=stay_at_mpiwg,position=position,abteilung=abteilung) - return True - else: - return False - - def getPublicationSelectionMode(self): - """get publication selection mode, default 'priority'""" - return getattr(self,'publicationSelectionMode','priority') - - def changePublicationSelectionMode(self,publicationSelectionMode,RESPONSE=None): - """change PublicationSelectionMode""" - - self.publicationSelectionMode=publicationSelectionMode - self.ZCacheable_invalidate() - if RESPONSE: - self.redirect(RESPONSE,"editPublications") - - - def downloadCV(self,RESPONSE): - """download cv file""" - ob=self._getOb("downloadableFiles")._getOb("cv.pdf") - - RESPONSE.redirect(ob.absolute_url()+"/download") - - def getLastUpdateCV(self): - """getDate of Last Update""" - try: - ob=self._getOb("downloadableFiles")._getOb("cv.pdf") - return ob.getLastChangeDate() - except: - return "No file yet!" - def getLastUpdatePublications(self): - """getDate of Last Update""" - try: - ob=self._getOb("downloadableFiles")._getOb("publications.pdf") - return ob.getLastChangeDate() - except: - return "No file yet!" - def downloadPublications(self,RESPONSE): - """download publications""" - ob=self._getOb("downloadableFiles")._getOb("publications.pdf") - - RESPONSE.redirect(ob.absolute_url()+"/download") - - def changeDownloads(self,cv_pdf=None,cv_publish=None,publications_pdf=None,publications_publish=None,RESPONSE=None): - """"change the downloadable files""" - self.ZCacheable_invalidate() - if not hasattr(self,'downloadableFiles'): - - extFolder = extVersionedFileFolder() - extFolder.id = "downloadableFiles" - self._setObject(extFolder.id,extFolder) - - ob = self._getOb("downloadableFiles") - - if cv_publish: - self.cv_publish=cv_publish - - if publications_publish: - self.publications_publish=publications_publish - - if cv_pdf: - if not hasattr(ob,"cv.pdf"): - ob.addFile("",cv_pdf,newName="cv.pdf") - - else: - cvFile = getattr(ob,"cv.pdf") - cvFile.addContentObject("","",file=cv_pdf) - - if publications_pdf: - if not hasattr(ob,"publications.pdf"): - ob.addFile("",cv_pdf,newName="publications.pdf") - - else: - cvFile = getattr(ob,"publications.pdf") - cvFile.addContentObject("","",file=publications_pdf) - - if RESPONSE: - self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) - - - def getPublishImage(self): - """publish the image??, default no""" - return getattr(self,'publishImage','no') - - def updateImage(self,publishImage,file=None,rename=None,RESPONSE=None): - """update image""" - - if file and not(file.filename==""): - if self.getImageObj(): - self.getImageObj().updateImage(file,_rename=None,RESPONSE=None) - else: - # create new image object - xp = file.filename.rfind('.') - if xp > 0: - ext = file.filename[xp:] - #fn = self.getId()+ext - fn = self.getId() - logger("MPWIG STAFF", logging.INFO, "new filename: %s"%fn) - self.getImageFolder().addImage2(file,fileName=fn) - else: - logger("MPWIG STAFF", logging.ERROR, "uploaded filename %s has no extension!"%file.filename) - - self.publishImage=publishImage - - if RESPONSE: - self.redirect(RESPONSE,"edit") - - def getImageFolder(self): - """getImageFolder""" - #TODO: make place of staff image folder configurable - - try: - return self.getPhysicalRoot().www_neu.images.staff_images - except: - logger("MPWIG STAFF", logging.ERROR, "image folder not found: has to be add /www_neu/staff_images") - return None - - def getImageObj(self): - """getImage""" - imageFolder=self.getImageFolder() - - if not imageFolder: return None - - image=getattr(imageFolder,self.getId(),None) - - if not image: - for suffix in ['jpg','tif']: - - image=getattr(imageFolder,self.getId()+"."+suffix,None) - if image: - break - return image - - def getImageUrl(self): - """getImageUrl""" - image=self.getImageObj() - if not image: - return None - else: - return self.getImageObj().absolute_url()+"/image" - - def PrincipiaSearchSource(self): - """Return cataloguable key for ourselves.""" - return str(self) - - manage_options = Folder.manage_options+( - {'label':'Edit','action':'changeMPIWGStaffForm'}, - {'label':'Change Publications Special','action':'changePublications_specialForm'}, - ) + Cacheable.manage_options - - __manager_id = "ramCache" - def __init__(self,id, lastName,firstName,key): - """init""" - self.id=id - self.title=key - self.lastName=lastName - self.firstName=firstName - self.key=key - - def getPersonID(self): - """gibt den ID fuer die Person zurueck" - im Moment ist personID = id, i.e. e-mail - """ - return self.id - - def getConeUrl(self): - """gibt coneURL zurueck""" - - self.coneService=getattr(self, "coneServiceURL",coneService) - logging.debug("coneservice:"+self.coneService) - - if getattr(self,'_v_cone',None)==None: - try: - - self._v_cone=SrvTxtUtils.getHttpData(self.coneService+self.getPersonID()) - #cone = urllib2.urlopen(self.coneService+self.getPersonID()) - #self._v_cone=cone.read() - if self._v_cone==None: - self._v_cone="" - except: - self._v_cone="" - return "" - - return self._v_cone - - - - - def harvest_page_old(self,context=None): - """geharvestete seite = verschlankte version von members_main""" - #pt = getTemplate(self, "harvest_members_main") - - if not self.isPublished(): - return "" - if not context: - context=self - - - ext=getattr(self,"harvest_members_main",None) - if ext: - return getattr(self,ext.getId())() - - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','harvest_members_main')).__of__(context) - - - return pt() - - def harvest_page(self,mode="normal"): - """harvest""" - logging.debug("AAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") - if not self.isPublished(): - return - st = getattr(self.en.staff.members,self.getId()).index_html(mode) - - templates = self.en.getHarvestCache() - #templates = getattr(self,'getHarvestCache',self.en.getHarvestCache)() - rendered = st - templates[self.absolute_url()]=rendered - transaction.commit() - return rendered - - - - def index_html(self,mode="normal"): - """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 - - # look for individual page - if self.hasObject("index.html"): - pt = getattr(self, "index.html") - # else use template - else: - if mode=="slim": - pt = getTemplate(self, "members_main_slim") - else: - pt = getTemplate(self, "members_main") - # 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): - """Priority publications manual field""" - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changePublications_special.zpt')).__of__(self) - return pt() - - def changePublications_special(self,usePublicationsSpecial=None,specialPublicationsField=None,RESPONSE=None): - """change publications special params""" - self.ZCacheable_invalidate() - if usePublicationsSpecial: - self.usePublicationsSpecial=True - - else: - self.usePublicationsSpecial=False - - self.specialPublicationsField=specialPublicationsField[0:] - - if RESPONSE is not None: - self.redirect(RESPONSE,'manage_main') - - - def publications_full(self): - """show publication""" - pt=getTemplate(self, "publications_full_main") - return pt() - - def talks_full(self): - """show talks""" - pt=getTemplate(self, 'talks_full_main') - return pt() - - def teaching_full(self): - """show talks""" - pt=getTemplate(self, 'teaching_full_main') - return pt() - - def changeMPIWGStaffForm(self): - """change form""" - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGStaff.zpt')).__of__(self) - return pt() - - security.declareProtected('View management screens','changeMPIWGStaff') - def changeMPIWGStaff(self,lastName,firstName,key=None,RESPONSE=None): - """change it""" - self.ZCacheable_invalidate() - self.title="%s, %s"%(lastName,firstName) - self.lastName=lastName - self.firstName=firstName - if key: - self.key = key - - - if RESPONSE is not None: - self.redirect(RESPONSE,'manage_main') - - security.declareProtected('View management screens','edit') - def edit(self): - """Edit the pages""" - #TODO: zusammenspiel mit apache, redirect auf 18080 rausnehmen bzw. zumindest verallgemeinern - #if self.REQUEST['SERVER_URL']=="http://www.mpiwg-berlin.mpg.de": - # redURL="http://xserve04.mpiwg-berlin.mpg.de:18080/www_neu/de/mitarbeiter/members/%s/edit"%self.getId() - # - # self.REQUEST.RESPONSE.redirect(redURL) - - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMPIWGStaff.zpt')).__of__(self) - - - logging.debug("XX:"+email.Utils.formatdate().split("-")[0]+'GMT') - 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.""" - - if path == selected: - return style + 'sel' - else: - return style - - - def getLabel(self): - """returns a label for this object""" - return self.title - - def getBreadcrumbs(self): - """return list of breadcrumbs from here to the root""" - crumbs = [] - # skip direct parent Folder /members/ - parent = self.aq_parent.aq_parent - # get parents breadcrumbs - logging.debug("getbreadcrumbs-: title=%s self=%s parent=%s"%(self.title, repr(self), repr(parent))) - if hasattr(parent, 'getBreadcrumbs'): - logging.debug("getbreadcrumbs: recurse to %s"%parent) - crumbs = parent.getBreadcrumbs() - - # try to get acquisition URL from parent - if hasattr(parent, 'absolute_url'): - baseUrl = "%s/%s/"%(parent.absolute_url(), 'members') - else: - baseUrl = "/en/staff/members/" - - # add this - crumbs.append((self.getLabel(), baseUrl+self.getId(), self)) - - return crumbs - - - 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)) - self.ZCacheable_invalidate() - if RESPONSE: - self.redirect(RESPONSE,"edit") - - security.declareProtected('View management screens','changeResearch') - def changeResearch(self,noredirect=None,RESPONSE=None): - """change the research entries""" - self.ZCacheable_invalidate() - newEntries={} - key_main=self.REQUEST.form['key_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=['key_main'] - values=["'"+sql_quote(key_main)+"'"] - for key in newEntries[newEntry].keys(): - keys.append(key) - values.append("'"+sql_quote(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.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) - - security.declareProtected('View management screens','editCV') - def editCV(self,cv=None,oid=None,RESPONSE=None): - """edit Cv""" - - if (not oid): - 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.ZCacheable_invalidate() - self.ZSQLQuery(query%(self.ZSQLQuote(cv),oid)) - - if RESPONSE: - self.redirect(RESPONSE,"editCV") - - - def getProfile(self): - """get the profile""" - self.REQUEST.RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT') - - founds=self.ZSQLInlineSearchU(_table='personal_www',key=self.getKeyUTF8()) - 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() - - self.ZCacheable_invalidate() - - - 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: - self.redirect(RESPONSE,"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: - self.redirect(RESPONSE,"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.getKeyUTF8()) - 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+"
" - if (person.cv) and (not person.cv==""): - ret+="

Curriculum Vitae:


" - ret+=self.formatAscii(person.cv) - - return ret - security.declareProtected('View management screens','editDownloads') - def editDownloads(self): - """editiere die Downloads von der Webseite""" - - 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""" - - if (not oid): - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editAwards.zpt')).__of__(self) - return pt() - self.ZCacheable_invalidate() - query="UPDATE personal_www SET awards =%s WHERE oid='%s'" - - self.ZSQLQuery(query%(self.ZSQLQuote(awards),oid)) - - - if RESPONSE: - self.redirect(RESPONSE,"editAwards") - - security.declareProtected('View management screens','editTalks') - def editTalks(self): - """edit talks""" - - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editTalks.zpt')).__of__(self) - return pt() - - security.declareProtected('View management screens','editTeaching') - def editTeaching(self): - """edit Teaching""" - - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editTeaching.zpt')).__of__(self) - return pt() - - def getDocTypes(self): - finds = self.ZopeFind(self.metadata.main.meta.bib,obj_metatypes=["OSAS_MetadataMapping__neu"]) - - list= [x[0] for x in finds] - return "\n".join(list) - - security.declareProtected('View management screens','editMainData') - def editMainData(self,REQUEST=None,RESPONSE=None): - """edit main data""" - self.ZCacheable_invalidate() - argv=REQUEST.form - - if not argv.has_key('last_name'): - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMainData.zpt')).__of__(self) - return pt() - else: - self.ZSQLChange(argv,_table="personal_www",_identify="lower(key)=%s"%utf8ify(self.getKey().lower()),USE_FORM="yes") - # aendere auch dien enstsprechen infos in der instance - self.changeMPIWGStaff(argv['last_name'],argv['first_name']); - - - - self.reindex_object() - - - - if RESPONSE: - self.redirect(RESPONSE,"editMainData") - - security.declareProtected('View management screens','newBibliogrpaphy') - def newBibliography(self,_docType=None, _addEntry=None,RESPONSE=None,**argv): - - """add an entry to the bibliography""" - if not _docType: #kein docType - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','newBibliographyEntryDocType.zpt')).__of__(self) - return pt() - elif _docType and not _addEntry: #doctype aber keine daten - self.REQUEST['_docType']=_docType - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','newBibliographyEntry.zpt')).__of__(self) - return pt() - else: #doctype und daten - try: - newId=self.ZSQLSimpleSearch("select nextval('id_raw')")[0].nextval - except:#id_raw existiert nich, dann neu erzeugen - - self.createOrUpdateId_raw() - newId=self.ZSQLSimpleSearch("select nextval('id_raw')")[0].nextval - - bookId="b%06i" % newId - - self.ZSQLAdd(argv,_table="bibliography",reference_type=_docType,id=bookId) - - self.ZSQLAdd(_useRequest=False,_table="publications",id_gen_bib=bookId,key_main=self.getDBId(),publish='yes') - self.updatePublicationDB(personId=self.getDBId()) - - - if RESPONSE: - self.redirect(RESPONSE,"editPublications") - - return True - - security.declareProtected('View management screens','editImage') - def editImage(self): - """edit images""" - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editImageStaff.zpt')).__of__(self) - return pt() - - security.declareProtected('View management screens','editBibliography') - def editBibliography(self): - """edit the bibliography""" - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editBibliographyEntry.zpt')).__of__(self) - return pt() - - - security.declareProtected('View management screens','editPublications') - def editPublications(self): - """edit the bibliographie""" - - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editPublications.zpt')).__of__(self) - return pt() - - def changeSortingMode(self,sortingMode,RESPONSE=None,REQUEST=None): - """change sorting mode""" - self.ZCacheable_invalidate() - self.sortingMode=sortingMode - - if RESPONSE and REQUEST: - self.redirect(RESPONSE,REQUEST['HTTP_REFERER']) - - return True - - def getSortingMode(self): - """get sorting mode""" - mode=getattr(self,'sortingMode','priority') - if mode=="year": - return "year DESC" - else: - return mode - - def integer(self,value): - try: - return int(value) - except: - return 0 - - security.declareProtected('View management screens','changePublications') - def changePublications(self,RESPONSE=None): - """change the publication list""" - self.changeResearch(noredirect=True) - self.ZCacheable_invalidate() - #self.updatePublicationDB(personId=self.getDBId()) - self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) - - - - security.declareProtected('View management screens','addPublications') - def addPublications(self,submit=None,REQUEST=None,noredirect=None,RESPONSE=None): - """add publications""" - - #setzte flag ob aufruf aus suchformular - - if REQUEST.get("QUERY_STRING",None) and (not submit): - self.REQUEST.set('fromSearch','1') - else: - self.REQUEST.set('fromSearch','0') - - if not submit or (not (submit == "add")): - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addPublications.zpt')).__of__(self) - return pt() - - #new entries - entries = REQUEST.form.get('addEntries',None) - if not (type(entries) is ListType): - entries=[entries] - - - for bibId in entries: - query="INSERT INTO %s " % "publications" - query+="(key_main,id_institutsbibliographie,publish) " - query+="VALUES ('%s','%s','yes')" %(sql_quote(self.getKey()),sql_quote(bibId)) - - #self.ZSQLAdd(_table="publications",id_institutsbibliographie=bibId,id_main=self.getDBId(),publish='yes') - self.ZSQLQuery(query) - - self.updatePublicationDB(personId=self.getKey()) - - if not noredirect: - - self.redirect(RESPONSE,"./editPublications") - - return True - - - def getDBId(self): - """get id from the personal database""" - - #in der neuen version ist definitions gemaess der key der Datenbank gleich dem key im Object. - # TODO: remove all occurences of getDBId and replaces it by getKey - return self.getKey() - -# search=self.ZSQLInlineSearch(_table='personal_www',key=self.getKey(),publish_the_data='yes') -# if search:#name existiert und published, dann nimm diesen falls es mehrereeventuell nich publizierte datensaetze gibt. -# return search[0].id -# else:#nicht publiziert dann nimm einen davon -# search2=self.ZSQLInlineSearch(_table='personal_www',username=self.getId()) -# if search2: -# return search2[0].id -# else: -# return None - - - - formatBiblHelp=bibliography.formatBiblHelp - - def sortBibliography(self,list,sortingMode=None,max=None): - if not sortingMode: - sortingMode=self.getSortingMode() - - if sortingMode == "year": - l= self.sortYear(list) - else: - l=self.sortPriority(list) - - if max: - return l[0:min(len(l),max)] - else: - return l - - def sortPriority(self,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) - - if not list: - return [] - tmp=[x for x in list] - tmp.sort(sort) - - return tmp - - def sortYear(self,list): - #TODO: sort TO APPEAR and TO BE PUBLISHED etc... - - def sort(x,y): - try: - xInt=int(x.year) - except: - xInt=0 - try: - yInt=int(y.year) - except: - yInt=0 - - return cmp(yInt,xInt) - - - tmp=[x for x in list] - - tmp.sort(sort) - return tmp - - def deleteField(self,table,oid,RESPONSE=None): - """delete entry""" - query="DELETE FROM %s WHERE oid = '%s'"%(table,oid) - - self.ZSQLQuery(query) - self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) - - -def manage_addMPIWGStaffForm(self): - """form for adding the project""" - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addMPIWGStaffForm.zpt')).__of__(self) - return pt() - -def manage_addMPIWGStaff(self,id,lastName,firstName,RESPONSE=None): - """add it""" - newObj=MPIWGStaff(id,lastName,firstName) - - self._setObject(id,newObj) - - - if RESPONSE is not None: - self.redirect(RESPONSE,'manage_main') - - diff -r 1f2760ed3efe -r ddf6c1a27a4b MPIWGStaff_old.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MPIWGStaff_old.py Thu Feb 07 19:50:39 2013 +0100 @@ -0,0 +1,1004 @@ +"""This file contains the classes for the organization of the staff""" +# TODO: pruefe ob die id der einzelnen tabellen, wie id in publications noch benutzt werden +# TODO: pruefe ob die bibliographischen felder in publications noch benutzt werden +# TODO: wird username gebraucht? + +from OFS.Folder import Folder +from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder +from Products.PageTemplates.PageTemplateFile import PageTemplateFile +from Products.PageTemplates.PageTemplate import PageTemplate +from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate +from Products.ZCatalog.CatalogPathAwareness import CatalogAware +from Products.versionedFile.extVersionedFile import extVersionedFileFolder +from AccessControl import getSecurityManager + +import os +import logging +import bibliography +import email +from Globals import package_home +from Products.PythonScripts.standard import sql_quote +from types import * +from AccessControl import ClassSecurityInfo +import time +import logging +import email +import re +from OFS.Cache import Cacheable +import urllib2 +import transaction +import SrvTxtUtils + +from MPIWGHelper import * +#ersetzt logging +def logger(txt,method,txt2): + """logging""" + logging.info(txt+ txt2) + +departmentList="Renn\nRheinberger\nDaston\nKlein\nSibum\nIT\nInstitut\nBibliothek" +coneService="http://127.0.0.1:8280/MetaDataManagerRestlet/cone/" # kann in MPIWGRoot konfiguriert werden. + + + +def createNewDBEntry(self,publish_the_data,key,name,vorname,titles_new,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""" + + if date_to=="": # wenn date_to leer + date_to="date_none" + + if date_from=="": # wenn date_fromleer + date_from="date_none" + msg="" + #test ob id schon existiert + if self.ZSQLQuery("select key from personal_www where key='%s'"%id): + return False,"ERROR:key%s already exists"%key + + #eintragen + columnlist="""publish_the_data,key,last_name,first_name,titles_new,status,e_mail,e_mail_p,date_from,date_to,department,home_inst,funded_by,e_mail2,date_stay_at_mpiwg,web_object_created,"group",current_work,current_work_p """ + insertTuple=(publish_the_data,key,name,vorname,titles_new,position,e_mail,e_mail_p,date_from,date_to,abteilung,heimat_inst,funded_by,e_mail2,stay_at_mpiwg,web_object_created,group,current_work,"yes") + + insert=[] + for element in insertTuple: + if element=="date_none": # date_none eintrag wird zu null uebersetzt + insert.append('null') + else: + insert.append("%s"%self.ZSQLQuote(element)) + + insertStr=",".join(insert) + queryStr="INSERT INTO personal_www (%s) VALUES (%s)"%(columnlist,insertStr) + self.ZSQLQuery("SET DATESTYLE TO 'German'") + self.ZSQLQuery(queryStr) + logging.info("QQQQ %s:"%queryStr) + #currentwork + #if not (current_work==""): + # queryStr="INSERT INTO current_work (key_main,current,publish) VALUES ('%s',%s,'%s')"%(key,self.ZSQLQuote(current_work),"yes") + + # self.ZSQLQuery(queryStr) + + return True,msg +class MPIWGStaff(CatalogAware,ZSQLExtendFolder,Cacheable): + """Staff""" + + meta_type="MPIWGStaff" + default_catalog='MembersCatalog' + departmentList=departmentList + #_v_cone=None; + security=ClassSecurityInfo() + + def redirect(self,RESPONSE,url): + """mache ein redirect mit einem angehaengten time stamp um ein reload zu erzwingen""" + + timeStamp=time.time() + + if url.find("?")>-1: #giebt es schon parameter + addStr="&time=%s" + else: + addStr="?time=%s" + + RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT') + logging.error(email.Utils.formatdate()+' GMT') + RESPONSE.redirect(url+addStr%timeStamp) + + def getKeyUTF8(self): + """get db_key utf8""" + logging.debug("KEY - MPIWGStaff 1:"+self.getKey()) + logging.debug("KEY - MPIWGStaff 2 :"+utf8ify(self.getKey())) + + return utf8ify(self.getKey()) + + def setKey(self,key): + """set key""" + self.key=key + + def rmKey(self): + """rm""" + self.key=None + return "" + + def getKey(self): + """get database key""" + + + if getattr(self,'key',None): + logging.debug("KEY - MPIWGStaff 4:"+self.key) + #logging.error("SAVED KEY:%s"%self.key) + return unicodify(self.key.lower()) + #return self.key.lower() + + #fuer alt faelle ohne key + #logging.error("NEW KEY:%s"%(self.firstName+'_'+self.lastName).lower().replace(' ','')) + return (self.firstName+'_'+self.lastName).lower().replace(' ','') + + def getConnectionObj(self): + """returns connection id (from root)""" + try: + root = self.getMPIWGRoot() + return root.getConnectionObj() + except: + return self.en.getConnectionObj() + + def isPublished(self): + """gib publications status aus der datenbank aus""" + key=self.getKey() + query="select count(publish_the_data) from personal_www where lower(key)='%s' and publish_the_data='yes'"%key + + res = self.ZSQLQuery(query) + + if res and res[0].count>0: + return True + else: + return False + + + + def updateDBEntry(self,publish_the_data,date_from,date_to,DBid=None,stay_at_mpiwg="",position="",abteilung=""): + """zpddatedb""" + if not DBid: + DBid=self.getDBId() + + + self.ZSQLQuery("SET DATESTYLE TO 'German'") + + test=self.ZSQLQuery("select id from personal_www where id='%s' "%DBid) + + + if test and (len(test)>0): #dataset exists + logger("MPIWG Web",logging.INFO,'UPDATE: _table="personal_www",_identify="id=%s"'%DBid+',publish_the_data=%s'%publish_the_data+',date_from=%s'%date_from+',date_to=%s'%date_to+',stay_at_mpiwg=%s'%stay_at_mpiwg+',position=%s'%position) + self.ZSQLChange(_table="personal_www",_identify="id=%s"%DBid,publish_the_data=publish_the_data, + date_from=date_from, + date_to=date_to,stay_at_mpiwg=stay_at_mpiwg,position=position,abteilung=abteilung) + return True + else: + return False + + def getPublicationSelectionMode(self): + """get publication selection mode, default 'priority'""" + return getattr(self,'publicationSelectionMode','priority') + + def changePublicationSelectionMode(self,publicationSelectionMode,RESPONSE=None): + """change PublicationSelectionMode""" + + self.publicationSelectionMode=publicationSelectionMode + self.ZCacheable_invalidate() + if RESPONSE: + self.redirect(RESPONSE,"editPublications") + + + def downloadCV(self,RESPONSE): + """download cv file""" + ob=self._getOb("downloadableFiles")._getOb("cv.pdf") + + RESPONSE.redirect(ob.absolute_url()+"/download") + + def getLastUpdateCV(self): + """getDate of Last Update""" + try: + ob=self._getOb("downloadableFiles")._getOb("cv.pdf") + return ob.getLastChangeDate() + except: + return "No file yet!" + def getLastUpdatePublications(self): + """getDate of Last Update""" + try: + ob=self._getOb("downloadableFiles")._getOb("publications.pdf") + return ob.getLastChangeDate() + except: + return "No file yet!" + def downloadPublications(self,RESPONSE): + """download publications""" + ob=self._getOb("downloadableFiles")._getOb("publications.pdf") + + RESPONSE.redirect(ob.absolute_url()+"/download") + + def changeDownloads(self,cv_pdf=None,cv_publish=None,publications_pdf=None,publications_publish=None,RESPONSE=None): + """"change the downloadable files""" + self.ZCacheable_invalidate() + if not hasattr(self,'downloadableFiles'): + + extFolder = extVersionedFileFolder() + extFolder.id = "downloadableFiles" + self._setObject(extFolder.id,extFolder) + + ob = self._getOb("downloadableFiles") + + if cv_publish: + self.cv_publish=cv_publish + + if publications_publish: + self.publications_publish=publications_publish + + if cv_pdf: + if not hasattr(ob,"cv.pdf"): + ob.addFile("",cv_pdf,newName="cv.pdf") + + else: + cvFile = getattr(ob,"cv.pdf") + cvFile.addContentObject("","",file=cv_pdf) + + if publications_pdf: + if not hasattr(ob,"publications.pdf"): + ob.addFile("",cv_pdf,newName="publications.pdf") + + else: + cvFile = getattr(ob,"publications.pdf") + cvFile.addContentObject("","",file=publications_pdf) + + if RESPONSE: + self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) + + + def getPublishImage(self): + """publish the image??, default no""" + return getattr(self,'publishImage','no') + + def updateImage(self,publishImage,file=None,rename=None,RESPONSE=None): + """update image""" + + if file and not(file.filename==""): + if self.getImageObj(): + self.getImageObj().updateImage(file,_rename=None,RESPONSE=None) + else: + # create new image object + xp = file.filename.rfind('.') + if xp > 0: + ext = file.filename[xp:] + #fn = self.getId()+ext + fn = self.getId() + logger("MPWIG STAFF", logging.INFO, "new filename: %s"%fn) + self.getImageFolder().addImage2(file,fileName=fn) + else: + logger("MPWIG STAFF", logging.ERROR, "uploaded filename %s has no extension!"%file.filename) + + self.publishImage=publishImage + + if RESPONSE: + self.redirect(RESPONSE,"edit") + + def getImageFolder(self): + """getImageFolder""" + #TODO: make place of staff image folder configurable + + try: + return self.getPhysicalRoot().www_neu.images.staff_images + except: + logger("MPWIG STAFF", logging.ERROR, "image folder not found: has to be add /www_neu/staff_images") + return None + + def getImageObj(self): + """getImage""" + imageFolder=self.getImageFolder() + + if not imageFolder: return None + + image=getattr(imageFolder,self.getId(),None) + + if not image: + for suffix in ['jpg','tif']: + + image=getattr(imageFolder,self.getId()+"."+suffix,None) + if image: + break + return image + + def getImageUrl(self): + """getImageUrl""" + image=self.getImageObj() + if not image: + return None + else: + return self.getImageObj().absolute_url()+"/image" + + def PrincipiaSearchSource(self): + """Return cataloguable key for ourselves.""" + return str(self) + + manage_options = Folder.manage_options+( + {'label':'Edit','action':'changeMPIWGStaffForm'}, + {'label':'Change Publications Special','action':'changePublications_specialForm'}, + ) + Cacheable.manage_options + + __manager_id = "ramCache" + def __init__(self,id, lastName,firstName,key): + """init""" + self.id=id + self.title=key + self.lastName=lastName + self.firstName=firstName + self.key=key + + def getPersonID(self): + """gibt den ID fuer die Person zurueck" + im Moment ist personID = id, i.e. e-mail + """ + return self.id + + def getConeUrl(self): + """gibt coneURL zurueck""" + + self.coneService=getattr(self, "coneServiceURL",coneService) + logging.debug("coneservice:"+self.coneService) + + if getattr(self,'_v_cone',None)==None: + try: + + self._v_cone=SrvTxtUtils.getHttpData(self.coneService+self.getPersonID()) + #cone = urllib2.urlopen(self.coneService+self.getPersonID()) + #self._v_cone=cone.read() + if self._v_cone==None: + self._v_cone="" + except: + self._v_cone="" + return "" + + return self._v_cone + + + + + def harvest_page_old(self,context=None): + """geharvestete seite = verschlankte version von members_main""" + #pt = getTemplate(self, "harvest_members_main") + + if not self.isPublished(): + return "" + if not context: + context=self + + + ext=getattr(self,"harvest_members_main",None) + if ext: + return getattr(self,ext.getId())() + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','harvest_members_main')).__of__(context) + + + return pt() + + def harvest_page(self,mode="normal"): + """harvest""" + logging.debug("AAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + if not self.isPublished(): + return + st = getattr(self.en.staff.members,self.getId()).index_html(mode) + + templates = self.en.getHarvestCache() + #templates = getattr(self,'getHarvestCache',self.en.getHarvestCache)() + rendered = st + templates[self.absolute_url()]=rendered + transaction.commit() + return rendered + + + + def index_html(self,mode="normal"): + """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 + + # look for individual page + if self.hasObject("index.html"): + pt = getattr(self, "index.html") + # else use template + else: + if mode=="slim": + pt = getTemplate(self, "members_main_slim") + else: + pt = getTemplate(self, "members_main") + # 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): + """Priority publications manual field""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changePublications_special.zpt')).__of__(self) + return pt() + + def changePublications_special(self,usePublicationsSpecial=None,specialPublicationsField=None,RESPONSE=None): + """change publications special params""" + self.ZCacheable_invalidate() + if usePublicationsSpecial: + self.usePublicationsSpecial=True + + else: + self.usePublicationsSpecial=False + + self.specialPublicationsField=specialPublicationsField[0:] + + if RESPONSE is not None: + self.redirect(RESPONSE,'manage_main') + + + def publications_full(self): + """show publication""" + pt=getTemplate(self, "publications_full_main") + return pt() + + def talks_full(self): + """show talks""" + pt=getTemplate(self, 'talks_full_main') + return pt() + + def teaching_full(self): + """show talks""" + pt=getTemplate(self, 'teaching_full_main') + return pt() + + def changeMPIWGStaffForm(self): + """change form""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGStaff.zpt')).__of__(self) + return pt() + + security.declareProtected('View management screens','changeMPIWGStaff') + def changeMPIWGStaff(self,lastName,firstName,key=None,RESPONSE=None): + """change it""" + self.ZCacheable_invalidate() + self.title="%s, %s"%(lastName,firstName) + self.lastName=lastName + self.firstName=firstName + if key: + self.key = key + + + if RESPONSE is not None: + self.redirect(RESPONSE,'manage_main') + + security.declareProtected('View management screens','edit') + def edit(self): + """Edit the pages""" + #TODO: zusammenspiel mit apache, redirect auf 18080 rausnehmen bzw. zumindest verallgemeinern + #if self.REQUEST['SERVER_URL']=="http://www.mpiwg-berlin.mpg.de": + # redURL="http://xserve04.mpiwg-berlin.mpg.de:18080/www_neu/de/mitarbeiter/members/%s/edit"%self.getId() + # + # self.REQUEST.RESPONSE.redirect(redURL) + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMPIWGStaff.zpt')).__of__(self) + + + logging.debug("XX:"+email.Utils.formatdate().split("-")[0]+'GMT') + 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.""" + + if path == selected: + return style + 'sel' + else: + return style + + + def getLabel(self): + """returns a label for this object""" + return self.title + + def getBreadcrumbs(self): + """return list of breadcrumbs from here to the root""" + crumbs = [] + # skip direct parent Folder /members/ + parent = self.aq_parent.aq_parent + # get parents breadcrumbs + logging.debug("getbreadcrumbs-: title=%s self=%s parent=%s"%(self.title, repr(self), repr(parent))) + if hasattr(parent, 'getBreadcrumbs'): + logging.debug("getbreadcrumbs: recurse to %s"%parent) + crumbs = parent.getBreadcrumbs() + + # try to get acquisition URL from parent + if hasattr(parent, 'absolute_url'): + baseUrl = "%s/%s/"%(parent.absolute_url(), 'members') + else: + baseUrl = "/en/staff/members/" + + # add this + crumbs.append((self.getLabel(), baseUrl+self.getId(), self)) + + return crumbs + + + 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)) + self.ZCacheable_invalidate() + if RESPONSE: + self.redirect(RESPONSE,"edit") + + security.declareProtected('View management screens','changeResearch') + def changeResearch(self,noredirect=None,RESPONSE=None): + """change the research entries""" + self.ZCacheable_invalidate() + newEntries={} + key_main=self.REQUEST.form['key_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=['key_main'] + values=["'"+sql_quote(key_main)+"'"] + for key in newEntries[newEntry].keys(): + keys.append(key) + values.append("'"+sql_quote(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.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) + + security.declareProtected('View management screens','editCV') + def editCV(self,cv=None,oid=None,RESPONSE=None): + """edit Cv""" + + if (not oid): + 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.ZCacheable_invalidate() + self.ZSQLQuery(query%(self.ZSQLQuote(cv),oid)) + + if RESPONSE: + self.redirect(RESPONSE,"editCV") + + + def getProfile(self): + """get the profile""" + self.REQUEST.RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT') + + founds=self.ZSQLInlineSearchU(_table='personal_www',key=self.getKeyUTF8()) + 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() + + self.ZCacheable_invalidate() + + + 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: + self.redirect(RESPONSE,"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: + self.redirect(RESPONSE,"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.getKeyUTF8()) + 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+"
" + if (person.cv) and (not person.cv==""): + ret+="

Curriculum Vitae:


" + ret+=self.formatAscii(person.cv) + + return ret + security.declareProtected('View management screens','editDownloads') + def editDownloads(self): + """editiere die Downloads von der Webseite""" + + 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""" + + if (not oid): + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editAwards.zpt')).__of__(self) + return pt() + self.ZCacheable_invalidate() + query="UPDATE personal_www SET awards =%s WHERE oid='%s'" + + self.ZSQLQuery(query%(self.ZSQLQuote(awards),oid)) + + + if RESPONSE: + self.redirect(RESPONSE,"editAwards") + + security.declareProtected('View management screens','editTalks') + def editTalks(self): + """edit talks""" + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editTalks.zpt')).__of__(self) + return pt() + + security.declareProtected('View management screens','editTeaching') + def editTeaching(self): + """edit Teaching""" + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editTeaching.zpt')).__of__(self) + return pt() + + def getDocTypes(self): + finds = self.ZopeFind(self.metadata.main.meta.bib,obj_metatypes=["OSAS_MetadataMapping__neu"]) + + list= [x[0] for x in finds] + return "\n".join(list) + + security.declareProtected('View management screens','editMainData') + def editMainData(self,REQUEST=None,RESPONSE=None): + """edit main data""" + self.ZCacheable_invalidate() + argv=REQUEST.form + + if not argv.has_key('last_name'): + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMainData.zpt')).__of__(self) + return pt() + else: + self.ZSQLChange(argv,_table="personal_www",_identify="lower(key)=%s"%utf8ify(self.getKey().lower()),USE_FORM="yes") + # aendere auch dien enstsprechen infos in der instance + self.changeMPIWGStaff(argv['last_name'],argv['first_name']); + + + + self.reindex_object() + + + + if RESPONSE: + self.redirect(RESPONSE,"editMainData") + + security.declareProtected('View management screens','newBibliogrpaphy') + def newBibliography(self,_docType=None, _addEntry=None,RESPONSE=None,**argv): + + """add an entry to the bibliography""" + if not _docType: #kein docType + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','newBibliographyEntryDocType.zpt')).__of__(self) + return pt() + elif _docType and not _addEntry: #doctype aber keine daten + self.REQUEST['_docType']=_docType + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','newBibliographyEntry.zpt')).__of__(self) + return pt() + else: #doctype und daten + try: + newId=self.ZSQLSimpleSearch("select nextval('id_raw')")[0].nextval + except:#id_raw existiert nich, dann neu erzeugen + + self.createOrUpdateId_raw() + newId=self.ZSQLSimpleSearch("select nextval('id_raw')")[0].nextval + + bookId="b%06i" % newId + + self.ZSQLAdd(argv,_table="bibliography",reference_type=_docType,id=bookId) + + self.ZSQLAdd(_useRequest=False,_table="publications",id_gen_bib=bookId,key_main=self.getDBId(),publish='yes') + self.updatePublicationDB(personId=self.getDBId()) + + + if RESPONSE: + self.redirect(RESPONSE,"editPublications") + + return True + + security.declareProtected('View management screens','editImage') + def editImage(self): + """edit images""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editImageStaff.zpt')).__of__(self) + return pt() + + security.declareProtected('View management screens','editBibliography') + def editBibliography(self): + """edit the bibliography""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editBibliographyEntry.zpt')).__of__(self) + return pt() + + + security.declareProtected('View management screens','editPublications') + def editPublications(self): + """edit the bibliographie""" + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editPublications.zpt')).__of__(self) + return pt() + + def changeSortingMode(self,sortingMode,RESPONSE=None,REQUEST=None): + """change sorting mode""" + self.ZCacheable_invalidate() + self.sortingMode=sortingMode + + if RESPONSE and REQUEST: + self.redirect(RESPONSE,REQUEST['HTTP_REFERER']) + + return True + + def getSortingMode(self): + """get sorting mode""" + mode=getattr(self,'sortingMode','priority') + if mode=="year": + return "year DESC" + else: + return mode + + def integer(self,value): + try: + return int(value) + except: + return 0 + + security.declareProtected('View management screens','changePublications') + def changePublications(self,RESPONSE=None): + """change the publication list""" + self.changeResearch(noredirect=True) + self.ZCacheable_invalidate() + #self.updatePublicationDB(personId=self.getDBId()) + self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) + + + + security.declareProtected('View management screens','addPublications') + def addPublications(self,submit=None,REQUEST=None,noredirect=None,RESPONSE=None): + """add publications""" + + #setzte flag ob aufruf aus suchformular + + if REQUEST.get("QUERY_STRING",None) and (not submit): + self.REQUEST.set('fromSearch','1') + else: + self.REQUEST.set('fromSearch','0') + + if not submit or (not (submit == "add")): + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addPublications.zpt')).__of__(self) + return pt() + + #new entries + entries = REQUEST.form.get('addEntries',None) + if not (type(entries) is ListType): + entries=[entries] + + + for bibId in entries: + query="INSERT INTO %s " % "publications" + query+="(key_main,id_institutsbibliographie,publish) " + query+="VALUES ('%s','%s','yes')" %(sql_quote(self.getKey()),sql_quote(bibId)) + + #self.ZSQLAdd(_table="publications",id_institutsbibliographie=bibId,id_main=self.getDBId(),publish='yes') + self.ZSQLQuery(query) + + self.updatePublicationDB(personId=self.getKey()) + + if not noredirect: + + self.redirect(RESPONSE,"./editPublications") + + return True + + + def getDBId(self): + """get id from the personal database""" + + #in der neuen version ist definitions gemaess der key der Datenbank gleich dem key im Object. + # TODO: remove all occurences of getDBId and replaces it by getKey + return self.getKey() + +# search=self.ZSQLInlineSearch(_table='personal_www',key=self.getKey(),publish_the_data='yes') +# if search:#name existiert und published, dann nimm diesen falls es mehrereeventuell nich publizierte datensaetze gibt. +# return search[0].id +# else:#nicht publiziert dann nimm einen davon +# search2=self.ZSQLInlineSearch(_table='personal_www',username=self.getId()) +# if search2: +# return search2[0].id +# else: +# return None + + + + formatBiblHelp=bibliography.formatBiblHelp + + def sortBibliography(self,list,sortingMode=None,max=None): + if not sortingMode: + sortingMode=self.getSortingMode() + + if sortingMode == "year": + l= self.sortYear(list) + else: + l=self.sortPriority(list) + + if max: + return l[0:min(len(l),max)] + else: + return l + + def sortPriority(self,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) + + if not list: + return [] + tmp=[x for x in list] + tmp.sort(sort) + + return tmp + + def sortYear(self,list): + #TODO: sort TO APPEAR and TO BE PUBLISHED etc... + + def sort(x,y): + try: + xInt=int(x.year) + except: + xInt=0 + try: + yInt=int(y.year) + except: + yInt=0 + + return cmp(yInt,xInt) + + + tmp=[x for x in list] + + tmp.sort(sort) + return tmp + + def deleteField(self,table,oid,RESPONSE=None): + """delete entry""" + query="DELETE FROM %s WHERE oid = '%s'"%(table,oid) + + self.ZSQLQuery(query) + self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER']) + + +def manage_addMPIWGStaffForm(self): + """form for adding the project""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addMPIWGStaffForm.zpt')).__of__(self) + return pt() + +def manage_addMPIWGStaff(self,id,lastName,firstName,RESPONSE=None): + """add it""" + newObj=MPIWGStaff(id,lastName,firstName) + + self._setObject(id,newObj) + + + if RESPONSE is not None: + self.redirect(RESPONSE,'manage_main') + + diff -r 1f2760ed3efe -r ddf6c1a27a4b __init__.py --- a/__init__.py Wed Jan 30 11:47:21 2013 +0100 +++ b/__init__.py Thu Feb 07 19:50:39 2013 +0100 @@ -67,3 +67,11 @@ ) ) + context.registerClass( + MPIWGStaff.MPIWGStaffFolder, + constructors = ( + MPIWGStaff.manage_addMPIWGStaffFolderForm, + MPIWGStaff.manage_addMPIWGStaffFolder + ) + ) + diff -r 1f2760ed3efe -r ddf6c1a27a4b css/mpiwg.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/css/mpiwg.css Thu Feb 07 19:50:39 2013 +0100 @@ -0,0 +1,1149 @@ +/* MPIWG website style sheet + * + * (c) 2013 Robert Casties + */ + + + +body { + margin: 0; + font-family: Verdana, Arial, sans-serif; + background-color: #fdf8ef; + font-size: 12px; +} + +/* + * global styles + */ + +img { + border: none; +} + +a { + color: #ee802d; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +/* new link-classes (with icons) */ + +a.internal { + background: url(../images/arr_more.gif) no-repeat; + padding-left: 12px; + padding-top: 1px; +} + +a.download { + background: url(../images/download.gif) no-repeat; + padding-left: 17px; +/* padding-top:1px; */ +} + +a.external { + background: url(../images/external.gif) no-repeat; + padding-left: 15px; +/* padding-top:1px; */ +} +a.pdf { + background: url(../images/pdf.gif) no-repeat; + padding-left: 15px; +/* padding-top:1px; */ +} + +a.audio { + background: url(../images/audio.gif) no-repeat; + padding-left: 15px; +/* padding-top:1px; */ +} + +a.book { + background: url(../images/book.gif) no-repeat; + padding-left: 20px; + margin-left: -5px; + margin-top: -1px; +} + +a.maillink { + color: #485297 !important; +} + +h1 a { + /* a header with a link looks like a header */ + color: inherit; + font-weight: inherit; + text-decoration: none; +} + +img.pic_large { + /* class for wide pictures used for example on institute/addres.html etc. */ + margin-bottom: 20px; +} + + +/* + * header and wrapper + */ + +#wrapper { + /* float: left; */ + width: 960px; + margin: 0 auto; + padding: 20px 0 0 20px; + background-color: #fcf2df; +} + +#header { + /* float: left; */ + width: 900px; + margin: 0 0 10px 0; +} + +#header div.title { + display: inline; + /* float: left; */ + width: 661px; + height: 40px; +} + +#header div.title img { + margin-bottom: 30px; +} + +#header div.logo { + display: inline; + /* float: right; */ + width: 87px; + height: 88px; +} + +#header div.logo img { + margin-left: 145px; +} + +/* Main Navigation */ + +#mainnav { + /* float: left; */ + width: 900px; + font-size: 12px; + border-top: 8px solid #fab775; + margin-bottom: 20px; + padding-top: 5px; +} + +#mainnav div.sec { + display: inline; + /* float: left; */ + border-top: 8px solid #fab775; + margin-top: -0px; + margin-right: 35px; + padding-top: 5px; +} + +#mainnav div.sec:hover { + border-top: 8px solid #ea8500; +} + +#mainnav a { + color: #666666; + outline: none; +} + +#mainnav a:hover { + color: #000000; + text-decoration: none; +} + +#mainnav div.sec.on { + border-top: 8px solid #ea8500; +} + +#mainnav div.sec.on a { + color: #ea8500; + outline: none; + font-weight: bold; +} + +#mainnav div.sec.lang { + float: right; + margin-top: -13px; + margin-right: 0; +} + + + + + + +/* Search */ + +div.search { + float: left; + width: 900px; + height: 25px; +} + +#wrapper_home div.search { + float: right; + width: 220px; +} + +.searchform { + float: right; +} + +input.searchinput { + width: 211px; + padding-left: 18px; + border: 1px solid #dccbae; + background: url(../images/search.gif) no-repeat #FFFFFF; + color: #EA8500; +} + + + + + + +/* Breadcrumbs & Quicklinks */ + +div.quicklinks { + float: left; + width: 900px; + border-bottom: 3px solid #dccbae; + color: #EA8500; +} + +#wrapper_home div.quicklinks { + float: right; + width: 230px; + border-bottom: none; +} + +div.breadcrumbs { + float: left; + font-size: 10px; + color: #6a4d3c; +} + +div.breadcrumbs a { + color: #6a4d3c; + text-decoration: none; +} + +div.breadcrumbs .selected { + color: #6a4d3c; + font-weight: bold; +} + +select.quickfind { + float: right; + width: 230px; + height: 20px; + padding: 2px 2px 2px 18px; + color: #EA8500; + font-size: 11px; + border: none; + background: url(../images/arr_qf.gif) no-repeat #f4daae; +} + + + + + + + + + +/* + * Content + */ + +/* frontpage */ + +div.feature, div.feature .thumbnails { + float: left; + width: 650px; +/* margin-right: 20px; */ + font-size: 12px; + line-height: 1.6; +} + +div.feature .thumb { + float: left; + width: 129px; + margin-right: 1px; + margin-bottom: 1px; +} + +div.feature .feature_image { + float: left; + width: 650px; + margin-bottom: 15px; +} + +div.feature .caption { + text-align: right; + font-size: 10px; + color: #b69f7b; + margin-top: 5px; +} + +div.feature h1 { + color: #485297; + font-size: 15px; + font-weight: bold; + margin: 10px 2px 2px 2px; +} + +div.feature h2 { + color: #485297; + font-size: 15px; + font-weight:normal; + margin: 10px 2px 2px 2px; +} + +div.feature p { +/* margin-top: 0.5em; + margin-bottom: 0.5em; */ +} + + + + +/* + * main section + */ + +div.content { + float: left; + width: 900px; +} + +div.main { + float: left; + width: 720px; + background-color: #FFFFFF; + margin-bottom: 10px; + padding-right: 10px; + font-size: 12px; +} + +div.main div.center { + float: left; + width: 460px; + padding: 20px; +} + + +div.center, div.center_wide { + line-height: 1.6; +} +div.center ul { + list-style: none; + margin-left: 0; + padding: 0; +} + +div.center li { + margin-bottom: 10px; +} + + +div.main div.center_wide { + float: left; + width: 710px; +/* padding: 20px 0 0 20px; */ + padding: 20px; +} + + +div.main h1 { + color: #485297; + font-size: 15px; + font-weight: bold; + margin: 10px 2px 10px 2px; +} + +div.main h2 { + color: #485297; + font-size: 15px; + font-weight: normal; + margin: 2px; +} + +div.main h3 { + color: #485297; + font-size: 13px; + font-weight: normal; + margin: 2px; +} + + + + + +/* + * subnavigation + */ + +div.leftbox { + float: left; + width: 170px; +} + +div.subnav { + float: left; + width: 170px; + font-size: 11px; +} + +div.subnav .sn_off, .subnavbox .sn_off { + float: left; + width: 164px; + border-bottom: 1px solid #dccbae; + padding: 3px 6px 6px 0; +} + +div.subnav .sn_on { + float: left; + width: 158px; + border-bottom: 1px solid #dccbae; + padding: 3px 6px 6px 6px; + background: #EA8500; +} + +div.subnav .sn_on a { + color: #FCF2DF; + font-weight: bold; +} + +div.subnav .sn_off .dept { + font-style: italic; + color: #b69f7b; +} + +div.subnav .sn_on .dept { + font-style: italic; + color: #f9f4e1; +} + +div.subnavbox { + /* navigation below e.g. research projects */ + float: left; + width: 170px; + font-size: 11px; + margin-top: 30px; +} + +div.subnavbox h2 { + float: left; + width: 170px; + height: 20px; + font-size: 11px; + color: #b69f7b; + margin-bottom: 0px; + padding-bottom: 3px; + margin-top: 20px; + background: transparent url(../images/side.gif) repeat-x; +} + + + + + + +/* + * research section + */ + +div.center_wide.dept { + padding-left: 16px !important; + padding-right: 0 !important; +} + +div.center.dept { + padding-left: 16px !important; + padding-right: 0 !important; + width: 480px !important; +} + +div.dept_block { + float: left; + width: 221px; + min-height:420px; + border-bottom: 2px solid #979CE0; + margin-right: 15px; + margin-bottom: 20px; + font-size: 11px; +} + +div.dept_block.clear { + clear:left; +} + +div.dept_block.wide { + width: 460px !important; + min-height:0px !important; + height: auto !important; +} + +div.dept_block.short { + min-height: 290px !important; + border-bottom: None; +} + +div.dept_block h2 { + margin: 0 0 5px 0; + font-size: 13px; + font-weight: normal; + color: #485297; +} + +div.dept_block.wide h2 { + margin: 0 0 5px 0; + font-size: 16px; + color: #485297; +} + +div.dept_block h1 { + font-size: 13px; + font-weight: bold; + color: #485297; +} + +div.dept_block.wide h1 { + font-size: 16px; +} + +div.dept_block h2 a, div.dept_block h1 a { + color: #485297; +} + +div.dept_block p { + font-size: 11px; + line-height: 1.6; +} + +p.dept_leader, p.dept_summary { + /* legacy */ + font-size: 11px; + line-height:1.4; +} + + + +/* + * people list + */ + +div.namelist { + float: left; + clear: left; + padding-top: 10px; +} + +div.namelist.line { + border-top: 3px solid #dccbae; +} +/* NEW */ +div.namelist h2 { + border-bottom: 3px solid #dccbae; +} +div.namelist h2.noline { + border-bottom: none; +} +div.namelist.small { + font-size: 11px; +} + +div.center_wide div.namelist { + width: 700px; +} +div.center div.namelist div.row { + width:100%; +} +div.namelist div.row { + float: left; + border-bottom: 1px solid #dccbae; + margin-top: 5px; + padding-bottom: 7px; +} +div.namelist div.row.noline { + border-bottom: none; +} + +div.center_wide div.namelist div.row { + width: 700px; +} + +div.namelist div.row:last-child { + border-bottom: none; +} + +div.namelist .name { + display: block; + float: left; + width: 30%; +} + +div.namelist.namelinks .name a { + color: #485297; +} + +div.namelist .definition { + display: block; + float: left; + width: 70%; +} + +div.namelist.namelinks .definition a { + color: #485297; +} + +/* legacy */ +div.namelist.namelinks .definition.normallinks a { + color: #EA8500; +} + +div.list_disclaimer { + float: left; + width: 180px; + font-size: 10px; + margin-right: 20px; +} + +div.letters { + float: left; + margin-right: 10px; + color: #EA8500; +} +div.letters a { + margin-left: 0.2em; + margin-right: 0.2em; +} + +div.letter { + float: left; + width: 700px; + margin-top: 20px; + padding-bottom: 3px; + border-bottom: 3px solid #dccbae; + font-weight: bold; + font-size: 13px; + color: #dccbae; +} + +div.jump_top { + float: left; + width: 700px; + text-align: right; + font-size: 10px; +} + + + + +/* bios */ + +p.bio_section_header { + color: #485297; + padding-bottom: 5px; + margin-bottom: 5px; + border-bottom: 1px solid #dccbae; +} + + + +/* + * right sidebar + */ + +div.sidebar { + float: right; + width: 220px; + font-size: 10px; + line-height: 1.6; +/* margin-right: 10px; */ +} + +#wrapper_home .sidebar { + width: 230px; +} + +div.sideblock { +/* border-bottom: 1px solid #dccbae; */ + float: left; + clear: left; +} + +div.sideblock h2 { + padding-bottom: 5px; + margin: 18px 0px 0px 0px; + /* brown bottom line + background: transparent url(../images/side.gif) repeat-x; + */ + border-bottom: 3px solid #dccbae; + font-size: 12px; + color: #485297; + /*float:left; + clear:both;*/ + font-weight: normal; +} + +div.sideblock h2 a { + /* no longer so ugly hack to have right-adjust link... */ + float: right; + color: #EA8500; + font-size: 10px; +} + +div.sideblock h2 .proj_state { + /* right-adjusted block besides the title */ + float: right; + font-size: 10px; + color: #b69f7b; + font-weight: bold; +} +div.sideblock h2 .proj_state a { + /* inside should not float */ + float: none; +} + +div.sideblock a.maillink { + color: #ea8500 !important; +} + +div.sideblock .item, div.sideblock p { + float:left; + width:220px; + margin: 5px 0 0 0; + padding: 0 0 5px 0; + border-bottom: 1px solid #dccbae; + +} + +div.sideblock .item.noline { + border-bottom: none; +} + +div.sideblock .project { + background: url(../images/arr_right.gif) no-repeat #f5daaf; + padding: 6px 6px 6px 20px; + border-bottom: 1px solid #f3be7c; + width:194px; +} + +div.sideblock .project.inactive { + background: url(../images/arr_right.gif) no-repeat #f6e6cc; + width:194px; +} + +div.sideblock .project.parent { + background: url(../images/arr_up.gif) no-repeat #f9f4e1; + color: #666666; + border-bottom: 1px solid #dccbae; + margin-top:20px; +} + +div.sideblock .project a { + color: #333; +} + +div.sideblock .item.featurearchive { + border-bottom:none; + float:left; + margin: 5px 0 10px 0; + padding: 0 0 5px 0; + border-bottom: None; +} + +div.sideblock .item img { + margin-right: 8px; +} + +div.sideblock .item.link, div.sideblock .item.internal { + padding: 0 0 10px 20px; + background: url(../images/arr_more.gif) no-repeat; + width: 200px; +} +div.sideblock .item.book { + padding: 0 0 10px 20px; + background: url(../images/book.gif) no-repeat; + width: 200px; +} + +div.sideblock .item.external { + padding: 0 0 10px 20px; + background: url(../images/external.gif) no-repeat; + width: 200px; +} + +div.sideblock .item.video { + padding: 0 0 10px 20px; + background: url(../images/vid.gif) no-repeat; + width: 200px; +} + +div.sideblock .item.audio { + padding: 0 0 10px 20px; + background: url(../images/audio.gif) no-repeat; + width: 200px; +} + +div.sideblock .item.download { + padding: 0 0 10px 20px; + background: url(../images/download.gif) no-repeat; + width: 200px; +} + + + + +/* + * footer + */ + +.footer { + float: left; + width: 700px; + background-color: #FFFFFF; + margin: 0 10px 20px 20px; + border-top: 1px solid #485297; +} + +#wrapper_home .footer { + float: left; + width: 900px; + margin: 0 10px 20px 20px; + border-top: 1px solid #dccbae; +} + +div.services { + float: right; + font-size: 11px; + margin-top: 5px; +} + +.services a { + color: #485297; +} + +div.serviceprint { + float: left; + margin-left: 20px; + padding-left: 20px; + height: 25px; + background: url(../images/print.gif) no-repeat; +} + +div.serviceforward { + float: left; + margin-left: 20px; + padding-left: 20px; + height: 25px; + background: url(../images/forward.gif) no-repeat; +} + +div.servicepdf { + float: left; + margin-left: 20px; + padding-left: 20px; + height: 25px; + background: url(../images/pdf.gif) no-repeat; +} + +div.boilerplate { + float: left; + margin: 0 0 50px 170px; + width: 730px; +} + +#wrapper_home div.boilerplate { + float: left; + margin: 30px 0 50px 0px; + width: 900px; + border-top: 1px solid #dccbae; + padding-top: 10px; +} + +div.legal { + float: left; + font-size: 11px; + color: #EA8500; +} + +div.mpg_signet { + float: right; +} + + +/* more generic lists */ + +ul.big { + width:100%; +} + +ul.big li { + border-bottom: 1px solid #dccbae; + margin-top: 5px; + padding-bottom: 7px; +} +ul.big li:last-child { + border-bottom: none; +} + + + +/* Sitemap */ +div.dept_block_sitemap { + float: left; + width: 221px; + font-size: 11px; +} + +.dept_title_sitemap { + margin: 0 0 5px 0; + font-size: 13px; + color: #485297; + width: 221px; + padding-top: 5px; + border-top: 2px solid #979CE0; +} + +.dept_title a, .dept_title_sitemap a, .dept_headline a { + color: #485297; +} + + +div.banner_large .caption { + font-size: 10px; + color: #b69f7b; + margin-top: 5px; +} + + +div.image_large .caption { + font-size: 10px; + color: #b69f7b; + margin-top: 5px; +} +div.image_small { + width: 230px; + padding: 10px; +} +div.image_small.left { + float: left; + padding-left: 0px; +} +div.image_small.right { + float: right; + padding-right: 0px; +} +div.image_small .caption { + font-size: 10px; + color: #b69f7b; + margin-top: 5px; +} + + + +/* projects */ + +div.projectlist { + width:100%; +} + +div.projectlist h2 { + width:700px; + font-size: 13px; + border-bottom: 2px solid #dccbae; + font-weight:normal; +} +div.projectlist h2 a { + color: #485297; +} +div.projectlist h2 a .dep { + font-weight:bold; + color: #485297; + margin-right:10px; +} +div.project_block { + margin-top:10px; + margin-bottom:14px; +} + +ul.projectlist { + list-style-image:url(../images/arr_more.gif); +/* line-height: 20px; */ +} +ul.projectlist a{ + color: #485297; +} + + +p.maintext_more { + font-size: 12px; + margin-top: -10px; + padding-left: 15px; + background: url(../images/arr_more.gif) no-repeat; +} +p.maintext_authors { + font-size: 12px; + font-weight: bold; +} + + +div.caption_inline { + /* caption for images on project pages */ + float: left; + width: 208px; + font-size: 9px; + color: #b69f7b; + margin-top: 5px; +} + +div.pic_inline { + float: left; + width: 220px; +} +div.pic_inline_container { + float: left; + width: 220px; + margin: 5px 15px 0 0; +} + + + +/* Research Units */ +li.level_1 { + margin-left:2px; +} +li.level_2 { + margin-left:22px; + border-bottom: 1px solid #dccbae; + font-weight:bold; +} +li.level_3 { + margin-left:52px; + font-weight:bold; +} +li.level_4 { + margin-left:82px; +} + +a.expand { + margin-left:45px; + margin-top:10px; +} + + + + + + + +/* Events */ + +div.event { + margin-bottom: 44px; +} + +div.event span.category{ + border-bottom:1px solid #dccbae; + color: #485297; + + font-size:12px; +} +div.event h2 { + margin-left:0px; +/* color: #dccbae; + font-weight:bold; + border-bottom:2px solid #dccbae; + */ + color: #485297; + font-weight:normal; +} + +div.event h1{ + margin-left:0px; +} + +div.event p { + font-size: 11px; + + margin-left:82px; +} + + +div.event div.row { + width:100%; + float: left; + border-bottom: 1px solid #dccbae; + margin-bottom: 5px; + padding-bottom: 7px; +} + + +div.event div.row div.name { + float:left; + width:80px; + color:#485297; +} + +div.event div.row div.definition { + float:left; + margin-left:20px; + width:300px; +} + + + +/* mediathek */ + +div.media_nav { + background-color:#ffffff; +} + +div.media_nav div.element { + float:left; + margin-left:8px; + margin-right:8px; +} + + + +/* unknown */ +div.line{ + border-bottom: 3px solid #dccbae; + margin-bottom:10px; + margin-top:10px; + width:700px; +} +/* used e.g. on staff-pages 'kollegium/board of directors' */ + +.deptlink { + color: #485297; + margin:20px; +} + +ul.presse li { + border-top: 1px solid #dccbae; + font-size: 11px; + padding-left:8px; + padding-top: 8px; +} + +h2.line { + border-bottom:2px solid #dccbae; + margin-bottom:8px; +} +h1.line { + border-bottom:3px solid #dccbae; + padding-bottom:5px; +} + diff -r 1f2760ed3efe -r ddf6c1a27a4b zpt/addMPIWGStaffFolderForm.zpt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zpt/addMPIWGStaffFolderForm.zpt Thu Feb 07 19:50:39 2013 +0100 @@ -0,0 +1,9 @@ +
Header
+

Add a MPIWGStaff folder

+
+

ID

+

+

Title

+

+

+
diff -r 1f2760ed3efe -r ddf6c1a27a4b zpt/www/main_template.zpt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zpt/www/main_template.zpt Thu Feb 07 19:50:39 2013 +0100 @@ -0,0 +1,106 @@ + + + + + Max Planck Institute for the History of Science + + + + + + +
+
+ + + + + + +
+
+ + +
+ +
+ +
+ + + + + + +
+ + + + +
+ +
+ + +