version 1.30, 2004/09/10 19:59:28
|
version 1.36, 2004/10/11 15:41:51
|
Line 6 from Products.PageTemplates.PageTemplate
|
Line 6 from Products.PageTemplates.PageTemplate
|
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate |
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate |
from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder |
from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder |
|
from Globals import package_home |
import urllib |
import urllib |
import MPIWGStaff |
import MPIWGStaff |
import string |
import string |
import re |
import re |
|
import os |
from types import * |
from types import * |
|
|
import xmlhelper # Methoden zur Verwaltung der projekt xmls |
import xmlhelper # Methoden zur Verwaltung der projekt xmls |
Line 72 class MPIWGRoot(ZSQLExtendFolder):
|
Line 73 class MPIWGRoot(ZSQLExtendFolder):
|
folders=['MPIWGProject','Folder'] |
folders=['MPIWGProject','Folder'] |
meta_type='MPIWGRoot' |
meta_type='MPIWGRoot' |
|
|
|
def upDateSQL(self,fileName): |
|
"""updates SQL databases using fm.jar""" |
|
fmJarPath=os.path.join(package_home(globals()), 'updateSQL/fm.jar') |
|
xmlPath=os.path.join(package_home(globals()), "updateSQL/%s"%fileName) |
|
|
|
os.popen("java -classpath %s -Djava.awt.headless=true Convert %s"%(fmJarPath,xmlPath),"r").read() |
|
|
|
return 1 |
|
|
|
def patchProjects(self,RESPONSE): |
|
"""patch""" |
|
projects=self.ZopeFind(self.projects,obj_metatypes=['MPIWGProject']) |
|
for project in projects: |
|
tmp=project[1].WEB_project_description[0].replace("/CD/projects/","")[0:] |
|
setattr(project[1],'WEB_project_description',[tmp[0:]]) |
|
RESPONSE.write("<p>%s</p>\n"%project[0]) |
|
|
def replaceNotEmpty(self,format,field): |
def replaceNotEmpty(self,format,field): |
"""replace not empty""" |
"""replace not empty""" |
if field and (not field==''): |
if field and (not field==''): |
Line 348 class MPIWGRoot(ZSQLExtendFolder):
|
Line 366 class MPIWGRoot(ZSQLExtendFolder):
|
|
|
|
|
manage_options = Folder.manage_options+( |
manage_options = Folder.manage_options+( |
{'label':'Import Persons','action':'importNamesForm'}, |
{'label':'Update Personal Homepages','action':'updateHomepages'}, |
{'label':'Main config','action':'changeMPIWGRootForm'}, |
{'label':'Main config','action':'changeMPIWGRootForm'}, |
{'label':'Edit Historical Persons','action':'editHistoricalPersonsForm'}, |
{'label':'Edit Historical Persons','action':'editHistoricalPersonsForm'}, |
{'label':'Store Historical Persons','action':'storeHistoricalPersons'}, |
{'label':'Store Historical Persons','action':'storeHistoricalPersons'}, |
Line 382 class MPIWGRoot(ZSQLExtendFolder):
|
Line 400 class MPIWGRoot(ZSQLExtendFolder):
|
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
def updateHomepages(self,RESPONSE): |
|
"""lege members an""" |
|
self.upDateSQL('personalwww.xml') |
|
founds=self.ZSQLInlineSearch(_table='personal_www') |
|
project=getattr(self,'members') |
|
for found in founds: |
|
|
|
if not (found.e_mail==""): |
|
newObj=MPIWGStaff.MPIWGStaff(found.username,found.name,found.vorname) |
|
|
|
try: |
|
project._setObject(found.username,newObj) |
|
RESPONSE.write("<p>new:%s</p>\n"%found.username) |
|
except: |
|
RESPONSE.write("<p>old:%s (%s,%s)</p>\n"%(found.username,found.name,found.vorname)) |
|
|
|
|
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
|
def getAllMembers(self): |
def getAllMembers(self): |
"""give list of all members""" |
"""give list of all members""" |
ret=[] |
ret=[] |
Line 431 class MPIWGRoot(ZSQLExtendFolder):
|
Line 471 class MPIWGRoot(ZSQLExtendFolder):
|
|
|
return returnList |
return returnList |
|
|
|
|
def formatElementForOverview(self,element): |
def formatElementForOverview(self,element): |
"""format the element for output in overview""" |
"""format the element for output in overview""" |
if element[0]==1: #department |
if element[0]==1: #department |
#print element[3].getContent('xdata_05') |
#print element[3].getContent('xdata_05') |
if element[3].getContent('xdata_05') == "4": |
if element[3].getContent('xdata_05') == "4": |
return """<h2><a href="%s">Ind. Research Group I: %s</a></h2>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) |
return """<h2 class="hier"><a href="%s">Ind. Research Group I: %s</a></h2>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) |
if element[3].getContent('xdata_05') == "5": |
if element[3].getContent('xdata_05') == "5": |
return """<h2><a href="%s">Ind. Research Group II: %s</a></h2>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) |
return """<h2 class="hier"><a href="%s">Ind. Research Group II: %s</a></h2>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) |
|
|
return """<h2><a href="%s">Department %s: %s</a></h2>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('xdata_05'),element[3].getContent('WEB_title')) |
return """<h2 class="hier"><a href="%s">Department %s: %s</a></h2>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('xdata_05'),element[3].getContent('WEB_title')) |
|
|
elif element[0]==2: #mainprojects |
elif element[0]==2: #mainprojects |
return """<h3><a href="%s">%s</a></h3><p>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) |
return """<h3 class="hier"><a href="%s">%s</a></h3><p>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) |
|
|
elif element[0]==3: |
elif element[0]==3: |
return """<p class="p_noindent"><a href="%s">%s</a></p>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) |
return """<p class="hier"><a href="%s">%s</a></p>"""%(element[3].absolute_url()+"/index.html",element[3].getContent('WEB_title')) |
|
|
|
|
def changePosition(self,treeId,select,RESPONSE=None): |
def changePosition(self,treeId,select,RESPONSE=None): |
"""Change Postion Entry""" |
"""Change Postion Entry""" |
Line 560 class MPIWGRoot(ZSQLExtendFolder):
|
Line 602 class MPIWGRoot(ZSQLExtendFolder):
|
proj=None |
proj=None |
|
|
if proj: |
if proj: |
|
if person =="Otto Sibum" : person="H. Otto Sibum" |
|
if person =="Norton Wise" : person="M. Norton Wise" |
#ret.append("<a href=%s >%s</a>"%(proj[0].absolute_url,person.encode('utf-8'))) |
#ret.append("<a href=%s >%s</a>"%(proj[0].absolute_url,person.encode('utf-8'))) |
ret.append("<a href=%s >%s</a>"%(proj[0].absolute_url+"/index.html",person)) |
ret.append("<a href=%s >%s</a>"%(proj[0].absolute_url+"/index.html",person)) |
else: |
else: |
Line 784 class MPIWGProject(Folder):
|
Line 828 class MPIWGProject(Folder):
|
{'label':'Edit Themes & Disciplines','action':'editMPIWGDisciplinesThemesForm'}, |
{'label':'Edit Themes & Disciplines','action':'editMPIWGDisciplinesThemesForm'}, |
) |
) |
|
|
|
|
|
def index_html(self): |
|
"""show homepage""" |
|
ext=self.ZopeFind(self.aq_parent,obj_ids=["project_main"]) |
|
|
|
if ext: |
|
return getattr(self,ext[0][1].getId())() |
|
|
|
pt=PageTemplateFile('Products/MPIWGWeb/zpt/project_main').__of__(self) |
|
return pt() |
|
|
def getDataFields(self): |
def getDataFields(self): |
"""giveListofDatafields""" |
"""giveListofDatafields""" |
ret=[] |
ret=[] |
Line 839 class MPIWGProject(Folder):
|
Line 894 class MPIWGProject(Folder):
|
#teste ob WEB_project_description und keine führenden p tags |
#teste ob WEB_project_description und keine führenden p tags |
if (len(text2)>4) and (not text2[0:3]=='<p>') and (field=='WEB_project_description'): |
if (len(text2)>4) and (not text2[0:3]=='<p>') and (field=='WEB_project_description'): |
return "<p>"+text2+"</p>" |
return "<p>"+text2+"</p>" |
|
#if text2=="Otto Sibum": |
|
#text2="H. Otto Sibum" |
return text2 |
return text2 |
|
|
def show_html(self): |
def show_html(self): |