changeset 85:d705644861dc

text_x_arnica: removed html definition for mode2, renamed mode1 methods
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 19 Jun 2008 20:50:36 +0200
parents 93125407c585
children 88243aba10ce
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 18 insertions(+), 86 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Mon Jun 09 19:17:19 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Thu Jun 19 20:50:36 2008 +0200
@@ -39,7 +39,7 @@
                  show_text=True, show_date=True, show_tools=True,
                  sort_by_date=False, sort_by_name=True, sort_by_alias=False,
                  reverse_sort=False,
-                 mode=1, only_items=False, template_itemlist=False,
+                 only_items=False, template_itemlist=False,
                  album=False, album_title=unicode, album_image=u'',
                  renew=False,
                  thumbnail_width=128, webnail_width=640,
@@ -57,8 +57,6 @@
     @param sort_by_alias: if set and also only_items is True it is used to order the images
                           by the alias name
     @param reverse_sort: if set the file list is reverse sorted
-    @param mode: default is 1 which writes the description below the image,
-                 any other number means description right of image
     @param only_items: if set only images which are described in listitem are shown, e.g.
                        * [[image1.jpg|alias]]
                        * [[image2.jpg|alias]]
@@ -127,9 +125,9 @@
         self.description = [] # array of description
         self.webimg = [] # array of images for forms
 
-    def show_tools_restricted(self, this_target):
-        """ show only tools to users with enough rights
-        @param this_target: image
+    def html_show_tools_restricted(self, this_target):
+        """ shows restricted tools
+            @param this_target: image
         """
         if not self.request.user.may.delete(self.pagename):
             return ''
@@ -194,7 +192,7 @@
                             <input type="image" value="submit" src="%(htdocs)s/common/arnica/arnica_load_slide_show.png" title="slide_show" >
                        </td>
                     </form>
-                    %(show_tools_restricted)s
+                    %(html_show_tools_restricted)s
                 </tr>
             </table>'''   % {
             "baseurl": self.request.getScriptname(),
@@ -209,77 +207,13 @@
             "images": packLine([self.webimg[idx]] + self.webimg),
             "this_target": self.full[idx],
             "thumbnail": "%s%s" % (AttachFile.getAttachUrl(self.pagename, '', self.request), self.thumb[idx]),
-            "show_tools_restricted": self.show_tools_restricted(this_image)
+            "html_show_tools_restricted": self.html_show_tools_restricted(this_image)
             }
 
         return text
 
-    def show_alias_mode2(self, idx):
-        """ view mode 2 alias text is on righthand of image """
-        if self.show_text:
-            return '''
-<td valign="top" width="%(text_width)s" %(style)s>
- %(this_alias)s
-</td>''' % {
-        "this_alias": self.description[idx],
-        "text_width": self.text_width,
-        "style": ' align="left" style="padding:0px; margin:2px 2px; border-style:none"'}
-        else:
-            return ''
-
-    def show_date_mode2(self, idx):
-        """ view mode 2 selection for date """
-        if self.show_date:
-            return '''<td%(style)s><p>%(this_exif_date)s</p></td>''' % {
-                      "style": self.td_style,
-                      "this_exif_date": self.exif_date[idx]}
-        else:
-            return ''
-
-    def show_tools_mode2(self, idx):
-        """ view mode 2 selection for tools """
-        if self.show_tools:
-            return "<td align=""center""%(style)s> %(tools)s </td>" % {
-                "style": self.td_style,
-                "tools": self.tools_html(idx)}
-        else:
-            return ''
-
-    def mode2_html(self, idx):
-        """ html code of mode 2 """
-        text = '''
-        <form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">
-                <input type="hidden" name="action" value="arnica_slides">
-                <input type="hidden" name="do" value="slide_show">
-                <input type="hidden" name="alias" value='%(description)s'>
-                <input type="hidden" name="exif_date" value='%(exif_date)s'>
-                <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="image_for_webnail" value='%(image_for_webnail)s'>
-                <input type="image" value="submit" src=""%(baseurl)s/%(pagename)s?action=arnica_slides&do=view&target=%(thumbnail)s">
-        </form>
-            %(alias_html)s
-    <tr>%(tools_html)s%(date_html)s</tr>''' % {
-     "tdstyle": self.td_style,
-     "baseurl": self.request.getScriptname(),
-     "pagename": wikiutil.quoteWikinameURL(self.pagename),
-     "thumbnail_width": self.thumbnail_width,
-     "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": self.thumb[idx],
-     "tools_html": self.show_tools_mode2(idx),
-     "date_html": self.show_date_mode2(idx),
-     "alias_html": self.show_alias_mode2(idx)
-     }
-
-        return text
-
-    def show_tools_mode1(self, idx):
-        """ view mode 1 selection of tools """
+    def html_show_tools(self, idx):
+        """ shows toolbox """
         if self.show_tools:
             text = "<tr><td align=""center""%(style)s>%(tools)s </td></tr>" % {
                 "style": self.td_style,
@@ -288,8 +222,8 @@
             text = ''
         return text
 
-    def show_date_mode1(self, idx):
-        """ view mode 1 selection of date """
+    def html_show_date(self, idx):
+        """ shows date """
         if self.show_date:
             return '''
 <tr>
@@ -300,7 +234,7 @@
         else:
             return ''
 
-    def show_alias_mode1(self, idx):
+    def html_show_alias(self, idx):
         """ view mode 1 alias text below image """
         if self.show_text:
             return '''
@@ -313,8 +247,8 @@
         else:
             return ''
 
-    def mode1_html(self, idx):
-        """ html code of mode 1 (default)"""
+    def html_preview(self, idx):
+        """ defines arrangement of thumbnail, text, date and tools """
         title = ""
         if self.album:
             title = "%(n)d images (%(album_title)s)" % {"n": len(self.full), "album_title": self.album_title or self.pagename}
@@ -355,9 +289,9 @@
      "images": packLine([self.webimg[idx]] + self.webimg),
      "thumbnail": self.thumb[idx],
      "thumbnail_width": self.thumbnail_width,
-     "tools_html": self.show_tools_mode1(idx),
-     "date_html": self.show_date_mode1(idx),
-     "alias_html": self.show_alias_mode1(idx)
+     "tools_html": self.html_show_tools(idx),
+     "date_html": self.html_show_date(idx),
+     "alias_html": self.html_show_alias(idx)
      }
         #self.request.write(data)
 
@@ -583,9 +517,7 @@
                 if self.image_for_webnail:
                     self.webimg = self.full
 
-                text = self.mode1_html(i)
-                if self.mode != 1:
-                    text = self.mode2_html(i)
+                text = self.html_preview(i)
 
                 if col_count <= COLUMNS:
                     result.append(''.join(text))
@@ -610,7 +542,7 @@
                 self.webimg = self.web
                 if self.image_for_webnail:
                     self.webimg = self.full
-                text = self.mode1_html(i)
+                text = self.html_preview(i)
             except ValueError:
                 text = _("You can't use as album image: '%(album_image)s' because it is not listed in only_items!") % {"album_image": album_image, }
             result.append(''.join(text))