]> www.average.org Git - mkgallery.git/blobdiff - mkgallery.pl
customizable header and footer
[mkgallery.git] / mkgallery.pl
index a486e1b29dd8af353a54cf6563e4d9291298b72a..ad32e66407aee4a62726e952edb6c8928151cd55 100755 (executable)
@@ -105,6 +105,7 @@ sub new {
                $self = {
                                -parent=>$parent,
                                -root=>$parent->{-root},
+                               -depth=>$parent->{-depth}+1,
                                -base=>$name,
                                -fullpath=>$fullpath,
                                -inc=>'../'.$parent->{-inc},
@@ -114,6 +115,7 @@ sub new {
                $class = $this;
                my $root=shift;
                $self = {
+                               -depth=>0,
                                -root=>$root,
                                -fullpath=>$root,
                                -inc=>getinc($root),
@@ -509,7 +511,9 @@ sub makeaux {
                                end_Tr,
                                end_table,"\n",
                                center(table({-class=>'picframe'},
-                                       Tr(td(img({-src=>$imgsrc}))))),"\n",
+                                       Tr(td(img({-src=>$imgsrc,
+                                                  -class=>'standalone',
+                                                  -alt=>$title}))))),"\n",
                                end_html,"\n";
                        close($F);
                }
@@ -536,7 +540,9 @@ sub makeaux {
                        start_center,"\n",
                        h1($title),"\n",
                        table({-class=>'ipage'},
-                               Tr(td(img({-src=>$imgsrc})),
+                               Tr(td(img({-src=>$imgsrc,
+                                          -class=>'thumbnail',
+                                          -alt=>$title})),
                                        td($self->infotable))),
                        a({-href=>'../index.html',-class=>'conceal'},
                                'Index'),"\n",
@@ -571,7 +577,10 @@ sub startindex {
        print $IND start_html(-title => $title,
                        -encoding=>"utf-8",
                        -head=>$rsslink,
-                       -style=>{-src=>$inc."gallery.css"},
+                       -style=>[
+                               {-src=>$inc."gallery.css"},
+                               {-src=>$inc."custom.css"},
+                       ],
                        -script=>[
                                {-src=>$inc."mootools.js"},
                                {-src=>$inc."overlay.js"},
@@ -585,19 +594,48 @@ sub startindex {
                comment("Created by ".$version),"\n",
                start_div({-class => 'indexContainer',
                                -id => 'indexContainer'}),
-               a({-href=>"../index.html"},"UP"),"\n",
-               start_center,"\n",
-               h1($title),"\n",
                "\n";
+       my $EVL;
+       if (open($EVL,$inc.'header.pl')) {
+               my $prm;
+               while (<$EVL>) {
+                       $prm .= $_;
+               }
+               close($EVL);
+               %_ = (
+                       -version        => $version,
+                       -depth          => $self->{-depth},
+                       -title          => $title,
+                       -breadcrumbs    => "breadcrumbs unimplemented",
+               );
+               print $IND eval $prm,"\n";
+       } else {
+               print $IND a({-href=>"../index.html"},"UP"),"\n",
+                       h1({-class=>'title'},$title),"\n",
+       }
 }
 
 sub endindex {
        my $self = shift;
        my $IND = $self->{-IND};
 
-       print $IND end_center,end_div,
-       # "\n",'<script type="text/javascript">init_gallery();</script>',"\n",
-       end_html,"\n";
+       print $IND end_div;
+       my $EVL;
+       if (open($EVL,$self->{-inc}.'footer.pl')) {
+               my $prm;
+               while (<$EVL>) {
+                       $prm .= $_;
+               }
+               close($EVL);
+               %_ = (
+                       -version        => $version,
+                       -depth          => $self->{-depth},
+                       -title          => $self->{-title},
+                       -breadcrumbs    => "breadcrumbs unimplemented",
+               );
+               print $IND eval $prm,"\n";
+       }
+       print $IND end_html,"\n";
 
        close($IND) if ($IND);
        undef $self->{-IND};
@@ -619,7 +657,7 @@ sub startsublist {
        my $self = shift;
        my $IND = $self->{-IND};
 
-       print $IND h2("Albums"),"\n",start_table,"\n";
+       print $IND h2({-class=>"atitle"},"Albums"),"\n",start_table,"\n";
 }
 
 sub sub_entry {
@@ -646,8 +684,8 @@ sub startimglist {
        my $first = $self->{-firstimg}->{-base};
        my $slideref = sprintf(".html/%s-slide.html",$first);
 
-       print $IND h2("Images ",
-               a({-href=>$slideref,-class=>'showStart',-id=>$first},
+       print $IND h2({-class=>"ititle"},"Images ",
+               a({-href=>$slideref,-class=>'showStart',-rel=>'i'.$first},
                        '&gt; slideshow')),"\n";
 }
 
@@ -666,28 +704,32 @@ sub img_entry {
 
        print $IND a({-name=>$name}),"\n",
                start_table({-class=>'slide'}),start_Tr,start_td,"\n",
-               div({-class=>'slidetitle',-id=>$name},
+               div({-class=>'slidetitle'},
                        "\n ",a({-href=>".html/$name-info.html",
                                -title=>'Image Info: '.$name,
                                -class=>'infoBox'},
                                $title),"\n"),"\n",
-               div({-class=>'slideimage',-id=>$name},
+               div({-class=>'slideimage'},
                        "\n ",a({-href=>".html/$name-static.html",
                                -title=>$title,
                                -class=>'showImage',
-                               -id=>$name},
-                               img({-src=>$thumb})),"\n"),"\n",
-               start_div({-class=>'varimages',-id=>$name,-title=>$title}),"\n";
+                               -rel=>'i'.$name},
+                               img({-src=>$thumb,
+                                    -class=>'thumbnail',
+                                    -alt=>$title})),"\n"),"\n",
+               start_div({-class=>'varimages',-id=>'i'.$name,-title=>$title}),"\n";
        foreach my $sz(@sizes) {
                my $src=$self->{$sz}->{'url'};
                my $w=$self->{$sz}->{'dim'}->[0];
                my $h=$self->{$sz}->{'dim'}->[1];
                print $IND "  ",a({-href=>$src,
                        -class=>"conceal",
+                       -rel=>$w."x".$h,
                        -title=>"Reduced to ".$w."x".$h},
                        $w."x".$h)," \n";
        }
        print $IND "  ",a({-href=>$name,
+                               -rel=>$w."x".$h,
                                -title=>'Original'},$w."x".$h),
                "\n",end_div,"\n",
                end_td,end_Tr,end_table,"\n";