Mercurial > hg > MPIWGWeb
changeset 64:b5ff783027d6
more work on projects.
author | casties |
---|---|
date | Fri, 03 May 2013 12:00:34 +0200 |
parents | fd6931bd49c8 |
children | 63184d71c014 |
files | MPIWGProjects.py zpt/project/edit_publications.zpt zpt/project/related_publication/edit_basic.zpt |
diffstat | 3 files changed, 31 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/MPIWGProjects.py Fri May 03 11:30:41 2013 +0200 +++ b/MPIWGProjects.py Fri May 03 12:00:34 2013 +0200 @@ -669,22 +669,33 @@ return items - def addPublication(self, text, RESPONSE=None): + def addPublication(self, text=None, link=None, RESPONSE=None): """add an MPIWG_Publication""" - number = self._getLastPublicationNumber() + 1 - name = "publication_" + str(number) - while hasattr(self, name): - number += 1 + if text or link: + number = self._getLastPublicationNumber() + 1 name = "publication_" + str(number) + while hasattr(self, name): + number += 1 + name = "publication_" + str(number) + + newPublication = MPIWGProject_publication(name) - newPublication = MPIWGProject_publication(name) + self._setObject(name, newPublication) + obj = getattr(self, name) + obj.text = text + obj.link = link + obj.enabled = True; + obj.place = self._getLastPublicationNumber() + 1 + obj.id = name + # hasLinkToBookPage updates bookid if available + if obj.hasLinkToBookPage() and not text: + # take title from book page + try: + book = self.en.books[obj.bookId] + obj.text = book.getInfo('title') + except: + pass - self._setObject(name, newPublication) - obj = getattr(self, name) - obj.text = text[0:] - obj.enabled = True; - obj.place = self._getLastPublicationNumber() + 1 - obj.id = name if RESPONSE is not None: self.redirect(RESPONSE, 'managePublications')
--- a/zpt/project/edit_publications.zpt Fri May 03 11:30:41 2013 +0200 +++ b/zpt/project/edit_publications.zpt Fri May 03 12:00:34 2013 +0200 @@ -26,7 +26,10 @@ <h3>Add a project publication</h3> <form tal:attributes="action string:$root/addPublication" method="post"> - <textarea name="text" rows="3" cols="80"></textarea> + <p><b>Bibliographical entry:</b><br/> + <textarea name="text" rows="2" cols="80"></textarea> + </p> + <p><b>Link:</b> <input name="link" size="60"/> (optional, can be link to MPIWG book page)</p> <p><input type="submit" value="submit"/></p> </form>
--- a/zpt/project/related_publication/edit_basic.zpt Fri May 03 11:30:41 2013 +0200 +++ b/zpt/project/related_publication/edit_basic.zpt Fri May 03 12:00:34 2013 +0200 @@ -9,11 +9,12 @@ <h3>Edit a project publication</h3> <form action="editPublication" method="post" enctype="multipart/form-data"> - <p>Bibliographical entry</p> + <p><b>Bibliographical entry:</b><br/> <textarea tal:content="structure python:getattr(here,'text','')" name="text" rows="3" cols="80"></textarea> - - <p>Link</p> + </p> + <p><b>Link:</b><br/> <input size="100" tal:attributes="value python:getattr(here,'link','')" name="link"> + </p> <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>