--- MPIWGWeb/MPIWGProjects.py 2005/04/25 16:58:02 1.46 +++ MPIWGWeb/MPIWGProjects.py 2005/10/10 08:42:49 1.47.2.25 @@ -7,6 +7,7 @@ from Products.PageTemplates.PageTemplate from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder from Products.ZCatalog.CatalogPathAwareness import CatalogAware +from OFS.Image import Image from Globals import package_home import urllib import MPIWGStaff @@ -15,11 +16,11 @@ import re import os from types import * import zLOG -import xmlhelper # Methoden zur Verwaltung der projekt xmls +import xmlhelper # Methoden zur Verwaltung der projekt xml from OFS.SimpleItem import SimpleItem from OFS.Folder import Folder from Products.ZSQLMethods.SQL import SQLConnectionIDs - +from AccessControl import ClassSecurityInfo from bibliography import * import time @@ -61,11 +62,111 @@ def sortI(x,y): except: return cmp(x[1],y[1]) +class MPIWGLink(SimpleItem): + """create a symbolic link to another page""" + + meta_type="MPIWGLink" + + def isActiveItem(self): + """teste ob ausgewaehlt""" + #url1 beim link anstelle von url1, da link jeweils index_html als url hat. + if self.absolute_url()==self.REQUEST['URL1']: + return "aktiv" + else: + return "" + + def __init__(self,id,link,title='',weight=''): + """init mpiwglink""" + self.id=id + self.link=link + self.title=title + self.weight=weight + + def getObj(self): + """bekomme original""" + ## objpath=self.link.replace("/",".") +## if objpath[0]!=".": +## objpath="."+objpath + +## print objpath +## return eval("self"+objpath) + + + splitted=self.link.lstrip().split("/") + obj=self + for x in splitted: + if not x=="": + obj=getattr(obj,x) + + return obj + + def getWeight(self): + if self.linkWeight and linkWeight!="": + return self.linkWeight + else: + return self.getObj().weight + + manage_options=SimpleItem.manage_options+( + {'label':'main config','action':'changeLinkForm'}, + ) + + + def changeLinkForm(self): + """change MPIWG link""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','MPIWGLinkChange.zpt')).__of__(self) + return pt() + + def changeLink(self,link,title,weight,RESPONSE=None): + """change links""" + self.link=link + self.title=title + self.weight=weight + + if RESPONSE is not None: + RESPONSE.redirect('manage') + + def index_html(self): + """index""" + + return self.getObj().pt_render(extra_context={'here':self}) + + +def manage_addMPIWGLinkForm(self): + """Form for adding link""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/AddMPIWGLink.zpt')).__of__(self) + return pt() + +def manage_addMPIWGLink(self,id,link,title,weight,RESPONSE=None): + """add link""" + newObj=MPIWGLink(id,link,title,weight) + + self._setObject(id,newObj) + + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + + class MPIWGTemplate(ZopePageTemplate): """Create a layout Template for different purposes""" meta_type="MPIWGTemplate" + manage_options=ZopePageTemplate.manage_options+( + {'label':'Change Weight','action':'changeWeightForm'}, + ) + + def changeWeightForm(self): + """change weight form""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','MPIWGTemplateChangeWeight.zpt')).__of__(self) + return pt() + + def changeWeight(self,weight,RESPONSE=None): + """change weight""" + self.weight=weight + if RESPONSE is not None: + RESPONSE.redirect('manage') + + def __init__(self, id, text=None, content_type=None,MPIWGType=None): self.id = str(id) @@ -81,7 +182,13 @@ class MPIWGTemplate(ZopePageTemplate): """change form""" - + def isActiveItem(self): + """teste ob ausgewaehlt""" + if self.absolute_url()==self.REQUEST['URL']: + return "aktiv" + else: + return "" + def manage_addMPIWGTemplateForm(self): """Form for adding""" pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/AddMPIWGTemplate.zpt')).__of__(self) @@ -90,7 +197,7 @@ def manage_addMPIWGTemplateForm(self): from urllib import quote -def manage_addMPIWGTemplate(self, MPIWGType,id, title=None,REQUEST=None): +def manage_addMPIWGTemplate(self, MPIWGType,id, title=None,weight=0,REQUEST=None): "Add a Page Template with optional file content." if type(MPIWGType)==StringType: MPIWGTypes=[MPIWGType] @@ -125,7 +232,9 @@ def manage_addMPIWGTemplate(self, MPIWGT except AttributeError: u = REQUEST['URL1'] - + ob = getattr(self, id) + ob.weight=weight + REQUEST.RESPONSE.redirect(u+'/manage_main') return '' @@ -136,7 +245,7 @@ class MPIWGRoot(ZSQLExtendFolder): fieldLabels={'WEB_title':'WEB_Title','xdata_01':'Responsible Scientists','xdata_02':'Department', 'xdata_03':'Historical Persons','xdata_04':'Time period', 'xdata_05':'Sorting number','xdata_06':'Keywords','xdata_07':'Short title', - 'xdata_08':'Other involved scholars' ,'xdata_09':'Part of','xdata_10':'Covered by', + 'xdata_08':'Other involved scholars' ,'xdata_09':'Disciplines','xdata_10':'Themes', 'xdata_11':'Object Digitallibrary','xdata_12':'Cooperation partners', 'xdata_13':'Funding institutions','WEB_project_header':'WEB_project_header', 'WEB_project_description':'WEB_project_description','WEB_related_pub':'WEB_related_pub'} @@ -144,22 +253,115 @@ class MPIWGRoot(ZSQLExtendFolder): folders=['MPIWGProject','Folder','ECHO_Navigation'] meta_type='MPIWGRoot' + def versionHeaderEN(self): + """version header text""" + + date= self.REQUEST.get('date',None) + if date: + txt="""
%s
\n"%project[0]) + tmp=project[1].WEB_project_description[0].replace("/CD/projects/","")[0:] + setattr(project[1],'WEB_project_description',[tmp[0:]]) + RESPONSE.write("%s
\n"%project[0]) def replaceNotEmpty(self,format,field): """replace not empty""" @@ -340,16 +542,32 @@ class MPIWGRoot(ZSQLExtendFolder): pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editHistoricalPersonsForm')).__of__(self) return pt() - def getProjectsByFieldContent(self,fieldName,fieldContentsEntry): + def getProjectsByFieldContent(self,fieldName,fieldContentsEntry, date=None): """gib alle Projekte aus mit Value von field mit fieldName enthält ein Element der Liste fieldContents""" + def sort(x,y): + return cmp(x.WEB_title[0],y.WEB_title[0]) + if type(fieldContentsEntry) is StringType: - fieldContents=[fieldContentsEntry] + fieldContentsTmp=[fieldContentsEntry] else: - fieldContents=fieldContentsEntry - - projects=self.ProjectCatalog({fieldName:string.join(fieldContents,' OR')}) + fieldContentsTmp=fieldContentsEntry + + fieldContents=[] + for x in fieldContentsTmp: + fieldContents.append(" AND ".join(x.split())) + projects=self.ProjectCatalog({fieldName:string.join(fieldContents,' AND')}) #print projects - return projects + #ret=[x for x in projects] + ret=[] + for x in projects: + obj=x.getObject() + obj=obj.getActualVersion(date) + if obj and (not getattr(obj,'invisible',None)): + #if not (x in ret): + ret.append(x) + + ret.sort(sort) + return ret def changeMPIWGRootForm(self): """edit""" @@ -368,29 +586,32 @@ class MPIWGRoot(ZSQLExtendFolder): def getDisciplineList(self): """get disciplines as list""" - return self.disciplineList.split("\n") + list= self.disciplineList.split("\n") + return [x.rstrip().lstrip() for x in list] def getThemeList(self): """get themes as list""" - return self.themesList.split("\n") + list= self.themesList.split("\n") + return [x.rstrip().lstrip() for x in list] def test(self): """test""" return self.getProjectsByFieldContent('xdata_09',['biology'])[0].absolute_url - def getContexts(self,childs=None,parents=None,depth=None): + def getContexts(self,childs=None,parents=None,depth=None,date=None): """childs alle childs, alle parents""" ret=[] + if parents: splitted=parents.split(".") parentId=string.join(splitted[0:len(splitted)-1],".") - for project in self.getProjectFields('xdata_05',sort='int'): + for project in self.getProjectFields('xdata_05',sort='int',date=date): if project[1]==parentId: ret.append(project) if childs: - for project in self.getProjectFields('xdata_05',sort='int'): + for project in self.getProjectFields('xdata_05',sort='int',date=date): searchStr=childs+"(\..*)" if re.match(searchStr,project[1]): @@ -403,7 +624,7 @@ class MPIWGRoot(ZSQLExtendFolder): ret.append(project) return ret - def getProjectFields(self,fieldName,folder=None,sort=None): + def getProjectFields(self,fieldName,date=None,folder=None,sort=None): """getListofFieldNames""" ret=[] @@ -412,8 +633,8 @@ class MPIWGRoot(ZSQLExtendFolder): for object in objects: obj=object[1] - - if not getattr(obj,'invisible',None): + obj=obj.getActualVersion(date) + if obj and (not getattr(obj,'invisible',None)): if fieldName=="WEB_title_or_short": if len(obj.getContent('xdata_07'))<3: # hack weil z.Z. manchmal noch ein Trennzeichen ; oder , im Feld statt leer @@ -436,7 +657,7 @@ class MPIWGRoot(ZSQLExtendFolder): def showNewProjects(self): projects=[] for objs in self.getProjectFields('WEB_title_or_short'): # Get all Projets - if objs[0].xdata_05[0] == "": + if objs[0].xdata_05 and (objs[0].xdata_05[0] == ""): projects.append(objs) @@ -550,10 +771,11 @@ class MPIWGRoot(ZSQLExtendFolder): return entry - def getTree(self): + def getTree(self,date=None): """generate Tree from project list""" + returnList=[] - for project in self.getProjectFields('xdata_05',sort="int"): # get Projects sorted by xdata_05 + for project in self.getProjectFields('xdata_05',sort="int",date=date): # get Projects sorted by xdata_05 for idNr in project[1].split(";"): # more than one number if not idNr=="": @@ -563,11 +785,65 @@ class MPIWGRoot(ZSQLExtendFolder): #title=project[0].WEB_title title=[project[0].getContent('WEB_title')] #print title - returnList.append((depth,nr,title,project[0])) + if idNr[0]!="x": + returnList.append((depth,nr,title,project[0])) return returnList + def formatElementsAsList(self,elements): + """formatiere tree als liste""" + + actualDepth=0 + ret="" + for element in elements: + if (element[0]>actualDepth): + #fuege soviele ul ein wie unterschied in tiefe + if element[0]==1: + ret+="""") + + for pubSplit in pubSplits: + pubSplit=pubSplit.replace("
","") + self.addPublication(pubSplit) + + if RESPONSE: + RESPONSE.redirect('managePublications') + + def copyImageToMargin(self,RESPONSE=None): + """copy inline images to marginal images""" + self.getContent('WEB_project_description',filter='yes') + + filename=self.imageURL.split("/")[-1] + #lege neues images object an, mit leerem bild + + if self.ZopeFind(self,obj_ids=[filename]): + #existiert das bild schon, dann neueun filenamen + filename="project_image_"+filename + + self.addImage(None,self.imagecap,filename=filename) + #hole die bilddaten aus der url + data=urllib.urlopen(self.absolute_url()+"/"+self.imageURL).read() + + obj=getattr(self,filename) + obj.update_data(data) + + if RESPONSE: + RESPONSE.redirect('manageImages') + + def manageImages(self,imageName=None,op=None): + """managage images""" + + + if imageName and op: + if op=='up': + images=self.getImages() + for image in images: + if image[0]==imageName: + nr=images.index(image) + if not nr==0: + images[nr-1][1].place+=1 + images[nr][1].place-=1 + pass + elif op=='down': + images=self.getImages() + for image in images: + if image[0]==imageName: + nr=images.index(image) + if not (nr==len(images)-1): + images[nr+1][1].place-=1 + images[nr][1].place+=1 + pass + + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','MPIWGProject_manageImagesForm.zpt')).__of__(self) + return pt() + + def managePublications(self,pubName=None,op=None): + """managage images""" + + + if pubName and op: + if op=='up': + publications=self.getPublications() + for publication in publications: + if publication[0]==pubName: + nr=publications.index(publication) + if not nr==0: + publications[nr-1][1].place+=1 + publications[nr][1].place-=1 + pass + elif op=='down': + publications=self.getPublications() + for publication in publications: + if publication[0]==pubName: + nr=publications.index(publication) + if not (nr==len(publications)-1): + publications[nr+1][1].place-=1 + publications[nr][1].place+=1 + pass + + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','MPIWGProject_managePublicationsForm.zpt')).__of__(self) + return pt() + + def getPublications(self): + """get all Publications""" + def sort_images(x,y): + return cmp(getattr(x[1],'place',0),getattr(y[1],'place',0)) + + publications=self.ZopeFind(self,obj_metatypes=['MPIWGProject_publication']) + + publications.sort(sort_images) + return publications + + def addPublication(self,text,RESPONSE=None): + """add an MPIWG_Publication""" + + name="publication_"+str(self.getLastPublicationNumber()+1) + + newPublication=MPIWGProject_publication(name) + + self._setObject(name,newPublication) + obj=getattr(self,name) + obj.text=text[0:] + obj.enabled=True; + obj.place=self.getLastPublicationNumber()+1 + obj.id=name + + if RESPONSE is not None: + RESPONSE.redirect('managePublications') + + + def getLastPublicationNumber(self): + publications=self.getPublications() + + if not publications: + return 0 + else: + return getattr(publications[-1][1],'place',0) + + def deletePublication(self,id,RESPONSE=None): + """delete Publication id""" + self.manage_delObjects([id]) + if RESPONSE: + RESPONSE.redirect('managePublications') + + def getImages(self): + """get all Images""" + def sort_images(x,y): + return cmp(getattr(x[1],'place',0),getattr(y[1],'place',0)) + + images=self.ZopeFind(self,obj_metatypes=['MPIWGProject_image']) + + images.sort(sort_images) + return images + + def getLastImageNumber(self): + images=self.getImages() + + if not images: + return 0 + else: + return getattr(images[-1][1],'place',0) + + def deleteImage(self,id,RESPONSE=None): + """delete Image id""" + self.manage_delObjects([id]) + if RESPONSE: + RESPONSE.redirect('manageImages') + + def addImage(self,fileHd,caption,RESPONSE=None,filename=None): + """add an MPIWG_Project_image""" + + if not filename: + filename=fileHd.filename + + if not fileHd: + fileHd=file(os.path.join(package_home(globals()),'blank.gif')) + + newImage=MPIWGProject_image(filename,filename,fileHd) + + self._setObject(filename,newImage) + obj=getattr(self,filename) + obj.caption=caption[0:] + obj.enabled=True; + obj.place=self.getLastImageNumber()+1 + + if RESPONSE is not None: + RESPONSE.redirect('manageImages') + def PrincipiaSearchSource(self): """Return cataloguable key for ourselves.""" return str(self) @@ -883,6 +1395,47 @@ class MPIWGProject(CatalogAware,Folder): return retTXT%(s,s) else: return "" + + def getActualVersion(self,date=None): + """actuelle version""" + def sortProjectsByTime(x,y): + return cmp(x[1].archiveTime,y[1].archiveTime) + + if not date: + if self.isActual(): + return self + else: + return None + + #suche ob aeltere versionen vorhanden sind + + finds=self.ZopeFind(self,obj_metatypes=['MPIWGProject']) + if not finds: #wenn nicht dann teste ob die aktuelle version schon existiert hat. + ad=getattr(self,'creationTime','20050101000000') + if int(date)>int(ad): + return self + else: + return None + + + else: + finds.sort(sortProjectsByTime) + + for find in finds: + #gehe durch die alten Projekte und finde das entprechende + if (int(find[1].archiveTime) > int(date)) and (int(date)>int(getattr(find[1],'creationTime','20050101000000'))): + return find[1] + + #kein passendes gefunden, dann teste ob das aktuelle in frage kommt + ad=getattr(self,'creationTime','20050101000000') + + if int(date)>int(ad): + + return self + else: + return None + + def isActual(self): """gibt 1 zurueck wenn aktuell, 0 sonst""" actualTime=time.localtime() @@ -959,16 +1512,17 @@ class MPIWGProject(CatalogAware,Folder): RESPONSE.redirect('manage_main') def __init__(self, id, argv=None): - """initieriere classe""" - + """initiere classe""" + + self.creationTime=time.strftime("%Y%m%d%H%M%S",time.localtime())[0:] self.id=id self.title=id if argv: for arg in definedFields: - try: - setattr(self,arg,argv[arg]) - except: - setattr(self,arg,"") + try: + setattr(self,arg,argv[arg]) + except: + setattr(self,arg,"") else: for arg in definedFields: setattr(self,arg,'') @@ -989,36 +1543,59 @@ class MPIWGProject(CatalogAware,Folder): def sortProjectsByTime(x,y): return cmp(x[1].archiveTime,y[1].archiveTime) - + + #suche ob aeltere versionen vorhanden sind + finds=self.ZopeFind(self,obj_metatypes=['MPIWGProject']) - if not finds: - return self.absolute_url() + if not finds: #wenn nicht dann teste ob die aktuelle version schon existiert hat. + ad=getattr(self,'creationTime','20050101000000') + if int(date)>int(ad): + return self.REQUEST['URL1']+"/"+self.getId() + else: + return self.REQUEST['URL1']+"/no_project" + + else: finds.sort(sortProjectsByTime) for find in finds: - if int(find[1].archiveTime) > int(date): - return find[1].absolute_url() + #gehe durch die alten Projekte und finde das entprechende + if (int(find[1].archiveTime) > int(date)) and (int(date)>int(getattr(find[1],'creationTime','20050101000000'))): + return self.REQUEST['URL1']+"/"+find[1].getId() - return self.absolute_url() + #kein passendes gefunden, dann teste ob das aktuelle in frage kommt + ad=getattr(self,'creationTime','20050101000000') - - - def index_html(self): - """show homepage""" + if int(date)>int(ad): - if self.REQUEST.has_key('date') and self.REQUEST.SESSION.get('MPI_redirected',None)==None: - self.REQUEST.SESSION['MPI_redirected']=1 - self.REQUEST.RESPONSE.redirect(self.checkDate(self.REQUEST['date'])) + return self.REQUEST['URL1']+"/"+self.getId() else: - self.REQUEST.SESSION['MPI_redirected']=None + return self.REQUEST['URL1']+"/no_project" - ext=self.ZopeFind(self.aq_parent,obj_ids=["project_main"]) - + + def no_project(self): + """warnung: project noch nicht existent""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','no_project')).__of__(self) + return pt() + + def index_html(self,request=True,context=None): + """show homepage""" + if not context: + context=self + if request: + if self.REQUEST.has_key('date') and self.REQUEST.SESSION.get('MPI_redirected',None)==None: + self.REQUEST.SESSION['MPI_redirected']=1 + self.REQUEST.RESPONSE.redirect(self.checkDate(self.REQUEST['date'])+"?date="+self.REQUEST['date']) + else: + self.REQUEST.SESSION['MPI_redirected']=None + + #ext=self.ZopeFind(self.aq_parent,obj_ids=["project_main"]) + ext=getattr(self,"project_main",None) if ext: - return getattr(self,ext[0][1].getId())() + return getattr(self,ext.getId())() + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','project_main')).__of__(context) - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','project_main')).__of__(self) return pt() @@ -1039,7 +1616,7 @@ class MPIWGProject(CatalogAware,Folder): """get attrbiute""" return getattr(self,field) - def getContent(self,field): + def getContent(self,field,filter=None): """Inhalt des Feldes""" text=u'' @@ -1071,12 +1648,53 @@ class MPIWGProject(CatalogAware,Folder): if (text2=='') and (field=='WEB_project_header'): return self.getContent('WEB_title') + if filter: + splitted=text2.split("""""") + if len(splitted)>1: + tmp=splitted[1].split("
") + #return repr(splitted[1]) + try: + self.imageURL=tmp[0].split("\"")[1].encode('utf-8') + except: + self.imageURL=tmp[0].split("src=")[1].split(" ")[0].encode('utf-8') + + split2="".join(tmp[1:]) + + text3=splitted[0]+split2 + + splitted=text3.split("""""") + if len(splitted)>1: + tmp=splitted[1].split("
") + self.imagecap=tmp[0].encode('utf-8') + + split4="".join(tmp[1:]) + + text5=splitted[0]+split4 + else: + #keine caption + text5=text3 + else: + #kein bild + text5=text2 + else: + text5=text2 + #teste ob WEB_project_description und keine führenden p tags - if (len(text2)>4) and (not text2[0:3]=='') and (field=='WEB_project_description'): - return "
"+text2+"
" + if (len(text5)>4) and (not text5[0:3]=='') and (field=='WEB_project_description'): + text5= "
"+text5+"
" + + #filter image + + + return text5.encode('utf-8') - return text2.encode('utf-8') + def showImagesOfPage(self,imageUrl=None): + """show Images of project""" + self.getContent('WEB_project_description',filter='yes') #get the content and store image infos into session + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','projectImageView.zpt')).__of__(self) + return pt() + def show_html(self): """simple index""" @@ -1084,12 +1702,90 @@ class MPIWGProject(CatalogAware,Folder): pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','MPIWGProject_index.zpt')).__of__(self) return pt() + def saveFromPreview(self): + """save content aus preview""" + self.WEB_project_description=self.previewTemplate.WEB_project_description[0:] + self.REQUEST.RESPONSE.redirect("./index.html") + + def saveEditedContent(self,kupu=None,preview=None): + """save Edited content""" + + if preview: + kupu=preview + #find content of body tags + start=kupu.find("") + end=kupu.find("") + newcontent= kupu[start+6:end] + + if preview: + + return self.preview(newcontent) + + self.copyObjectToArchive() + self.WEB_project_description=newcontent[0:] + + self.REQUEST.RESPONSE.redirect("./index.html") + + return True + + security.declareProtected('View managment screens','edit') + def edit(self,western=None): + """Edit pages""" + if western: + self.REQUEST.RESPONSE.setCookie("MP_debug_code","western",path="/") + + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGProjectNeu.zpt')).__of__(self) + return pt() + + def preview(self,description): + """preview""" + tmpPro=getattr(self,"previewTemplate",None) + if not tmpPro: + tmpPro=MPIWGProject("previewTemplate") + self._setObject("previewTemplate",tmpPro) + for field in definedFields: + setattr(tmpPro,field,getattr(self,field)) + tmpPro.WEB_project_description=description[0:] + + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','previewFrame.zpt')).__of__(self) + return pt() + + #return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+"/previewTemplate") + + + def getWebProject_description(self): + """get description""" + debug= self.REQUEST.cookies.get("MP_debug_code",None) + + if debug and debug=="western": + return """ + + + + + %s + + """%self.WEB_project_description[0] + + return """ + + + + + %s + + """%self.getContent('WEB_project_description') + + + def editMPIWGProjectForm(self): """editform""" pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGProject.zpt')).__of__(self) return pt() - def editMPIWGProject(self,RESPONSE=None): + + def editMPIWGProject(self,RESPONSE=None,fromEdit=None): """edit the project and archive the old version""" self.copyObjectToArchive() # archive the object @@ -1100,17 +1796,29 @@ class MPIWGProject(CatalogAware,Folder): setattr(self,x,[self.REQUEST[x].decode('utf-8')]) + if fromEdit and (RESPONSE is not None): + RESPONSE.redirect('./editMPIWGBasisEditor') + + else: + if RESPONSE is not None: + RESPONSE.redirect('manage_main') - - if RESPONSE is not None: - RESPONSE.redirect('manage_main') + + security.declareProtected('View managment screens','editMPIWGDisciplinesThemesEditor') + def editMPIWGDisciplinesThemesEditor(self): + """edit from edit""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGDisciplinesThemesNeu.zpt')).__of__(self) + return pt() + + def editMPIWGDisciplinesThemesForm(self): """edit the disciplines and themes Form""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGDisciplinesThemes.zpt')).__of__(self) return pt() - def editMPIWGDisciplinesThemes(self,disciplines=None,themes=None,RESPONSE=None): + def editMPIWGDisciplinesThemes(self,disciplines=None,themes=None,RESPONSE=None,fromEdit=None): """edit disciplin and form""" if disciplines: if type(disciplines) is StringType: @@ -1126,9 +1834,13 @@ class MPIWGProject(CatalogAware,Folder): self.xdata_10=string.join(themes,";") else: self.xdata_10="" - - if RESPONSE is not None: - RESPONSE.redirect('manage_main') + + if fromEdit and (RESPONSE is not None): + RESPONSE.redirect('./editMPIWGDisciplinesThemesEditor') + + else: + if RESPONSE is not None: + RESPONSE.redirect('manage_main') def isChecked(self,wert,list): @@ -1140,16 +1852,26 @@ class MPIWGProject(CatalogAware,Folder): else: splitted=list[0].split(";") - + splitted=[y.rstrip().lstrip() for y in splitted] + for x in splitted: if (not x==u'') and x in wert: return 1 return 0 + + security.declareProtected('View management screens','editMPIWGBasisEditor') + def editMPIWGBasisEditor(self): + """editform""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGBasisNeu.zpt')).__of__(self) + return pt() + def editMPIWGBasisForm(self): """editform""" pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGBasis.zpt')).__of__(self) return pt() + + def editMPIWGRelatedPublicationsForm(self): """Edit related Publications""" pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','edit_MPIWGRelatedPublications.zpt')).__of__(self) @@ -1207,6 +1929,6 @@ def manage_addMPIWGProject(self,id,RESPO self._setObject(id,newObj) - + if RESPONSE is not None: RESPONSE.redirect('manage_main')