--- MPIWGWeb/MPIWGProjects.py 2006/09/14 18:28:27 1.47.2.60
+++ MPIWGWeb/MPIWGProjects.py 2006/11/06 16:08:30 1.47.2.63
@@ -33,7 +33,6 @@ from Ft.Xml.XPath import Evaluate
from Ft.Xml.XPath.Context import Context
from Ft.Xml.Domlette import NonvalidatingReader,PrettyPrint, Print
from Ft.Xml import EMPTY_NAMESPACE
-import psycopg
definedFields=['WEB_title','xdata_01','xdata_02','xdata_03','xdata_04','xdata_05','xdata_06','xdata_07','xdata_08','xdata_09','xdata_10','xdata_11','xdata_12','xdata_13','WEB_project_header','WEB_project_description','WEB_related_pub']
@@ -148,9 +147,9 @@ class MPIWGLink(SimpleItem):
else:
return self.getObj().weight
- manage_options=SimpleItem.manage_options+(
+ manage_options=(
{'label':'main config','action':'changeLinkForm'},
- )
+ )+SimpleItem.manage_options
def changeLinkForm(self):
@@ -325,6 +324,35 @@ class MPIWGRoot(ZSQLExtendFolder):
return str
+
+ def browserCheck(self):
+ """check the browsers request to find out the browser type"""
+ bt = {}
+ ua = self.REQUEST.get_header("HTTP_USER_AGENT")
+ bt['ua'] = ua
+ bt['isIE'] = False
+ bt['isN4'] = False
+ if string.find(ua, 'MSIE') > -1:
+ bt['isIE'] = True
+ else:
+ bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1)
+
+ try:
+ nav = ua[string.find(ua, '('):]
+ ie = string.split(nav, "; ")[1]
+ if string.find(ie, "MSIE") > -1:
+ bt['versIE'] = string.split(ie, " ")[1]
+ except: pass
+
+ bt['isMac'] = string.find(ua, 'Macintosh') > -1
+ bt['isWin'] = string.find(ua, 'Windows') > -1
+ bt['isIEWin'] = bt['isIE'] and bt['isWin']
+ bt['isIEMac'] = bt['isIE'] and bt['isMac']
+ bt['staticHTML'] = False
+
+ return bt
+
+
def versionHeaderEN(self):
"""version header text"""
@@ -454,6 +482,30 @@ class MPIWGRoot(ZSQLExtendFolder):
return True
return False
+ def getSection(self):
+ """returns the current section name"""
+ root = self.absolute_url()
+ url = self.REQUEST['URL']
+ path = string.replace(url, root, '')
+ paths = path.split('/')
+ if len(paths) > 0:
+ sec = paths[1]
+ if sec.find('.') < 0:
+ return sec
+ else:
+ return None
+ return None
+
+ def getSectionStyle(self, name, style=""):
+ """returns a string with the given style + '-sel' if the current section == name"""
+ if self.getSection() == name:
+ return style + '-sel'
+ else:
+ return style
+
+ def MPIWGrootURL(self):
+ """returns the URL to the root"""
+ return self.absolute_url()
def upDateSQL(self,fileName):
"""updates SQL databases using fm.jar"""
@@ -1303,7 +1355,11 @@ class MPIWGRoot(ZSQLExtendFolder):
if person =="Otto Sibum" : person="H. Otto Sibum"
if person =="Norton Wise" : person="M. Norton Wise"
#ret.append("%s"%(proj[0].absolute_url,person.encode('utf-8')))
- ret.append("%s"%(proj[0].absolute_url+"/index.html",person))
+ if self.MPIWGrootURL().split("/")[-1]=='en':
+ tmpPath="/en/staff/members/"
+ else:
+ tmpPath="/de/mitarbeiter/members/"
+ ret.append("%s"%(tmpPath+proj[0].getObject().getId()+"/index.html",person))
else:
#ret.append("%s"%person.encode('utf-8'))
ret.append("%s"%person)
@@ -1450,6 +1506,7 @@ class MPIWGRoot(ZSQLExtendFolder):
def generateNameIndex(self):
"""erzeuge einen index verwendeter personen"""
+ import psycopg
o = psycopg.connect('dbname=authorities user=dwinter password=3333',serialize=0)
results={}
print self.fulltext.historicalNames.items()
@@ -2496,4 +2553,4 @@ def manage_addMPIWGProject(self,id,RESPO
if RESPONSE is not None:
- RESPONSE.redirect('manage_main')
\ No newline at end of file
+ RESPONSE.redirect('manage_main')