Problem with error message
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 23 Mar 2010 11:00:00 +0000 (12:00 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Fri, 14 May 2010 07:27:44 +0000 (09:27 +0200)
output_html_with_http_headers now takes status too

C4/Output.pm
errors/400.pl
errors/401.pl
errors/402.pl
errors/403.pl
errors/404.pl
errors/500.pl

index 1e00d4f..788d89d 100644 (file)
@@ -358,7 +358,7 @@ sub pagination_bar {
 
 =item output_html_with_http_headers
 
-   &output_html_with_http_headers($query, $cookie, $html[, $content_type])
+   &output_html_with_http_headers($query, $cookie, $html[, $content_type][, status])
 
 Outputs the HTML page $html with the appropriate HTTP headers,
 with the authentication cookie $cookie and a Content-Type that
@@ -369,7 +369,7 @@ response's Content-Type to that value instead of "text/html".
 
 =cut
 
-sub output_html_with_http_headers ($$$;$) {
+sub output_html_with_http_headers ($$$;$$) {
     my $query = shift;
     my $cookie = shift;
     my $html = shift; 
@@ -383,8 +383,10 @@ sub output_html_with_http_headers ($$$;$) {
     //gx;
 
     my $content_type = @_ ? shift : "text/html";
+    my $status = shift; 
     $content_type = "text/html" unless $content_type =~ m!/!; # very basic sanity check
     print $query->header(
+        -status  => $status,
         -type    => $content_type,
         -charset => 'UTF-8',
         -cookie  => $cookie,
index b04b7fd..58363bf 100755 (executable)
@@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 $template->param( admin => $admin );
-output_with_http_headers $query, $cookie, $template->output, 'html', '400 Bad Request';
+output_html_with_http_headers $query, $cookie, $template->output, 'html', '400 Bad Request';
index 3ea459a..665f1d8 100755 (executable)
@@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 $template->param( admin => $admin );
-output_with_http_headers $query, $cookie, $template->output, 'html', '401 Unauthorized';
+output_html_with_http_headers $query, $cookie, $template->output, 'html', '401 Unauthorized';
index 4bfe7ce..b94d0bd 100755 (executable)
@@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 $template->param( admin => $admin );
-output_with_http_headers $query, $cookie, $template->output, 'html', '402 Payment Required';
+output_html_with_http_headers $query, $cookie, $template->output, 'html', '402 Payment Required';
index 4058ce9..b08ae39 100755 (executable)
@@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 $template->param( admin => $admin );
-output_with_http_headers $query, $cookie, $template->output, 'html', '403 Forbidden';
+output_html_with_http_headers $query, $cookie, $template->output, 'html', '403 Forbidden';
index 418723f..806ad2c 100755 (executable)
@@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 $template->param( admin => $admin );
-output_with_http_headers $query, $cookie, $template->output, 'html', '404 Not Found';
+output_html_with_http_headers $query, $cookie, $template->output, 'html', '404 Not Found';
index 6f570a2..28c7aef 100755 (executable)
@@ -34,4 +34,4 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 $template->param( admin => $admin );
-output_with_http_headers $query, $cookie, $template->output, 'html', '500 Internal Server Error';
+output_html_with_http_headers $query, $cookie, $template->output, 'html', '500 Internal Server Error';