# HG changeset patch # User casties # Date 1368712708 -7200 # Node ID 2dd8e3be4a8e14042c853fc4934af3b2f801fafa # Parent 1b8be917a167a79bf90bfdcc1fb196a600467c09 add project image link. fix edit image template bug. diff -r 1b8be917a167 -r 2dd8e3be4a8e MPIWGProjects.py --- a/MPIWGProjects.py Thu May 16 15:05:57 2013 +0200 +++ b/MPIWGProjects.py Thu May 16 15:58:28 2013 +0200 @@ -221,22 +221,39 @@ meta_type = "MPIWGProject_image" # templates - showImage = PageTemplateFile('zpt/project/image/projectImageView', globals()) + oldShowImage = PageTemplateFile('zpt/project/image/projectImageView', globals()) editForm = PageTemplateFile('zpt/project/image/edit_basic', globals()) getUrl = MPIWGHelper.getUrl - def editImage(self, file=None, caption=None, RESPONSE=None): + + def getCaption(self): + """Return the image caption.""" + return getattr(self, 'caption', None) + + + def getLink(self): + """Return the image link.""" + return getattr(self, 'link', None) + + + def editImage(self, file=None, caption=None, link=None, RESPONSE=None): """edit the Image""" if (not file) and (not caption): pt = self.editForm return pt() - if file and (not file.filename.lstrip().rstrip() == ""): + if file and (not file.filename.strip() == ""): self.manage_upload(file) if caption: - self.caption = caption[0:] + if isinstance(caption, list): + caption = caption[0] + + self.caption = caption + + if link: + self.link = link if RESPONSE: self.redirect(RESPONSE, "../manageImages") @@ -542,6 +559,11 @@ return t + def getMPIWGProject(self): + """Return this project for acquisition.""" + return self + + def getMPIWGProjectUrl(self): """Return this project for acquisition.""" return self.absolute_url() diff -r 1b8be917a167 -r 2dd8e3be4a8e zpt/project/edit_images.zpt --- a/zpt/project/edit_images.zpt Thu May 16 15:05:57 2013 +0200 +++ b/zpt/project/edit_images.zpt Thu May 16 15:58:28 2013 +0200 @@ -11,6 +11,7 @@ Image Caption + Link @@ -23,14 +24,15 @@
- + + Edit
Delete

- The image for the project description should have a width of 220px. + The image for the project description should have a width of 230px.

The last image in the list is used as the project thumbnail image (140x87px): Tags View + tal:attributes="href python:here.getMPIWGProject().getUrl(baseUrl=here.en.MPIWGrootURL()+'/research/projects')">View

diff -r 1b8be917a167 -r 2dd8e3be4a8e zpt/project/image/edit_basic.zpt --- a/zpt/project/image/edit_basic.zpt Thu May 16 15:05:57 2013 +0200 +++ b/zpt/project/image/edit_basic.zpt Thu May 16 15:58:28 2013 +0200 @@ -1,23 +1,32 @@ - + -

Edit Image

+

Edit Image

- - - - - - - - - -
ImageCaption

Upload new image:

+ +

Image

+
+ +
+

Upload new image:

+ +

Caption

+

(shown below image)

+
+ +
+ +

Link

+

(optional, URL of larger image)

+
+ +
+

diff -r 1b8be917a167 -r 2dd8e3be4a8e zpt/project/project_index_html.zpt --- a/zpt/project/project_index_html.zpt Thu May 16 15:05:57 2013 +0200 +++ b/zpt/project/project_index_html.zpt Thu May 16 15:58:28 2013 +0200 @@ -53,9 +53,8 @@
- -
empty image
J.-A.-D. Ingres: Mme Moitessier, 1856. Oel/Lw. 120 x 92,1 cm. London, National Gallery.