changeset 61:04fb655633ef

more cleaning up projects.
author casties
date Thu, 02 May 2013 18:32:01 +0200
parents dc41deabc8f8
children 64be5db08495
files MPIWGProjects.py MPIWGProjects_removed.py zpt/edit_project_error_relatedProject.zpt zpt/edit_publicationForm.zpt zpt/edit_relatedProjectForm.zpt zpt/project/edit_basic.zpt zpt/project/edit_images.zpt zpt/project/edit_publications.zpt zpt/project/edit_related_projects.zpt zpt/project/edit_related_projects_error.zpt zpt/project/edit_template.zpt zpt/project/project_template.zpt zpt/project/pubman/change_publications.zpt zpt/project/pubman/show_publications.zpt zpt/project/related_project/edit_basic.zpt zpt/project/related_publication/edit_basic.zpt zpt/showExtendedProjectBibliography.zpt
diffstat 17 files changed, 359 insertions(+), 343 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGProjects.py	Thu May 02 11:26:57 2013 +0200
+++ b/MPIWGProjects.py	Thu May 02 18:32:01 2013 +0200
@@ -92,9 +92,16 @@
     """publications object fuer project"""
 
     meta_type = "MPIWGProject_publication"
+    
+    text = None
+    link = None
+    bookId = None
+    
+    editForm = 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"""
-        
+        """mache ein redirect mit einem angehaengten time stamp um ein reload zu erzwingen"""        
         timeStamp = time.time()
         
         if url.find("?") > -1:  # giebt es schon parameter
@@ -106,93 +113,53 @@
         logging.debug(email.Utils.formatdate() + ' GMT')
         RESPONSE.redirect(url + addStr % timeStamp)
 
-    def hasLinkToBookPage(self, mode="not_cached"):
+
+    def hasLinkToBookPage(self):
         """teste ob eingebener link zu einer MPIWG Book page geht"""
-        
-        
         logging.debug("MPIWGProject_publication - begin hasLinkToBookPage")
-        if (getattr(self, 'link', '') == ''):
+        if not 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
+        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 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):
+    def editPublication(self, text=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)
+            pt = self.editForm
             return pt()
-
        
         if text:
-            self.text = text[0:]
+            self.text = text
         
         if description:
             self.description = description
         
         if link:
-            self.link = link[0:]
+            self.link = link
+            self.hasLinkToBookPage()
         
-        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")
 
@@ -202,6 +169,12 @@
 
     meta_type = "MPIWGProject_relatedProject"
     
+    objid = None
+    projectLabel = None
+    
+    editForm = 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"""
         
@@ -217,16 +190,39 @@
         RESPONSE.redirect(url + addStr % timeStamp)
 
     
+    def getProjectId(self):
+        """Return the related project id."""
+        return self.objid
+
+
+    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)
+
     
+    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
+            
+        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.editForm
             return pt()
         
         # hole die id des projektes
@@ -239,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;
        
@@ -310,15 +307,20 @@
     edit_css = ImageFile('css/edit.css', globals())
     # make css refreshable for development
     edit_css.index_html = refreshingImageFileIndexHtml
+    # user-accessible editing templates
     edit_basic = PageTemplateFile('zpt/project/edit_basic', globals())
     editForm = PageTemplateFile('zpt/project/edit_description', globals())
     edit_template = PageTemplateFile('zpt/project/edit_template', 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())
     # 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())
@@ -474,6 +476,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"""
@@ -548,7 +555,7 @@
         return [p for p in tree.getChildrenOf(self.getNumber()) if p.checkActive(active)]
     
               
-    def getRelatedProjects(self):
+    def getRelatedProjectList(self):
         """returns the list of related projects"""
         items = self.objectValues(spec='MPIWGProject_relatedProject')
         # sort by place
@@ -556,7 +563,7 @@
         return items
         
 
-    def getRelatedPublications(self):
+    def getPublicationList(self):
         """returns the list of related publications"""
         items = self.objectValues(spec='MPIWGProject_publication')
         # sort by place
@@ -592,7 +599,7 @@
 
         for idx in range(len(objectList)):
             object = objectList[idx]
-            if object.getId() == objectId():
+            if object.getId() == objectId:
                 if direction == 'up':
                     if idx > 0:
                         # move up
@@ -607,9 +614,9 @@
                         
                 return
                       
-    def manageImages(self, imageName=None, op=None):
+    def manageImages(self, name=None, op=None):
         """manage images"""
-        self.moveObjectPlace(self.getImageList(), imageName, op)
+        self.moveObjectPlace(self.getImageList(), name, op)
  
         # invalidate thumbnail
         self.projectThumb = None
@@ -620,7 +627,7 @@
 
     def managePublications(self, name=None, op=None):
         """manage publications"""
-        self.moveObjectPlace(self.getRelatedPublications(), name, op)
+        self.moveObjectPlace(self.getPublicationList(), name, op)
 
         pt = self.editPublicationsForm
         return pt()
@@ -628,7 +635,7 @@
     
     def manageRelatedProjects(self, name=None, op=None):
         """manage related projects"""
-        self.moveObjectPlace(self.getRelatedProjects(), name, op)
+        self.moveObjectPlace(self.getRelatedProjectList(), name, op)
 
         pt = self.editRelatedProjectsForm
         return pt()    
@@ -656,17 +663,17 @@
 
     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)
+        pt = self.editRelatedProjectsError
         return pt(link=link)
 
 
     def addRelatedProject(self, link, RESPONSE=None):
         """add a MPIWGProject_relatedProject"""
-        number = self.getLastPublicationNumber() + 1
-        name = "RelatedProject" + str(number)
+        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("/")
@@ -694,25 +701,32 @@
         obj.enabled = True;
         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.getRelatedPublications()
-        if not publications:
+    def getLastImageNumber(self):
+        items = self.getImageList()
+        if not items:
             return 0
         else:
-            return getattr(publications[-1], 'place', 0)
+            return getattr(items[-1], 'place', 0)
+
+        
+    def getLastPublicationNumber(self):
+        items = self.getPublicationList()
+        if not items:
+            return 0
+        else:
+            return getattr(items[-1], 'place', 0)
 
         
     def getLastRelatedProjectNumber(self):
-        publications = self.getRelatedProjects()
-        if not publications:
+        items = self.getRelatedProjectList()
+        if not items:
             return 0
         else:
-            return getattr(publications[-1], 'place', 0)
+            return getattr(items[-1], 'place', 0)
 
         
     def deletePublication(self, id, RESPONSE=None):
@@ -732,9 +746,9 @@
     def deleteImage(self, id, RESPONSE=None):
         """delete Image id"""
         try:
-                self.manage_delObjects([id])
+            self.manage_delObjects([id])
         except:
-                logging.error("ERROR MPIWG: %s %s" % sys.exc_info()[0:2])
+            logging.error("ERROR MPIWG: %s %s" % sys.exc_info()[0:2])
                 
         # invalidate thumbnail
         self.projectThumb = None
@@ -756,7 +770,7 @@
 
         self._setObject(filename, newImage)
         obj = getattr(self, filename)
-        obj.caption = caption[0:]
+        obj.caption = caption[:]
         obj.enabled = True;
         obj.place = self.getLastImageNumber() + 1
         obj.id = filename
@@ -1289,7 +1303,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)):
@@ -1493,8 +1507,7 @@
     def changePublications(self,REQUEST):
         """change published publications"""
         
-        data=REQUEST.form
-       
+        data=REQUEST.form       
      
         if data.get("method","change"):
             for key in data.keys():
@@ -1506,8 +1519,7 @@
                 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) 
+        pt = self.editAdditionalPublicationsForm
         return pt()
     
     def deleteFromPublicationList(self,escidocid):
@@ -1533,27 +1545,22 @@
             logging.error(value)
         
 
-    def getSelectedPublications(self):
+    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 hasExtendedPublicationList(self):
+    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:
+        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):
@@ -1872,17 +1879,13 @@
                 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():
+                pub.hasLinkToBookPage()
+                
             #
             # unicodify
             #
--- a/MPIWGProjects_removed.py	Thu May 02 11:26:57 2013 +0200
+++ b/MPIWGProjects_removed.py	Thu May 02 18:32:01 2013 +0200
@@ -343,4 +343,31 @@
 
 
 
+    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/zpt/edit_project_error_relatedProject.zpt	Thu May 02 11:26:57 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 11:26:57 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 11:26:57 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 11:26:57 2013 +0200
+++ b/zpt/project/edit_basic.zpt	Thu May 02 18:32:01 2013 +0200
@@ -11,7 +11,7 @@
       <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>
--- a/zpt/project/edit_images.zpt	Thu May 02 11:26:57 2013 +0200
+++ b/zpt/project/edit_images.zpt	Thu May 02 18:32:01 2013 +0200
@@ -16,20 +16,24 @@
       <tal:block tal:repeat="image images">
         <tr tal:define="imgid image/getId">
           <td>
-            <a tal:attributes="href python:here.absolute_url()+'/manageImages?imageName='+imgid+'&op=up'">up</a><br/>
-            <a tal:attributes="href python:here.absolute_url()+'/manageImages?imageName='+imgid+'&op=down'">down</a>
+            <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 tal:condition="not:python:image.height==''" tal:content="structure python:image.tag(scale=250.0 / image.height)" />
-          <td tal:condition="python:image.height==''" tal:content="python:image.height" />
+          <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 python:imgid+'/editImage'">Edit</a><br /> <a
-            tal:attributes="href python:'deleteImage?id='+imgid">Delete</a></td>
+          <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 last image in the list is used as the project thumbnail image (140x87px). Preview: <img width="140" height="87"
+      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>
 
@@ -42,8 +46,8 @@
           <th>Caption</th>
         </tr>
         <tr>
-          <td><input name="fileHd" type="file" len="50" /></td>
-          <td><textarea name="caption" rows="3" cols="60"></textarea></td>
+          <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>
@@ -52,7 +56,7 @@
     </form>
 
     <p>
-      (if the marginal image from your current project description is not in this list, click <a href="copyImageToMargin">here</a>.)
+      (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>
--- a/zpt/project/edit_publications.zpt	Thu May 02 11:26:57 2013 +0200
+++ b/zpt/project/edit_publications.zpt	Thu May 02 18:32:01 2013 +0200
@@ -6,42 +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/getRelatedPublications">
-      <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.getId()+'&op=up'">up</a><br>
-          <a tal:attributes="href python:here.absolute_url()+'/managePublications?pubName='+publication.getId()+'&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="string:[${publication/place}]"/>
         <td tal:content="structure python:getattr(publication,'text','')" />
         <td>
-          <a tal:attributes="href python:publication.getId()+'/editPublication'">Edit</a><br/> 
-          <a tal:attributes="href python:'deletePublication?id='+publication.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/addPublicationsFromPubman"> 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 11:26:57 2013 +0200
+++ b/zpt/project/edit_related_projects.zpt	Thu May 02 18:32:01 2013 +0200
@@ -7,30 +7,34 @@
 <tal:block metal:fill-slot="navsel" tal:define="global menusel string:relatedProjects" />
 <tal:block metal:fill-slot="body">
   <table>
-    <tal:block tal:repeat="item 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='+item.getId()+'&op=up'">up</a><br>
-          <a tal:attributes="href python:here.absolute_url()+'/manageRelatedProjects?pubName='+item.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="string:[${item/place}]"/>
         <!-- <td tal:content="item/objid" /> -->
         <td tal:content="item/getProjectTitle" />
         <td>
-          <a tal:attributes="href python:item.getId()+'/editRelatedProject'">Edit</a><br/> 
-          <a tal:attributes="href python:'deleteRelatedProject?id='+item.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	Thu May 02 18:32:01 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 11:26:57 2013 +0200
+++ b/zpt/project/edit_template.zpt	Thu May 02 18:32:01 2013 +0200
@@ -2,7 +2,7 @@
           "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"/>  
@@ -12,12 +12,12 @@
   <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:test('basic'==menusel, 'mainmenusel', 'mainmenu')"><a href="editBasic">Basic information</a></span>
-    <span tal:attributes="class python:test('description'==menusel, 'mainmenusel', 'mainmenu')"><a href="edit">Project description</a></span>
-    <span tal:attributes="class python:test('images'==menusel, 'mainmenusel', 'mainmenu')"><a href="manageImages">Images</a></span>
-    <span tal:attributes="class python:test('publications'==menusel, 'mainmenusel', 'mainmenu')"><a href="managePublications">Publications</a></span>
-    <span tal:attributes="class python:test('relatedProjects'==menusel, 'mainmenusel', 'mainmenu')"><a href="manageRelatedProjects">Related Projects</a></span>
-    <span tal:attributes="class python:test('themes'==menusel, 'mainmenusel', 'mainmenu')"><a href="tagTheProject">Tags</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/edit">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">
--- a/zpt/project/project_template.zpt	Thu May 02 11:26:57 2013 +0200
+++ b/zpt/project/project_template.zpt	Thu May 02 18:32:01 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/change_publications.zpt	Thu May 02 11:26:57 2013 +0200
+++ b/zpt/project/pubman/change_publications.zpt	Thu May 02 18:32:01 2013 +0200
@@ -2,7 +2,7 @@
           "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="navsel" tal:define="global menusel string:publications" />
 
 <tal:block metal:fill-slot="body" tal:define="yes_no_list python:'yes\nno'">
   
@@ -13,7 +13,7 @@
 <table>
 
 <input type="hidden" method="change"/>
-<tr tal:repeat="entry python:here.getSelectedPublications()">
+<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>
--- a/zpt/project/pubman/show_publications.zpt	Thu May 02 11:26:57 2013 +0200
+++ b/zpt/project/pubman/show_publications.zpt	Thu May 02 18:32:01 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	Thu May 02 18:32:01 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	Thu May 02 18:32:01 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 11:26:57 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>