changeset 69:c86ee1081b62

Merge with fd6931bd49c869ea7b2fd377b18d3410185f066c
author dwinter
date Fri, 03 May 2013 11:39:34 +0200
parents 2ad8aa9d306c (current diff) fd6931bd49c8 (diff)
children fd167f42cf34
files zpt/edit_project_error_relatedProject.zpt zpt/edit_publicationForm.zpt zpt/edit_relatedProjectForm.zpt zpt/showExtendedProjectBibliography.zpt
diffstat 20 files changed, 889 insertions(+), 983 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGProjects.py	Thu May 02 15:40:27 2013 +0200
+++ b/MPIWGProjects.py	Fri May 03 11:39:34 2013 +0200
@@ -92,6 +92,89 @@
     """publications object fuer project"""
 
     meta_type = "MPIWGProject_publication"
+    
+    text = None
+    link = None
+    bookId = None
+    
+    editDescription = PageTemplateFile('zpt/project/related_publication/edit_basic', globals())
+    
+    
+    def redirect(self, RESPONSE, url):
+        """mache ein redirect mit einem angehaengten time stamp um ein reload zu erzwingen"""        
+        timeStamp = time.time()
+        
+        if url.find("?") > -1:  # giebt es schon parameter
+            addStr = "&time=%s"
+        else:
+            addStr = "?time=%s"
+            
+        RESPONSE.setHeader('Last-Modified', email.Utils.formatdate().split("-")[0] + 'GMT')
+        logging.debug(email.Utils.formatdate() + ' GMT')
+        RESPONSE.redirect(url + addStr % timeStamp)
+
+
+    def hasLinkToBookPage(self):
+        """teste ob eingebener link zu einer MPIWG Book page geht"""
+        logging.debug("MPIWGProject_publication - begin hasLinkToBookPage")
+        if not self.link:
+            return False  # es gibt keinen link
+        
+        paths = self.link.split('/')
+        if len(paths) > 2:
+            # book page should be in folder books
+            bookid = None
+            try:
+                idx = paths.index('books')
+                bookid = paths[idx + 1]
+                book = self.en.books[bookid]
+                self.bookId = bookid
+                return True
+            
+            except:
+                logging.debug("hasLinkToBookPage: not a book page link=%s"%self.link)
+
+        self.bookId = None
+        return False
+
+    
+    def getBookId(self):
+        """Return the book page id."""
+        return self.bookId
+    
+        
+    def editPublication(self, text=None, description=None, link=None, RESPONSE=None):
+        """edit a publication"""
+
+        if (not text) and (not description):
+            pt = self.editDescription
+            return pt()
+       
+        if text:
+            self.text = text
+        
+        if description:
+            self.description = description
+        
+        if link:
+            self.link = link
+            self.hasLinkToBookPage()
+        
+        if RESPONSE:
+            self.redirect(RESPONSE, "../managePublications")
+
+
+class MPIWGProject_relatedProject(Folder):
+    """publications object fuer project"""
+
+    meta_type = "MPIWGProject_relatedProject"
+    
+    objid = None
+    projectLabel = None
+    
+    editDescription = PageTemplateFile('zpt/project/related_project/edit_basic', globals())
+    
+
     def redirect(self, RESPONSE, url):
         """mache ein redirect mit einem angehaengten time stamp um ein reload zu erzwingen"""
         
@@ -106,121 +189,40 @@
         logging.debug(email.Utils.formatdate() + ' GMT')
         RESPONSE.redirect(url + addStr % timeStamp)
 
-    def hasLinkToBookPage(self, mode="not_cached"):
-        """teste ob eingebener link zu einer MPIWG Book page geht"""
-        
-        
-        logging.debug("MPIWGProject_publication - begin hasLinkToBookPage")
-        if (getattr(self, 'link', '') == ''):
-            return False  # es gibt keinen link
-        
-        logging.debug("MPIWGProject_publication - begin hasLinkToBookPage:" + self.link)
-        server = xmlrpclib.ServerProxy(self.link)
-        
-        if(mode == "cached"):
-            if (hasattr(self, "_v_hasLinkToBookPage")):
-                logging.debug("haslink cached")
-                return self._v_hasLinkToBookPage
-        
-        try:
-            server.getImageUrls()
-            logging.debug("MPIWGProject_publication - end TRUE")
-            self._v_hasLinkToBookPage = True
-            return True
-        except:
-            logging.debug("MPIWGProject_publication - end FALSE ")
-            self._v_hasLinkToBookPage = True
-            return False
     
-    
-    def getImageUrls(self, mode="not_cached"):
-        """get the image urls"""
-        
-        if (getattr(self, 'link', '') == ''):
-            return []  # es gibt keinen link
-        
-        server = xmlrpclib.ServerProxy(self.link)
-        
-        
-        if(mode == "cached"):
-            if (hasattr(self, "_v_imageUrls")):
-                logging.debug("getImageURL cached")
-                return self._v_imageUrls
-       
-        try:
-            urls = server.getImageUrls()
-            ret = []
-            for url in urls:
-                url = os.path.join(self.link, url)
-                ret.append(url)
-           
-        except:
-            self._v_imageUrls = []
-            return []
-        self._v_imageUrls = ret[0:]
-        return ret
-
-        
-    def editPublication(self, text=None, image1=None, image2=None, description=None, link=None, RESPONSE=None):
-        """edit a publication"""
-
-        if (not text) and (not description):
-            pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'edit_publicationForm.zpt')).__of__(self)
-            return pt()
-
-       
-        if text:
-            self.text = text[0:]
-        
-        if description:
-            self.description = description
-        
-        if link:
-            self.link = link[0:]
-        
-        if image1:
-            if hasattr(self, 'publicationImage1'):
-                self.publicationImage1.manage_upload(image1)
-            else:
-                nO = Image('publicationImage1', '', image1)
-                self._setObject('publicationImage1', nO)
-                
-        if image2:
-            if hasattr(self, 'publicationImage2'):
-                self.publicationImage2.manage_upload(image2)
-            else:
-                nO = Image('publicationImage2', '', image2)
-                self._setObject('publicationImage2', nO)
- 
-        self.ZCacheable_invalidate()
-        if RESPONSE:
-            self.redirect(RESPONSE, "../managePublications")
+    def getProjectId(self):
+        """Return the related project id."""
+        return self.objid
 
 
-class MPIWGProject_relatedProject(Folder):
-    """publications object fuer project"""
+    def getProject(self):
+        """Return the related project object."""
+        return getattr(self.projects, self.objid, None)
+
+    
+    def getProjectTitle(self):
+        """Return the title of the related project."""
+        return getattr(self, 'projectWEB_title', None)
 
-    meta_type = "MPIWGProject_relatedProject"
-    def redirect(self, RESPONSE, url):
-        """mache ein redirect mit einem angehaengten time stamp um ein reload zu erzwingen"""
-        
-        timeStamp = time.time()
-        
-        if url.find("?") > -1:  # giebt es schon parameter
-            addStr = "&time=%s"
-        else:
-            addStr = "?time=%s"
+    
+    def getProjectLabel(self):
+        """Return the label of the related project."""
+        label = getattr(self, 'projectLabel', None)
+        if not label:
+            proj = self.getProject()
+            if proj is not None:
+                label = proj.getLabel()
+                
+            self.projectLabel = label
             
-        RESPONSE.setHeader('Last-Modified', email.Utils.formatdate().split("-")[0] + 'GMT')
-        logging.debug(email.Utils.formatdate() + ' GMT')
-        RESPONSE.redirect(url + addStr % timeStamp)
+        return label
 
         
     def editRelatedProject(self, link=None, RESPONSE=None):
         """edit a publication"""
 
         if (not link):
-            pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'edit_relatedProjectForm.zpt')).__of__(self)
+            pt = self.editDescription
             return pt()
         
         # hole die id des projektes
@@ -233,13 +235,14 @@
         objid = splitted[-1]
         object = getattr(self.projects, objid, None)
         
-        if object == None:
+        if object is None:
             self.redirect(RESPONSE, 'errorRelatedProjects?link=' + link)
        
         self.orginallink = link[0:]
         self.objid = objid[0:]
     
         self.projectWEB_title = object.getProjectTitle()
+        self.projectLabel = object.getLabel()
        
         self.enabled = True;
        
@@ -254,7 +257,7 @@
 
     def showImage(self, imageUrl=None):
         """show Images at an extra page"""
-        self.getContent('WEB_project_description', filter='yes')  # get the content and store image infos into session
+        #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()
     
@@ -282,7 +285,7 @@
     
     manage_options = Folder.manage_options + (
         {'label':'Load New File', 'action':'loadNewFileForm'},
-        {'label':'Edit', 'action':'editForm'},
+        {'label':'Edit', 'action':'editDescription'},
         )
         # {'label':'Edit ProjectInfo','action':'editMPIWGProjectForm'},
         # {'label':'Edit BasisInfo','action':'editMPIWGBasisForm'},
@@ -304,13 +307,24 @@
     edit_css = ImageFile('css/edit.css', globals())
     # make css refreshable for development
     edit_css.index_html = refreshingImageFileIndexHtml
-    edit_basic = PageTemplateFile('zpt/project/edit_basic', globals())
-    editForm = PageTemplateFile('zpt/project/edit_description', globals())
+    # user-accessible editing templates
+    security.declareProtected('View management screens', 'editBasic')
+    editBasic = PageTemplateFile('zpt/project/edit_basic', globals())
+    editDescription = PageTemplateFile('zpt/project/edit_description', globals())
     edit_template = PageTemplateFile('zpt/project/edit_template', globals())
-    edit_related_projects = PageTemplateFile('zpt/project/edit_related_projects', globals())
+    editRelatedProjectsForm = PageTemplateFile('zpt/project/edit_related_projects', globals())
+    editRelatedProjectsError = PageTemplateFile('zpt/project/edit_related_projects_error', globals())
+    editImagesForm = PageTemplateFile('zpt/project/edit_images', globals())    
+    editPublicationsForm = PageTemplateFile('zpt/project/edit_publications', globals())
+    editAdditionalPublicationsForm = PageTemplateFile('zpt/project/pubman/change_publications', globals())
+    editAddAdditionalPublications = PageTemplateFile('zpt/project/pubman/add_publications', globals())
+    security.declareProtected('View management screens', 'edit')
+    edit = editDescription
     # management templates
     loadNewFileForm = PageTemplateFile('zpt/project/manage_newfile', globals())
     description_only_html = PageTemplateFile('zpt/project/description_only_html', globals())
+    # additional pages
+    additionalPublications = PageTemplateFile('zpt/project/pubman/show_publications', globals())
 
     # TODO: this should go away
     extendedBibliography = PageTemplateFile('zpt/project/extendedBibliography_template', globals())
@@ -360,6 +374,21 @@
         RESPONSE.redirect(url + addStr % timeStamp)
 
 
+    def getDefinedFields(self):
+        """show all defined fields."""
+        return definedFields
+
+
+    def getFieldLabels(self):
+        """Return the field labels dict."""
+        return fieldLabels
+    
+
+    def getEditableFields(self):
+        """giveListofDatafields"""
+        return editableFields
+    
+
     def getNumber(self):
         """returns sorting number"""
         n = getattr(self, 'xdata_05', None)
@@ -451,6 +480,11 @@
         else:
             return t
         
+        
+    def getMPIWGProjectUrl(self):
+        """Return this project for acquisition."""
+        return self.absolute_url()
+     
               
     def getUrl(self, baseUrl=None):
         """returns URL to this Project"""
@@ -477,13 +511,6 @@
         return thumb.absolute_url()
 
               
-    def getImageList(self):
-        """returns the sorted list of images for this project"""
-        items = self.objectValues(spec='MPIWGProject_image')
-        # sort by place
-        return sorted(items, key=lambda x:int(getattr(x, 'place', 0)))
-
-
     def getDepartment(self):
         """returns the department of this project"""
         num = self.getNumber()
@@ -525,22 +552,6 @@
         return [p for p in tree.getChildrenOf(self.getNumber()) if p.checkActive(active)]
     
               
-    def getRelatedProjects(self):
-        """returns the list of related projects"""
-        items = self.objectValues(spec='MPIWGProject_relatedProject')
-        # sort by place
-        items.sort(key=lambda x:int(getattr(x, 'place', 0)))
-        return items
-        
-
-    def getRelatedPublications(self):
-        """returns the list of related publications"""
-        items = self.objectValues(spec='MPIWGProject_publication')
-        # sort by place
-        items.sort(key=lambda x:int(getattr(x, 'place', 0)))
-        return items          
-        
-    
     def getRelatedDigitalSources(self):
         """returns the related digital sources"""
         t = getattr(self, 'xdata_11', None)
@@ -561,101 +572,106 @@
             return t
 
               
-    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
+    def _moveObjectPlace(self, objectList, objectId, direction):
+        """Move object with objectId from objectList in direction 
+        by changing its place attribute."""
+        if not objectId or not direction:
+            return
+
+        for idx in range(len(objectList)):
+            object = objectList[idx]
+            if object.getId() == objectId:
+                if direction == 'up':
+                    if idx > 0:
+                        # move up
+                        objectList[idx -1].place += 1
+                        objectList[idx].place -= 1
+                        
+                elif direction == 'down':
+                    if idx < len(objectList) - 1:
+                        # move down
+                        objectList[idx + 1].place -= 1
+                        objectList[idx].place += 1
+                        
+                return
+                      
 
+    def getImageList(self):
+        """returns the sorted list of images for this project"""
+        items = self.objectValues(spec='MPIWGProject_image')
+        # sort by place
+        return sorted(items, key=lambda x:int(getattr(x, 'place', 0)))
+
+
+    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[:]
+        obj.enabled = True;
+        obj.place = self._getLastImageNumber() + 1
+        obj.id = filename
 
         # invalidate thumbnail
         self.projectThumb = None
-        pt = PageTemplateFile('zpt/project/edit_images', globals()).__of__(self)
-        return pt()
+        
+        if RESPONSE is not None:            
+            self.redirect(RESPONSE, 'manageImages')
+
 
-    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
+    def _getLastImageNumber(self):
+        items = self.getImageList()
+        if not items:
+            return 0
+        else:
+            return getattr(items[-1], 'place', 0)
+
+        
+    def manageImages(self, name=None, op=None):
+        """manage images"""
+        self._moveObjectPlace(self.getImageList(), name, op)
+ 
+        # invalidate thumbnail
+        self.projectThumb = None
+        
+        pt = self.editImagesForm
+        return pt()
 
 
-        pt = PageTemplateFile('zpt/project/edit_publications', globals()).__of__(self)
-        return pt()
+    def deleteImage(self, id, RESPONSE=None):
+        """delete Image id"""
+        try:
+            self.manage_delObjects([id])
+        except:
+            logging.error("ERROR MPIWG: %s %s" % sys.exc_info()[0:2])
+                
+        # invalidate thumbnail
+        self.projectThumb = None
+        
+        if RESPONSE:
+            self.redirect(RESPONSE, 'manageImages')
+
+ 
+    def getPublicationList(self):
+        """returns the list of related publications"""
+        items = self.objectValues(spec='MPIWGProject_publication')
+        # sort by place
+        items.sort(key=lambda x:int(getattr(x, 'place', 0)))
+        return items          
+        
     
-    def manageRelatedProjects(self, pubName=None, op=None):
-        """manage related projects"""
-        if pubName and op:
-            if op == 'up':
-                relatedProjects = self.getRelatedProjects()
-                for project in relatedProjects:
-                    if project[0] == pubName:
-                        nr = relatedProjects.index(project)
-                        if not nr == 0:
-                            relatedProjects[nr - 1][1].place += 1
-                            relatedProjects[nr][1].place -= 1
-                        pass
-            elif op == 'down':
-                relatedProjects = self.getRelatedProjects()
-                for project in relatedProjects:
-                    if project[0] == pubName:
-                        nr = relatedProjects.index(project)
-                        if not (nr == len(relatedProjects) - 1):
-                            relatedProjects[nr + 1][1].place -= 1
-                            relatedProjects[nr][1].place += 1
-                        pass
-
-
-        pt = self.edit_related_projects
-        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"""
-        number = self.getLastPublicationNumber() + 1
+        number = self._getLastPublicationNumber() + 1
         name = "publication_" + str(number)
         while hasattr(self, name):
             number += 1
@@ -667,25 +683,50 @@
         obj = getattr(self, name)
         obj.text = text[0:]
         obj.enabled = True;
-        obj.place = self.getLastPublicationNumber() + 1
+        obj.place = self._getLastPublicationNumber() + 1
         obj.id = name
-        self.ZCacheable_invalidate()
         if RESPONSE is not None:
-        
             self.redirect(RESPONSE, 'managePublications')
 
-    def errorRelatedProjects(self, link):
-        """error creating a related project"""
-        pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'edit_project_error_relatedProject.zpt')).__of__(self)
-        return pt(link=link)
+
+    def _getLastPublicationNumber(self):
+        items = self.getPublicationList()
+        if not items:
+            return 0
+        else:
+            return getattr(items[-1], 'place', 0)
+
+        
+    def managePublications(self, name=None, op=None):
+        """manage publications"""
+        self._moveObjectPlace(self.getPublicationList(), name, op)
+
+        pt = self.editPublicationsForm
+        return pt()
+
+    
+    def deletePublication(self, id, RESPONSE=None):
+            """delete Publication id"""
+            self.manage_delObjects([id])
+            if RESPONSE:
+                self.redirect(RESPONSE, 'managePublications')
+              
+
+    def getRelatedProjectList(self):
+        """returns the list of related projects"""
+        items = self.objectValues(spec='MPIWGProject_relatedProject')
+        # sort by place
+        items.sort(key=lambda x:int(getattr(x, 'place', 0)))
+        return items
+        
 
     def addRelatedProject(self, link, RESPONSE=None):
-        """add an MPIWG_Publication"""
-        number = self.getLastPublicationNumber() + 1
-        name = "RelatedProject" + str(number)
+        """add a MPIWGProject_relatedProject"""
+        number = self._getLastRelatedProjectNumber() + 1
+        name = "related_project_" + str(number)
         while hasattr(self, name):
             number += 1
-            name = "RelatedProject_" + str(number)
+            name = "related_project_" + str(number)
         
         # hole die id des projektes
         splitted = link.split("/")
@@ -708,118 +749,125 @@
         obj.orginallink = link[0:]
         obj.objid = objid[0:]
         logging.debug("add relobj:objid" + repr(obj.objid))
-        obj.projectWEB_title = object.getContent('WEB_title')[0:]
+        obj.projectWEB_title = object.getProjectTitle()
         logging.debug("add relobj:webtitle" + repr(obj.projectWEB_title))
         obj.enabled = True;
-        obj.place = self.getLastRelatedProjectNumber() + 1
+        obj.place = self._getLastRelatedProjectNumber() + 1
         obj.id = name
-        self.ZCacheable_invalidate()
         if RESPONSE is not None:
             self.redirect(RESPONSE, 'manageRelatedProjects')
 
      
-    def getLastPublicationNumber(self):
-        publications = self.getPublications()
-       
-        if not publications:
-            return 0
-        else:
-            return getattr(publications[-1][1], 'place', 0)
-        
-    def getLastRelatedProjectNumber(self):
-        publications = self.getRelatedProjects()
-        
-        if not publications:
+    def _getLastRelatedProjectNumber(self):
+        items = self.getRelatedProjectList()
+        if not items:
             return 0
         else:
-            return getattr(publications[-1][1], 'place', 0)
+            return getattr(items[-1], 'place', 0)
+
         
-    def deletePublication(self, id, RESPONSE=None):
-            """delete Publication id"""
-            self.manage_delObjects([id])
-            self.ZCacheable_invalidate()
-            if RESPONSE:
-                self.redirect(RESPONSE, 'managePublications')
-              
+    def manageRelatedProjects(self, name=None, op=None):
+        """manage related projects"""
+        self._moveObjectPlace(self.getRelatedProjectList(), name, op)
+
+        pt = self.editRelatedProjectsForm
+        return pt()    
+
+
     def deleteRelatedProject(self, id, RESPONSE=None):
-            """delete Publication id"""
-            self.manage_delObjects([id])
-            self.ZCacheable_invalidate()
-            if RESPONSE:
-                self.redirect(RESPONSE, 'manageRelatedProjects')
+        """delete Publication id"""
+        self.manage_delObjects([id])
+        if RESPONSE:
+            self.redirect(RESPONSE, 'manageRelatedProjects')
+
+
+    def errorRelatedProjects(self, link):
+        """error creating a related project"""
+        pt = self.editRelatedProjectsError
+        return pt(link=link)
+
 
-    def getImages(self):
-        """get all Images"""
+    def getAdditionalPublicationList(self):
+        """hole publications aus der datenbank"""
+        query="select * from pubmanbiblio_projects where lower(key_main) = lower(%s) order by priority DESC"
+        return self.executeZSQL(query,[self.getId()])
 
-        def sort_images(x, y):
-            return cmp(getattr(x[1], 'place', 0), getattr(y[1], 'place', 0))
+        
+    def hasAdditionalPublications(self):
+        """test if extended publication list exists"""
+        query="select count(*) from pubmanbiblio_projects where lower(key_main) = lower(%s)"
+        res= self.executeZSQL(query,[self.getId()])        
+        if res[0].count > 0:
+            return True
+        else:
+            return False
 
 
-        if (getattr(self, 'imageURL', '') != '') or  (getattr(self, 'imagecap', '') != '')  :
-            try:
-                self.addImage(None, getattr(self, 'imagecap', ''), RESPONSE=None, filename=getattr(self, 'imageURL', ''))
-            except:
-                pass
-            self.imageURL = ''
-            self.imagecap = ''
+    def addAdditionalPublicationsFromPubman(self,REQUEST):
+        """addPublications from pubman"""
+        data=REQUEST.form
+        if data.get("method",None) is None:
+            pt = self.editAddAdditionalPublications
+            return pt()
+        
+        if data.get("method") == "search":
+            entries= self.mpiwgPubman.search(data)
+            pt = self.editAddAdditionalPublications
+            return pt(values=entries)
+        
+        if data.get("method") == "add":
+            return self.addEntriesToAdditionalPublicationList(data)
+            #pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self)
 
-        images = self.ZopeFind(self, obj_metatypes=['MPIWGProject_image'])
-        
-        images.sort(sort_images)
-        return images
-
-    def getLastImageNumber(self):
-        images = self.getImages()
+         
+    def addEntriesToAdditionalPublicationList(self,data):
+        """fuege eintrage aus data zur publications liste.
         
-        if not images:
-            return 0
-        else:
-            return getattr(images[-1][1], 'place', 0)
+        @param data Map mit escidocID --> value
+        value muss "add" sein damit hinzugefuegt wird"""
+        for key in data.keys():
+            if key.startswith('escidoc:'):
+                query="INSERT INTO pubmanbiblio_projects (key_main,escidocId) values (%s,%s)"
+                if data.get(key)=="add":
+                    self.executeZSQL(query,[self.getId(),key])
         
-    def deleteImage(self, id, RESPONSE=None):
-        """delete Image id"""
-        try:
-                self.manage_delObjects([id])
-        except:
-                logging.error("ERROR MPIWG: %s %s" % sys.exc_info()[0:2])
+        if hasattr(self,'REQUEST'):
+            return self.REQUEST.response.redirect("changeAdditionalPublications")
+
+    
+    def changeAdditionalPublications(self,REQUEST):
+        """change published publications"""
+        data=REQUEST.form       
+        if data.get("method","change"):
+            for key in data.keys():
+                splitted=key.split("__") #format escidoc_id__p fuer priority, nur escidocid
+                value=data[key]
+                if len(splitted)==1:
+                    self.deleteFromAdditionalPublicationList(key);
                 
-        # invalidate thumbnail
-        self.projectThumb = None
-        
-        if RESPONSE:
-            self.redirect(RESPONSE, 'manageImages')
+                elif(splitted[1]) == "p":
+                    self.setAdditionalPublicationPriority(splitted[0],value);
+                    
+        pt = self.editAdditionalPublicationsForm
+        return pt()
 
+    
+    def deleteFromAdditionalPublicationList(self,escidocid):
+        """Loessche publication with escidoc id from publication list"""
+        query ="DELETE FROM pubmanbiblio_projects WHERE escidocid=%s and key_main=%s"
+        self.executeZSQL(query,[escidocid,self.getId()]);
 
  
-    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
-        obj.id = filename
-
-        # invalidate thumbnail
-        self.projectThumb = None
+    def setAdditionalPublicationPriority(self,escidocid,value):
+        query="update pubmanbiblio_projects set priority=%s where escidocid=%s and key_main=%s"
+        try:
+            value = int(value)
+            self.executeZSQL(query,[value,escidocid,self.getId()]);
+        except:
+            logging.error("couldn't change:")
+            logging.error(escidocid)
+            logging.error(value)
         
-        if RESPONSE is not None:            
-            self.redirect(RESPONSE, 'manageImages')
-
-
-    def getEditableFields(self):
-        """giveListofDatafields"""
-        return editableFields
-    
 
     def getActualVersion(self, date=None):
         """actuelle version"""
@@ -885,18 +933,22 @@
         logging.info("copytoarchive 6")
         obj.manage_delObjects(ids)
         logging.info("copytoarchive 7")
+
         
     def setArchiveTime(self, time):
         """set Archive Time"""
         self.archiveTime = time[0:]
+
         
     def delArchiveTime(self):
         """delete archive time"""
         del self.archiveTime
+
    
     def isActiveProject(self):
         """check if the project is still active, default is true."""
         return getattr(self, 'isActiveFlag', True)
+
  
     def checkActive(self, active):
         """returns if the project state matches the active state.
@@ -906,6 +958,7 @@
         """
         act = getattr(self, 'isActiveFlag', True)
         return (active == 1 and act) or (active == 0) or (active == 2 and not act)
+
  
     def isArchivedProject(self):
         """check if the project is archived"""
@@ -917,6 +970,7 @@
             return False;
         
         return True
+
         
     def checkArchived(self, archived):
         """returns if the project state matches the archived state.
@@ -926,10 +980,12 @@
         """
         arch = self.isArchivedProject()
         return (archived == 1 and not arch) or (archived == 0) or (archived == 2 and arch)        
+
         
     def setActiveFlag(self, status=True):
         """set the active flag"""
         self.isActiveFlag = status
+
         
     def setCompletedAt(self, date):
         """set the date of completion, date should be in the form DD.MM.YYYY or MM.YYYY or YYYY"""
@@ -1041,7 +1097,6 @@
             else:
                 return self.REQUEST['URL1'] + "/no_project"
 
-
         else:
             finds.sort(sortProjectsByTime)
 
@@ -1053,120 +1108,17 @@
         # kein passendes gefunden, dann teste ob das aktuelle in frage kommt
         ad = getattr(self, 'creationTime', '20050101000000')
         
-        if int(date) > int(ad):
-        
+        if int(date) > int(ad):        
             return self.REQUEST['URL1'] + "/" + self.getId()
         else:
             return self.REQUEST['URL1'] + "/no_project"
-        
-            
-            
-    def getDefinedFields(self):
-        """show all defined fields"""
-        return definedFields
-
-    def getAttribute(self, field):
-        """get attrbiute"""
-        return getattr(self, field)
-
-    def getContent(self, field, filter=None):
-        """Inhalt des Feldes"""
-        # logging.debug("getContent field=%s filter=%s"%(field,filter))
-        
-        if field == "short_title":
-                text = self.getContent("xdata_07")
-                if text == "":
-                        text = self.getContent("WEB_title")
-                return text
-
-        text = u''
-
-        f = getattr(self, field)
-        if isinstance(f, list):
-            # compat with old lists
-            for x in f:
-                try:
-                    text += x
-                except:
-                    text = x
-        else:
-            text = f
-
-        try:
-            if text[len(text) - 1] == ";":
-                text = text[0:len(text) - 1]
-                
-        except:
-            pass
-        
-        if text == '':  # # wozu die folgenden Zeilen??
-            text2 = text
-        else:
-            text2 = re.sub(r';([^\s])', '; \g<1>', text)
-       
-        if field == "WEB_project_description":  # #Jedenfalls darf letzteres nicht gemacht werden, falls normaler text
-            text2 = text
+                    
             
-        # teste ob ergebnis leer und header dann nehme title
-        
-        if (text2 == '') and (field == 'WEB_project_header'):
-            return self.getContent('WEB_title')
-
-        if filter:
-            splitted = text2.split("""<p class="picture">""")
-            if len(splitted) > 1:
-                tmp = splitted[1].split("</p>")
-                # return repr(splitted[1])
-                try:
-                        self.imageURL = tmp[0].split("\"")[1].encode('utf-8')
-                except:
-                    try:
-                        self.imageURL = tmp[0].split("src=")[1].split(" ")[0].encode('utf-8')
-                    except:
-                        self.imageURL = ""
-
-                split2 = "</p>".join(tmp[1:])
-
-                text3 = splitted[0] + split2
-
-                splitted = text3.split("""<p class="picturetitle">""")
-                if len(splitted) > 1:
-                    tmp = splitted[1].split("</p>")
-                    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 fuehrenden p tags
-        if (len(text5) > 4) and (not text5[0:3] == '<p>') and (field == 'WEB_project_description'):
-            text5 = "<p>" + text5 + "</p>"
-
-
-        # filter image
-        
-        text5 = text5.lstrip().rstrip()  # loescher leerzeichen und einzelndes br
-        if (text5 == "<br>") or (text5 == "<br/>"):
-            text5 = ""
-
-        # logging.debug("getcontent: field=%s filter=%s -> %s"%(field,filter,repr(text5)))
-        return unicodify(text5)
-        # return utf8ify(text5) # return as utf-8 byte string
-
-
-
     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"""
@@ -1190,16 +1142,6 @@
         
         return True
 
-    security.declareProtected('View management 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)
-        pt = self.editForm
-        return pt()
-    
 
     def getBreadcrumbs(self):
         """return list of breadcrumbs from here to the root"""
@@ -1247,16 +1189,12 @@
         # return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+"/previewTemplate")
         
 
-    def editMPIWGProjectForm(self):
-        """editform"""
-        pt = PageTemplateFile(os.path.join(package_home(globals()), 'zpt', 'edit_MPIWGProject.zpt')).__of__(self)
-        return pt()
-
-
     def isResponsibleScientist(self, key):
         """teste ob eine Person in der Liste der respl. scientists auftaucht"""
         for resp in self.getResponsibleScientistsList():
-            if resp.get('key', None) == utf8ify(key):
+            logging.debug("resp=%s key=%s"%(repr(resp),repr(key)))
+            # TODO: we need to get ASCII keys!!
+            if utf8ify(resp.get('key', '').lower()) == utf8ify(key).lower():
                 return True
         
         return False
@@ -1376,21 +1314,17 @@
         if fromEdit and (RESPONSE is not None):
             return self.editBasic()
             
-        else:
-            if RESPONSE is not None:
-                RESPONSE.redirect('manage_main')
+        if RESPONSE is not None:
+            RESPONSE.redirect('manage_main')
 
 
-    security.declareProtected('View management screens', 'editBasic')
-    def editBasic(self, identifiedNames=None):
-        """editform"""
-        if not identifiedNames:
-            identifiedNames = self.identifyNames(self.getResponsibleScientists())
-        
-        logging.debug("editBasic: IdentifiedNames=%s" % repr(identifiedNames))
-        pt = self.edit_basic
-        return pt(identifiedNames=identifiedNames)
-
+    def getContent(self, field, filter=None):
+        """Inhalt des Feldes"""
+        val = getattr(self, field, '')
+        if isinstance(val, list):
+            val = val[0]
+            
+        return val
 
 
     def loadNewFile(self, RESPONSE=None):
@@ -1416,6 +1350,7 @@
         if RESPONSE is not None:
             RESPONSE.redirect('manage_main')
 
+
     def tagTheProject(self, RESPONSE=None):
         """TAG"""
         id = self.getId();
@@ -1428,7 +1363,7 @@
     def hasRelatedPublicationsOldVersion(self):
         """teste ob es related publications gibt"""        
         ret = True;
-        if (self.getRelatedPublications() == ''):
+        if (getattr(self, 'WEB_related_pub', '') == ''):
             ret = False;  # nichts im alten feld
         logging.debug("webrel:" + repr(ret))
         if (getattr(self, 'WEB_related_pub_copied', False)):
@@ -1439,8 +1374,7 @@
         
         if(len(publications) > 0):
             ret = False;  # es gibt publicationen in der neuen liste
-      
-        
+              
         logging.debug("len(publ)" + repr(ret))
         
         return ret;
@@ -1448,7 +1382,9 @@
 
     def copyPublicationsToList(self, RESPONSE=None):
         """copy publications in to list"""
-        publicationTxt = self.getRelatedPublications()
+        publicationTxt = getattr(self, 'WEB_related_pub', '')
+        if isinstance(publicationTxt, list):
+            publicationTxt = publicationTxt[0]
 
         pubSplits = publicationTxt.split("<p>")
 
@@ -1459,7 +1395,6 @@
         setattr(self, "WEB_related_pub_copied", True);
         
         if RESPONSE:
-                
             self.redirect(RESPONSE, 'managePublications')
         
 
@@ -1563,165 +1498,23 @@
 
 
     def updateProjectMembers(self, updateResponsibleScientistsList=False):
-        """updates project-member table"""
-        if updateResponsibleScientistsList:
-            # create responsibleScientistsList automatically
-            newScientists = {}
-            names = p.identifyNames(p.getResponsibleScientists())
-            for name in names:
-                logging.debug("updateAllProjectMembers: name=%s" % repr(name))
-                members = names[name]
-                if len(members) > 0:
-                    # take the first matching name
-                    newScientists[name] = {'name': name, 'key' : members[0].key, 'username' : re.sub('@mpiwg-berlin\.mpg\.de', '', members[0].e_mail)}
-                
-            self.setResponsibleScientistsList(newScientists)
-            
-        memberlist = self.getResponsibleScientistsList()
-           
+        """Update project-member table."""
+        # projects are identified by id
+        pid = self.getId()
+
         # clear projects_members table
-        pNum = self.getNumber()
-        if not pNum or not isinstance(pNum, basestring):
-            logging.error("updateProjectMembers: not a valid project number: %s" % repr(pNum))
-            return
+        self.executeZSQL("delete from projects_members where project_id = %s", [pid])
 
-        if len(memberlist) == 0:
-            return
-         
-        # fill projects_members table
-        self.executeZSQL("delete from projects_members where project_number = %s", [pNum])
-        for m in memberlist:
+        for m in self.getResponsibleScientistsList():
             memberKey = m.get('key', None)
             if not memberKey or not isinstance(memberKey, basestring):
                 logging.error("updateProjectMembers: not a valid member key: %s" % repr(memberKey))
                 continue
                         
-            self.executeZSQL("insert into projects_members (project_number, member_key) values (%s, %s)", (pNum, memberKey))
-
+            # fill projects_members table
+            self.executeZSQL("insert into projects_members (project_id, member_key) values (%s, %s)", (pid, memberKey))
     
     
-    def addPublicationsFromPubman(self,REQUEST):
-        """addPublications from pubman"""
-        
-        data=REQUEST.form
-       
-        if data.get("method",None) is None:
-            pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','add_publications.zpt')).__of__(self)
-            return pt()
-        
-        
-        
-        if data.get("method") == "search":
-            entries= self.mpiwgPubman.search(data)
-            pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','add_publications.zpt')).__of__(self)
-            
-           
-            return pt(values=entries)
-     
-     
-        
-        if data.get("method") == "add":
-            
-            return self.addEntriesToPublicationList(data)
-            #pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/staff/pubman','add_publications.zpt')).__of__(self)
-         
-    def addEntriesToPublicationList(self,data):
-        """fuege eintrage aus data zur publications liste,
-        @param data Map mit escidocID --> value
-        value muss "add" sein damit hinzugefuegt wird"""
-        
-        for key in data.keys():
-            
-            if key.startswith('escidoc:'):
-            
-                query="INSERT INTO pubmanbiblio_projects (key_main,escidocId) values (%s,%s)"
-                
-                if data.get(key)=="add":
-                    self.executeZSQL(query,[self.getId(),key])
-                    
-            
-        #selectedPublications = self.getSelectedPublications()
-        
-        #pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','change_publications.zpt')).__of__(self)
-        
-        #return pt()
-        
-        if hasattr(self,'REQUEST'):
-            return self.REQUEST.response.redirect("changePublications")
-    
-    def changePublications(self,REQUEST):
-        """change published publications"""
-        
-        data=REQUEST.form
-       
-     
-        if data.get("method","change"):
-            for key in data.keys():
-                splitted=key.split("__") #format escidoc_id__p fuer priority, nur escidocid
-                value=data[key]
-                if len(splitted)==1:
-                    self.deleteFromPublicationList(key);
-                
-                elif(splitted[1]) == "p":
-                    self.setPublicationPriority(splitted[0],value);
-                    
-        
-        pt = PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','change_publications.zpt')).__of__(self) 
-        return pt()
-    
-    def deleteFromPublicationList(self,escidocid):
-        """Loessche publication with escidoc id from publication list"""
-        
-        query ="DELETE FROM pubmanbiblio_projects WHERE escidocid=%s and key_main=%s"
-        
-        self.executeZSQL(query,[escidocid,self.getId()]);
- 
-    def setPublicationPriority(self,escidocid,value):
-    
-        query="update pubmanbiblio_projects set priority=%s where escidocid=%s and key_main=%s"
-        
-        try:
-      
-            value = int(value)
-            self.executeZSQL(query,[value,escidocid,self.getId()]);
-           
-          
-        except:
-            logging.error("couldn't change:")
-            logging.error(escidocid)
-            logging.error(value)
-        
-    def getSelectedPublications(self):
-        """hole publications aus der datenbank"""
-    
-    
-        query="select * from pubmanbiblio_projects where lower(key_main) = lower(%s) order by priority DESC"
-            
-           
-        return self.executeZSQL(query,[self.getId()])
- 
-     
-        
-    def hasExtendedPublicationList(self):
-        """test if extended publication list exists"""
-        
-    
-    
-        query="select count(*) from pubmanbiblio_projects where lower(key_main) = lower(%s)"
-            
-           
-        res= self.executeZSQL(query,[self.getId()])
-        
-        if res[0].count>0:
-            return True
-        else:
-            return False
-        
-    def publicationsFull(self,REQUEST):
-        """show publication"""
-        pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/project/pubman','show_publications.zpt')).__of__(self)
-        return pt()
-        
 
         
 def manage_addMPIWGProjectForm(self):
@@ -1746,7 +1539,6 @@
         newObj = MPIWGProject(id)
 
     self._setObject(id, newObj)
-
     
     if RESPONSE is not None:
         RESPONSE.redirect('manage_main')
@@ -1760,9 +1552,6 @@
     
     # cached HashTree with project hierarchy
     _v_projectTree = None
-
-    
-   
                     
     def getProjectTree(self):
         """Return the project hierarchy tree (and cache it).
@@ -1908,7 +1697,7 @@
             RESPONSE.redirect(self.en.MPIWGrootURL()+'/admin/showTree')
 
 
-    # TODO: it's broken. is this used?
+    # TODO: this is broken. is this used?
     def getAllProjectsAndTagsAsCSV(self,archived=1,RESPONSE=None):
         """alle projekte auch die nicht getaggten"""
         retList=[]
@@ -1948,7 +1737,6 @@
       
         return "\n".join(retList);
     
-    
         
     security.declareProtected('View management screens', 'updateAllProjectMembers')
     def updateAllProjectMembers(self, updateResponsibleScientistsList=False):
@@ -1984,30 +1772,46 @@
                 project.copyPublicationsToList()
                                 
             #
-            # old format responsibleScientistsList
+            # create responsibleScientistsList automatically
             #
-            memberlist = project.getResponsibleScientistsList()
-            if len(memberlist) > 0 and isinstance(memberlist[0], tuple):
-                log += "%s: updating memberlist!\n"%project.getId()
-                logging.debug("updateAllProjects(%s): updating memberlist" % project.getId())
+            if updateResponsibleScientistsList:
                 newScientists = {}
-                for m in memberlist:
-                    name = m[0]
-                    key = m[1] 
-                    username = None
-                    if key:
-                        if isinstance(key, list):
-                            key = key[0]
-                            
-                        # get username from db
-                        member = self.getMPIWGRoot().getStaffFolder().getMember(key=key)
-                        if member is not None:
-                            username = member.getUsername()
-                            
-                    newScientists[name] = {'name': name, 'key' : key, 'username' : username}
+                names = project.identifyNames(p.getResponsibleScientists())
+                for name in names:
+                    logging.debug("updateAllProjectMembers: name=%s" % repr(name))
+                    members = names[name]
+                    if len(members) > 0:
+                        # take the first matching name
+                        newScientists[name] = {'name': name, 'key' : members[0].key, 'username' : re.sub('@mpiwg-berlin\.mpg\.de', '', members[0].e_mail)}
                     
-                # set new list
                 project.setResponsibleScientistsList(newScientists)
+                
+            else:
+                #
+                # old format responsibleScientistsList
+                #
+                memberlist = project.getResponsibleScientistsList()
+                if len(memberlist) > 0 and isinstance(memberlist[0], tuple):
+                    log += "%s: updating memberlist!\n"%project.getId()
+                    logging.debug("updateAllProjects(%s): updating memberlist" % project.getId())
+                    newScientists = {}
+                    for m in memberlist:
+                        name = m[0]
+                        key = m[1] 
+                        username = None
+                        if key:
+                            if isinstance(key, list):
+                                key = key[0]
+                                
+                            # get username from db
+                            member = self.getMPIWGRoot().getStaffFolder().getMember(key=key)
+                            if member is not None:
+                                username = member.getUsername()
+                                
+                        newScientists[name] = {'name': name, 'key' : key, 'username' : username}
+                        
+                    # set new list
+                    project.setResponsibleScientistsList(newScientists)
 
             #
             # old inline images
@@ -2029,17 +1833,25 @@
                 log += "%s: has definedFields!\n"%project.getId()
                 logging.debug("updateAllProjects(%s): has definedFields!"%project.getId())
                 delattr(project, 'definedFields')
-                
+             
             #
-            # update extended bibliography
+            # update related publications
             #
-            if hasattr(project, 'publicationList'):
-                log += "%s: has publicationList!\n"%project.getId()
-                logging.debug("updateAllProjects(%s): has publicationList!"%project.getId())
-                extpub = project.publicationList
-                if hasattr(extpub, 'connection_id'):
-                    logging.debug("updateAllProjects(%s): extended publication %s has connection_id=%s!"%(project.getId(),extpub.getId(),extpub.connection_id))
-            
+            for pub in project.getPublicationList():
+                if not pub.text:
+                    msg = "%s: publication has no text: %s!\n"%(project.getId(), pub)
+                    log += msg
+                    logging.warn(msg)
+                    if not pub.link:
+                        msg = "%s: publication has no link either! Deleting: %s!\n"%(project.getId(), pub)
+                        log += msg
+                        logging.error(msg)
+                        project.deletePublication(pub.getId())
+                        
+                else:
+                    # hasLinkToBookPage updates the bookId
+                    pub.hasLinkToBookPage()
+                
             #
             # unicodify
             #
@@ -2054,8 +1866,7 @@
             fulllog += log    
             if RESPONSE is not None:
                 RESPONSE.write(log)
-                
-            
+                           
         log += "\n DONE! updated %s projects!" % cnt
         fulllog += log
         if RESPONSE is not None:
@@ -2064,9 +1875,6 @@
         else:
             return fulllog
                 
-
-
-            
         
 def manage_addMPIWGProjectFolderForm(self):
     """form for adding a MPIWGProjectFolder"""
--- a/MPIWGProjects_removed.py	Thu May 02 15:40:27 2013 +0200
+++ b/MPIWGProjects_removed.py	Fri May 03 11:39:34 2013 +0200
@@ -249,4 +249,125 @@
             return self        
 
 
+    def getContent(self, field, filter=None):
+        """Inhalt des Feldes"""
+        # logging.debug("getContent field=%s filter=%s"%(field,filter))
+        
+        if field == "short_title":
+                text = self.getContent("xdata_07")
+                if text == "":
+                        text = self.getContent("WEB_title")
+                return text
 
+        text = u''
+
+        f = getattr(self, field)
+        if isinstance(f, list):
+            # compat with old lists
+            for x in f:
+                try:
+                    text += x
+                except:
+                    text = x
+        else:
+            text = f
+
+        try:
+            if text[len(text) - 1] == ";":
+                text = text[0:len(text) - 1]
+                
+        except:
+            pass
+        
+        if text == '':  # # wozu die folgenden Zeilen??
+            text2 = text
+        else:
+            text2 = re.sub(r';([^\s])', '; \g<1>', text)
+       
+        if field == "WEB_project_description":  # #Jedenfalls darf letzteres nicht gemacht werden, falls normaler text
+            text2 = text
+            
+        # teste ob ergebnis leer und header dann nehme title
+        
+        if (text2 == '') and (field == 'WEB_project_header'):
+            return self.getContent('WEB_title')
+
+        if filter:
+            splitted = text2.split("""<p class="picture">""")
+            if len(splitted) > 1:
+                tmp = splitted[1].split("</p>")
+                # return repr(splitted[1])
+                try:
+                        self.imageURL = tmp[0].split("\"")[1].encode('utf-8')
+                except:
+                    try:
+                        self.imageURL = tmp[0].split("src=")[1].split(" ")[0].encode('utf-8')
+                    except:
+                        self.imageURL = ""
+
+                split2 = "</p>".join(tmp[1:])
+
+                text3 = splitted[0] + split2
+
+                splitted = text3.split("""<p class="picturetitle">""")
+                if len(splitted) > 1:
+                    tmp = splitted[1].split("</p>")
+                    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 fuehrenden p tags
+        if (len(text5) > 4) and (not text5[0:3] == '<p>') and (field == 'WEB_project_description'):
+            text5 = "<p>" + text5 + "</p>"
+
+
+        # filter image
+        
+        text5 = text5.lstrip().rstrip()  # loescher leerzeichen und einzelndes br
+        if (text5 == "<br>") or (text5 == "<br/>"):
+            text5 = ""
+
+        # logging.debug("getcontent: field=%s filter=%s -> %s"%(field,filter,repr(text5)))
+        return unicodify(text5)
+        # return utf8ify(text5) # return as utf-8 byte string
+
+
+
+    def getImageUrls(self, mode="not_cached"):
+        """get the image urls"""
+        
+        if (getattr(self, 'link', '') == ''):
+            return []  # es gibt keinen link
+        
+        server = xmlrpclib.ServerProxy(self.link)
+        
+        
+        if(mode == "cached"):
+            if (hasattr(self, "_v_imageUrls")):
+                logging.debug("getImageURL cached")
+                return self._v_imageUrls
+       
+        try:
+            urls = server.getImageUrls()
+            ret = []
+            for url in urls:
+                url = os.path.join(self.link, url)
+                ret.append(url)
+           
+        except:
+            self._v_imageUrls = []
+            return []
+        self._v_imageUrls = ret[0:]
+        return ret
+
+
--- a/MPIWGRoot.py	Thu May 02 15:40:27 2013 +0200
+++ b/MPIWGRoot.py	Fri May 03 11:39:34 2013 +0200
@@ -52,25 +52,6 @@
         #{'label':'Edit Historical Persons','action':'editHistoricalPersonsForm'},
         #{'label':'Store Historical Persons','action':'storeHistoricalPersons'},
         )
-
-    # TODO: is this used here?
-    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':'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'}
     
     # (is this used?)
     folders=['MPIWGProject','Folder','ECHO_Navigation']
--- a/MPIWGRoot_deleted_methods.py	Thu May 02 15:40:27 2013 +0200
+++ b/MPIWGRoot_deleted_methods.py	Fri May 03 11:39:34 2013 +0200
@@ -848,5 +848,9 @@
      
         return ret
 
+    def getAttribute(self, field):
+        """get attrbiute"""
+        return getattr(self, field)
+
 
       
--- a/zpt/edit_project_error_relatedProject.zpt	Thu May 02 15:40:27 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html metal:use-macro="here/edit_MPIWGProject_main/macros/page" xmlns:metal="http://xml.zope.org/namespaces/metal" >
-<head>
-<tal:block metal:fill-slot="navsel" tal:define="global menusel string:description" />
-</head>
-<body>
-<tal:block metal:fill-slot="body">
-  <h3>Error: Adding a project</h3>
-  <span tal:replace="options/link"/> is not a link to an MPIWG project.
-</tal:block>
-</body>
-</html>
--- a/zpt/edit_publicationForm.zpt	Thu May 02 15:40:27 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html metal:use-macro="here/edit_MPIWGProject_main/macros/page">
-<head>
-</head>
-<body>
-<tal:block metal:fill-slot="navsel" tal:define="global menusel string:publications" />
-<tal:block metal:fill-slot="body">
-  <h3>Edit a publication</h3>
-  
-  <form action="editPublication" method="post" enctype="multipart/form-data">
-  <p>Bibliographical entry</p>
-    <textarea tal:content="structure python:getattr(here,'text','')" name="text" rows="3" cols="80"></textarea>
-    
-  <p>Link</p>
-  	<input size="100"  tal:attributes="value python:getattr(here,'link','')" name="link">
-  
-  <h4>Images</h4>
-  <p>To display images on the you should use book pages. The link above has to be a link to a book page.</p>
-  
-  <tal:x tal:condition="python:here.hasLinkToBookPage()" tal:define="url python:here.getImageUrls()">
-  	  <p>Image 1 (e.g. Cover)</p>
-
-  <p tal:condition="python:len(url)>0">
-  	<img tal:attributes="src python:url[0]" height="100"/>
-  </p>
-  
-  <p>Image 2 (e.g. Table of Contents)</p>
-  <p tal:condition="python:len(url)>1">
-  	<img tal:attributes="src python:url[1]" height="100"/>
-  	</p>
-   
-  </tal:x>
-  <p tal:condition="not:python:here.hasLinkToBookPage()">
-   Link is not a link to a bookPage
-  </p>
-  
-  
-  <!-- 
-  <p>Image 1 (e.g. Cover)</p>
-  <p tal:condition="python:hasattr(here,'publicationImage1')">
-  	<img tal:attributes="src python:here.publicationImage1.absolute_url()" height="100"/>
-  	</p>
-   <p>Upload new image:<input type="file" name="image1" len="50"/></p>
-  <p>Image 2 (e.g. Table of Contents)</p>
-  <p tal:condition="python:hasattr(here,'publicationImage2')">
-  	<img tal:attributes="src python:here.publicationImage2.absolute_url()" height="100"/>
-  	</p>
-   <p>Upload new image:<input type="file" name="image2" len="50"/></p>
-  
- -->
-  <h3>Descriptive Text</h3>
-  <p>
-  <textarea tal:content="structure python:getattr(here,'description','')" name="description" rows="10" cols="80"></textarea>
-  </p>
-  <p><input type="submit" value="submit"/></p>
-  </form>
-  
-  <h3><a href="managePublications">Back to publication list</a></h3>
-</tal:block>
-</body>
-</html>
--- a/zpt/edit_relatedProjectForm.zpt	Thu May 02 15:40:27 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html metal:use-macro="here/edit_MPIWGProject_main/macros/page">
-<head>
-</head>
-<body>
-<tal:block metal:fill-slot="navsel" tal:define="global menusel string:publications" />
-<tal:block metal:fill-slot="body">
-  <h3>Edit related projects</h3>
-   <table><tr>
-   <td>Project id:</td>
-     <td tal:content="structure python:getattr(here,'objid','')" />
-     </tr>
-     <tr>  <td>WEB title:</td>
-        <td tal:content="structure python:getattr(here,'projectWEB_title','')" />
-     </tr>
-  </table>
-  <form action="editRelatedProject" method="post" enctype="multipart/form-data">
- 
-  <p>Link</p>
-  	<input size="100"  tal:attributes="value python:getattr(here,'orginallink','')" name="link">
-  
-  <input type="submit" value="change"/>
-  
-  <h3><a href="manageRelatedProjects">Back to related projects list</a></h3>
-</tal:block>
-</body>
-</html>
--- a/zpt/project/edit_basic.zpt	Thu May 02 15:40:27 2013 +0200
+++ b/zpt/project/edit_basic.zpt	Fri May 03 11:39:34 2013 +0200
@@ -11,11 +11,11 @@
       <table>
         <tr>
           <td><b>Project Title</b></td>
-          <td><input name="WEB_title" tal:attributes="value python:here.getProjectTitle()" size="80" /></td>
+          <td><input name="WEB_title" tal:attributes="value here/getProjectTitle" size="80" /></td>
         </tr>
         <tal:block tal:repeat="field here/getEditableFields">
           <tr>
-            <td><b tal:content="python:here.fieldLabels[field]" /></td>
+            <td><b tal:content="python:here.getFieldLabels()[field]" /></td>
             <td><input tal:attributes="name field; value python:here.getContent(field)" size=80 /></td>
           </tr>
         </tal:block>
@@ -29,7 +29,7 @@
             <td tal:condition="python:here.isActiveProject()"><input tal:attributes="name python:'active'" value="true" checked
               type="checkbox"></td>
             <td tal:condition="not:python:here.isActiveProject()"><input tal:attributes="name python:'active'" value="true"
-              type="checkbox"> <tal:x tal:condition="python:hasChildren">
+              type="checkbox"> <tal:x tal:condition="hasChildren">
 			 	 WARNING: This project is not visible, but has visible children.
 			</tal:x></td>
           </tal:x>
@@ -46,19 +46,18 @@
                    value python:here.getCompletedAt()"
             type="text" len="15" /> (format dd.mm.yyyy or mm.yyyy or yyyy)</td>
         </tr>
-
       </table>
 
-
       <h2>Names</h2>
-      <table tal:define="global count python:0">
+      <table tal:define="global count python:0;
+        identifiedNames python:here.identifyNames(here.getResponsibleScientists());">
         <tr>
           <th>Name in project</th><th>MPIWG member object</th>
         </tr>
-        <tr tal:repeat="identifiedName python:options.get('identifiedNames',{}).items()">
+        <tr tal:condition="identifiedNames" tal:repeat="identifiedName identifiedNames/items">
           <tal:x tal:define="global count python:count+1" />
           <td><input type="hidden"
-            tal:attributes="value python:here.decode(identifiedName[0]); name python:'responsibleScientist_name_%s'%count" /> <span
+            tal:attributes="value python:identifiedName[0]; name python:'responsibleScientist_name_%s'%count" /> <span
             tal:replace="python:identifiedName[0]" /> <!-- <pre tal:content="python:repr(identifiedName)"/> --></td>
           <td>
             <table>
--- a/zpt/project/edit_images.zpt	Thu May 02 15:40:27 2013 +0200
+++ b/zpt/project/edit_images.zpt	Fri May 03 11:39:34 2013 +0200
@@ -4,41 +4,60 @@
 <head>
 </head>
 <body>
-<tal:block metal:fill-slot="navsel" tal:define="global menusel string:images" />
-<tal:block metal:fill-slot="body">
-  <table tal:condition="python:here.getImages()">
-    <tr><th/><th>Image</th><th>Caption</th><th/></tr>
-    <tal:block tal:repeat="image here/getImages">
+  <tal:block metal:fill-slot="navsel" tal:define="global menusel string:images" />
+  <tal:block metal:fill-slot="body">
+    <table tal:define="images here/getImageList" tal:condition="images">
       <tr>
-        <td>
-          <a tal:attributes="href python:here.absolute_url()+'/manageImages?imageName='+image[0]+'&op=up'">up</a><br>
-          <a tal:attributes="href python:here.absolute_url()+'/manageImages?imageName='+image[0]+'&op=down'">down</a>
-        </td>
-        <td tal:condition="not:python:image[1].height==''" tal:content="structure python:image[1].tag(scale=250.0 / image[1].height)" />
-	<td tal:condition="python:image[1].height==''" tal:content="python:image[1].height"/>
-        <td tal:content="structure python:getattr(image[1],'caption','')" />
-        <td>
-          <a tal:attributes="href python:image[1].getId()+'/editImage'">Edit</a><br/>
-          <a tal:attributes="href python:'deleteImage?id='+image[1].getId()">Delete</a>
-        </td>
+        <th />
+        <th>Image</th>
+        <th>Caption</th>
+        <th />
       </tr>
-    </tal:block>
-  </table>
-  
-  <h3>Add an Image</h3>
-  
-  <form action="addImage" method="post" enctype="multipart/form-data">
-  <table>
-    <tr><th>Image</th><th>Caption</th></tr>
-    <tr>
-      <td><input name="fileHd" type="file" len="50"/></td>
-      <td><textarea name="caption" rows="3" cols="60"></textarea></td>
-    </tr>
-  </table>
-  <p><input type="submit" value="submit"/></p>
-  </form>
-  
-  <p>(if the marginal image from your current project description is not in this list, click <a href="copyImageToMargin">here</a>.)</p>
-</tal:block>
+      <tal:block tal:repeat="image images">
+        <tr tal:define="imgid image/getId">
+          <td>
+            <a tal:attributes="href string:$root/manageImages?name=$imgid&op=up">up</a><br/>
+            <a tal:attributes="href string:$root/manageImages?name=$imgid&op=down">down</a>
+          </td>
+          <td>
+            <img tal:attributes="src image/absolute_url" /><br/>
+            <span tal:content="string:(${image/width}x${image/height}px)"/>
+          </td>
+          <td tal:content="structure python:getattr(image,'caption','')" />
+          <td><a tal:attributes="href string:$root/$imgid/editImage">Edit</a><br /> <a
+            tal:attributes="href string:$root/deleteImage?id=$imgid">Delete</a></td>
+        </tr>
+      </tal:block>
+    </table>
+    <p>
+      The image for the project description should have a width of 220px.
+    </p>
+    <p>
+      The last image in the list is used as the project thumbnail image (140x87px): <img align="middle" width="140" height="87"
+        tal:attributes="src here/getThumbUrl" />
+    </p>
+
+    <h3>Add an Image</h3>
+
+    <form action="addImage" method="post" enctype="multipart/form-data">
+      <table>
+        <tr>
+          <th>Image</th>
+          <th>Caption</th>
+        </tr>
+        <tr>
+          <td valign="top"><input name="fileHd" type="file" len="50" /></td>
+          <td valign="top"><textarea name="caption" rows="3" cols="60"></textarea></td>
+        </tr>
+      </table>
+      <p>
+        <input type="submit" value="submit" />
+      </p>
+    </form>
+
+    <p>
+      (if the marginal image from your current project description is not in this list, click <a tal:attributes="href string:$root/copyImageToMargin">here</a>.)
+    </p>
+  </tal:block>
 </body>
 </html>
--- a/zpt/project/edit_publications.zpt	Thu May 02 15:40:27 2013 +0200
+++ b/zpt/project/edit_publications.zpt	Fri May 03 11:39:34 2013 +0200
@@ -6,41 +6,42 @@
 <body>
 <tal:block metal:fill-slot="navsel" tal:define="global menusel string:publications" />
 <tal:block metal:fill-slot="body">
+  <h2>Project publications</h2>
   <table>
-    <tal:block tal:repeat="publication here/getPublications">
-      <tr>
+    <tal:block tal:repeat="publication here/getPublicationList">
+      <tr tal:define="pubid publication/getId">
         <td>
-          <a tal:attributes="href python:here.absolute_url()+'/managePublications?pubName='+publication[0]+'&op=up'">up</a><br>
-          <a tal:attributes="href python:here.absolute_url()+'/managePublications?pubName='+publication[0]+'&op=down'">down</a>
+          <a tal:attributes="href string:$root/managePublications?name=$pubid&op=up">up</a><br>
+          <a tal:attributes="href string:$root/managePublications?name=$pubid&op=down">down</a>
         </td>
-        <td tal:content="structure python:getattr(publication[1],'text','')" />
+        <td tal:content="string:[${publication/place}]"/>
+        <td tal:content="structure python:getattr(publication,'text','')" />
         <td>
-          <a tal:attributes="href python:publication[1].getId()+'/editPublication'">Edit</a><br/> 
-          <a tal:attributes="href python:'deletePublication?id='+publication[1].getId()">Delete</a>
+          <a tal:attributes="href string:$root/$pubid/editPublication">Edit</a><br/> 
+          <a tal:attributes="href string:$root/deletePublication?id=$pubid">Delete</a>
         </td>
       </tr>
     </tal:block>
   </table>
 
-  <h3>Add a publication</h3>
-  <form action="addPublication" method="post">
+  <h3>Add a project publication</h3>
+  <form tal:attributes="action string:$root/addPublication" method="post">
     <textarea name="text" rows="3" cols="80"></textarea>
     <p><input type="submit" value="submit"/></p>
   </form>
-<!--  <p>(If the publications from your current project description are not showing in this list, click <a href="copyPublicationsToList">here</a> to copy them.)</p>
 
-<h3><tal:x condition="python:here.hasExtendedPublicationList()">
-		<a href="publicationList/editEntries">
-		Manage Extended Publication List</a>
-		</tal:x>
-		<tal:x condition="not:python:here.hasExtendedPublicationList()">
-		<a href="createExtendedPublicationList">
-		Create Extended Publication List</a>
-		</tal:x>
-</h3>-->
+  <h2>Additional publications</h2>
+  <tal:block tal:define="books here/getAdditionalPublicationList" tal:condition="exists:here/mpiwgPubman">
+    <ul class="publicationlist">
+      <li tal:repeat="book books">
+        <a tal:attributes="href python:'http://pubman.mpiwg-berlin.mpg.de/pubman/faces/viewItemFullPage.jsp?itemId='+book.escidocid" 
+           tal:content="structure python:here.mpiwgPubman.getEntryFromPubman(book.escidocid)"/>
+      </li>
+    </ul>
+  </tal:block>
 
-<h3><a href=" addPublicationsFromPubman"> Add publication to extended list</a></h3>
-<h3><a href=" changePublications"> Change publication list</a></h3>
+  <h3><a tal:attributes="href string:$root/addAdditionalPublicationsFromPubman"> Add publication to additional publication list</a></h3>
+  <h3><a tal:attributes="href string:$root/changePublications"> Change additional publication list</a></h3>
 </tal:block>
 </body>
 </html>
--- a/zpt/project/edit_related_projects.zpt	Thu May 02 15:40:27 2013 +0200
+++ b/zpt/project/edit_related_projects.zpt	Fri May 03 11:39:34 2013 +0200
@@ -1,35 +1,40 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html metal:use-macro="here/edit_MPIWGProject_main/macros/page">
+<html metal:use-macro="here/edit_template/macros/page">
 <head>
 </head>
 <body>
 <tal:block metal:fill-slot="navsel" tal:define="global menusel string:relatedProjects" />
 <tal:block metal:fill-slot="body">
   <table>
-    <tal:block tal:repeat="publication here/getRelatedProjects">
-      <tr>
+    <tal:block tal:repeat="item here/getRelatedProjectList">
+      <tr tal:define="proid item/getId">
         <td>
-          <a tal:attributes="href python:here.absolute_url()+'/manageRelatedProjects?pubName='+publication.getId()+'&op=up'">up</a><br>
-          <a tal:attributes="href python:here.absolute_url()+'/manageRelatedProjects?pubName='+publication.getId()+'&op=down'">down</a>
+          <a tal:attributes="href string:$root/manageRelatedProjects?name=$proid&op=up">up</a><br>
+          <a tal:attributes="href string:$root/manageRelatedProjects?name=$proid&op=down">down</a>
         </td>
-        <td tal:content="structure python:getattr(publication,'objid','')" />
-        <td tal:content="structure python:getattr(publication,'projectWEB_title','')" />
+        <td tal:content="string:[${item/place}]"/>
+        <!-- <td tal:content="item/objid" /> -->
+        <td tal:content="item/getProjectTitle" />
         <td>
-          <a tal:attributes="href python:publication.getId()+'/editRelatedProject'">Edit</a><br/> 
-          <a tal:attributes="href python:'deleteRelatedProject?id='+publication.getId()">Delete</a>
+          <a tal:attributes="href string:$root/$proid/editRelatedProject">Edit</a><br/> 
+          <a tal:attributes="href string:$root/deleteRelatedProject?id=$proid">Delete</a>
         </td>
       </tr>
     </tal:block>
   </table>
 
   <h3>Add related projects</h3>
-  <p>Please add the link to the project you want to add a relation to.</p>
-  <form action="addRelatedProject" method="post">
-    <input name="link" size="100">
-    <p><input type="submit" value="submit"/></p>
-  </form>
- 
-</tal:block>
+    <form tal:attributes="action string:$root/addRelatedProject" method="post">
+      <p>
+        Please enter the URL of the project you want to add a relation to:<br /> 
+        <input name="link" size="100">
+      </p>
+      <p>
+        <input type="submit" value="submit" />
+      </p>
+    </form>
+
+  </tal:block>
 </body>
 </html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/project/edit_related_projects_error.zpt	Fri May 03 11:39:34 2013 +0200
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html metal:use-macro="here/edit_MPIWGProject_main/macros/page" xmlns:metal="http://xml.zope.org/namespaces/metal">
+<head>
+<tal:block metal:fill-slot="navsel" tal:define="global menusel string:description" />
+</head>
+<body>
+  <tal:block metal:fill-slot="body">
+    <h3>Error adding a related project</h3>
+    <span tal:replace="string:'${options/link}'" /> is not a link to a MPIWG project.
+
+    <h3>
+      <a tal:attributes="href string:$root/manageRelatedProjects">Back to related projects list</a>
+    </h3>
+
+  </tal:block>
+</body>
+</html>
--- a/zpt/project/edit_template.zpt	Thu May 02 15:40:27 2013 +0200
+++ b/zpt/project/edit_template.zpt	Fri May 03 11:39:34 2013 +0200
@@ -2,23 +2,23 @@
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
   metal:define-macro="page">
-<head tal:define="global onload nothing;">
+<head tal:define="global root here/getMPIWGProjectUrl; global onload nothing;">
 <metal:block metal:define-slot="html_head"/>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <link rel="stylesheet" href="edit_css" type="text/css"/>  
 </head>
 <body tal:attributes="onload onload">
   <h3 tal:condition="not:here/isActiveProject">(!!Project is not visible!!)</h3>
-  <h2 class="title">Edit project <i tal:content="python:here.getContent('WEB_title')"/></h2>
+  <h2 class="title">Edit project <i tal:content="here/getProjectTitle"/></h2>
   <metal:block metal:define-slot="navsel"/>
   <div class="mainnav">
-    <span tal:attributes="class python:here.getPathStyle('basic', menusel, 'mainmenu')"><a href="editBasic">Basic information</a></span>
-    <span tal:attributes="class python:here.getPathStyle('description', menusel, 'mainmenu')"><a href="edit">Project description</a></span>
-    <span tal:attributes="class python:here.getPathStyle('images', menusel, 'mainmenu')"><a href="manageImages">Images</a></span>
-    <span tal:attributes="class python:here.getPathStyle('publications', menusel, 'mainmenu')"><a href="managePublications">Publications</a></span>
-    <span tal:attributes="class python:here.getPathStyle('relatedProjects', menusel, 'mainmenu')"><a href="manageRelatedProjects">Related Projects</a></span>
-    <span tal:attributes="class python:here.getPathStyle('themes', menusel, 'mainmenu')"><a href="tagTheProject">Tags</a></span>
-    <span class="mainmenu"><a target="_blank" href="index_html">View</a></span>
+    <span tal:attributes="class python:test('basic'==menusel, 'mainmenusel', 'mainmenu')"><a tal:attributes="href string:$root/editBasic">Basic information</a></span>
+    <span tal:attributes="class python:test('description'==menusel, 'mainmenusel', 'mainmenu')"><a tal:attributes="href string:$root/editDescription">Project description</a></span>
+    <span tal:attributes="class python:test('images'==menusel, 'mainmenusel', 'mainmenu')"><a tal:attributes="href string:$root/manageImages">Images</a></span>
+    <span tal:attributes="class python:test('publications'==menusel, 'mainmenusel', 'mainmenu')"><a tal:attributes="href string:$root/managePublications">Publications</a></span>
+    <span tal:attributes="class python:test('relatedProjects'==menusel, 'mainmenusel', 'mainmenu')"><a tal:attributes="href string:$root/manageRelatedProjects">Related Projects</a></span>
+    <span tal:attributes="class python:test('themes'==menusel, 'mainmenusel', 'mainmenu')"><a tal:attributes="href string:$root/tagTheProject">Tags</a></span>
+    <span class="mainmenu"><a target="_blank" tal:attributes="href python:here.getUrl(baseUrl=here.en.MPIWGrootURL()+'/research/projects')">View</a></span>
   </div>
   <div class="content">
   <tal:block metal:define-slot="body"/>
--- a/zpt/project/project_template.zpt	Thu May 02 15:40:27 2013 +0200
+++ b/zpt/project/project_template.zpt	Fri May 03 11:39:34 2013 +0200
@@ -80,57 +80,55 @@
     <!-- sideblock -->
 
     <!-- related projects -->
-    <div class="sideblock" tal:define="projects here/getRelatedProjects" tal:condition="projects">
+    <div class="sideblock" tal:define="projects here/getRelatedProjectList" tal:condition="projects">
       <h2>Related Projects</h2>
-      <div class="item" tal:repeat="project python:projects">
-        <a tal:attributes="href python:proBaseUrl+'/'+project.objid"
-          tal:content="python:project.projectWEB_title" />
+      <div class="item" tal:repeat="project projects">
+        <a tal:attributes="href string:$proBaseUrl/${project/getProjectId}"
+          tal:content="project/getProjectLabel" />
       </div>
       <!-- end item -->
     </div>
     <!-- sideblock -->
 
     <!-- related publications -->
-    <tal:block tal:define="publications here/getRelatedPublications;">
+    <tal:block tal:define="publications here/getPublicationList">
       <div class="sideblock" tal:condition="publications">
         <h2>Related Publications</h2>
-        <div class="item" tal:repeat="publication publications">
-          <tal:y condition="not:python:publication.hasLinkToBookPage(mode='cached')">
-            <tal:x condition="python:hasattr(publication,'publicationImage1')">
-              <a target="_blank" tal:attributes="href  python:publication.publicationImage1.absolute_url()"> <img width="150"
-                tal:attributes="src python:publication.publicationImage1.absolute_url()" />
-              </a>
-              <a tal:condition="python:hasattr(publication,'publicationImage2')" target="_blank"
-                tal:attributes="href python:publication.publicationImage2.absolute_url()"> <img width="150"
-                tal:condition="python:hasattr(publication,'publicationImage2')"
-                tal:attributes="src python:publication.publicationImage2.absolute_url()" />
-              </a>
-              <br />
+        <tal:block tal:repeat="publication publications">
+          <div class="item" tal:define="bookid publication/getBookId" tal:condition="publication/text">
+            <tal:y condition="not:bookid">
+              <tal:x tal:define="img publication/publicationImage1 | nothing" tal:condition="img">
+                <a target="_blank" tal:attributes="href img/absolute_url"> <img width="150"
+                  tal:attributes="src img/absolute_url" />
+                </a>
+                <br />
+              </tal:x>
+              <a tal:define="link publication/link | nothing;" tal:omit-tag="not:link" tal:content="structure publication/text"
+                tal:attributes="href link" />
+            </tal:y>
+            <tal:y condition="bookid">
+              <tal:x
+                tal:define="book python:here.books[bookid]; bookurl python:book.getUrl(baseUrl=root+'/'+secmap['resources']+'/books')">
+                <a tal:attributes="href bookurl"><img width="150" tal:attributes="src book/getImageUrl" /></a>
+                <br />
+                <a tal:attributes="href bookurl" tal:content="structure publication/text" />
+              </tal:x>
+            </tal:y>
+            <tal:x tal:condition="python:hasattr(publication, 'description')">
+              <div tal:content="structure publication/description" />
             </tal:x>
-          </tal:y>
-          <tal:y condition="python:publication.hasLinkToBookPage(mode='cached')"
-            tal:define="urls python:publication.getImageUrls(mode='cached')">
-            <tal:x condition="python:len(urls)>0">
-              <a target="_blank" tal:attributes="href python:urls[0]"><img width="150" tal:attributes="src python:urls[0]" /></a>
-              <a tal:condition="python:len(urls)>1" target="_blank" tal:attributes="href python:urls[1]"><img width="150"
-                tal:attributes="src python:urls[1]" /></a>
-              <br />
-            </tal:x>
-          </tal:y>
-          <a tal:define="link publication/link | nothing;" tal:omit-tag="not:link" tal:content="structure python:publication.text" 
-             tal:attributes="href link"/>
-          <br />
-          <tal:x tal:condition="python:hasattr(publication,'description')"
-            tal:content="structure python:publication.description" />
-        </div>
-        <!-- end item -->
+          </div>
+          <!-- end item -->
+        </tal:block>
       </div>
       <!-- sideblock -->
 
-      <div class="sideblock" tal:condition="python:here.hasExtendedPublicationList()">
-        <h2>Further Publications</h2>
+      <div class="sideblock" tal:condition="here/hasAdditionalPublications">
+        <h2>Additional Publications</h2>
         <div class="item">
-          <a href="publicationsFull">Publications in the context of this project</a>
+          <a class="internal" tal:attributes="href python:here.getUrl(baseUrl=proBaseUrl)+'/additionalPublications'">
+            Publications in the context of this project
+          </a>
         </div>
       </div>
     </tal:block>
--- a/zpt/project/pubman/add_publications.zpt	Thu May 02 15:40:27 2013 +0200
+++ b/zpt/project/pubman/add_publications.zpt	Fri May 03 11:39:34 2013 +0200
@@ -2,38 +2,35 @@
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html metal:use-macro="here/edit_template/macros/page">
 <body>
-<tal:block metal:fill-slot="navsel" tal:define="global menusel string:talks" />
-
-<tal:block metal:fill-slot="body" tal:define="yes_no_list python:'yes\nno'">
-  <form action="" method="post">
-  <input type="hidden" name="method" value="search"/>
- 	<div> Author/Editor: <input type="text" size="30" name="author"/></div>
- 	<div> Title: <input type="text" size="30" name="title"/></div>
- 	<div> Somewhere in the metadata: <input type="text" size="30" name="any"/></div>
- 
-  <input type="submit" value="submit">
-
-  </form>
-
+  <tal:block metal:fill-slot="navsel" tal:define="global menusel string:publications" />
 
-<div tal:condition="python:options.has_key('values')">
-<form action="" method="post">
-  <input type="hidden" name="method" value="add"/>
-
-<table>
-
+  <tal:block metal:fill-slot="body" tal:define="yes_no_list python:'yes\nno'">
+    <form action="" method="post">
+      <input type="hidden" name="method" value="search" />
+      <div>
+        Author/Editor: <input type="text" size="30" name="author" />
+      </div>
+      <div>
+        Title: <input type="text" size="30" name="title" />
+      </div>
+      <div>
+        Somewhere in the metadata: <input type="text" size="30" name="any" />
+      </div>
+      <input type="submit" value="submit">
+    </form>
 
-<tr tal:repeat="entry python:options['values'].items()">
-<td><input type="checkbox" value="add" tal:attributes="name python:entry[0]"/></td>
-<td><tal:x tal:replace="structure python:entry[1]"/></td>
-</tr>
-
-</table>
-<input type="submit" value="submit"/>
-
-</form>
-
-</div>
-</tal:block>
+    <div tal:condition="python:options.has_key('values')">
+      <form action="" method="post">
+        <input type="hidden" name="method" value="add" />
+        <table>
+          <tr tal:repeat="entry python:options['values'].items()">
+            <td><input type="checkbox" value="add" tal:attributes="name python:entry[0]" /></td>
+            <td><tal:x tal:replace="structure python:entry[1]" /></td>
+          </tr>
+        </table>
+        <input type="submit" value="submit" />
+      </form>
+    </div>
+  </tal:block>
 </body>
 </html>
--- a/zpt/project/pubman/change_publications.zpt	Thu May 02 15:40:27 2013 +0200
+++ b/zpt/project/pubman/change_publications.zpt	Fri May 03 11:39:34 2013 +0200
@@ -2,29 +2,22 @@
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html metal:use-macro="here/edit_template/macros/page">
 <body>
-<tal:block metal:fill-slot="navsel" tal:define="global menusel string:talks" />
-
-<tal:block metal:fill-slot="body" tal:define="yes_no_list python:'yes\nno'">
-  
-
-<div>
-<form action="" method="post">
-
-<table>
+  <tal:block metal:fill-slot="navsel" tal:define="global menusel string:publications" />
 
-<input type="hidden" method="change"/>
-<tr tal:repeat="entry python:here.getSelectedPublications()">
-<td><input type="checkbox" value="delete" tal:attributes="name python:entry.escidocid"/></td>
-<td><input type="text" size="5" tal:attributes="name python:entry.escidocid+'__p'; value python:entry.priority"/></td>
-<td><tal:x tal:replace="structure python:here.mpiwgPubman.getEntryFromPubman(entry.escidocid)"/></td>
-</tr>
-
-</table>
-<input type="submit" value="submit"/>
-
-</form>
-
-</div>
-</tal:block>
+  <tal:block metal:fill-slot="body" tal:define="yes_no_list python:'yes\nno'">
+    <div>
+      <form action="" method="post">
+        <table>
+          <input type="hidden" method="change" />
+          <tr tal:repeat="entry python:here.getAdditionalPublicationList()">
+            <td><input type="checkbox" value="delete" tal:attributes="name python:entry.escidocid" /></td>
+            <td><input type="text" size="5" tal:attributes="name python:entry.escidocid+'__p'; value python:entry.priority" /></td>
+            <td><tal:x tal:replace="structure python:here.mpiwgPubman.getEntryFromPubman(entry.escidocid)" /></td>
+          </tr>
+        </table>
+        <input type="submit" value="submit" />
+      </form>
+    </div>
+  </tal:block>
 </body>
 </html>
--- a/zpt/project/pubman/show_publications.zpt	Thu May 02 15:40:27 2013 +0200
+++ b/zpt/project/pubman/show_publications.zpt	Fri May 03 11:39:34 2013 +0200
@@ -36,35 +36,16 @@
       Cooperation Partners: <span tal:content="structure partners">Partners</span>
     </p>
 
-      <h2>Selected publications</h2>
-      <tal:block tal:define="
-			     books python:here.getSelectedPublications();
-			   
-				">
-       
-        <tal:block >
-         
-          <ul class="publicationlist">
-	    <li tal:repeat="found3 books">
-	     <span>
-	    <a tal:attributes="href python:'http://pubman.mpiwg-berlin.mpg.de/pubman/faces/viewItemFullPage.jsp?itemId='+found3.escidocid"><span tal:replace="structure python:here.mpiwgPubman.getEntryFromPubman(found3.escidocid)"/>
-            </a>
-	  </span>
-	
-            </li>
-          </ul>
-        </tal:block>
+    <h2>Selected publications</h2>
+    <tal:block tal:define="books here/getAdditionalPublicationList;">
+      <ul class="publicationlist">
+        <li tal:repeat="found3 books">
+          <a tal:attributes="href python:'http://pubman.mpiwg-berlin.mpg.de/pubman/faces/viewItemFullPage.jsp?itemId='+found3.escidocid" 
+             tal:content="structure python:here.mpiwgPubman.getEntryFromPubman(found3.escidocid)"/>
+        </li>
+      </ul>
+    </tal:block>
 
-    
-      
-      </tal:block>
-
-<!--
-        <p> 
-	  <a href="/institutsbiblio/FMPro?-db=personal-www&amp;-max=1&amp;-Lay=ALL&amp;-format=search_inst_bib.html&amp;ID=[FMP-Field: ID]&amp;-Error=null.html&amp;-find" target="_new"> 
-              search the institute's bibliography </a>
- -->
-   
-</div>
+  </div>
   </body>
 </html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/project/related_project/edit_basic.zpt	Fri May 03 11:39:34 2013 +0200
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html metal:use-macro="here/edit_template/macros/page">
+<head>
+</head>
+<body>
+  <tal:block metal:fill-slot="navsel" tal:define="global menusel string:relatedProjects" />
+  <tal:block metal:fill-slot="body">
+    <h3>Edit related project</h3>
+    <form action="editRelatedProject" method="post">
+    <table>
+      <tr>
+        <td><b>Project id:</b></td>
+        <td tal:content="here/getProjectId" />
+      </tr>
+      <tr>
+        <td><b>Project title:</b></td>
+        <td tal:content="here/getLabel" />
+      </tr>
+      <tr>
+        <td><b>Link</b></td>
+        <td>
+          <input size="100" tal:attributes="value python:getattr(here,'orginallink','')" name="link"/> 
+          <input type="submit" value="change" />
+        </td>
+      </tr>
+    </table>
+    </form>
+        <h3>
+          <a tal:attributes="href string:$root/manageRelatedProjects">Back to related projects list</a>
+        </h3>
+  </tal:block>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zpt/project/related_publication/edit_basic.zpt	Fri May 03 11:39:34 2013 +0200
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html metal:use-macro="here/edit_MPIWGProject_main/macros/page">
+<head>
+</head>
+<body>
+<tal:block metal:fill-slot="navsel" tal:define="global menusel string:publications" />
+<tal:block metal:fill-slot="body">
+  <h3>Edit a project publication</h3>
+  
+  <form action="editPublication" method="post" enctype="multipart/form-data">
+  <p>Bibliographical entry</p>
+    <textarea tal:content="structure python:getattr(here,'text','')" name="text" rows="3" cols="80"></textarea>
+    
+  <p>Link</p>
+  	<input size="100" tal:attributes="value python:getattr(here,'link','')" name="link">
+  
+  <h4>Image</h4>
+  <p>Only images of MPIWG book pages are displayed. The link above has to be a link to a MPIWG book page.</p>
+  
+  <tal:x tal:define="hasbook here/hasLinkToBookPage; bookid here/getBookId" tal:condition="bookid">
+    <p tal:define="book python:here.books[bookid]" >
+  	 <img tal:attributes="src book/getImageUrl" width="150"/>
+    </p>
+  </tal:x>
+  <p tal:condition="not:here/hasLinkToBookPage">
+   Link is not a MPIWG book page.
+  </p>
+  
+  <!-- 
+  <p>Image 1 (e.g. Cover)</p>
+  <p tal:condition="python:hasattr(here,'publicationImage1')">
+  	<img tal:attributes="src python:here.publicationImage1.absolute_url()" height="100"/>
+  	</p>
+   <p>Upload new image:<input type="file" name="image1" len="50"/></p>
+  <p>Image 2 (e.g. Table of Contents)</p>
+  <p tal:condition="python:hasattr(here,'publicationImage2')">
+  	<img tal:attributes="src python:here.publicationImage2.absolute_url()" height="100"/>
+  	</p>
+   <p>Upload new image:<input type="file" name="image2" len="50"/></p>
+  
+ -->
+  <h3>Descriptive Text</h3>
+  <p>
+  <textarea tal:content="structure python:getattr(here,'description','')" name="description" rows="10" cols="80"></textarea>
+  </p>
+  <p><input type="submit" value="submit"/></p>
+  </form>
+  
+  <h3><a href="managePublications">Back to publication list</a></h3>
+</tal:block>
+</body>
+</html>
--- a/zpt/showExtendedProjectBibliography.zpt	Thu May 02 15:40:27 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<html metal:use-macro="here/projects/extendedBibliography/macros/page">
-  
-</html>