handle a link to original image
authorgc <gc>
Wed, 27 Apr 2005 21:49:25 +0000 (21:49 +0000)
committergc <gc>
Wed, 27 Apr 2005 21:49:25 +0000 (21:49 +0000)
bin/booh
lib/booh/booh-lib.rb
lib/booh/html-merges.rb

index fb8d643bb7309aa5674552785f8d7e371fed377f..49762e1a526e670d1dd77d2eab85dfd1e7df8583 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -310,7 +310,7 @@ end
 
 def substitute_html_sizes(html, sizeobj, type)
     sizestrings = []
-    if $images_size.length > 1
+    if $images_size.length > 1 || (type == 'image' && $limit_sizes =~ /original/)
         for sizeobj2 in $images_size
             if sizeobj != sizeobj2
                 if type == 'thumbnails'
@@ -322,6 +322,9 @@ def substitute_html_sizes(html, sizeobj, type)
                 sizestrings << sizename(sizeobj2['name'])
             end
         end
+        if type == 'image' && $limit_sizes =~ /original/
+            sizestrings << '<a id="linkoriginal" target="newframe">' + sizename('original') + '</a>'
+        end
     end
     html.sub!(/~~sizes~~(.+)~~/) { sizestrings.join($1) }
 end
@@ -411,6 +414,9 @@ def walk_source_dir
             thumbnail_videos ||= {}
             thumbnail_videos[sizeobj['name']] = []
         end
+        if $limit_sizes =~ /original/
+            fullscreen_images['original'] = []
+        end
 
         images.size >= 1 and msg 3, _("\tcreating images thumbnails...")
 
@@ -431,6 +437,13 @@ def walk_source_dir
                     gen_thumbnails_element("#{dir}/#{img}", xmldir, true, [ { 'filename' => fullscreen_dest_img, 'size' => size_fullscreen },
                                                                             { 'filename' => thumbnail_dest_img, 'size' => size_thumbnails } ])
                 end
+                if $limit_sizes =~ /original/
+                    fullscreen_images['original'] << img
+                end
+                destimg = "#{dest_dir}/#{img}"
+                if $limit_sizes =~ /original/ && !File.exists?(destimg)
+                    psys("cp '#{dir}/#{img}' '#{destimg}'")
+                end
             end
         }
 
@@ -536,7 +549,8 @@ def walk_source_dir
                     images4js = fullscreen_images[sizeobj['name']].collect { |e| "\"#{e}\"" }.join(', ')
                     otherimages4js = ''
                     othersizes = []
-                    for sizeobj2 in $images_size
+                    all_images_sizes = $limit_sizes =~ /original/ ? $images_size + [ { 'name' => 'original' } ] : $images_size
+                    for sizeobj2 in all_images_sizes
                         if sizeobj != sizeobj2
                             otherimages4js += "var images_#{size2js(sizeobj2['name'])} = new Array(" + fullscreen_images[sizeobj2['name']].collect { |e| "\"#{e}\"" }.join(', ') + ")\n"
                             othersizes << "\"#{size2js(sizeobj2['name'])}\""
index 6b4f5696f5c41e1a0ddc60f825d90df3c8611b9d..b79a1d3b7147230ef03a59bbc96c71d305f7ea62 100644 (file)
@@ -42,7 +42,8 @@ module Booh
     def sizename(key)
         #- fake for gettext to find these; if themes need more sizes, english name for them should be added here
         sizenames = { 'small' => utf8(_("small")), 'medium' => utf8(_("medium")), 'large' => utf8(_("large")),
-                      'x-large' => utf8(_("x-large")), 'xx-large' => utf8(_("xx-large")) }
+                      'x-large' => utf8(_("x-large")), 'xx-large' => utf8(_("xx-large")),
+                      'original' => utf8(_("original")) }
         return sizenames[key] || key
     end
     
index ff3c0cdd30780158f4d31e483c0174f33300f098..5b8a0a48070d2ceefeb2d28ac3b8837e37963de7 100644 (file)
@@ -177,7 +177,11 @@ function show_current_text() {
         document.getElementById('image_counter').firstChild.data = ( current + 1 ) + "/" + images.length;
         document.getElementById('main_text').firstChild.data = captions[current] || images[current];
         for (i = 0; i < other_sizes.length; i++) { 
-            document.getElementById('link' + other_sizes[i]).href = 'image-' + other_sizes[i] + '.html?current=' + eval("images_" + other_sizes[i] + "[current]");
+            if (other_sizes[i] == "original") {
+                document.getElementById('link' + other_sizes[i]).href = eval("images_" + other_sizes[i] + "[current]");
+            } else {
+                document.getElementById('link' + other_sizes[i]).href = 'image-' + other_sizes[i] + '.html?current=' + eval("images_" + other_sizes[i] + "[current]");
+            }
         }
         document.getElementById('thumbnails').href = 'thumbnails-~~current_size~~.html#' + images[current];
         set_cursor("default");