Lines 28-33
package C4::Output;
Link Here
|
28 |
use strict; |
28 |
use strict; |
29 |
#use warnings; FIXME - Bug 2505 |
29 |
#use warnings; FIXME - Bug 2505 |
30 |
|
30 |
|
|
|
31 |
use URI::Escape; |
32 |
|
31 |
use C4::Context; |
33 |
use C4::Context; |
32 |
use C4::Dates qw(format_date); |
34 |
use C4::Dates qw(format_date); |
33 |
use C4::Budgets qw(GetCurrency); |
35 |
use C4::Budgets qw(GetCurrency); |
Lines 42-54
BEGIN {
Link Here
|
42 |
|
44 |
|
43 |
@ISA = qw(Exporter); |
45 |
@ISA = qw(Exporter); |
44 |
@EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead |
46 |
@EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead |
45 |
%EXPORT_TAGS = ( all =>[qw(setlanguagecookie pagination_bar |
47 |
%EXPORT_TAGS = ( all =>[qw(setlanguagecookie pagination_bar parametrized_url |
46 |
&output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)], |
48 |
&output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)], |
47 |
ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)], |
49 |
ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)], |
48 |
html =>[qw(&output_with_http_headers &output_html_with_http_headers)] |
50 |
html =>[qw(&output_with_http_headers &output_html_with_http_headers)] |
49 |
); |
51 |
); |
50 |
push @EXPORT, qw( |
52 |
push @EXPORT, qw( |
51 |
setlanguagecookie getlanguagecookie pagination_bar |
53 |
setlanguagecookie getlanguagecookie pagination_bar parametrized_url |
52 |
); |
54 |
); |
53 |
push @EXPORT, qw( |
55 |
push @EXPORT, qw( |
54 |
&output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers FormatData FormatNumber |
56 |
&output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers FormatData FormatNumber |
Lines 327-332
sub is_ajax {
Link Here
|
327 |
return ( $x_req and $x_req =~ /XMLHttpRequest/i ) ? 1 : 0; |
329 |
return ( $x_req and $x_req =~ /XMLHttpRequest/i ) ? 1 : 0; |
328 |
} |
330 |
} |
329 |
|
331 |
|
|
|
332 |
sub parametrized_url { |
333 |
my $url = shift || ''; # ie page.pl?ln={LANG} |
334 |
my $vars = shift || {}; # ie { LANG => en } |
335 |
my $ret = $url; |
336 |
while ( my ($key,$val) = each %$vars) { |
337 |
my $val_url = URI::Escape::uri_escape_utf8($val); |
338 |
$ret =~ s/\{$key\}/$val_url/g; |
339 |
} |
340 |
$ret =~ s/\{[^\{]*\}//g; # remove not defined vars |
341 |
return $ret; |
342 |
} |
343 |
|
330 |
END { } # module clean-up code here (global destructor) |
344 |
END { } # module clean-up code here (global destructor) |
331 |
|
345 |
|
332 |
1; |
346 |
1; |