Skip to content
Permalink
Browse files

Item10443: preserve old parameters

git-svn-id: http://svn.foswiki.org/branches/Release01x01@11033 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
ArthurClemens ArthurClemens
ArthurClemens authored and ArthurClemens committed Mar 13, 2011
1 parent e6a36cc commit b2be6ad1119361b7580d41850e58f42404085c99
Showing with 19 additions and 20 deletions.
  1. +18 −19 HistoryPlugin/lib/Foswiki/Plugins/HistoryPlugin.pm
  2. +1 −1 HistoryPlugin/templates/oopshistory.tmpl
@@ -26,12 +26,12 @@ sub initPlugin {
return 0;
}

Foswiki::Func::registerTagHandler( 'HISTORY', \&handleHistory );
Foswiki::Func::registerTagHandler( 'HISTORY', \&_handleHistory );

return 1;
}

sub handleHistory {
sub _handleHistory {
my ( $session, $params, $theTopic, $theWeb ) = @_;

my $web = $params->{web} || $theWeb;
@@ -94,23 +94,22 @@ sub handleHistory {
}
}
else {

$rev1 =~ s/1\.// if $rev1;
$rev2 =~ s/1\.// if $rev2;

if ( defined $params->{rev1} || defined $params->{rev2} ) {
$rev2 ||= $rev1 ? $rev1 + $nrev - 1 : $maxrev;
$rev1 ||= $rev2 - $nrev + 1;
}
else {
$rev1 = ( $rev2 - $nrev ) + 1;
}

( $rev1, $rev2 ) = ( $rev2, $rev1 ) if $rev1 > $rev2;
$rev1 = $maxrev if $rev1 > $maxrev;
$rev1 = 1 if $rev1 < 1;
$rev2 = $maxrev if $rev2 > $maxrev;
$rev2 = 1 if $rev2 < 1;
# deprecated syntax

$rev1 = $params->{rev1};
$rev1 =~ s/1\.// if $rev1;
$rev2 = $params->{rev2};
$rev2 =~ s/1\.// if $rev2;
$nrev = $params->{nrev} || 10;

$rev2 ||= $rev1 ? $rev1 + $nrev - 1 : $maxrev;
$rev1 ||= $rev2 - $nrev + 1;

( $rev1, $rev2 ) = ( $rev2, $rev1 ) if $rev1 > $rev2;
$rev1 = $maxrev if $rev1 > $maxrev;
$rev1 = 1 if $rev1 < 1;
$rev2 = $maxrev if $rev2 > $maxrev;
$rev2 = 1 if $rev2 < 1;
}

my $format =
@@ -34,7 +34,7 @@ This version is tested with Foswiki in IE6, IE7 and FF3.
%HISTORY{"<tr><td align="right"><a href=\"%SCRIPTURL{view}%/%WEB%/%TOPIC%?rev=$rev\">$rev</a></td><td style=\"background-color:#fffaf2; text-align:center;\"><input type=\"radio\" name=\"rev2\" value=\"$rev\" style=\"border:none; background-color:#fffaf2;\" /></td><td style=\"background-color:#f2f7fc; text-align:center;\"><input type=\"radio\" name=\"rev1\" value=\"$rev\" style=\"border:none; background-color:#f2f7fc;\" /></td><td style="white-space: nowrap;">$date</td><td>[[$wikiusername][$wikiname]]</td><td><div class="historyRevComment">%REVCOMMENT[$rev]%</div></td></tr>" rev1="%URLPARAM{"rev1"}%" rev2="%URLPARAM{"rev2"}%" nrev="%URLPARAM{"nrev"}%" header="" footer="</table>$n%TMPL:P{"historytable:navigation"}%%TMPL:END%


%TMPL:DEF{"historytable:navigation"}%$next{'%MAKETEXT{"Jump to latest revision ([_1])" args="%HISTORY_MAXREV%"}%' url='%SCRIPTURL{oops}%/%WEB%/%TOPIC%?template=oopshistory&nrev=$nrev'} $next{'%MAKETEXT{"View later"}%' url='%SCRIPTURL{oops}%/%WEB%/%TOPIC%?template=oopshistory&rev1=$rev1&nrev=$nrev'} $previous{'%MAKETEXT{"View earlier"}%' url='%SCRIPTURL{oops}%/%WEB%/%TOPIC%?template=oopshistory&rev1=$rev1&nrev=$nrev'} $previous{'%MAKETEXT{"Jump to first revision ([_1])" args="$rev1"}%' url='%SCRIPTURL{oops}%/%WEB%/%TOPIC%?template=oopshistory&rev1=1&nrev=$nrev'}"}%%TMPL:END%
%TMPL:DEF{"historytable:navigation"}%$next{'%MAKETEXT{"Jump to latest revision ([_1])" args="%HISTORY_MAXREV%"}%' url='%SCRIPTURL{oops}%/%WEB%/%TOPIC%?template=oopshistory&nrev=$nrev'} $next{'%MAKETEXT{"View later"}%' url='%SCRIPTURL{oops}%/%WEB%/%TOPIC%?template=oopshistory&rev1=$rev1&nrev=$nrev'} $previous{'%MAKETEXT{"View earlier"}%' url='%SCRIPTURL{oops}%/%WEB%/%TOPIC%?template=oopshistory&rev1=$rev1&nrev=$nrev'} $previous{'%MAKETEXT{"Jump to first revision"}%' url='%SCRIPTURL{oops}%/%WEB%/%TOPIC%?template=oopshistory&rev1=1&nrev=$nrev'}"}%%TMPL:END%


%TMPL:DEF{"historytable_rcp_disabled"}%<table class="foswikiTable historySelectTable" summary="%MAKETEXT{"Topic history"}%">

0 comments on commit b2be6ad

Please sign in to comment.
You can’t perform that action at this time.