changeset 157:0116eb3e1099

text_x_arnica: replaced baseurl/pagename by Page.url
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 12 Jul 2008 14:42:22 +0200
parents a6ff4cf3dbc2
children cc31ed821e35
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Sat Jul 12 14:09:43 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Sat Jul 12 14:42:22 2008 +0200
@@ -199,12 +199,11 @@
     files = [fn for fn in files if wikiutil.isPicture(fn) and not fn.startswith('tmp.')]
     return files
 
-def getCacheUrl(base_url, pagename, filename):
+def getCacheUrl(url, filename):
     """ Get URL that points to cache of `filename` on page `pagename`. """
-    url = "%(base_url)s/%(pagename)s?action=arnica_slides&do=view&target=%(filename)s" % {'base_url': base_url,
-                                                                                          'pagename': pagename,
-                                                                                          'filename': filename}
-    return wikiutil.escape(url)
+    url_action = "%(url)s?action=arnica_slides&do=view&target=%(filename)s" % {'url': url,
+                                                                               'filename': filename}
+    return wikiutil.escape(url_action)
 
 class Parser:
     """ arnica parser """
@@ -251,7 +250,7 @@
             return ''
 
         return '''
-        <form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
+        <form action="%(url)s" method="POST" enctype="multipart/form-data">
             <div class="rotate-to-left">
                 <input type="hidden" name="action" value="arnica_slides">
                 <input type="hidden" name="do" value="rotate_left">
@@ -259,7 +258,7 @@
                 <input type="image" value="submit" src="%(htdocs)s/arnica/img/arnica_rotate_to_left.png" title="rotate to left">
             </div>
         </form>
-        <form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
+        <form action="%(url)s" method="POST" enctype="multipart/form-data">
             <div class="rotate-to-right">
                 <input type="hidden" name="action" value="arnica_slides">
                 <input type="hidden" name="do" value="rotate_right">
@@ -267,7 +266,7 @@
                 <input type="image"  value="submit" src="%(htdocs)s/arnica/img/arnica_rotate_to_right.png" title="rotate to right">
             </div>
         </form>
-        <form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
+        <form action="%(url)s" method="POST" enctype="multipart/form-data">
              <div class="delete-image">
                  <input type="hidden" name="action" value="arnica_slides">
                  <input type="hidden" name="do" value="delete">
@@ -275,7 +274,7 @@
                  <input type="image" value="submit" src="%(htdocs)s/arnica/img/arnica_remove_image.png" title="move to bak">
              </div>
         </form>''' % {
-            'baseurl': self.request.getScriptname(),
+            'url': Page(self.request, self.pagename).url(self.request),
             'style': self.td_style,
             'htdocs': self.request.cfg.url_prefix_static,
             "pagename": wikiutil.quoteWikinameURL(self.pagename),
@@ -287,7 +286,7 @@
         """
         this_image = self.full[idx]
         text = '''
-        <form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
+        <form action="%(url)s" method="POST" enctype="multipart/form-data">
             <div class="get-image">
                 <input type="hidden" name="action" value="AttachFile">
                 <input type="hidden" name="do" value="get">
@@ -295,7 +294,7 @@
                 <input type="image" value="submit" src="%(htdocs)s/arnica/img/arnica_full_image.png" title="load image">
             </div>
         </form>
-        <form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
+        <form action="%(url)s" method="POST" enctype="multipart/form-data">
             <div class="slide-show">
                 <input type="hidden" name="action" value="arnica_slides">
                 <input type="hidden" name="do" value="slide_show">
@@ -308,7 +307,7 @@
                 <input type="image" value="submit" title="slide show" src="%(htdocs)s/arnica/img/arnica_load_slide_show.png">
             </div>
         </form> %(html_tools_restricted)s''' % {
-            "baseurl": self.request.getScriptname(),
+            "url": Page(self.request, self.pagename).url(self.request),
             "pagename": wikiutil.quoteWikinameURL(self.pagename),
             "htdocs": self.request.cfg.url_prefix_static,
             "tablestyle": self.inner_table_style,
@@ -358,7 +357,7 @@
                                                         "album_title": self.album_title or self.pagename}
         text = '''
 <div class="arrange-thumbnails">
-    <form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
+    <form action="%(url)s" method="POST" enctype="multipart/form-data">
         <div class="image"> %(title)s
              <input type="hidden" name="action" value="arnica_slides">
              <input type="hidden" name="do" value="slide_show">
@@ -378,14 +377,14 @@
      "title": title,
      "tdstyle": self.td_style,
      "style": self.inner_table_style,
-     "baseurl": self.request.getScriptname(),
+     "url": Page(self.request, self.pagename).url(self.request),
      "pagename": wikiutil.quoteWikinameURL(self.pagename),
      "description": packLine([self.description[idx]] + self.description),
      "exif_date": packLine([self.exif_date[idx]] + self.exif_date),
      "image_for_webnail": self.image_for_webnail,
      "target": self.webimg[idx],
      "images": packLine([self.webimg[idx]] + self.webimg),
-     "thumbnail": getCacheUrl(self.request.getScriptname(), wikiutil.quoteWikinameURL(self.pagename), self.thumb[idx]),
+     "thumbnail": getCacheUrl(Page(self.request, self.pagename).url(self.request), self.thumb[idx]),
      "thumbnail_width": self.thumbnail_width,
      "html_tools": self.html_show_tools(idx),
      "date_html": self.html_show_date(idx),