[devel-15: various bits of refactoring ganesh**Sun Jan 05 04:01:15 GMT 2003 devel-15: various bits of refactoring fixed bugs in firstpic/lastpic/rand(om)pic code a few minor updates ] { hunk ./MERGING 28 +devel-15: various bits of refactoring + fixed bugs in firstpic/lastpic/rand(om)pic code + a few minor updates hunk ./MERGING 70 - devel-13 -> devel-14 + devel-13 -> devel-15 hunk ./PhotoPub/AlbumHelper.pm 4 -@EXPORT_OK = qw(&rangelink); +@EXPORT_OK = qw(&rangelink &dispimgwithdefaults); hunk ./PhotoPub/AlbumHelper.pm 6 +use PhotoPub::RangeHelper qw(&dispimg); +use PhotoPub::Annots qw(&getannot); + hunk ./PhotoPub/AlbumHelper.pm 18 +sub dispimgwithdefaults($,$,$,$) { + my ($other,$photo,$extra)=@_; + &dispimg($other,$photo,&getannot($photo,'options'),$extra); +} + hunk ./PhotoPub/RangeHelper.pm 52 - my $out = '
'; + my $out = '
';
hunk ./PhotoPub/Utils.pm 5
- $pathre $rangere &untaint %errorstrings &checkpath &md5_uri);
+ $pathre $rangere &untaint %errorstrings &checkpath &md5_uri
+ &handleparameters &includetag &excludetag &handlepages);
hunk ./PhotoPub/Utils.pm 14
+use HTML::Entities;
hunk ./PhotoPub/Utils.pm 140
+sub handleparameters($,\$) {
+ my ($query,$templateref)=@_;
+ my @params=();
+
+ # Handle parameters declared in template file
+ while($$templateref=~s/\/&dispimg($1,$photos[$pnum],$options,$2)/gies;
- }
- if($ifph =~ /(lastpic)/i) {
- $pnum = scalar(@photos) - 1;
- $ptag = $1;
- my $options=getannot($photos[$pnum],'options');
- $ifph =~ s/\
/&dispimg($1,$photos[$pnum],$options,$2)/gies;
- }
- if($ifph =~ /(randompic)/i || $ifph =~ /(randpic)/i) {
- $pnum = int(rand(scalar(@photos)));
- $ptag = $1;
- my $options=getannot($photos[$pnum],'options');
- $ifph =~ s/\
/&dispimg($1,$photos[$pnum],$options,$2)/gies;
- }
- $out=~s/\
}
+ {&dispimgwithdefaults($1,$photos[0],$2)}sieg;
+
+ $out =~ s{\
}
+ {&dispimgwithdefaults($1,$photos[$lastnum],$2)}sieg;
+
+ $out =~ s{\
}
+ {&dispimgwithdefaults
+ ($1,$photos[$randnum],$2)}sieg;
+ } else {
+ &includetag('nophotos',\$out);
+ &excludetag('ifphotos',\$out);
+ }
hunk ./cgi-bin/album.pl 264
- $text=~s/\
\nstart $startnum\nend $endnum\n";
- foreach my $p (@photos) {
- print $p."\n";
- }
- print "\n";
- }
- }
-}
-
-$template=~s/\\nstart $startnum\nend $endnum\n";
+ foreach my $p (@photos) {
+ print $p."\n";
+ }
+ print "\n";
hunk ./cgi-bin/range.pl 121
-# Deal with link to the previous page
-
-if($isprev) {
- $template=~s/\