lib/ralbum/skins/gfold/out/album_page.rb in gf-ralbum-0.0.2 vs lib/ralbum/skins/gfold/out/album_page.rb in gf-ralbum-0.0.5

- old
+ new

@@ -1,316 +1,316 @@ -module View - - (@@proc_table ||= {})['album_page'] = proc do -_buf = ""; _buf << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; -pagename='albums' -_buf << "<html>\n"; -language=nil -_buf << "<head> - <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"/> - <title>Giovanni Ferro - "; _buf << ERB::Util.h(@album.name); _buf << "</title> - <meta name=\"description\" content=\"Giovanni Ferro photos\"/> - <meta name=\"keywords\" content=\"Giovanni Ferro,photo,pictures,digital photography\"/> - <link rel=\"stylesheet\" type=\"text/css\" href=\""; _buf << ("#{@album.relroot}res/style1.css").to_s; _buf << "\" media=\"screen\" title=\"style1\"/> - <link rel=\"alternate stylesheet\" type=\"text/css\" href=\""; _buf << ("#{@album.relroot}res/style2.css").to_s; _buf << "\" media=\"screen\" title=\"style2\"/> - <script type=\"text/javascript\" src=\""; _buf << ("#{@album.relroot}res/prototype.js").to_s; _buf << "\"></script> - <script type=\"text/javascript\" src=\""; _buf << ("#{@album.relroot}res/styleswitcher.js").to_s; _buf << "\"></script> -</head> -<body> - -<table align=\"center\" summary=\"\" width=\"100%\"> - <tr> - <td align=\"center\"> - \n"; -if pagename=='index' then -_buf << " <span class=\"menusel\">Home</span>\n"; -end -if pagename!='index' then -_buf << " <a class=\"menu\" href=\"/index.html\">Home</a>\n"; -end -_buf << " | \n"; -if pagename=='albums' then -_buf << " <span class=\"menusel\">Albums</span>\n"; -end -if pagename!='albums' then -_buf << " <a class=\"menu\" href=\"/albums/html/\">Albums</a>\n"; -end -_buf << " | - <!-- - <span class=\"menusel\" id=\"if:pagename=='projects'\">Projects</span> - <a class=\"menu\" href=\"/projects.html\" id=\"if:pagename!='projects'\">Projects</a> - | - -->\n"; -if pagename=='guestbook' then -_buf << " <span class=\"menusel\">Guestbook</span>\n"; -end -if pagename!='guestbook' then -_buf << " <a class=\"menu\" href=\"/guestbook/gb.cgi?act=view\"> - Guestbook - </a>\n"; -end -_buf << " | \n"; -if pagename=='cv' then -_buf << " <span class=\"menusel\">Curriculum</span>\n"; -end -if pagename!='cv' then -_buf << " <a class=\"menu\" href=\"/cv_it.html\">Curriculum</a>\n"; -end -_buf << " | \n"; -if pagename=='contactme' then -_buf << " <span class=\"menusel\">Contact Me</span>\n"; -end -if pagename!='contactme' then -_buf << " <a class=\"menu\" href=\"/contactme/contactme.cgi\">Contact Me</a>\n"; -end -_buf << " - - - - <span class=\"menutext\"> style: </span> - <a class=\"menu\" href=\"#\" onclick=\"javascript: as.enable('style1');return false;\">1</a> - <span class=\"menutext\"> | </span> - <a class=\"menu\" href=\"#\" onclick=\"javascript: as.enable('style2'); return false;\">2</a> - - <!-- - <script language=\"javascript\" type=\"text/javascript\"> - writemenu(); - </script> - --> - \n"; -if not language.nil? then -_buf << " - - <span class=\"menutext\"> lang: </span> \n"; -if language=='it' then -_buf << " <span class=\"menusel\">it</span> \n"; -end -if language!='it' then -_buf << " <a class=\"menu\" href=\""; _buf << ERB::Util.h(pagename); _buf << "_it.html\">it</a> \n"; -end -_buf << " |\n"; -if language=='en' then -_buf << " <span class=\"menusel\">en</span> \n"; -end -if language!='en' then -_buf << " <a class=\"menu\" href=\""; _buf << ERB::Util.h(pagename); _buf << "_en.html\">en</a> \n"; -end -end -_buf << " - </td> - </tr> -</table> - -<table class=\"album_maintable\" align=\"center\" - border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> - <tr> - <td> - - <!-- begin header table --> - <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"> - - <!-- breadcrumbs or Trail --> - <tr> - <td class=\"album_breadcrumbs\" align=\"left\">\n"; - item_ctr = 0 - for item in @album.breadcrumbs - item_ctr += 1 - if item_ctr > 1 -_buf << " <span class=\"album_treepathdots\">::</span>\n"; - end - item_path = item[:path] # retrieve path and - item_title = item[:title] # title from a hash - if item_path.nil? # if path is null then -_buf << (item_title).to_s; else -_buf << " <a class=\"album_treepath\" - href=\""; _buf << ERB::Util.h(@album.relroot + item_path); _buf << "\">\n"; -_buf << (item_title).to_s; _buf << " </a>\n"; - end - end -_buf << " </td> - <td class=\"album_breadcrumbs\" align=\"right\" nowrap=\"nowrap\"> - "; _buf << ERB::Util.h(@album.nr_leaves); _buf << "&nbsp;"; _buf << ERB::Util.h(@resource.photos); _buf << "\n"; -if @album.nr_childs>0 then -_buf << " "; _buf << ERB::Util.h(@album.nr_childs); _buf << "&nbsp;sub-albums\n"; -end -_buf << " </td> - </tr> - - <tr> - <td width=\"80%\" align=\"left\"> - "; _buf << ERB::Util.h(@album.description); _buf << " - </td> -\n"; -if not @album.root? then -_buf << " <td width=\"20%\" align=\"right\"> - <a href=\""; _buf << ERB::Util.h(@album.relroot_with_prefix); _buf << "index.html\" title=\"Up to top\"><img - src=\""; _buf << ("#{@album.relroot}res/top.gif").to_s; _buf << "\" border=\"0\" alt=\"Top\"/></a> - &nbsp; - <a title=\"Up to album\" href=\"../index.html\"><img - src=\""; _buf << ("#{@album.relroot}res/up.gif").to_s; _buf << "\" border=\"0\" alt=\"Up\"/></a> - &nbsp;&nbsp;&nbsp; - </td>\n"; -end -_buf << " - </tr> - </table> - <!-- End header table --> - </td> - </tr> - - <!-- thumbnails header table -->\n"; -if @album.leaves.length>0 then -_buf << " <tr> - <td> - <!-- begin thumbnails header table --> - <table width=\"100%\" - border=\"0\" cellspacing=\"0\" cellpadding=\"3\"> - <tr> - <td class=\"album_section\" align=\"left\">"; _buf << ERB::Util.h(@resource.thumbnails); _buf << "</td> - </tr> - </table> - <!-- end thumbnails header table --> - </td> - </tr>\n"; -end -_buf << " - <!-- thumbnails body -->\n"; -if @album.leaves.length>0 then -_buf << " <tr> - <td align=\"center\"> - <!-- begin thumbnail table --> - <table class=\"album_thumbnails_table\">\n"; - start_pos = 1 - while start_pos <= @album.leaves.length - idx = start_pos -_buf << " <tr - class=\"album_thumbnail_image_row\">\n"; - while idx <= @album.leaves.length && idx % 7 != 0 - photo = @album.leaves[ idx-1 ] -_buf << " <td - class=\"album_thumbnail_image\"> - <a href=\""; _buf << ERB::Util.h(photo.defaultImageFile.pageurl); _buf << "\" - title=\""; _buf << ERB::Util.h(photo.name); _buf << "\"><img - src=\""; _buf << ("#{@album.relroot + photo.thumb.url}").to_s; _buf << "\" - alt=\"Giovanni Ferro - "; _buf << ERB::Util.h(photo.name); _buf << "\" - border=\"0\"/></a> - </td>\n"; - idx += 1 - end -_buf << " </tr>\n"; - idx = start_pos -_buf << " <tr class=\"album_thumbnail_title_row\">\n"; - while idx <= @album.leaves.length && idx % 7 != 0 - photo = @album.leaves[ idx-1 ] -_buf << " <td class=\"album_thumbnail_title\"> - "; _buf << ERB::Util.h(photo.name); _buf << " - </td>\n"; - idx += 1 - end -_buf << " </tr>\n"; - start_pos += 7 - end -_buf << " </table> - <!-- end thumbnail table --> - </td> - </tr>\n"; -end -_buf << " - <!-- subalbums header -->\n"; -if @album.childs.length>0 then -_buf << " <tr> - <td> - <!-- begin subalbums header table --> - <table width=\"100%\" - border=\"0\" cellspacing=\"0\" cellpadding=\"3\"> - <tr> - <td class=\"album_section\" align=\"left\">"; _buf << ERB::Util.h(@resource.subalbums); _buf << "</td> - </tr> - </table> - <!-- end header table --> - </td> - </tr>\n"; -end -_buf << " - <!-- sub-albums body -->\n"; -if @album.childs.length>0 then -_buf << " <tr> - <td> - <!-- begin sub-album table --> - <table width=\"100%\" - border=\"0\" cellspacing=\"5\" cellpadding=\"2\"> -\n"; - col = 1 - for subalbum in @album.childs - if col == 1 -_buf << " <tr>\n"; - end - -_buf << " - <td class=\"album_subalbum_image\"> - <a href=\""; _buf << ERB::Util.h(subalbum.pageurl); _buf << "\" - title=\""; _buf << ERB::Util.h(subalbum.name); _buf << "\"><img - src=\""; _buf << ("#{@album.relroot + subalbum.defaultImagePool.thumb.url}").to_s; _buf << "\" - alt=\""; _buf << ERB::Util.h(subalbum.defaultImagePool.name); _buf << "\" - border=\"1\"/></a> - </td> - <td> - <a href=\""; _buf << ERB::Util.h(subalbum.pageurl); _buf << "\">"; _buf << ERB::Util.h(subalbum.name); _buf << "</a> - <br/> - "; _buf << ERB::Util.h(subalbum.nr_leaves); _buf << "&nbsp;photos\n"; -if subalbum.nr_childs>0 then -_buf << " ,&nbsp;"; _buf << ERB::Util.h(subalbum.nr_childs); _buf << "&nbsp;sub-albums\n"; -end -_buf << " <br/> - "; _buf << ERB::Util.h(subalbum.description); _buf << " - </td> -\n"; - col += 1 - if col == 3 - col = 1 -_buf << " </tr>\n"; - end - end - if col != 1 -_buf << " </tr>\n"; - end -_buf << " - </table> - <!-- end sub-album table --> - </td> - </tr>\n"; -end -_buf << " -</table> - -<div id=\"footer\"> - <div class=\"left\"> - Copyright &copy; 2002-2004, <b>Giovanni Ferro</b> - </div> - - <div class=\"right\"> - <a href=\"http://validator.w3.org/check?uri=referer\"><img - style=\"border:0;\" src=\""; _buf << ("#{@album.relroot}res/valid-xhtml.png").to_s; _buf << "\" - alt=\"Valid XHTML\"/></a> - &nbsp; &nbsp; - <a href=\"http://jigsaw.w3.org/css-validator/check/referer/\"><img - style=\"border:0;\" src=\""; _buf << ("#{@album.relroot}res/valid-css.png").to_s; _buf << "\" - alt=\"Valid CSS\"/></a> - </div> -</div> - -</body> -</html> -\n"; -; _buf - end#proc - - module_function - def expand_album_page(context={}) - if context.is_a?(Hash) - hash = context - context = Object.new - hash.each { |key, val| context.instance_variable_set("@#{key}", val) } - end - proc_obj = @@proc_table['album_page'] - context.instance_eval(&proc_obj) - end - -end +module View + + (@@proc_table ||= {})['album_page'] = proc do +_buf = ""; _buf << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; +pagename='albums' +_buf << "<html>\n"; +language=nil +_buf << " <head> + <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"/> + <title>Giovanni Ferro - "; _buf << ERB::Util.h(@album.name); _buf << "</title> + <meta name=\"description\" content=\"Giovanni Ferro photos\"/> + <meta name=\"keywords\" content=\"Giovanni Ferro,photo,pictures,digital photography\"/> + <link rel=\"stylesheet\" type=\"text/css\" href=\""; _buf << ("#{@album.relroot}res/style1.css").to_s; _buf << "\" media=\"screen\" title=\"style1\"/> + <link rel=\"alternate stylesheet\" type=\"text/css\" href=\""; _buf << ("#{@album.relroot}res/style2.css").to_s; _buf << "\" media=\"screen\" title=\"style2\"/> + <script type=\"text/javascript\" src=\""; _buf << ("#{@album.relroot}res/prototype.js").to_s; _buf << "\"></script> + <script type=\"text/javascript\" src=\""; _buf << ("#{@album.relroot}res/styleswitcher.js").to_s; _buf << "\"></script> + </head> + <body> + + <table align=\"center\" summary=\"\" width=\"100%\"> + <tr> + <td align=\"center\"> +\n"; +if pagename=='index' then +_buf << " <span class=\"menusel\">Home</span>\n"; +end +if pagename!='index' then +_buf << " <a class=\"menu\" href=\"/index.html\">Home</a>\n"; +end +_buf << " |\n"; +if pagename=='albums' then +_buf << " <span class=\"menusel\">Albums</span>\n"; +end +if pagename!='albums' then +_buf << " <a class=\"menu\" href=\"/albums/html/\">Albums</a>\n"; +end +_buf << " | + <!-- + <span class=\"menusel\" id=\"if:pagename=='projects'\">Projects</span> + <a class=\"menu\" href=\"/projects.html\" id=\"if:pagename!='projects'\">Projects</a> + | + -->\n"; +if pagename=='guestbook' then +_buf << " <span class=\"menusel\">Guestbook</span>\n"; +end +if pagename!='guestbook' then +_buf << " <a class=\"menu\" href=\"/guestbook/gb.cgi?act=view\"> + Guestbook + </a>\n"; +end +_buf << " |\n"; +if pagename=='cv' then +_buf << " <span class=\"menusel\">Curriculum</span>\n"; +end +if pagename!='cv' then +_buf << " <a class=\"menu\" href=\"/cv_it.html\">Curriculum</a>\n"; +end +_buf << " |\n"; +if pagename=='contactme' then +_buf << " <span class=\"menusel\">Contact Me</span>\n"; +end +if pagename!='contactme' then +_buf << " <a class=\"menu\" href=\"/contactme/contactme.cgi\">Contact Me</a>\n"; +end +_buf << " + - + + <span class=\"menutext\"> style: </span> + <a class=\"menu\" href=\"#\" onclick=\"javascript: as.enable('style1');return false;\">1</a> + <span class=\"menutext\"> | </span> + <a class=\"menu\" href=\"#\" onclick=\"javascript: as.enable('style2'); return false;\">2</a> + + <!-- + <script language=\"javascript\" type=\"text/javascript\"> + writemenu(); + </script> + --> +\n"; +if not language.nil? then +_buf << " - + <span class=\"menutext\"> lang: </span>\n"; +if language=='it' then +_buf << " <span class=\"menusel\">it</span>\n"; +end +if language!='it' then +_buf << " <a class=\"menu\" href=\""; _buf << ERB::Util.h(pagename); _buf << "_it.html\">it</a>\n"; +end +_buf << " |\n"; +if language=='en' then +_buf << " <span class=\"menusel\">en</span>\n"; +end +if language!='en' then +_buf << " <a class=\"menu\" href=\""; _buf << ERB::Util.h(pagename); _buf << "_en.html\">en</a>\n"; +end +end +_buf << " + </td> + </tr> + </table> + + <table class=\"album_maintable\" align=\"center\" + border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> + <tr> + <td> + + <!-- begin header table --> + <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"> + + <!-- breadcrumbs or Trail --> + <tr> + <td class=\"album_breadcrumbs\" align=\"left\">\n"; + item_ctr = 0 + for item in @album.breadcrumbs + item_ctr += 1 + if item_ctr > 1 +_buf << " <span class=\"album_treepathdots\">::</span>\n"; + end + item_path = item[:path] # retrieve path and + item_title = item[:title] # title from a hash + if item_path.nil? # if path is null then +_buf << (item_title).to_s; else +_buf << " <a class=\"album_treepath\" + href=\""; _buf << ERB::Util.h(@album.relroot + item_path); _buf << "\">\n"; +_buf << (item_title).to_s; _buf << " </a>\n"; + end + end +_buf << " </td> + <td class=\"album_breadcrumbs\" align=\"right\" nowrap=\"nowrap\"> + "; _buf << ERB::Util.h(@album.nr_leaves); _buf << "&nbsp;"; _buf << ERB::Util.h(@resource.photos); _buf << "\n"; +if @album.nr_children>0 then +_buf << " "; _buf << ERB::Util.h(@album.nr_children); _buf << "&nbsp;sub-albums\n"; +end +_buf << " </td> + </tr> + + <tr> + <td width=\"80%\" align=\"left\"> + "; _buf << ERB::Util.h(@album.description); _buf << " + </td> +\n"; +if not @album.root? then +_buf << " <td width=\"20%\" align=\"right\"> + <a href=\""; _buf << ERB::Util.h(@album.relroot_with_prefix); _buf << "index.html\" title=\"Up to top\"><img + src=\""; _buf << ("#{@album.relroot}res/top.gif").to_s; _buf << "\" border=\"0\" alt=\"Top\"/></a> + &nbsp; + <a title=\"Up to album\" href=\"../index.html\"><img + src=\""; _buf << ("#{@album.relroot}res/up.gif").to_s; _buf << "\" border=\"0\" alt=\"Up\"/></a> + &nbsp;&nbsp;&nbsp; + </td>\n"; +end +_buf << " + </tr> + </table> + <!-- End header table --> + </td> + </tr> + + <!-- thumbnails header table -->\n"; +if @album.leaves.length>0 then +_buf << " <tr> + <td> + <!-- begin thumbnails header table --> + <table width=\"100%\" + border=\"0\" cellspacing=\"0\" cellpadding=\"3\"> + <tr> + <td class=\"album_section\" align=\"left\">"; _buf << ERB::Util.h(@resource.thumbnails); _buf << "</td> + </tr> + </table> + <!-- end thumbnails header table --> + </td> + </tr>\n"; +end +_buf << " + <!-- thumbnails body -->\n"; +if @album.leaves.length>0 then +_buf << " <tr> + <td align=\"center\"> + <!-- begin thumbnail table --> + <table class=\"album_thumbnails_table\">\n"; + start_pos = 1 + while start_pos <= @album.leaves.length + idx = start_pos +_buf << " <tr + class=\"album_thumbnail_image_row\">\n"; + while idx <= @album.leaves.length && idx % 7 != 0 + photo = @album.leaves[ idx-1 ] +_buf << " <td + class=\"album_thumbnail_image\"> + <a href=\""; _buf << ERB::Util.h(photo.default_image_file.page_url); _buf << "\" + title=\""; _buf << ERB::Util.h(photo.name); _buf << "\"><img + src=\""; _buf << ("#{@album.relroot + photo.thumb.page_url}").to_s; _buf << "\" + alt=\"Giovanni Ferro - "; _buf << ERB::Util.h(photo.name); _buf << "\" + border=\"0\"/></a> + </td>\n"; + idx += 1 + end +_buf << " </tr>\n"; + idx = start_pos +_buf << " <tr class=\"album_thumbnail_title_row\">\n"; + while idx <= @album.leaves.length && idx % 7 != 0 + photo = @album.leaves[ idx-1 ] +_buf << " <td class=\"album_thumbnail_title\"> + "; _buf << ERB::Util.h(photo.name); _buf << " + </td>\n"; + idx += 1 + end +_buf << " </tr>\n"; + start_pos += 7 + end +_buf << " </table> + <!-- end thumbnail table --> + </td> + </tr>\n"; +end +_buf << " + <!-- subalbums header -->\n"; +if @album.children.length>0 then +_buf << " <tr> + <td> + <!-- begin subalbums header table --> + <table width=\"100%\" + border=\"0\" cellspacing=\"0\" cellpadding=\"3\"> + <tr> + <td class=\"album_section\" align=\"left\">"; _buf << ERB::Util.h(@resource.subalbums); _buf << "</td> + </tr> + </table> + <!-- end header table --> + </td> + </tr>\n"; +end +_buf << " + <!-- sub-albums body -->\n"; +if @album.children.length>0 then +_buf << " <tr> + <td> + <!-- begin sub-album table --> + <table width=\"100%\" + border=\"0\" cellspacing=\"5\" cellpadding=\"2\"> +\n"; + col = 1 + for subalbum in @album.children + if col == 1 +_buf << " <tr>\n"; + end + +_buf << " + <td class=\"album_subalbum_image\"> + <a href=\""; _buf << ERB::Util.h(subalbum.page_url); _buf << "\" + title=\""; _buf << ERB::Util.h(subalbum.name); _buf << "\"><img + src=\""; _buf << ("#{@album.relroot + subalbum.default_image_pool.thumb.page_url}").to_s; _buf << "\" + alt=\""; _buf << ERB::Util.h(subalbum.default_image_pool.name); _buf << "\" + border=\"1\"/></a> + </td> + <td> + <a href=\""; _buf << ERB::Util.h(subalbum.page_url); _buf << "\">"; _buf << ERB::Util.h(subalbum.name); _buf << "</a> + <br/> + "; _buf << ERB::Util.h(subalbum.nr_leaves); _buf << "&nbsp;photos\n"; +if subalbum.nr_children>0 then +_buf << " ,&nbsp;"; _buf << ERB::Util.h(subalbum.nr_children); _buf << "&nbsp;sub-albums\n"; +end +_buf << " <br/> + "; _buf << ERB::Util.h(subalbum.description); _buf << " + </td> +\n"; + col += 1 + if col == 3 + col = 1 +_buf << " </tr>\n"; + end + end + if col != 1 +_buf << " </tr>\n"; + end +_buf << " + </table> + <!-- end sub-album table --> + </td> + </tr>\n"; +end +_buf << " + </table> + +<div id=\"footer\"> + <div class=\"left\"> + Copyright &copy; 2002-2004, <b>Giovanni Ferro</b> + </div> + + <div class=\"right\"> + <a href=\"http://validator.w3.org/check?uri=referer\"><img + style=\"border:0;\" src=\""; _buf << ("#{@album.relroot}res/valid-xhtml.png").to_s; _buf << "\" + alt=\"Valid XHTML\"/></a> + &nbsp; &nbsp; + <a href=\"http://jigsaw.w3.org/css-validator/check/referer/\"><img + style=\"border:0;\" src=\""; _buf << ("#{@album.relroot}res/valid-css.png").to_s; _buf << "\" + alt=\"Valid CSS\"/></a> + </div> +</div> + + </body> +</html> +\n"; +; _buf + end#proc + + module_function + def expand_album_page(context={}) + if context.is_a?(Hash) + hash = context + context = Object.new + hash.each { |key, val| context.instance_variable_set("@#{key}", val) } + end + proc_obj = @@proc_table['album_page'] + context.instance_eval(&proc_obj) + end + +end