changeset 35:f8e8abce7208

arnica_slides: small refactoring (renaming parameter)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 24 May 2008 11:33:28 +0200
parents 864fba4e90f3
children 3f042c1e2509
files data/plugin/action/arnica_slides.py
diffstat 1 files changed, 11 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Sat May 24 11:03:40 2008 +0200
+++ b/data/plugin/action/arnica_slides.py	Sat May 24 11:33:28 2008 +0200
@@ -160,14 +160,14 @@
 
     return html
 
-def html_slideform(request, pagename, alias, exif_date, target, idx, image_for_webnail):
+def html_slideform(request, pagename, alias, exif_date, images, idx, image_for_webnail):
     """ html code for the slideform
     @param request: request object
     @param pagename: pagename where the attachments are located
     @param url_wiki_page:
     @param alias: text alias for filename
     @param exif_date: date information
-    @param target: all images
+    @param images: all images
     @param idx: index position of the image
     @param image_for_webnail: identifier for AttchFile or arnica_slides
     """
@@ -176,14 +176,11 @@
     else:
         url = AttachFile.getAttachUrl(pagename, "", request)
 
-    option_webnail = option_list(url + target[idx], pagename, target, request, image_for_webnail)
-
+    option_webnail = option_list(url + images[idx], pagename, images, request, image_for_webnail)
     inner_table_style = ' style="border-style:none; margin:10px;"'
-
-    this_webnail_list = ''
-    for name in target:
-        this_webnail_list += url + name + ','
-        html = '''
+    this_webnail_list = "".join(["%s%s," % (url, name) for name in images])
+    
+    html = '''
 <form name=slideform method="POST">
    <input type="hidden" name="flag" value="webnail">
    <input type="hidden" name="webnail_list" value='%(this_webnail_list)s'>
@@ -239,13 +236,13 @@
 "htdocs": request.cfg.url_prefix_static,
 "base_url": request.getScriptname(),
 "this_webnail_list": this_webnail_list,
-"this_webnail_name": ','.join(target),
+"this_webnail_name": ','.join(images),
 "this_alias_text": wikiutil.escape(alias[idx], quote=1),
 "this_alias_list": wikiutil.escape('!,!'.join(alias), quote=1),
 "this_exif_date_text": wikiutil.escape(exif_date[idx], quote=1),
 "this_exif_date_list": wikiutil.escape(','.join(exif_date), quote=1),
 
-"this_image": url + target[idx],
+"this_image": url + images[idx],
 "pagename": pagename,
 "tablestyle": inner_table_style,
 "option_webnails": option_webnail,
@@ -362,7 +359,7 @@
             return
 
         request.formatter = Formatter(request)
-        attachment_path = AttachFile.getAttachDir(request, self.pagename)
+        attachment_path = AttachFile.getAttachDir(request, pagename)
         command = request.form.get('do', ['none'])[0]
         target = request.form.get('target', [''])[0]
 
@@ -370,7 +367,6 @@
             web = {}
             images = request.form.get('images', [''])[0]
             images = images.split(',')
-            target = images[0]
             images = (images[1:])
 
             all_description = request.form.get('alias', [''])[0]
@@ -388,11 +384,10 @@
             image_for_webnail = int(request.form.get("image_for_webnail", [0])[0])
 
             if not image_for_webnail:
-                url = getAttachUrl(request.getScriptname(), pagename, target)
+                web['src'] = getAttachUrl(request.getScriptname(), pagename, target)
             else:
-                url = AttachFile.getAttachUrl(pagename, target, request)
+                web['src']  = AttachFile.getAttachUrl(pagename, target, request)
 
-            web['src'] = url
             web['title'] = target
 
             mimetype = "text/html"