#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
# NOTE: I'm pretty sure this module is deprecated in favor of
use URI::Escape;
use C4::Context;
-use C4::Dates qw(format_date);
-use C4::Budgets qw(GetCurrency);
use C4::Templates;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
setlanguagecookie getlanguagecookie pagination_bar parametrized_url
);
push @EXPORT, qw(
- &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers FormatData
+ &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers
);
}
=over 2
=cut
-=item FormatData
-
-FormatData($data_hashref)
-C<$data_hashref> is a ref to data to format
-
-Format dates of data those dates are assumed to contain date in their noun
-Could be used in order to centralize all the formatting for HTML output
-=cut
-
-sub FormatData{
- my $data_hashref=shift;
- $$data_hashref{$_} = format_date( $$data_hashref{$_} ) for grep{/date/} keys (%$data_hashref);
-}
-
=item pagination_bar
pagination_bar($base_url, $nb_pages, $current_page, $startfrom_name)
=cut
sub pagination_bar {
- my $base_url = (@_ ? shift : $ENV{SCRIPT_NAME} . $ENV{QUERY_STRING}) or return;
+ my $base_url = (@_ ? shift : return);
my $nb_pages = (@_) ? shift : 1;
my $current_page = (@_) ? shift : undef; # delay default until later
my $startfrom_name = (@_) ? shift : 'page';
+ my $additional_parameters = shift || {};
# how many pages to show before and after the current page?
my $pages_around = 2;
$base_url =~ s/$delim$//; # remove trailing delim
my $url = $base_url . (($base_url =~ m/$delim/ or $base_url =~ m/\?/) ? '&' : '?' ) . $startfrom_name . '=';
+ my $url_suffix;
+ while ( my ( $k, $v ) = each %$additional_parameters ) {
+ $url_suffix .= '&' . $k . '=' . $v;
+ }
my $pagination_bar = '';
# navigation bar useful only if more than one page to display !
"\n" . ' '
. '<a href="'
. $url
- . '1" rel="start">'
+ . '1'
+ . $url_suffix
+ . '"rel="start">'
. '<<' . '</a>';
}
else {
. '<a href="'
. $url
. $previous
+ . $url_suffix
. '" rel="prev">' . '<' . '</a>';
}
else {
"\n" . ' '
. '<a href="'
. $url
- . $page_number . '">'
+ . $page_number
+ . $url_suffix
+ . '">'
. $page_number . '</a>';
}
$last_displayed_page = $page_number;
. ' <a href="'
. $url
. $next
+ . $url_suffix
. '" rel="next">' . '>' . '</a>';
}
else {
. ' <a href="'
. $url
. $nb_pages
+ . $url_suffix
. '" rel="last">'
. '>>' . '</a>';
}