add possibility to display "made with" markup at the bottom of pages
authorgc <gc>
Sat, 5 Nov 2005 01:03:13 +0000 (01:03 +0000)
committergc <gc>
Sat, 5 Nov 2005 01:03:13 +0000 (01:03 +0000)
bin/booh
bin/booh-backend
data/booh/themes/dark/skeleton_image.html
data/booh/themes/dark/skeleton_index.html
data/booh/themes/dark/skeleton_thumbnails.html
data/booh/themes/simple/skeleton_image.html
data/booh/themes/simple/skeleton_index.html
data/booh/themes/simple/skeleton_thumbnails.html

index 0d1bafd9ff689c4099b87926602087e0ea1b491b..8f431f5f962980dab9b183cb7b8a4118c1ea44c1 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -2452,6 +2452,10 @@ def new_album
     tooltips.set_tip(optimize432, utf8(_("Resize images with optimized sizes for 3/2 aspect ratio rather than 4/3 (typical aspect ratio of pictures from non digital cameras are 3/2 when pictures from digital cameras are 4/3)")), nil)
     vb.add(Gtk::HBox.new(false, 3).pack_start(Gtk::Label.new(utf8(_("Number of thumbnails per row: "))), false, false, 0).
                                    pack_start(nperrowradios = Gtk::HBox.new, false, false, 0))
+    vb.add(Gtk::HBox.new(false, 3).pack_start(Gtk::Label.new(utf8(_("'Made with' markup on pages bottom: "))), false, false, 0).
+                                   pack_start(madewithentry = Gtk::Entry.new, true, true, 0))
+    tooltips.set_tip(madewithentry, utf8(_("Optional HTML markup to use on pages bottom for a small 'made with' label; %booh is replaced by the website of booh;
+for example: made with <a href=\"%booh\">booh</a>!")), nil)
 
     src_nb_calculated_for = ''
     src_nb_thread = nil
@@ -2567,6 +2571,7 @@ def new_album
             else
                 nperrowradios.add(nperrow_group = rb = Gtk::RadioButton.new(n.to_s))
             end
+            tooltips.set_tip(rb, utf8(_("Set the number of thumbnails per row of the 'thumbnails' pages (if chosen theme uses a row arrangement)")), nil)
             if $default_N == n
                 rb.active = true
             end
@@ -2636,6 +2641,7 @@ def new_album
     sizes = theme_sizes.find_all { |e| e[:widget].active? }.collect { |e| e[:value] }.join(',')
     nperrow = nperrows.find { |e| e[:widget].active? }[:value]
     opt432 = optimize432.active?
+    madewith = madewithentry.text
     if src_nb_thread
         Thread.kill(src_nb_thread)
         gtk_thread_abandon  #- needed because we're about to destroy widgets in dialog, for which they may be some pending gtk calls
@@ -2646,7 +2652,7 @@ def new_album
     if ok
         call_backend("booh-backend --source '#{srcdir}' --destination '#{destdir}' --config-skel '#{configskel}' --for-gui " +
                      "--verbose-level #{$verbose_level} --theme #{theme} --sizes #{sizes} --thumbnails-per-row #{nperrow} " +
-                     "#{opt432 ? '--optimize-for-32' : ''} #{additional_booh_options}",
+                     "#{opt432 ? '--optimize-for-32' : ''} --made-with '#{madewith}' #{additional_booh_options}",
                      utf8(_("Please wait while scanning source directory...")),
                      'full scan',
                      { :closure_after => proc { open_file_user(configskel) } })
@@ -2669,6 +2675,7 @@ def properties
     if limit_sizes
         limit_sizes = limit_sizes.split(/,/)
     end
+    madewith = $xmldoc.root.attributes['made-with']
 
     tooltips = Gtk::Tooltips.new
     frame1 = Gtk::Frame.new(utf8(_("Locations"))).add(tbl = Gtk::Table.new(0, 0, false))
@@ -2678,22 +2685,29 @@ def properties
                1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 2)
     tbl.attach(Gtk::Label.new(utf8(_("Directory where the web-album is created: "))),
                0, 1, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 2, 2)
-    tbl.attach(Gtk::Alignment.new(0, 0.5, 0, 0).add(Gtk::Label.new.set_markup('<i>' + dest + '</i>')),
+    tbl.attach(Gtk::Alignment.new(0, 0.5, 0, 0).add(Gtk::Label.new.set_markup('<i>' + dest + '</i>').set_selectable(true)),
                1, 2, 2, 3, Gtk::FILL, Gtk::SHRINK, 2, 2)
     tbl.attach(Gtk::Label.new(utf8(_("Filename where this album's properties are stored: "))),
                0, 1, 3, 4, Gtk::SHRINK, Gtk::SHRINK, 2, 2)
-    tbl.attach(Gtk::Alignment.new(0, 0.5, 0, 0).add(Gtk::Label.new.set_markup('<i>' + $orig_filename + '</i>')),
+    tbl.attach(Gtk::Alignment.new(0, 0.5, 0, 0).add(Gtk::Label.new.set_markup('<i>' + $orig_filename + '</i>').set_selectable(true)),
                1, 2, 3, 4, Gtk::FILL, Gtk::SHRINK, 2, 2)
 
     frame2 = Gtk::Frame.new(utf8(_("Configuration"))).add(vb = Gtk::VBox.new)
     vb.add(Gtk::HBox.new(false, 3).pack_start(Gtk::Label.new(utf8(_("Theme: "))), false, false, 0).
-                         pack_start(theme_button = Gtk::Button.new(theme), false, false, 0))
+                                   pack_start(theme_button = Gtk::Button.new(theme), false, false, 0))
     vb.add(Gtk::HBox.new(false, 3).pack_start(Gtk::Label.new(utf8(_("Sizes of images to generate: "))), false, false, 0).
                                    pack_start(sizes = Gtk::HBox.new, false, false, 0))
     vb.add(optimize432 = Gtk::CheckButton.new(utf8(_("Optimize for 3/2 aspect ratio"))).set_active(opt432))
     tooltips.set_tip(optimize432, utf8(_("Resize images with optimized sizes for 3/2 aspect ratio rather than 4/3 (typical aspect ratio of pictures from non digital cameras are 3/2 when pictures from digital cameras are 4/3)")), nil)
     vb.add(Gtk::HBox.new(false, 3).pack_start(Gtk::Label.new(utf8(_("Number of thumbnails per row: "))), false, false, 0).
                                    pack_start(nperrowradios = Gtk::HBox.new, false, false, 0))
+    vb.add(Gtk::HBox.new(false, 3).pack_start(Gtk::Label.new(utf8(_("'Made with' markup on pages bottom: "))), false, false, 0).
+                                   pack_start(madewithentry = Gtk::Entry.new, true, true, 0))
+    if madewith
+        madewithentry.text = madewith
+    end
+    tooltips.set_tip(madewithentry, utf8(_("Optional HTML markup to use on pages bottom for a small 'made with' label; %booh is replaced by the website of booh;
+for example: made with <a href=\"%booh\">booh</a>!")), nil)
 
     theme_sizes = []
     nperrows = []
@@ -2734,6 +2748,7 @@ def properties
             else
                 nperrowradios.add(nperrow_group = rb = Gtk::RadioButton.new(n.to_s))
             end
+            tooltips.set_tip(rb, utf8(_("Set the number of thumbnails per row of the 'thumbnails' pages (if chosen theme uses a row arrangement)")), nil)
             nperrowradios.add(Gtk::Label.new('  '))
             if nperrow && n.to_s == nperrow || !nperrow && $default_N == n
                 rb.active = true
@@ -2777,14 +2792,15 @@ def properties
     save_limit_sizes = theme_sizes.find_all { |e| e[:widget].active? }.collect { |e| e[:value] }
     save_opt432 = optimize432.active?
     save_nperrow = nperrows.find { |e| e[:widget].active? }[:value]
+    save_madewith = madewithentry.text
     dialog.destroy
 
-    if ok && (save_theme != theme || save_limit_sizes != limit_sizes || save_opt432 != opt432 || save_nperrow != nperrow)
+    if ok && (save_theme != theme || save_limit_sizes != limit_sizes || save_opt432 != opt432 || save_nperrow != nperrow || save_madewith != madewith)
         mark_document_as_dirty
         save_current_file
         call_backend("booh-backend --use-config '#{$filename}' --for-gui --verbose-level #{$verbose_level} " +
                      "--thumbnails-per-row #{save_nperrow} --theme #{save_theme} --sizes #{save_limit_sizes.join(',')} " +
-                     "#{save_opt432 ? '--optimize-for-32' : ''} #{additional_booh_options}",
+                     "#{save_opt432 ? '--optimize-for-32' : ''} --made-with '#{save_madewith}' #{additional_booh_options}",
                      utf8(_("Please wait while scanning source directory...")),
                      'full scan',
                      { :closure_after => proc {
index 6dacc456165314bb92b761f5086570888213b315..874ae5fe40160c97c5d4991978705ad59a59b04f 100755 (executable)
@@ -53,6 +53,7 @@ $options = [
     [ '--sizes',         '-S', GetoptLong::REQUIRED_ARGUMENT, _("Specify the list of images sizes to use instead of all specified in the theme (this is a comma-separated list)") ],
     [ '--thumbnails-per-row', '-T', GetoptLong::REQUIRED_ARGUMENT, _("Specify the amount of thumbnails per row in the thumbnails page (if applicable in theme)") ],
     [ '--optimize-for-32', '-o', GetoptLong::NO_ARGUMENT,       _("Resize images with optimized sizes for 3/2 aspect ratio rather than 4/3 (typical aspect ratio of pictures from non digital cameras are 3/2 when pictures from digital cameras are 4/3)") ],
+    [ '--made-with',     '-n', GetoptLong::REQUIRED_ARGUMENT, _("Specify the HTML markup to use on the bottom of pages") ],
     [ '--empty-comments','-e', GetoptLong::NO_ARGUMENT,       _("Prefer empty comments over filename when creating new albums") ],
 
     [ '--mproc',         '-m', GetoptLong::REQUIRED_ARGUMENT, _("Specify the number of processors for multi-processors machines") ],
@@ -195,6 +196,9 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.") %
             when '--optimize-for-32'
                 $optimize_for_32 = true
 
+            when '--made-with'
+                $madewith = arg
+
             when '--empty-comments'
                 $empty_comments = true
 
@@ -230,6 +234,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.") %
         if $mode == 'use_config' || $mode =~ /^merge_config/
             $optimize_for_32 = !$xmldoc.root.attributes['optimize-for-32'].nil?
             $N_per_row = $xmldoc.root.attributes['thumbnails-per-row']
+            $madewith = $xmldoc.root.attributes['made-with']
         end
     end
 
@@ -264,6 +269,9 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.") %
         if $N_per_row
             additional_params += " thumbnails-per-row='#{$N_per_row}'"
         end
+        if $madewith
+            additional_params += " made-with='#{$madewith}'"
+        end
         $xmldoc = Document.new "<booh version='#{$VERSION}' source='#{utf8($source)}' destination='#{utf8($dest)}' theme='#{$theme}' #{additional_params}/>"
         $xmldoc << XMLDecl.new(XMLDecl::DEFAULT_VERSION, $CURRENT_CHARSET)
         $mode = 'gen_config'
@@ -287,6 +295,15 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.") %
         else
             $xmldoc.root.delete_attribute('thumbnails-per-row')
         end
+        if $madewith
+            $xmldoc.root.add_attribute('made-with', $madewith)
+        else
+            $xmldoc.root.delete_attribute('made-with')
+        end
+    end
+
+    if $madewith
+        $madewith = $madewith.gsub('%booh', 'http://zarb.org/~gc/html/booh.html')
     end
 end
 
@@ -785,6 +802,7 @@ def walk_source_dir
                      concat(videos)
             to_del = Dir.entries(dest_dir).find_all { |e| !File.directory?("#{dest_dir}/#{e}") && !all_elements.include?(e) && e !~ /^thumbnails-\w+\.jpg/ } - themestuff
             if to_del.size > 0
+                msg 3, _("\tcleaning up: #{to_del.join(', ')}")
                 system("rm -f " + to_del.collect { |e| "#{dest_dir}/#{e}" }.join(' '))
             end
 
@@ -797,6 +815,7 @@ def walk_source_dir
 
             #- generate .htaccess file if needed
             if auth_user_file = xmldir.attributes['password-protect']
+                msg 3, _("\tgenerating password protection file #{dest_dir}/.htaccess")
                 ios = File.open("#{dest_dir}/.htaccess", "w")
                 ios.write("AuthType Basic\nAuthName \"protected area\"\nAuthUserFile #{auth_user_file}\nrequire valid-user\n")
                 ios.close
@@ -864,6 +883,7 @@ def walk_source_dir
                     i.gsub!(/~~theme~~/, $theme)
                     i.gsub!(/~~current_size~~/, sizeobj['name'])
                     i.gsub!(/~~current_size_js~~/, size2js(sizeobj['name']))
+                    i.gsub!(/~~madewith~~/, $madewith || '')
                 end
                 ios = File.open("#{dest_dir}/thumbnails-#{size2js(sizeobj['name'])}.html", "w")
                 ios.write(html)
@@ -901,6 +921,7 @@ def walk_source_dir
                         i.gsub!(/~~thumbnails~~/, '<a href="thumbnails-' + size2js(sizeobj['name']) + '.html" id="thumbnails">' + utf8(_('return to thumbnails')) + '</a>')
                         i.gsub!(/~~theme~~/, $theme)
                         i.gsub!(/~~current_size~~/, size2js(sizeobj['name']))
+                        i.gsub!(/~~madewith~~/, $madewith || '')
                         substitute_html_sizes(i, sizeobj, 'image')
                     end
                     ios = File.open("#{dest_dir}/image-#{size2js(sizeobj['name'])}.html", "w")
@@ -1036,6 +1057,7 @@ def walk_source_dir
 
             for i in html
                 i.gsub!(/~~thumbnails~~/, html_index)
+                i.gsub!(/~~madewith~~/, $madewith || '')
             end
             
         else
index e35ae5bd327afcb56d57ee83272be57f9d709ce9..b4d1210e4904c1c9395303117f1b1bd48ec404c6 100644 (file)
@@ -101,4 +101,8 @@ input:hover {
         <font size="-1">~~previous_album~~ ~~ifprevious_album?~~|~~fi~~ ~~thumbnails~~ ~~ifnext_album?~~|~~fi~~ ~~next_album~~</font>
 </tr>
 </table>
+
+<p align="right"><font size="-1"><i>~~madewith~~</i></font></p>
+
+</body>
 </html>
index 2aaad6a3b547f32aa99ff0192bb7432abd0421d7..18493213a8d5e2f2955972e0a76fc7b2d06ed6ad 100644 (file)
@@ -61,5 +61,7 @@ input {
 ~~iterate1_close~~
 </table>
 
+<p align="right"><font size="-1"><i>~~madewith~~</i></font></p>
+
 </body>
 </html>
index c936a57c6fc84e6daa246fa396bab09d0afa2dad..fc5a3dabc7c27aefd26752be725a17c6c75eb50e 100644 (file)
@@ -69,5 +69,7 @@ input {
 
 <p align="center">~~previous_album~~ ~~ifprevious_album?~~|~~fi~~ ~~return_to_albums~~ ~~ifnext_album?~~|~~fi~~ ~~next_album~~</p>
 
+<p align="right"><font size="-1"><i>~~madewith~~</i></font></p>
+
 </body>
 </html>
index 27b9e29bcf11efe0ccf7d883d78cacd36b616468..f1682804dbcce7fa997d3576c46912548d414a46 100644 (file)
@@ -90,4 +90,8 @@ input:hover {
         <font size="-1">~~previous_album~~ ~~ifprevious_album?~~|~~fi~~ ~~thumbnails~~ ~~ifnext_album?~~|~~fi~~ ~~next_album~~</font>
 </tr>
 </table>
+
+<p align="right"><font size="-1"><i>~~madewith~~</i></font></p>
+
+</body>
 </html>
index f510f74996d0f8686c2f5e6b72717c43f76fd899..d280abc5b06c3cd123a360bd8d9171d324fd7013 100644 (file)
@@ -59,5 +59,7 @@ input {
 ~~iterate1_close~~
 </table>
 
+<p align="right"><font size="-1"><i>~~madewith~~</i></font></p>
+
 </body>
 </html>
index 8ad867c52980f8dcd5d2ed61b91cc216f90b677f..33305d6b3c487906e1dd564e60eca0647d1f1f62 100644 (file)
@@ -67,5 +67,7 @@ input {
 
 <p align="center">~~previous_album~~ ~~ifprevious_album?~~|~~fi~~ ~~return_to_albums~~ ~~ifnext_album?~~|~~fi~~ ~~next_album~~</p>
 
+<p align="right"><font size="-1"><i>~~madewith~~</i></font></p>
+
 </body>
 </html>