changeset 172:7fe39dcfb6c1

improved editing project images.
author casties
date Fri, 07 Jun 2013 17:35:22 +0200
parents 9d8f202e3895
children 37bfced67084
files MPIWGProjects.py zpt/project/edit_images.zpt
diffstat 2 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGProjects.py	Fri Jun 07 17:19:48 2013 +0200
+++ b/MPIWGProjects.py	Fri Jun 07 17:35:22 2013 +0200
@@ -712,7 +712,7 @@
 
 
 
-    def addImage(self, fileHd, caption, RESPONSE=None, filename=None):
+    def addImage(self, fileHd, caption=None, link=None, RESPONSE=None, filename=None):
         """add an MPIWG_Project_image"""
 
         if not filename:
@@ -743,14 +743,11 @@
 
         self._setObject(filename, newImage)
         obj = getattr(self, filename)
-        if caption is None:
-            obj.caption=None
-        else:
-            obj.caption = caption[:]
-            
+        obj.caption = caption
         obj.enabled = True;
         obj.place = self._getLastImageNumber() + 1
         obj.id = filename
+        obj.link = link
 
         # invalidate thumbnail
         self.projectThumb = None
--- a/zpt/project/edit_images.zpt	Fri Jun 07 17:19:48 2013 +0200
+++ b/zpt/project/edit_images.zpt	Fri Jun 07 17:35:22 2013 +0200
@@ -25,7 +25,7 @@
             <span tal:content="string:(${image/width}x${image/height}px)"/>
           </td>
           <td tal:content="structure image/getCaption" />
-          <td tal:content="structure image/getLink" />
+          <td><a tal:define="link image/getLink" tal:condition="link" tal:attributes="href link" tal:content="link"/></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>
@@ -49,10 +49,12 @@
         <tr>
           <th>Image</th>
           <th>Caption</th>
+          <th>Link(optional)</th>
         </tr>
         <tr>
-          <td valign="top"><input name="fileHd" type="file" len="50" /></td>
+          <td valign="top"><input name="fileHd" type="file"/></td>
           <td valign="top"><textarea name="caption" rows="3" cols="60"></textarea></td>
+          <td valign="top"><input name="link" type="text"/></td>
         </tr>
       </table>
       <p>