annotate MPIWGStaff.py @ 57:84879a3f91a6

getLastArrivals
author dwinter
date Tue, 30 Apr 2013 22:34:00 +0200
parents a6ace48c2bf2
children d452fff7c52e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1 """This file contains the classes for the organization of the staff"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
2 # TODO: pruefe ob die id der einzelnen tabellen, wie id in publications noch benutzt werden
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
3 # TODO: pruefe ob die bibliographischen felder in publications noch benutzt werden
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
4 # TODO: wird username gebraucht?
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
5
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
6 from zExceptions import Redirect
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
7
0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
8 from OFS.Folder import Folder
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
9 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
10 from Products.PageTemplates.PageTemplate import PageTemplate
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
11 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
12 from Products.ZCatalog.CatalogPathAwareness import CatalogAware
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
13 from Products.versionedFile.extVersionedFile import extVersionedFileFolder
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
14 from AccessControl import getSecurityManager
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
15
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
16 from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
17
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
18 from Products.ZDBInterface.ZDBInterfaceFolder import ZDBInterfaceFolder
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
19 from AccessControl import ClassSecurityInfo
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
20 from App.class_init import InitializeClass
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
21 from Products.ExtFile.ExtFile import *
0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
22 import os
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
23 import logging
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
24 import email
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
25 from Globals import package_home
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
26 from Products.PythonScripts.standard import sql_quote
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
27 from types import *
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
28 import time
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
29 import logging
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
30 import re
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
31 from OFS.Cache import Cacheable
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
32 import urllib2
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
33 import transaction
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
34
28
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
35 from SrvTxtUtils import getHttpData, getAt, getInt, unicodify, utf8ify
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
36 import bibliography
0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
37
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
38 from MPIWGHelper import *
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
39 #ersetzt logging
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
40 def logger(txt,method,txt2):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
41 """logging"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
42 logging.info(txt+ txt2)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
43
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
44 departmentList="Renn\nRheinberger\nDaston\nKlein\nSibum\nIT\nInstitut\nBibliothek"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
45 coneService="http://127.0.0.1:8280/MetaDataManagerRestlet/cone/" # kann in MPIWGRoot konfiguriert werden.
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
46
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
47
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
48
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
49 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=""):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
50 """lege person in der datenbank an"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
51
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
52 if date_to=="": # wenn date_to leer
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
53 date_to="date_none"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
54
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
55 if date_from=="": # wenn date_fromleer
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
56 date_from="date_none"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
57 msg=""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
58 #test ob id schon existiert
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
59 if self.ZSQLQuery("select key from personal_www where key='%s'"%id):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
60 return False,"ERROR:key%s already exists"%key
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
61
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
62 #eintragen
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
63 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 """
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
64 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")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
65
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
66 insert=[]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
67 for element in insertTuple:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
68 if element=="date_none": # date_none eintrag wird zu null uebersetzt
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
69 insert.append('null')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
70 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
71 insert.append("%s"%self.ZSQLQuote(element))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
72
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
73 insertStr=",".join(insert)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
74 queryStr="INSERT INTO personal_www (%s) VALUES (%s)"%(columnlist,insertStr)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
75 self.ZSQLQuery("SET DATESTYLE TO 'German'")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
76 self.ZSQLQuery(queryStr)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
77 logging.info("QQQQ %s:"%queryStr)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
78 #currentwork
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
79 #if not (current_work==""):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
80 # queryStr="INSERT INTO current_work (key_main,current,publish) VALUES ('%s',%s,'%s')"%(key,self.ZSQLQuote(current_work),"yes")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
81
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
82 # self.ZSQLQuery(queryStr)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
83
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
84 return True,msg
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
85
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
86
0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
87 class MPIWGStaff(CatalogAware,ZSQLExtendFolder,Cacheable):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
88 """Staff"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
89
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
90 meta_type="MPIWGStaff"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
91 default_catalog='MembersCatalog'
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
92 departmentList=departmentList
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
93 #_v_cone=None;
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
94 security=ClassSecurityInfo()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
95
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
96 manage_options = Folder.manage_options+(
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
97 {'label':'Edit','action':'changeMPIWGStaffForm'},
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
98 {'label':'Change Publications Special','action':'changePublications_specialForm'},
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
99 ) + Cacheable.manage_options
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
100
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
101 __manager_id = "ramCache"
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
102 def __init__(self,id, lastName,firstName,key):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
103 """init"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
104 self.id=id
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
105 self.title=key
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
106 self.lastName=lastName
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
107 self.firstName=firstName
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
108 self.key=key
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
109
28
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
110 # compat TODO: remove this
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
111 def getat(self, array, idx, default=None):
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
112 """returns always an int (0 in case of problems)"""
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
113 return getAt(array, idx, default)
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
114
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
115 # compat TODO: remove this
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
116 def decode(self, s):
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
117 """TODO: remove this"""
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
118 return unicodify(s)
dd765003647b compatibility band-aid.
casties
parents: 3
diff changeset
119
0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
120 def redirect(self,RESPONSE,url):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
121 """mache ein redirect mit einem angehaengten time stamp um ein reload zu erzwingen"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
122
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
123 timeStamp=time.time()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
124
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
125 if url.find("?")>-1: #giebt es schon parameter
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
126 addStr="&time=%s"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
127 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
128 addStr="?time=%s"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
129
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
130 RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
131 logging.error(email.Utils.formatdate()+' GMT')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
132 RESPONSE.redirect(url+addStr%timeStamp)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
133
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
134 def getKeyUTF8(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
135 """get db_key utf8"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
136 logging.debug("KEY - MPIWGStaff 1:"+self.getKey())
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
137 logging.debug("KEY - MPIWGStaff 2 :"+utf8ify(self.getKey()))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
138
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
139 return utf8ify(self.getKey())
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
140
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
141 def setKey(self,key):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
142 """set key"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
143 self.key=key
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
144
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
145 def rmKey(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
146 """rm"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
147 self.key=None
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
148 return ""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
149
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
150 def getKey(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
151 """get database key"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
152
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
153
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
154 if getattr(self,'key',None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
155 logging.debug("KEY - MPIWGStaff 4:"+self.key)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
156 #logging.error("SAVED KEY:%s"%self.key)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
157 return unicodify(self.key.lower())
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
158 #return self.key.lower()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
159
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
160 #fuer alt faelle ohne key
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
161 #logging.error("NEW KEY:%s"%(self.firstName+'_'+self.lastName).lower().replace(' ',''))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
162 return (self.firstName+'_'+self.lastName).lower().replace(' ','')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
163
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
164 def getConnectionObj(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
165 """returns connection id (from root)"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
166 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
167 root = self.getMPIWGRoot()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
168 return root.getConnectionObj()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
169 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
170 return self.en.getConnectionObj()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
171
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
172 def isPublished(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
173 """gib publications status aus der datenbank aus"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
174 key=self.getKey()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
175 query="select count(publish_the_data) from personal_www where lower(key)='%s' and publish_the_data='yes'"%key
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
176
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
177 res = self.ZSQLQuery(query)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
178
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
179 if res and res[0].count>0:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
180 return True
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
181 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
182 return False
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
183
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
184
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
185
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
186 def updateDBEntry(self,publish_the_data,date_from,date_to,DBid=None,stay_at_mpiwg="",position="",abteilung=""):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
187 """zpddatedb"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
188 if not DBid:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
189 DBid=self.getDBId()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
190
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
191
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
192 self.ZSQLQuery("SET DATESTYLE TO 'German'")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
193
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
194 test=self.ZSQLQuery("select id from personal_www where id='%s' "%DBid)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
195
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
196
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
197 if test and (len(test)>0): #dataset exists
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
198 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)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
199 self.ZSQLChange(_table="personal_www",_identify="id=%s"%DBid,publish_the_data=publish_the_data,
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
200 date_from=date_from,
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
201 date_to=date_to,stay_at_mpiwg=stay_at_mpiwg,position=position,abteilung=abteilung)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
202 return True
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
203 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
204 return False
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
205
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
206 def getPublicationSelectionMode(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
207 """get publication selection mode, default 'priority'"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
208 return getattr(self,'publicationSelectionMode','priority')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
209
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
210 def changePublicationSelectionMode(self,publicationSelectionMode,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
211 """change PublicationSelectionMode"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
212
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
213 self.publicationSelectionMode=publicationSelectionMode
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
214 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
215 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
216 self.redirect(RESPONSE,"editPublications")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
217
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
218
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
219 def downloadCV(self,RESPONSE):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
220 """download cv file"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
221 ob=self._getOb("downloadableFiles")._getOb("cv.pdf")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
222
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
223 RESPONSE.redirect(ob.absolute_url()+"/download")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
224
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
225 def getLastUpdateCV(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
226 """getDate of Last Update"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
227 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
228 ob=self._getOb("downloadableFiles")._getOb("cv.pdf")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
229 return ob.getLastChangeDate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
230 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
231 return "No file yet!"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
232 def getLastUpdatePublications(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
233 """getDate of Last Update"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
234 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
235 ob=self._getOb("downloadableFiles")._getOb("publications.pdf")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
236 return ob.getLastChangeDate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
237 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
238 return "No file yet!"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
239 def downloadPublications(self,RESPONSE):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
240 """download publications"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
241 ob=self._getOb("downloadableFiles")._getOb("publications.pdf")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
242
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
243 RESPONSE.redirect(ob.absolute_url()+"/download")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
244
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
245 def changeDownloads(self,cv_pdf=None,cv_publish=None,publications_pdf=None,publications_publish=None,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
246 """"change the downloadable files"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
247 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
248 if not hasattr(self,'downloadableFiles'):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
249
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
250 extFolder = extVersionedFileFolder()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
251 extFolder.id = "downloadableFiles"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
252 self._setObject(extFolder.id,extFolder)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
253
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
254 ob = self._getOb("downloadableFiles")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
255
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
256 if cv_publish:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
257 self.cv_publish=cv_publish
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
258
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
259 if publications_publish:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
260 self.publications_publish=publications_publish
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
261
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
262 if cv_pdf:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
263 if not hasattr(ob,"cv.pdf"):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
264 ob.addFile("",cv_pdf,newName="cv.pdf")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
265
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
266 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
267 cvFile = getattr(ob,"cv.pdf")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
268 cvFile.addContentObject("","",file=cv_pdf)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
269
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
270 if publications_pdf:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
271 if not hasattr(ob,"publications.pdf"):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
272 ob.addFile("",cv_pdf,newName="publications.pdf")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
273
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
274 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
275 cvFile = getattr(ob,"publications.pdf")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
276 cvFile.addContentObject("","",file=publications_pdf)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
277
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
278 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
279 self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER'])
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
280
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
281
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
282 def getPublishImage(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
283 """publish the image??, default no"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
284 return getattr(self,'publishImage','no')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
285
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
286 def updateImage(self,publishImage,file=None,rename=None,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
287 """update image"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
288
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
289 if file and not(file.filename==""):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
290 if self.getImageObj():
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
291 self.getImageObj().updateImage(file,_rename=None,RESPONSE=None)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
292 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
293 # create new image object
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
294 xp = file.filename.rfind('.')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
295 if xp > 0:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
296 ext = file.filename[xp:]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
297 #fn = self.getId()+ext
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
298 fn = self.getId()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
299 logger("MPWIG STAFF", logging.INFO, "new filename: %s"%fn)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
300 self.getImageFolder().addImage2(file,fileName=fn)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
301 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
302 logger("MPWIG STAFF", logging.ERROR, "uploaded filename %s has no extension!"%file.filename)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
303
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
304 self.publishImage=publishImage
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
305
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
306 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
307 self.redirect(RESPONSE,"edit")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
308
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
309 def getImageFolder(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
310 """getImageFolder"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
311 #TODO: make place of staff image folder configurable
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
312
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
313 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
314 return self.getPhysicalRoot().www_neu.images.staff_images
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
315 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
316 logger("MPWIG STAFF", logging.ERROR, "image folder not found: has to be add /www_neu/staff_images")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
317 return None
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
318
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
319 def getImageObj(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
320 """getImage"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
321 imageFolder=self.getImageFolder()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
322
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
323 if not imageFolder: return None
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
324
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
325 image=getattr(imageFolder,self.getId(),None)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
326
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
327 if not image:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
328 for suffix in ['jpg','tif']:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
329
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
330 image=getattr(imageFolder,self.getId()+"."+suffix,None)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
331 if image:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
332 break
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
333 return image
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
334
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
335 def getImageUrl(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
336 """getImageUrl"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
337 image=self.getImageObj()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
338 if not image:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
339 return None
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
340 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
341 return self.getImageObj().absolute_url()+"/image"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
342
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
343 def PrincipiaSearchSource(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
344 """Return cataloguable key for ourselves."""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
345 return str(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
346
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
347 def getPersonID(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
348 """gibt den ID fuer die Person zurueck"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
349 im Moment ist personID = id, i.e. e-mail
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
350 """
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
351 return self.id
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
352
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
353 def getConeUrl(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
354 """gibt coneURL zurueck"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
355
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
356 self.coneService=getattr(self, "coneServiceURL",coneService)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
357 logging.debug("coneservice:"+self.coneService)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
358
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
359 if getattr(self,'_v_cone',None)==None:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
360 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
361
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
362 self._v_cone=getHttpData(self.coneService+self.getPersonID())
0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
363 #cone = urllib2.urlopen(self.coneService+self.getPersonID())
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
364 #self._v_cone=cone.read()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
365 if self._v_cone==None:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
366 self._v_cone=""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
367 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
368 self._v_cone=""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
369 return ""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
370
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
371 return self._v_cone
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
372
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
373
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
374
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
375
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
376 def harvest_page_old(self,context=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
377 """geharvestete seite = verschlankte version von members_main"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
378 #pt = getTemplate(self, "harvest_members_main")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
379
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
380 if not self.isPublished():
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
381 return ""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
382 if not context:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
383 context=self
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
384
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
385
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
386 ext=getattr(self,"harvest_members_main",None)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
387 if ext:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
388 return getattr(self,ext.getId())()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
389
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
390 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','harvest_members_main')).__of__(context)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
391
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
392
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
393 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
394
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
395 def harvest_page(self,mode="normal"):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
396 """harvest"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
397 logging.debug("AAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
398 if not self.isPublished():
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
399 return
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
400 st = getattr(self.en.staff.members,self.getId()).index_html(mode)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
401
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
402 templates = self.en.getHarvestCache()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
403 #templates = getattr(self,'getHarvestCache',self.en.getHarvestCache)()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
404 rendered = st
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
405 templates[self.absolute_url()]=rendered
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
406 transaction.commit()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
407 return rendered
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
408
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
409
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
410
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
411 def index_html(self,mode="normal"):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
412 """show homepage"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
413
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
414 bound_names={}
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
415 request = self.REQUEST
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
416 if request is not None:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
417 response = request.response
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
418 if not response.headers.has_key('content-type'):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
419 response.setHeader('content-type', 'text/html')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
420
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
421 security = getSecurityManager()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
422 bound_names['user'] = security.getUser()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
423
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
424 # Retrieve the value from the cache.
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
425 keyset = None
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
426 if self.ZCacheable_isCachingEnabled():
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
427
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
428 # Prepare a cache key.
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
429 keyset = {'here': self}
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
430
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
431 result = self.ZCacheable_get(keywords=keyset)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
432
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
433 if result is not None:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
434 # Got a cached value.
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
435 return result
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
436
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
437 # look for individual page
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
438 if self.hasObject("index.html"):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
439 pt = getattr(self, "index.html")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
440 # else use template
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
441 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
442 if mode=="slim":
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
443 pt = getTemplate(self, "members_main_slim")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
444 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
445 pt = getTemplate(self, "members_main")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
446 # Execute the template in a new security context.
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
447 security.addContext(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
448
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
449 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
450 result = pt.pt_render(extra_context=bound_names)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
451 if keyset is not None:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
452 # Store the result in the cache.
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
453 self.ZCacheable_set(result, keywords=keyset)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
454
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
455 return result
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
456 finally:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
457 security.removeContext(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
458
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
459
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
460
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
461 def changePublications_specialForm(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
462 """Priority publications manual field"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
463 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changePublications_special.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
464 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
465
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
466 def changePublications_special(self,usePublicationsSpecial=None,specialPublicationsField=None,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
467 """change publications special params"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
468 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
469 if usePublicationsSpecial:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
470 self.usePublicationsSpecial=True
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
471
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
472 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
473 self.usePublicationsSpecial=False
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
474
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
475 self.specialPublicationsField=specialPublicationsField[0:]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
476
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
477 if RESPONSE is not None:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
478 self.redirect(RESPONSE,'manage_main')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
479
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
480
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
481 def publications_full(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
482 """show publication"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
483 pt=getTemplate(self, "publications_full_main")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
484 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
485
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
486 def talks_full(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
487 """show talks"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
488 pt=getTemplate(self, 'talks_full_main')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
489 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
490
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
491 def teaching_full(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
492 """show talks"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
493 pt=getTemplate(self, 'teaching_full_main')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
494 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
495
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
496 def changeMPIWGStaffForm(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
497 """change form"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
498 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGStaff.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
499 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
500
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
501 security.declareProtected('View management screens','changeMPIWGStaff')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
502 def changeMPIWGStaff(self,lastName,firstName,key=None,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
503 """change it"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
504 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
505 self.title="%s, %s"%(lastName,firstName)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
506 self.lastName=lastName
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
507 self.firstName=firstName
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
508 if key:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
509 self.key = key
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
510
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
511
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
512 if RESPONSE is not None:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
513 self.redirect(RESPONSE,'manage_main')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
514
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
515 security.declareProtected('View management screens','edit')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
516 def edit(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
517 """Edit the pages"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
518 #TODO: zusammenspiel mit apache, redirect auf 18080 rausnehmen bzw. zumindest verallgemeinern
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
519 #if self.REQUEST['SERVER_URL']=="http://www.mpiwg-berlin.mpg.de":
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
520 # redURL="http://xserve04.mpiwg-berlin.mpg.de:18080/www_neu/de/mitarbeiter/members/%s/edit"%self.getId()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
521 #
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
522 # self.REQUEST.RESPONSE.redirect(redURL)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
523
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
524 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMPIWGStaff.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
525
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
526
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
527 logging.debug("XX:"+email.Utils.formatdate().split("-")[0]+'GMT')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
528 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
529
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
530 mainEditFile=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMPIWGStaff_main.zpt'))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
531 addPublicationsBib=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addPublicationsBib.zpt'))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
532
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
533 def getPathStyle(self, path, selected, style=""):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
534 """returns a string with the given style + 'sel' if path == selected."""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
535
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
536 if path == selected:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
537 return style + 'sel'
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
538 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
539 return style
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
540
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
541
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
542 def getLabel(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
543 """returns a label for this object"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
544 return self.title
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
545
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
546 def getBreadcrumbs(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
547 """return list of breadcrumbs from here to the root"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
548 crumbs = []
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
549 # skip direct parent Folder /members/
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
550 parent = self.aq_parent.aq_parent
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
551 # get parents breadcrumbs
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
552 logging.debug("getbreadcrumbs-: title=%s self=%s parent=%s"%(self.title, repr(self), repr(parent)))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
553 if hasattr(parent, 'getBreadcrumbs'):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
554 logging.debug("getbreadcrumbs: recurse to %s"%parent)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
555 crumbs = parent.getBreadcrumbs()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
556
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
557 # try to get acquisition URL from parent
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
558 if hasattr(parent, 'absolute_url'):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
559 baseUrl = "%s/%s/"%(parent.absolute_url(), 'members')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
560 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
561 baseUrl = "/en/staff/members/"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
562
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
563 # add this
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
564 crumbs.append((self.getLabel(), baseUrl+self.getId(), self))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
565
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
566 return crumbs
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
567
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
568
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
569 def changeCurrentWork(self,current_work,key,publish="yes",RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
570 """change current work"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
571
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
572 query="UPDATE personal_www SET current_work =%s WHERE key='%s'"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
573
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
574 self.ZSQLQuery(query%(self.ZSQLQuote(current_work),key))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
575
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
576 query="UPDATE personal_www SET current_work_p =%s WHERE key='%s'"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
577
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
578 self.ZSQLQuery(query%(self.ZSQLQuote(publish),key))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
579 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
580 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
581 self.redirect(RESPONSE,"edit")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
582
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
583 security.declareProtected('View management screens','changeResearch')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
584 def changeResearch(self,noredirect=None,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
585 """change the research entries"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
586 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
587 newEntries={}
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
588 key_main=self.REQUEST.form['key_main']
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
589
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
590 mainfieldL=self.REQUEST.form['main_fields'].split(",")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
591 mainfield={}
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
592 for x in mainfieldL:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
593 tmp=x.split('__')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
594 mainfield[tmp[0]]=tmp[1]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
595 for field in self.REQUEST.form.keys():
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
596 splittedField=field.split("__")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
597 if len(splittedField)<3:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
598 pass #kein datenbank eintrag
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
599
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
600 elif splittedField[2]=='new': # store new entries
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
601 if not newEntries.has_key(splittedField[0]):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
602 newEntries[splittedField[0]]={}
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
603
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
604 newEntries[splittedField[0]][splittedField[1]]=self.REQUEST.form[field]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
605
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
606 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
607 query="UPDATE %s "%splittedField[0]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
608 query+="SET %s = '%s' "%(splittedField[1],sql_quote(self.REQUEST.form[field]))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
609 query+="WHERE oid = '%s' "%sql_quote(splittedField[2])
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
610
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
611 self.ZSQLQuery(query)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
612
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
613
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
614 #new entries
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
615 for newEntry in newEntries.keys():
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
616 query="INSERT INTO %s "%newEntry
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
617 keys=['key_main']
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
618 values=["'"+sql_quote(key_main)+"'"]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
619 for key in newEntries[newEntry].keys():
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
620 keys.append(key)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
621 values.append("'"+sql_quote(newEntries[newEntry][key])+"'")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
622
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
623
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
624 keystring=",".join(keys)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
625
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
626 valuestring=",".join(values)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
627
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
628 query+=" (%s) "%keystring
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
629 query+="VALUES (%s)"%valuestring
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
630 if not (newEntries[newEntry][mainfield[newEntry]].lstrip().rstrip()==""):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
631 self.ZSQLQuery(query)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
632
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
633 if not noredirect:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
634 self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER'])
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
635
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
636 security.declareProtected('View management screens','editCV')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
637 def editCV(self,cv=None,oid=None,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
638 """edit Cv"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
639
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
640 if (not oid):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
641 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editCV.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
642 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
643
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
644 query="UPDATE personal_www SET cv =%s WHERE oid='%s'"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
645 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
646 self.ZSQLQuery(query%(self.ZSQLQuote(cv),oid))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
647
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
648 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
649 self.redirect(RESPONSE,"editCV")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
650
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
651
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
652 def getProfile(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
653 """get the profile"""
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
654 self.REQUEST.RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT')
0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
655
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
656 founds=self.ZSQLInlineSearchU(_table='personal_www',key=self.getKeyUTF8())
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
657 html="""<html><body>%s</body></html>"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
658 if founds.profile and founds.profile != "":
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
659
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
660 return html%founds.profile
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
661 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
662
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
663 return html%self.generateProfileForPerson(founds)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
664
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
665 def editProfile(self,oid=None,RESPONSE=None, kupu=None, preview=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
666 """edit Profile, new entry replaces CD, current work and research interests"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
667
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
668 if (not oid):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
669 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editProfile.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
670 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
671
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
672 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
673
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
674
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
675 if preview:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
676 pass
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
677 #TODO: not supported yet
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
678 #kupu=preview
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
679 # find content of body tags
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
680
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
681 start=kupu.find("<body>")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
682 end=kupu.find("</body>")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
683
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
684 newcontent= kupu[start+6:end]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
685
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
686
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
687
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
688
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
689 if preview:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
690 #TODO: not supported yet
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
691 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
692 self.redirect(RESPONSE,"editProfile")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
693
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
694 #return self.preview(newcontent)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
695
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
696 query="UPDATE personal_www SET profile=%s WHERE oid='%s'"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
697 self.ZSQLQuery(query%(self.ZSQLQuote(newcontent),oid))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
698 logging.error("PROFILE:"+query%(self.ZSQLQuote(newcontent),oid))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
699 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
700 self.redirect(RESPONSE,"editProfile")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
701
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
702
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
703
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
704 def generateProfileForPerson(self,person):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
705 """erzeugt ein automatisches Profil aus den alten Eintraegen CV, Current work, und research interests"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
706
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
707 ret=""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
708 #founds=self.ZSQLInlineSearch(_table='research_interest',key_main=person.getKeyUTF8())
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
709 founds=self.ZSQLInlineSearch(_table='research_interest',key_main=person.key)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
710 if founds:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
711 ret="<p class=\"bio_section_header\">Research interests: </p><br/>"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
712 for found in self.sortPriority(founds):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
713 ret+=found.interest+"<br/>"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
714
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
715
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
716 if (person.current_work) and (not person.current_work==""):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
717 ret+="<p class=\"bio_section_header\">Current work: </p><br/>"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
718
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
719 ret+=person.current_work+"<br/>"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
720 if (person.cv) and (not person.cv==""):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
721 ret+="<p class=\"bio_section_header\">Curriculum Vitae: </p><br/>"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
722 ret+=self.formatAscii(person.cv)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
723
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
724 return ret
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
725 security.declareProtected('View management screens','editDownloads')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
726 def editDownloads(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
727 """editiere die Downloads von der Webseite"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
728
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
729 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editDownloads.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
730 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
731
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
732 security.declareProtected('View management screens','editAdditionalLinks.zpt')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
733 def editAdditionalLinks(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
734 """editiere die Downloads von der Webseite"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
735
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
736 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editAdditionalLinks.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
737 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
738
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
739
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
740 security.declareProtected('View management screens','editAwards')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
741 def editAwards(self,awards=None,oid=None,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
742 """edit a awards"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
743
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
744 if (not oid):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
745 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editAwards.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
746 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
747 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
748 query="UPDATE personal_www SET awards =%s WHERE oid='%s'"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
749
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
750 self.ZSQLQuery(query%(self.ZSQLQuote(awards),oid))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
751
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
752
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
753 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
754 self.redirect(RESPONSE,"editAwards")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
755
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
756 security.declareProtected('View management screens','editTalks')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
757 def editTalks(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
758 """edit talks"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
759
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
760 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editTalks.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
761 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
762
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
763 security.declareProtected('View management screens','editTeaching')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
764 def editTeaching(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
765 """edit Teaching"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
766
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
767 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editTeaching.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
768 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
769
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
770 def getDocTypes(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
771 finds = self.ZopeFind(self.metadata.main.meta.bib,obj_metatypes=["OSAS_MetadataMapping__neu"])
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
772
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
773 list= [x[0] for x in finds]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
774 return "\n".join(list)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
775
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
776 security.declareProtected('View management screens','editMainData')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
777 def editMainData(self,REQUEST=None,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
778 """edit main data"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
779 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
780 argv=REQUEST.form
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
781
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
782 if not argv.has_key('last_name'):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
783 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editMainData.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
784 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
785 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
786 self.ZSQLChange(argv,_table="personal_www",_identify="lower(key)=%s"%utf8ify(self.getKey().lower()),USE_FORM="yes")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
787 # aendere auch dien enstsprechen infos in der instance
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
788 self.changeMPIWGStaff(argv['last_name'],argv['first_name']);
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
789
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
790
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
791
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
792 self.reindex_object()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
793
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
794
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
795
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
796 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
797 self.redirect(RESPONSE,"editMainData")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
798
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
799 security.declareProtected('View management screens','newBibliogrpaphy')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
800 def newBibliography(self,_docType=None, _addEntry=None,RESPONSE=None,**argv):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
801
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
802 """add an entry to the bibliography"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
803 if not _docType: #kein docType
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
804 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','newBibliographyEntryDocType.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
805 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
806 elif _docType and not _addEntry: #doctype aber keine daten
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
807 self.REQUEST['_docType']=_docType
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
808 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','newBibliographyEntry.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
809 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
810 else: #doctype und daten
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
811 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
812 newId=self.ZSQLSimpleSearch("select nextval('id_raw')")[0].nextval
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
813 except:#id_raw existiert nich, dann neu erzeugen
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
814
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
815 self.createOrUpdateId_raw()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
816 newId=self.ZSQLSimpleSearch("select nextval('id_raw')")[0].nextval
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
817
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
818 bookId="b%06i" % newId
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
819
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
820 self.ZSQLAdd(argv,_table="bibliography",reference_type=_docType,id=bookId)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
821
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
822 self.ZSQLAdd(_useRequest=False,_table="publications",id_gen_bib=bookId,key_main=self.getDBId(),publish='yes')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
823 self.updatePublicationDB(personId=self.getDBId())
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
824
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
825
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
826 if RESPONSE:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
827 self.redirect(RESPONSE,"editPublications")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
828
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
829 return True
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
830
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
831 security.declareProtected('View management screens','editImage')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
832 def editImage(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
833 """edit images"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
834 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editImageStaff.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
835 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
836
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
837 security.declareProtected('View management screens','editBibliography')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
838 def editBibliography(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
839 """edit the bibliography"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
840 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editBibliographyEntry.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
841 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
842
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
843
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
844 security.declareProtected('View management screens','editPublications')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
845 def editPublications(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
846 """edit the bibliographie"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
847
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
848 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editPublications.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
849 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
850
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
851 def changeSortingMode(self,sortingMode,RESPONSE=None,REQUEST=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
852 """change sorting mode"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
853 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
854 self.sortingMode=sortingMode
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
855
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
856 if RESPONSE and REQUEST:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
857 self.redirect(RESPONSE,REQUEST['HTTP_REFERER'])
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
858
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
859 return True
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
860
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
861 def getSortingMode(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
862 """get sorting mode"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
863 mode=getattr(self,'sortingMode','priority')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
864 if mode=="year":
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
865 return "year DESC"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
866 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
867 return mode
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
868
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
869 def integer(self,value):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
870 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
871 return int(value)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
872 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
873 return 0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
874
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
875 security.declareProtected('View management screens','changePublications')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
876 def changePublications(self,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
877 """change the publication list"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
878 self.changeResearch(noredirect=True)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
879 self.ZCacheable_invalidate()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
880 #self.updatePublicationDB(personId=self.getDBId())
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
881 self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER'])
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
882
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
883
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
884
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
885 security.declareProtected('View management screens','addPublications')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
886 def addPublications(self,submit=None,REQUEST=None,noredirect=None,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
887 """add publications"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
888
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
889 #setzte flag ob aufruf aus suchformular
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
890
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
891 if REQUEST.get("QUERY_STRING",None) and (not submit):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
892 self.REQUEST.set('fromSearch','1')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
893 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
894 self.REQUEST.set('fromSearch','0')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
895
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
896 if not submit or (not (submit == "add")):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
897 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addPublications.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
898 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
899
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
900 #new entries
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
901 entries = REQUEST.form.get('addEntries',None)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
902 if not (type(entries) is ListType):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
903 entries=[entries]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
904
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
905
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
906 for bibId in entries:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
907 query="INSERT INTO %s " % "publications"
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
908 query+="(key_main,id_institutsbibliographie,publish) "
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
909 query+="VALUES ('%s','%s','yes')" %(sql_quote(self.getKey()),sql_quote(bibId))
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
910
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
911 #self.ZSQLAdd(_table="publications",id_institutsbibliographie=bibId,id_main=self.getDBId(),publish='yes')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
912 self.ZSQLQuery(query)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
913
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
914 self.updatePublicationDB(personId=self.getKey())
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
915
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
916 if not noredirect:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
917
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
918 self.redirect(RESPONSE,"./editPublications")
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
919
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
920 return True
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
921
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
922
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
923 def getDBId(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
924 """get id from the personal database"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
925
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
926 #in der neuen version ist definitions gemaess der key der Datenbank gleich dem key im Object.
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
927 # TODO: remove all occurences of getDBId and replaces it by getKey
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
928 return self.getKey()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
929
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
930 formatBiblHelp=bibliography.formatBiblHelp
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
931
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
932 def sortBibliography(self,list,sortingMode=None,max=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
933 if not sortingMode:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
934 sortingMode=self.getSortingMode()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
935
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
936 if sortingMode == "year":
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
937 l= self.sortYear(list)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
938 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
939 l=self.sortPriority(list)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
940
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
941 if max:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
942 return l[0:min(len(l),max)]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
943 else:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
944 return l
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
945
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
946 def sortPriority(self,list):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
947 def sort(x,y):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
948 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
949 xInt=int(x.priority)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
950 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
951 xInt=0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
952 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
953 yInt=int(y.priority)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
954 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
955 yInt=0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
956
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
957 return cmp(xInt,yInt)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
958
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
959 if not list:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
960 return []
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
961 tmp=[x for x in list]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
962 tmp.sort(sort)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
963
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
964 return tmp
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
965
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
966 def sortYear(self,list):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
967 #TODO: sort TO APPEAR and TO BE PUBLISHED etc...
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
968
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
969 def sort(x,y):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
970 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
971 xInt=int(x.year)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
972 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
973 xInt=0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
974 try:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
975 yInt=int(y.year)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
976 except:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
977 yInt=0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
978
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
979 return cmp(yInt,xInt)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
980
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
981
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
982 tmp=[x for x in list]
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
983
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
984 tmp.sort(sort)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
985 return tmp
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
986
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
987 def deleteField(self,table,oid,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
988 """delete entry"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
989 query="DELETE FROM %s WHERE oid = '%s'"%(table,oid)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
990
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
991 self.ZSQLQuery(query)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
992 self.redirect(RESPONSE,self.REQUEST['HTTP_REFERER'])
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
993
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
994
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
995 def manage_addMPIWGStaffForm(self):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
996 """form for adding the project"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
997 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addMPIWGStaffForm.zpt')).__of__(self)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
998 return pt()
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
999
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1000 def manage_addMPIWGStaff(self,id,lastName,firstName,RESPONSE=None):
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1001 """add it"""
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1002 newObj=MPIWGStaff(id,lastName,firstName)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1003
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1004 self._setObject(id,newObj)
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1005
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1006 if RESPONSE is not None:
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1007 self.redirect(RESPONSE,'manage_main')
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1008
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1009
0
bca61e893fcc first checkin of MPIWGWeb r2 branch from CVS into mercurial
casties
parents:
diff changeset
1010
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1011 class MPIWGStaffFolder(ZDBInterfaceFolder):
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1012 """Folder of staff objects"""
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1013
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1014 meta_type="MPIWGStaffFolder"
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1015 security=ClassSecurityInfo()
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1016
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1017 #
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1018 # templates
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1019 #
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1020 member_index_html = PageTemplateFile('zpt/staff/member_index_html', globals())
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1021
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1022
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1023 #
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1024 # hook into traversal to create folder of virtual staff objects
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1025 # like /members/$username/index_html
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1026 #
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1027 def __before_publishing_traverse__(self, object, request):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1028 stack = request.TraversalRequestNameStack
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1029 logging.debug("MPIWGStaffFolder: traverse stack=%s self=%s"%(repr(stack),repr(self)))
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1030
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1031 # TODO: should we do more checks?
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1032 if stack and len(stack) > 0:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1033 try:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1034 # id is the first path component
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1035 id = stack[-1]
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1036 logging.debug(id)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1037
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1038 member = self.getMember(id)
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1039 if member is not None:
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1040 member = member.__of__(self)
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1041 request.set('MPIWGStaffMember', member)
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1042 stack.pop(-1)
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1043
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1044 #weitere parameter
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1045 if len(stack)> 0:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1046 mode = stack[-1]
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1047 request.set('MPIWGStaffMode', mode)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1048 stack.pop(-1)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1049
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1050
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1051 except (IndexError, ValueError):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1052 # missing context or not an integer id; perhaps some URL hacking going on?
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1053 logging.error("error traversing user id!")
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1054 raise Redirect(self.absolute_url()) # redirects to `/members`, adjust as needed
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1055
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1056
57
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1057
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1058
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1059 def index_html(self,REQUEST,RESPONSE):
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1060 """show homepage"""
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1061 logging.debug("MPIWGStaffFolder: index_html!")
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1062 member = REQUEST.get('MPIWGStaffMember', None)
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1063 mode = REQUEST.get('MPIWGStaffMode', None)
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1064 if member is not None:
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1065
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1066 if mode is not None:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1067 return member.execute(mode,REQUEST);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1068
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1069
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1070 logging.debug("member: key=%s"%(member.getKey()))
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1071 pt = None
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1072 try:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1073 # get template /template/member_index_html
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1074 pt = getattr(self.template, 'member_index_html', None)
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1075 except:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1076 logging.error("No template /template/member_index_html")
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1077 # TODO: error page?
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1078 return "No template /template/member_index_html"
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1079
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1080 if pt is not None:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1081 return pt(member=member)
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1082
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1083 return REQUEST
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1084
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1085
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1086 def getMember(self, username=None, key=None):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1087 """returns a MPIWGStaffMember object if the username exists"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1088 member = None
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1089 if username is not None:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1090 # TODO: we should have a username column
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1091 email = '%s@mpiwg-berlin.mpg.de'%username
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1092 content = self.executeZSQL("select * from personal_www where e_mail = %s", [email])
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1093 if len(content) > 0:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1094 member = MPIWGStaffMember(self, dbresult=content)
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1095
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1096 elif key is not None:
40
fd8e78bbc5ed more work on projects.
casties
parents: 38
diff changeset
1097 # TODO: sometimes key is lowercased (e.g. responsibleScientistsList), we should fix the data
fd8e78bbc5ed more work on projects.
casties
parents: 38
diff changeset
1098 content = self.executeZSQL("select * from personal_www where lower(key) = %s", [key.lower()])
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1099 if len(content) > 0:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1100 member = MPIWGStaffMember(self, dbresult=content)
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1101
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1102 return member
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1103
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1104
40
fd8e78bbc5ed more work on projects.
casties
parents: 38
diff changeset
1105 def isActiveMember(self, key):
fd8e78bbc5ed more work on projects.
casties
parents: 38
diff changeset
1106 """returns if member key is active"""
fd8e78bbc5ed more work on projects.
casties
parents: 38
diff changeset
1107 res = self.executeZSQL("select * from personal_www where lower(key) = %s and publish_the_data = 'yes'", [key.lower()])
fd8e78bbc5ed more work on projects.
casties
parents: 38
diff changeset
1108 return len(res) > 0
fd8e78bbc5ed more work on projects.
casties
parents: 38
diff changeset
1109
fd8e78bbc5ed more work on projects.
casties
parents: 38
diff changeset
1110
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1111 def sortPriority(self,list):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1112 def sort(x,y):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1113 try:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1114 xInt=int(x.priority)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1115 except:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1116 xInt=0
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1117 try:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1118 yInt=int(y.priority)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1119 except:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1120 yInt=0
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1121
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1122 return cmp(xInt,yInt)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1123
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1124 if not list:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1125 return []
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1126 tmp=[x for x in list]
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1127 tmp.sort(sort)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1128
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1129 return tmp
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1130
56
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1131 def getPublicationsFromPubman(self,coneId="renn",limit=None,publicationType=None):
38
3c98cc79dd14 version 0.1 mit publicationen von pubman (TEST!!)
dwinter
parents: 37
diff changeset
1132
46
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1133 logging.debug("coneID:%s"%coneId)
38
3c98cc79dd14 version 0.1 mit publicationen von pubman (TEST!!)
dwinter
parents: 37
diff changeset
1134 try:
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1135 pubs=self.mpiwgPubman.getPublications(coneId,limit=limit,publicationType=publicationType)
46
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1136
38
3c98cc79dd14 version 0.1 mit publicationen von pubman (TEST!!)
dwinter
parents: 37
diff changeset
1137 return pubs
3c98cc79dd14 version 0.1 mit publicationen von pubman (TEST!!)
dwinter
parents: 37
diff changeset
1138 except:
3c98cc79dd14 version 0.1 mit publicationen von pubman (TEST!!)
dwinter
parents: 37
diff changeset
1139 return []
57
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1140
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1141 def getLastArrivals(self,limit=None):
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1142 """getlast arrivals"""
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1143 if not limit:
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1144 selectStr="select * from personal_www_list_web where publish_the_data = 'yes' and is_scholar='yes' order by date_from DESC"
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1145 else:
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1146 selectStr="select * from personal_www_list_web where publish_the_data = 'yes' and is_scholar='yes' order by date_from DESC limit %s"%limit
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1147
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1148 res=self.members.executeZSQL(selectStr)
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1149
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1150 return res
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1151
84879a3f91a6 getLastArrivals
dwinter
parents: 56
diff changeset
1152
2
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1153 def manage_addMPIWGStaffFolderForm(self):
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1154 """form for adding the project"""
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1155 pt=PageTemplateFile('zpt/addMPIWGStaffFolderForm', globals()).__of__(self)
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1156 return pt()
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1157
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1158 def manage_addMPIWGStaffFolder(self,id,title,RESPONSE=None):
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1159 """add it"""
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1160 newObj=MPIWGStaffFolder(id,title)
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1161
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1162 self._setObject(id,newObj)
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1163
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1164 if RESPONSE is not None:
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1165 RESPONSE.redirect('manage_main')
ddf6c1a27a4b new version with main_template and css in product.
casties
parents: 0
diff changeset
1166
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1167
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1168 class MPIWGStaffMember(Folder):
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1169 """MPIWG staff member object from database"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1170
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1171 security = ClassSecurityInfo()
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1172
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1173 def __init__(self, folder, dbresult):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1174 """constructor: takes parent MPIWGStaffFolder and content"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1175 self.folder = folder
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1176 self.content = dbresult[0]
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1177
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1178 def isValid(self):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1179 """returns if this member exists"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1180 return len(self.content) > 0
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1181
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1182 def getKey(self):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1183 """returns the db key"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1184 return self.content.key
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1185
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1186 def getUsername(self):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1187 """returns the username"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1188 id = re.sub('@mpiwg-berlin\.mpg\.de', '', self.content.e_mail)
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1189 return id
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1190
46
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1191 def getConeId(self):
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1192 """return cone ID"""
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1193 results= self.folder.executeZSQL("SELECT coneid FROM keys WHERE key_main = %s",[self.content.key])
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1194 for res in results:
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1195 return res.coneid
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1196 return None
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1197
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1198 def getPublishedImageUrl(self):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1199 """returns the URL to the image if it is published"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1200 if self.content.image_p == 'yes':
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1201 url = 'http://digilib.mpiwg-berlin.mpg.de/digitallibrary/Scaler?fn=permanent/mpiwg/staff/%s'%self.getUsername()
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1202 return url
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1203
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1204 return None
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1205
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1206 def getContent(self):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1207 """returns the db content of this object"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1208 return self.content
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1209
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1210
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1211 # TODO: ugly!
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1212 security.declarePublic('sortBibliography')
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1213 def sortBibliography(self,bib,sortingMode=None,max=None):
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1214 """sort bibliography"""
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1215 if not sortingMode:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1216 sortingMode= "priority"
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1217
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1218 l = [x for x in bib]
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1219
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1220 if sortingMode == "year":
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1221 l.sort(key=lambda x: getInt(x.year))
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1222 else:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1223 l.sort(key=lambda x: getInt(x.priority))
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1224
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1225 if max:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1226 return l[0:min(len(l),max)]
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1227 else:
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1228 return l
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1229
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1230
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1231
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1232 def execute(self,mode,REQUEST=None):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1233 method = getattr(self,mode,None)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1234 if method is not None:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1235 return method(REQUEST);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1236 else:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1237 return "NOT FOUND"
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1238
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1239
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1240 def getProfile(self,REQUEST):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1241 """get the profile"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1242 self.REQUEST.RESPONSE.setHeader('Last-Modified',email.Utils.formatdate().split("-")[0]+'GMT')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1243
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1244
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1245 html="""<html><body>%s</body></html>"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1246 if self.content.profile and self.content.profile != "":
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1247
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1248 return html%self.content.profile
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1249 else:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1250
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1251 return html%""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1252
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1253
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1254
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1255
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1256
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1257 def getTalks(self):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1258
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1259 return self.folder.executeZSQL("SELECT oid,* FROM talks WHERE key_main = %s",[self.content.key])
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1260 #return self.folder.ZSQLInlineSearch(_table='talks',key_main=self.content.key)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1261
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1262
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1263 def getTeaching(self):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1264
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1265 return self.folder.executeZSQL("SELECT oid,* FROM teaching WHERE key_main = %s",[self.content.key])
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1266
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1267
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1268
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1269 def getLastUpdateCV(self):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1270 """getDate of Last Update"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1271 try:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1272 fname="%s_cv.pdf"%self.getUsername().encode('utf-8')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1273 logging.debug(fname)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1274 ob=self.folder._getOb("downloadableFiles")._getOb(fname)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1275 return ob.bobobase_modification_time()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1276 except:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1277 return "No file yet!"
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1278
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1279 def getLastUpdatePublications(self):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1280 """getDate of Last Update"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1281 try:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1282 ob=self.folder._getOb("downloadableFiles")._getOb("%s_publications.pdf"%self.getUsername().encode('utf-8'))
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1283 return ob.bobobase_modification_time()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1284 except:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1285 return "No file yet!"
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1286
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1287
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1288 def downloadCV(self,REQUEST):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1289
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1290 fname="%s_cv.pdf"%self.getUsername().encode('utf-8')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1291 logging.debug(fname)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1292 ob=self.folder._getOb("downloadableFiles")._getOb(fname)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1293 REQUEST.RESPONSE.redirect(ob.absolute_url())
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1294
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1295 def downloadPublications(self,REQUEST):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1296 ob=self.folder._getOb("downloadableFiles")._getOb("%s_publications.pdf"%self.getUsername().encode('utf-8'))
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1297 REQUEST.RESPONSE.redirect(ob.absolute_url())
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1298
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1299 def getAdditionalLinks(self):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1300
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1301 return self.folder.executeZSQL("SELECT oid,* FROM additionalLink WHERE key_main = %s",[self.content.key])
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1302 #return self.folder.ZSQLInlineSearch(_table='talks',key_main=self.content.key)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1303
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1304 #return self.folder.ZSQLInlineSearch(_table='talks',key_main=self.content.key)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1305
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1306 def getPathStyle(self, path, selected, style=""):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1307 """returns a string with the given style + 'sel' if path == selected."""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1308
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1309 if path == selected:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1310 return style + 'sel'
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1311 else:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1312 return style
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1313
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1314
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1315
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1316 mainEditFile=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_main.zpt'))
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1317
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1318
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1319 security.declareProtected('View management screens','edit')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1320 def edit(self,REQUEST=None):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1321 """Edit the basic information"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1322
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1323
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1324
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1325 if REQUEST:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1326 argv=REQUEST.form
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1327
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1328 if argv.has_key('last_name'): #got data to change
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1329 self.invalidate_chache()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1330 self.changeData(argv);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1331
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1332 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_basic.zpt')).__of__(self)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1333 return pt()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1334
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1335
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1336 security.declareProtected('View management screens','edit')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1337 def editShortEntry(self,REQUEST=None):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1338 """Edit the basic information"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1339
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1340
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1341
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1342 if REQUEST:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1343 argv=REQUEST.form
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1344
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1345 if argv.has_key('current_work'): #got data to change
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1346 self.invalidate_chache()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1347 self.changeData(argv);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1348
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1349 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_shortEntry.zpt')).__of__(self)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1350 return pt()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1351
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1352
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1353 security.declareProtected('View management screens','editProfile')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1354 def editProfile(self, REQUEST=None):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1355 """edit Profile, new entry replaces CD, current work and research interests"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1356
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1357
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1358 if REQUEST:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1359 kupu=REQUEST.form.get('kupu',None);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1360 preview=REQUEST.form.get('preview',None);
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1361
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1362
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1363 if kupu:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1364 start=kupu.find("<body>")
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1365 end=kupu.find("</body>")
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1366
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1367 newcontent= kupu[start+6:end]
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1368 query="UPDATE personal_www SET profile=%s WHERE key='%s'"
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1369 self.executeZSQL(query%(self.ZSQLQuote(newcontent),self.content.key))
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1370 logging.error("PROFILE:"+query%(self.ZSQLQuote(newcontent),self.content.key))
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1371
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1372 if preview:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1373 pass
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1374 #TODO: not supported yet
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1375 #if RESPONSE:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1376 # self.redirect(RESPONSE,"editProfile")
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1377
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1378 #return self.preview(newcontent)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1379
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1380 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_profile.zpt')).__of__(self)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1381 return pt()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1382
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1383
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1384
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1385 security.declareProtected('View management screens','editTalks')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1386 def editTalks(self,REQUEST):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1387 """edit talks"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1388
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1389
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1390 if REQUEST:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1391 argv=REQUEST.form
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1392
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1393 if argv.has_key('main_fields'): #got data to change
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1394 self.invalidate_chache()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1395 self.changeAdditionalData(argv);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1396
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1397 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_talks.zpt')).__of__(self)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1398 return pt()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1399
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1400
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1401 security.declareProtected('View management screens','editTeaching')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1402 def editTeaching(self,REQUEST):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1403 """edit teaching"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1404
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1405
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1406 if REQUEST:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1407 argv=REQUEST.form
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1408
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1409 if argv.has_key('main_fields'): #got data to change
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1410 self.invalidate_chache()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1411 self.changeAdditionalData(argv);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1412
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1413 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_teaching.zpt')).__of__(self)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1414 return pt()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1415
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1416
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1417 security.declareProtected('View management screens','editAdditionalLinks.zpt')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1418 def editAdditionalLinks(self,REQUEST):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1419 """editiere die additiona link von der Webseite"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1420
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1421 if REQUEST:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1422 argv=REQUEST.form
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1423
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1424 if argv.has_key('main_fields'): #got data to change
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1425 self.invalidate_chache()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1426 self.changeAdditionalData(argv);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1427
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1428 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_additionalLinks.zpt')).__of__(self)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1429 return pt()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1430
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1431
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1432 security.declareProtected('View management screens','editDownloads')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1433 def editDownloads(self,REQUEST):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1434 """editiere die Downloads von der Webseite"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1435
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1436 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_downloads.zpt')).__of__(self)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1437 return pt()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1438
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1439 def editPublications(self,REQUEST):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1440 """editiere die Publications von der Webseite"""
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1441
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1442
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1443 data=REQUEST.form
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1444
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1445 if data.has_key('selectionMode'):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1446 query="UPDATE personal_www SET publications_mode=%s WHERE key=%s"
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1447
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1448 self.executeZSQL(query,[data['selectionMode'],self.getKey()])
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1449
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1450 self.refresh_content()
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1451
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1452 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff','edit_publications.zpt')).__of__(self)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1453 return pt()
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1454
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1455
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1456 def refresh_content(self,):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1457
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1458 self.content = self.folder.executeZSQL("select * from personal_www where key = %s", [self.getKey()])[0]
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1459
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1460
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1461 def changeDownloads(self,REQUEST):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1462 """"change the downloadable files"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1463 self.invalidate_chache();
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1464
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1465 data=REQUEST.form
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1466
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1467 ob = self.folder._getOb("downloadableFiles")
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1468
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1469 if data.get('cv_publish',None):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1470
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1471 self.changeData({'cv_p':data['cv_publish']})
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1472
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1473 if data.get('publications_publish',None):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1474 self.changeData({'publications_p':data['publications_publish']})
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1475
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1476
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1477 if data.get('cv_pdf',None):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1478 cvName ="%s_cv.pdf"%self.getUsername()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1479 cvName=cvName.encode('utf-8')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1480 logging.debug("CCC")
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1481 if not hasattr(ob,cvName):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1482
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1483 cvFile = ExtFile(cvName,cvName)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1484 ob._setObject(cvName,cvFile)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1485
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1486
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1487 cvFile = getattr(ob,cvName)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1488
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1489 cvFile.manage_upload(file=data['cv_pdf'])
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1490
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1491
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1492
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1493
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1494 if data.get('publications_pdf',None):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1495
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1496
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1497 pdfName="%s_publications.pdf"%self.getUsername()
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1498 pdfName=pdfName.encode('utf-8')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1499
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1500 if not hasattr(ob,pdfName):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1501
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1502 cvFile = ExtFile(pdfName,pdfName)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1503 ob._setObject(pdfName,cvFile)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1504
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1505
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1506 cvFile = getattr(ob,pdfName)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1507
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1508 cvFile.manage_upload(file=data['publications_pdf'])
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1509
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1510
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1511 #REQUEST.response.redirect(self.REQUEST['HTTP_REFERER'])
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1512
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1513
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1514
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1515
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1516 def changeData(self,changeSet):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1517 """changes the data in the database, changeset expects field --> value."""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1518 for field in changeSet.keys():
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1519 if hasattr(self.content,field):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1520 logging.debug("Changing: %s"%field)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1521
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1522
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1523 results = self.folder.executeZSQL("update personal_www set "+field+" = %s where key = %s ", [changeSet.get(field),self.getKey().encode('utf-8')]);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1524
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1525 logging.debug(results)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1526
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1527
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1528 security.declareProtected('View management screens','changeAdditionalData')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1529 def changeAdditionalData(self,data):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1530 """change the research entries"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1531
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1532 self.invalidate_chache();
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1533
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1534 newEntries={}
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1535
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1536
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1537 mainfieldL=data['main_fields'].split(",") #fields to be changed
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1538 # format DATABASE__FIELDNAME
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1539
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1540 mainfield={}
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1541 for x in mainfieldL:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1542 tmp=x.split('__')
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1543 mainfield[tmp[0]]=tmp[1]
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1544 for field in data:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1545 splittedField=field.split("__")
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1546 if len(splittedField)<3:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1547 pass #kein datenbank eintrag
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1548
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1549 elif splittedField[2]=='new': # store new entries
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1550 if not newEntries.has_key(splittedField[0]):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1551 newEntries[splittedField[0]]={}
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1552
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1553 newEntries[splittedField[0]][splittedField[1]]=data[field]
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1554
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1555 else:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1556 query="UPDATE %s "%splittedField[0]
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1557 query+="SET %s = '%s' "%(splittedField[1],sql_quote(data[field]))
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1558 query+="WHERE oid = '%s' "%sql_quote(splittedField[2])
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1559
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1560 self.executeZSQL(query)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1561
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1562
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1563 #new entries
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1564 for newEntry in newEntries.keys():
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1565 query="INSERT INTO %s "%newEntry
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1566 keys=['key_main']
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1567 values=["'"+sql_quote(self.getKey())+"'"]
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1568 for key in newEntries[newEntry].keys():
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1569 keys.append(key)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1570 values.append("'"+sql_quote(newEntries[newEntry][key])+"'")
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1571
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1572
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1573 keystring=",".join(keys)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1574
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1575 valuestring=",".join(values)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1576
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1577 query+=" (%s) "%keystring
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1578 query+="VALUES (%s)"%valuestring
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1579 if not (newEntries[newEntry][mainfield[newEntry]].lstrip().rstrip()==""):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1580 self.executeZSQL(query)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1581
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1582
38
3c98cc79dd14 version 0.1 mit publicationen von pubman (TEST!!)
dwinter
parents: 37
diff changeset
1583
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1584
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1585
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1586 def deleteField(self,REQUEST):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1587 """delete entry"""
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1588
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1589
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1590 table = REQUEST.form.get('table',None);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1591 oid = REQUEST.form.get('oid',None);
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1592
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1593 if table is None or oid is None:
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1594 return
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1595
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1596 query="DELETE FROM %s WHERE oid = '%s'"%(table,oid)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1597
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1598 self.executeZSQL(query)
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1599 REQUEST.response.redirect(self.REQUEST['HTTP_REFERER'])
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1600
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1601
40
fd8e78bbc5ed more work on projects.
casties
parents: 38
diff changeset
1602 def invalidate_cache(self):
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1603 #TODO: How to invalidate the varnish cache from the member object
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1604 pass;
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1605
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1606
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1607 def getStaffURL(self):
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1608 ident = self.content.e_mail;
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1609 splitted = ident.split("@");
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1610 return splitted[0]
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1611
56
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1612 def getPublicationsFromPubman(self,limit=None,publicationType=None):
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1613
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1614
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1615 if self.content.publications_mode=="year" or publicationType is not None:
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1616 coneId = self.getConeId();
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1617 if coneId:
56
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1618 pubs= self.folder.getPublicationsFromPubman(coneId,limit=limit,publicationType=publicationType)
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1619 return pubs
38
3c98cc79dd14 version 0.1 mit publicationen von pubman (TEST!!)
dwinter
parents: 37
diff changeset
1620
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1621 elif self.content.publications_mode=="priority":
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1622 selPubs= self.getSelectedPublications()
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1623
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1624 pubs=[]
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1625 for selPub in selPubs:
53
e718d9a72f19 bibliographie funktionen
dwinter
parents: 48
diff changeset
1626 logging.debug("searchFor:%s"%selPub.escidocid)
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1627 pubs.append((selPub.escidocid,self.mpiwgPubman.getEntryFromPubman(selPub.escidocid)))
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1628
46
955d102392db pubman integration 0.2
dwinter
parents: 38
diff changeset
1629 return pubs
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1630 return {}
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1631
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1632
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1633 def publicationsFull(self,REQUEST):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1634 """show publication"""
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1635 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','show_publications.zpt')).__of__(self)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1636 return pt(member=self.content)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1637
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1638
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1639
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1640
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1641
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1642 def addPublicationsFromPubman(self,REQUEST):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1643 """addPublications from pubman"""
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1644
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1645 data=REQUEST.form
38
3c98cc79dd14 version 0.1 mit publicationen von pubman (TEST!!)
dwinter
parents: 37
diff changeset
1646
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1647 if data.get("method",None) is None:
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1648 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1649 return pt()
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1650
37
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1651
9b38ba45773b ?berarbeitung MPIWGStaff
dwinter
parents: 28
diff changeset
1652
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1653 if data.get("method") == "search":
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1654 entries= self.mpiwgPubman.search(data)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1655 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1656
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1657
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1658 return pt(values=entries)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1659
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1660
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1661
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1662 if data.get("method") == "add":
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1663
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1664 return self.addEntriesToPublicationList(data)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1665 #pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1666
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1667
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1668
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1669 def addEntriesToPublicationList(self,data):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1670 """fuege eintrage aus data zur publications liste,
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1671 @param data Map mit escidocID --> value
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1672 value muss "add" sein damit hinzugefuegt wird"""
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1673
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1674 for key in data.keys():
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1675
56
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1676 if key.startswith('escidoc:'):
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1677
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1678
56
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1679 query="INSERT INTO pubmanbiblio (key_main,escidocId) values (%s,%s)"
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1680
56
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1681 if data.get(key)=="add":
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1682 self.executeZSQL(query,[self.getKey(),key])
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1683
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1684
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1685
56
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1686 #selectedPublications = self.getSelectedPublications()
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1687
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1688 #pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','change_publications.zpt')).__of__(self)
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1689
56
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1690 #return pt()
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1691 if hasattr(self,'REQUEST'):
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1692 return self.REQUEST.response.redirect("changePublications")
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1693
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1694
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1695 def changePublications(self,REQUEST):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1696 """change published publications"""
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1697
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1698 data=REQUEST.form
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1699
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1700
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1701 if data.get("method","change"):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1702 for key in data.keys():
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1703 splitted=key.split("__") #format escidoc_id__p fuer priority, nur escidocid
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1704 value=data[key]
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1705 if len(splitted)==1:
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1706 self.deleteFromPublicationList(key);
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1707
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1708 elif(splitted[1]) == "p":
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1709 self.setPublicationPriority(splitted[0],value);
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1710
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1711
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1712 pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','change_publications.zpt')).__of__(self)
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1713 return pt()
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1714
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1715
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1716 def deleteFromPublicationList(self,escidocid):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1717 """Loessche publication with escidoc id from publication list"""
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1718
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1719 query ="DELETE FROM pubmanbiblio WHERE escidocid=%s and key_main=%s"
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1720
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1721 self.executeZSQL(query,[escidocid,self.getKey()]);
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1722
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1723
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1724 def setPublicationPriority(self,escidocid,value):
56
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1725 try:
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1726 query="update pubmanbiblio set priority=%s where escidocid=%s and key_main=%s"
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1727
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1728 self.executeZSQL(query,[value,escidocid,self.getKey()]);
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1729
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1730 except:
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1731 logging.error("couldn't change:")
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1732 logging.error(escidocid)
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1733 logging.error(value)
a6ace48c2bf2 publication management f?r projekte
dwinter
parents: 53
diff changeset
1734
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1735 def getSelectedPublications(self):
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1736 """hole publications aus der datenbank"""
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1737
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1738
53
e718d9a72f19 bibliographie funktionen
dwinter
parents: 48
diff changeset
1739 query="select * from pubmanbiblio where lower(key_main) = lower(%s) order by priority DESC"
47
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1740
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1741
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1742 return self.executeZSQL(query,[self.getKey()])
225179dfd892 getPublications erweitert nach Typ
dwinter
parents: 46
diff changeset
1743
3
ee3eb9a6665a MPIWGStaffFolder shows members from db now.
casties
parents: 2
diff changeset
1744 InitializeClass(MPIWGStaffMember)