From: Emmanuel Lacour Date: Wed, 12 Mar 2014 16:45:57 +0000 (+0100) Subject: Upgrade callback for 4.2.x X-Git-Tag: 0.08~3 X-Git-Url: http://git.home-dn.net/?p=manu%2FRT-Extension-SearchResults-XLS.git;a=commitdiff_plain;h=88c0c6602002fc7c0bb26d6d633237286e268bb8 Upgrade callback for 4.2.x --- diff --git a/html/Callbacks/Results-XLS/Elements/Tabs/Privileged b/html/Callbacks/Results-XLS/Elements/Tabs/Privileged index 30c51c1..75eee5e 100644 --- a/html/Callbacks/Results-XLS/Elements/Tabs/Privileged +++ b/html/Callbacks/Results-XLS/Elements/Tabs/Privileged @@ -55,12 +55,29 @@ my $query_string = sub { return $u->query; }; -if ( $request_path =~ qr{^/Search/Results\.html} ) { - my $tabs = PageMenu; - $tabs->child( - 'xls' => title => loc('XLS'), - path => '/Search/Results.xls?' . $query_string->( %{ $m->request_args } ) - ); + +if ( + ( + $request_path =~ m{^/Search/} + && $request_path !~ m{^/Search/Simple\.html} + ) + || ( $request_path =~ m{^/Search/Simple\.html} + && $DECODED_ARGS->{'q'} ) + ) { + + my $has_query = ''; + my $current_search = $session{"CurrentSearchHash"} || {}; + $has_query = 1 if ( $DECODED_ARGS->{'Query'} or $current_search->{'Query'} ); + + if ( $has_query ) { + my $tabs = PageMenu; + my $feeds = $tabs->child('more'); + + $feeds->child( + 'xls' => title => loc('XLS'), + path => '/Search/Results.xls?' . $query_string->( %{ $m->request_args } ) + ); + } }