From ee8787e39c776489e8748f3ae2dab3b8a0026da2 Mon Sep 17 00:00:00 2001 From: Emmanuel Lacour Date: Tue, 10 Feb 2009 12:04:43 +0100 Subject: [PATCH] Copy cmp_version from 3.8 branch as it's not present in old versions. --- .../Results-XLS/Search/Results.html/SearchActions | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/html/Callbacks/Results-XLS/Search/Results.html/SearchActions b/html/Callbacks/Results-XLS/Search/Results.html/SearchActions index b8bb004..b3bca55 100644 --- a/html/Callbacks/Results-XLS/Search/Results.html/SearchActions +++ b/html/Callbacks/Results-XLS/Search/Results.html/SearchActions @@ -1,8 +1,27 @@ % # Don't display this callback if our RT Version contains the new ResultsView % # AfterTools Callback -% if (RT::Handle::cmp_version( '3.8.1', $RT::VERSION ) > 0 ) { +% if ( $must_display ) { XLS % } +<%INIT> +my $must_display = 0; + +# cmp_version is present only since 3.8.0 +sub cmp_version($$) { + my ($a, $b) = (@_); + my @a = split /[^0-9]+/, $a; + my @b = split /[^0-9]+/, $b; + for ( my $i = 0; $i < @a; $i++ ) { + return 1 unless defined $b[$i]; + return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i]; + } + return 0 if @a == @b; + return -1; +} + +$must_display = ( cmp_version( '3.8.1', $RT::VERSION ) > 0 ); + + <%ARGS> $QueryString => undef -- 2.11.0