changeset 167:3311d9f639cf

arnica_slides, text_x_arnica: use real image name in the option list
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 14 Jul 2008 18:30:36 +0200
parents 9817520ac155
children cf3fef32a87b
files data/plugin/action/arnica_slides.py data/plugin/parser/text_x_arnica.py
diffstat 2 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Mon Jul 14 17:15:39 2008 +0200
+++ b/data/plugin/action/arnica_slides.py	Mon Jul 14 18:30:36 2008 +0200
@@ -165,7 +165,7 @@
 
     return html
 
-def html_slideform(request, pagename, alias, exif_date, images, idx, image_for_webnail):
+def html_slideform(request, pagename, alias, exif_date, images, original_images, idx, image_for_webnail):
     """ html code for the slideform
     @param request: request object
     @param pagename: pagename where the attachments are located
@@ -180,9 +180,11 @@
         url = cache.url(request, "")
     else:
         url = AttachFile.getAttachUrl(pagename, "", request)
+        
+    link_to_image = AttachFile.getAttachUrl(pagename, original_images[idx], request)
 
     image_url = "%s%s" % (url, images[idx])
-    option_webnail = option_list(image_url, pagename, images, alias, request, image_for_webnail)
+    option_webnail = option_list(image_url, pagename, images, original_images, alias, request, image_for_webnail)
     inner_table_style = ' style="border-style:none; margin:10px;"'
     this_webnail_list = "".join(["%s%s|" % (url, name) for name in images])
 
@@ -193,6 +195,7 @@
 <div>
 <input type="hidden" name="flag" value="webnail">
 <input type="hidden" name="webnail_list" value="%(this_webnail_list)s">
+<input type="hidden" name="original_images" value="%(original_images)s">
 <input type="hidden" name="webnail_name" value="%(this_webnail_name)s">
 <input type="hidden" name="alias" value="%(this_alias_list)s">
 <input type="hidden" name="exif_date" value="%(this_exif_date_list)s">
@@ -213,7 +216,7 @@
 <img src="%(server)s%(this_image)s" name="show" alt="%(this_alias_text)s,%(this_exif_date_text)s">
 </div>
 <div class="image-description">
-<span id="arnica_alias_text">%(this_alias_text)s</span>,
+<span id="arnica_alias_text"><a href=%(link_url)s>%(this_alias_text)s</a></span>,
 <span id="arnica_exif_date_text">%(this_exif_date_text)s</span>
 </div>
 </div>
@@ -221,8 +224,10 @@
 "server": request.getQualifiedURL(),
 "htdocs": request.cfg.url_prefix_static,
 "base_url": request.getScriptname(),
+"link_url": link_to_image,
 "this_webnail_list": this_webnail_list,
 "this_webnail_name": packLine(images),
+"original_images": packLine(original_images),
 "this_alias_text": wikiutil.escape(alias[idx], quote=1),
 "this_alias_list": wikiutil.escape(packLine(alias), quote=1),
 "this_exif_date_text": wikiutil.escape(exif_date[idx], quote=1),
@@ -234,7 +239,7 @@
 }
     return html
 
-def option_list(this_image, pagename, text, alias, request, image_for_webnail):
+def option_list(this_image, pagename, text, original_images, alias, request, image_for_webnail):
     """ generates the pulldown option list
     @param this_image: selected image  on top
     @param pagename: pagename of attachments
@@ -256,12 +261,12 @@
             txt += '<option selected value="%(name)s">%(prefix)s: %(alias)s' % {
                     "prefix": prefix,
                     "name": this_image,
-                    "alias": alias[i]}
+                    "alias": original_images[i]}
         else:
             txt += '<option value="%(name)s">%(prefix)s: %(alias)s' % {
                     "prefix": prefix,
                     "name": this_image,
-                    "alias": alias[i]}
+                    "alias": original_images[i]}
         i += 1
 
     return txt
@@ -309,6 +314,8 @@
 
         target = request.form.get('target', [''])[0]
         images = request.form.get('images', [''])[0]
+        original_images = request.form.get('original_images', [''])[0]
+        
         all_description = request.form.get('alias', [''])[0]
         all_exif_date = request.form.get('exif_date', [''])[0]
         image_for_webnail = (request.form.get("image_for_webnail", [0])[0])  == u'True'
@@ -321,6 +328,10 @@
 
         images = unpackLine(images)
         images = (images[1:])
+        
+        original_images = unpackLine(original_images)
+        original_images = (original_images[1:])
+        
 
         all_description = unpackLine(all_description)
         all_description = (all_description[1:])
@@ -354,7 +365,7 @@
                                  html_head=html_js(request, idx))
 
         request.write(request.formatter.startContent("content"))
-        html = html_slideform(request, pagename, all_description, all_exif_date, images, idx, image_for_webnail)
+        html = html_slideform(request, pagename, all_description, all_exif_date, images, original_images, idx, image_for_webnail)
         request.write(html)
         request.write(request.formatter.endContent())
         request.write(request.theme.send_footer(pagename))
--- a/data/plugin/parser/text_x_arnica.py	Mon Jul 14 17:15:39 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Mon Jul 14 18:30:36 2008 +0200
@@ -283,6 +283,7 @@
                 <input type="hidden" name="target" value="%(target)s">
                 <input type="hidden" name="pagename" value="%(pagename)s">
                 <input type="hidden" name="images" value="%(images)s">
+                <input type="hidden" name="original_images" value="%(original_images)s">
                 <input type="hidden" name="exif_date" value="%(exif_date)s">
                 <input type="hidden" name="image_for_webnail" value="%(image_for_webnail)s">
                 <input type="image" value="submit" title="slide show" src="%(htdocs)s/arnica/img/arnica_load_slide_show.png">
@@ -298,7 +299,9 @@
             "image_for_webnail": self.image_for_webnail,
             "exif_date": packLine([self.exif_date[idx]] + self.exif_date),
             "target": self.webimg[idx],
+            "original_images": packLine([self.full[idx]] + self.full),
             "images": packLine([self.webimg[idx]] + self.webimg),
+            "original_images": packLine([self.full[idx]] + self.full),
             "this_target": self.full[idx],
             "thumbnail": "%s%s" % (AttachFile.getAttachUrl(self.pagename, '', self.request), self.thumb[idx]),
             "html_tools_restricted": self.html_tools_restricted(this_image)
@@ -346,6 +349,7 @@
              <input type="hidden" name="target" value="%(target)s">
              <input type="hidden" name="pagename" value="%(pagename)s">
              <input type="hidden" name="images" value="%(images)s">
+             <input type="hidden" name="original_images" value="%(original_images)s">
              <input type="hidden" name="exif_date" value="%(exif_date)s">
              <input type="hidden" name="image_for_webnail" value="%(image_for_webnail)s">
              <input type="image" value="submit" title="slide show" src="%(thumbnail)s">
@@ -364,6 +368,7 @@
      "exif_date": packLine([self.exif_date[idx]] + self.exif_date),
      "image_for_webnail": self.image_for_webnail,
      "target": self.webimg[idx],
+     "original_images": packLine([self.full[idx]] + self.full),
      "images": packLine([self.webimg[idx]] + self.webimg),
      "thumbnail": cache.url(self.request, self.thumb[idx]),
      "thumbnail_width": self.thumbnail_width,