X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=Gallery%2FWeb.pm;h=78445c6f727b0e6be53c62ed93b9a35693599d14;hb=HEAD;hp=03b8d7ac6969a1fab32d36ae196687c0c83a163d;hpb=326051281153aa80cd90265f36c6ff8967685dd0;p=gallery.git diff --git a/Gallery/Web.pm b/Gallery/Web.pm deleted file mode 100644 index 03b8d7a..0000000 --- a/Gallery/Web.pm +++ /dev/null @@ -1,140 +0,0 @@ -# Simple Photo Gallery: Web Interface -# (c) 2003--2005 Martin Mares - -package Gallery::Web; -import Gallery qw(%CF); - -use UCW::CGI; - -my $show_img; -my $send_archive; - -my %args = ( - 'i' => { 'var' => \$show_img, 'check' => '\d+' }, - 'a' => { 'var' => \$send_archive } -); - -sub new() { - UCW::CGI::parse_args(\%args); - if ($send_archive && $CF{'AllowArchives'}) { - require Gallery::Archive; - return new Gallery::Archive($send_archive); - } else { - return bless {}; - } -} - -sub error($) { - print "

Bad luck, the script is broken. Sorry.\n

$_[0]\n"; - print "\n"; -} - -our (@images, %widths, %heights, %widths_orig, %heights_orig, %imgno); - -sub load_notes() { - @images = (""); - %widths = (); - %heights = (); - %imgno = (); - my $notes = $CF{'MetaDataDir'} . "/notes"; - open NOTES, $notes or die "Unable to read notes ($notes): $!"; - while () { - chomp; - my ($n, $w, $h, $wo, $ho) = split /\s+/; - push @images, $n; - $widths{$n} = $w; - $heights{$n} = $h; - $widths_orig{$n} = $wo; - $heights_orig{$n} = $ho; - $imgno{$n} = $#images; - } - close NOTES; -} - -sub show_links($$$) { - my ($prev, $up, $next) = @_; - print "

"; - print ""; - print "Back" if $prev ne ""; - print "\n"; - print ""; - print "Forward" if $next ne ""; - print "\n"; - print "Up\n" if $up ne ""; -} - -sub Start($) { - my $title = UCW::CGI::html_escape($CF{"Title"}); - print < - -$CF{"HeadExtras"} - -$title - -$CF{"TopExtras"} -EOF - $UCW::CGI::error_hook = \&error; - load_notes(); - if ($show_img ne "" && $show_img > 0 && $show_img <= $#images) { - show_links(($show_img > 1 ? ("?i=".($show_img-1)) : ""), - "?", - ($show_img < $#images ? ("?i=".($show_img+1)) : "")); - } else { - show_links($CF{'BackURL'}, $CF{'ParentURL'}, $CF{'FwdURL'}); - print "

$CF{'Title'}

\n"; - print "

$CF{'SubTitle'}

\n" if defined $CF{'SubTitle'}; - } -} - -sub Finish($) { - print "$CF{'BotExtras'}\n\n"; -} - -sub RawHTML($$) { - my ($obj, $h) = @_; - print $h if $show_img eq ""; -} - -sub img($$$) { - my ($this, $orig, $annot) = @_; - my ($base, $ext) = ($orig =~ /^(.*)\.([^.]+)$/) or die "Unable to dissect name $orig"; - $annot = UCW::CGI::html_escape($annot); - my $id = $imgno{$base} || 0; - - if ($show_img ne "") { - if ($id == $show_img) { - print "

$annot

\n" if $annot ne ""; - my $img = $CF{'PhotoUrlPrefix'} . $orig; - print "

$orig\n"; - } - return; - } - - my $thumb = $CF{'ThumbUrlPrefix'} . "$base-thumb.jpg"; - my $w = $widths{$base} || 10; - my $h = $heights{$base} || 10; - my $side_w = $CF{"ThumbW"} + 2*$CF{"InteriorMargin"}; - my $side_h = $CF{"ThumbH"} + 2*$CF{"InteriorMargin"}; - my $box_w = $CF{"LeftW"} + $side_w + $CF{"RightW"}; - my $box_h = $CF{"TopH"} + $side_h + $CF{"BotH"}; - print "

\n"; - print "\n"; - print "\n"; - my $ol = $CF{'LeftW'} + $CF{'InteriorMargin'} + int(($CF{'ThumbW'} - $w)/2); - my $ot = $CF{'TopH'} + $CF{'InteriorMargin'} + int(($CF{'ThumbH'} - $h)/2); - my $tit = ($annot ne "") ? " title=\"$annot\"" : ""; - my $url = ($CF{"ImageSubpages"} ? "?i=$id" : $orig); - print "$orig\n"; - print "\n"; - print "\n"; - print "
\n"; -# if ($annot ne "") { -# print "

$annot\n"; -# } - print "

\n\n"; -} - -1;