From 72238e7b142d2c1274059764fa115dc852d27ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Wed, 2 Dec 2015 09:49:02 +0100 Subject: [PATCH] Bug 15288: Staff error pages: Code duplication removal and better translatability This patch changes the 400, 401, 402, 403, 404, 500 error pages to be handled by one template only. Additionally it removes a translatability issue due to a sentence split by html tags. To test: - Apply patch - Trigger 404 error by calling a page that does not exist - Try to trigger other error pages and/or carefully review code changes in the *.pl files --- errors/400.pl | 7 ++- errors/401.pl | 7 ++- errors/402.pl | 7 ++- errors/403.pl | 7 ++- errors/404.pl | 7 ++- errors/500.pl | 7 ++- .../intranet-tmpl/prog/en/modules/errors/400.tt | 29 ----------- .../intranet-tmpl/prog/en/modules/errors/401.tt | 30 ----------- .../intranet-tmpl/prog/en/modules/errors/402.tt | 29 ----------- .../intranet-tmpl/prog/en/modules/errors/403.tt | 29 ----------- .../intranet-tmpl/prog/en/modules/errors/500.tt | 29 ----------- .../en/modules/errors/{404.tt => errorpage.tt} | 16 +++--- .../opac-tmpl/bootstrap/en/modules/errors/404.tt | 54 -------------------- 13 files changed, 38 insertions(+), 220 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/errors/400.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/errors/401.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/errors/402.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/errors/403.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/errors/500.tt rename koha-tmpl/intranet-tmpl/prog/en/modules/errors/{404.tt => errorpage.tt} (77%) delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/errors/404.tt diff --git a/errors/400.pl b/errors/400.pl index 23dc5ae..7c947db 100755 --- a/errors/400.pl +++ b/errors/400.pl @@ -27,12 +27,15 @@ my $query = CGI->new; my $admin = C4::Context->preference('KohaAdminEmailAddress'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => 'errors/400.tt', + template_name => 'errors/errorpage.tt', query => $query, type => 'intranet', authnotrequired => 1, debug => 1, } ); -$template->param( admin => $admin ); +$template->param ( + admin => $admin, + errno => 400, +); output_with_http_headers $query, $cookie, $template->output, 'html', '400 Bad Request'; diff --git a/errors/401.pl b/errors/401.pl index 88c88d8..fcd2d88 100755 --- a/errors/401.pl +++ b/errors/401.pl @@ -26,12 +26,15 @@ my $query = CGI->new; my $admin = C4::Context->preference('KohaAdminEmailAddress'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => 'errors/401.tt', + template_name => 'errors/errorpage.tt', query => $query, type => 'intranet', authnotrequired => 1, debug => 1, } ); -$template->param( admin => $admin ); +$template->param ( + admin => $admin, + errno => 401, +); output_with_http_headers $query, $cookie, $template->output, 'html', '401 Unauthorized'; diff --git a/errors/402.pl b/errors/402.pl index 552398b..1a9f3a6 100755 --- a/errors/402.pl +++ b/errors/402.pl @@ -27,12 +27,15 @@ my $query = CGI->new; my $admin = C4::Context->preference('KohaAdminEmailAddress'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => 'errors/402.tt', + template_name => 'errors/errorpage.tt', query => $query, type => 'intranet', authnotrequired => 1, debug => 1, } ); -$template->param( admin => $admin ); +$template->param ( + admin => $admin, + errno => 402, +); output_with_http_headers $query, $cookie, $template->output, 'html', '402 Payment Required'; diff --git a/errors/403.pl b/errors/403.pl index 11918c3..3a46f68 100755 --- a/errors/403.pl +++ b/errors/403.pl @@ -27,12 +27,15 @@ my $query = CGI->new; my $admin = C4::Context->preference('KohaAdminEmailAddress'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => 'errors/403.tt', + template_name => 'errors/errorpage.tt', query => $query, type => 'intranet', authnotrequired => 1, debug => 1, } ); -$template->param( admin => $admin ); +$template->param ( + admin => $admin, + errno => 403, +); output_with_http_headers $query, $cookie, $template->output, 'html', '403 Forbidden'; diff --git a/errors/404.pl b/errors/404.pl index e7e0071..57191f1 100755 --- a/errors/404.pl +++ b/errors/404.pl @@ -27,12 +27,15 @@ my $query = CGI->new; my $admin = C4::Context->preference('KohaAdminEmailAddress'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => 'errors/404.tt', + template_name => 'errors/errorpage.tt', query => $query, type => 'intranet', authnotrequired => 1, debug => 1, } ); -$template->param( admin => $admin ); +$template->param ( + admin => $admin, + errno => 404, +); output_with_http_headers $query, $cookie, $template->output, 'html', '404 Not Found'; diff --git a/errors/500.pl b/errors/500.pl index 9fb6e0c..0008faf 100755 --- a/errors/500.pl +++ b/errors/500.pl @@ -27,12 +27,15 @@ my $query = CGI->new; my $admin = C4::Context->preference('KohaAdminEmailAddress'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => 'errors/500.tt', + template_name => 'errors/errorpage.tt', query => $query, type => 'intranet', authnotrequired => 1, debug => 1, } ); -$template->param( admin => $admin ); +$template->param ( + admin => $admin, + errno => 500, +); output_with_http_headers $query, $cookie, $template->output, 'html', '500 Internal Server Error'; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/400.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/errors/400.tt deleted file mode 100644 index 350f629..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/400.tt +++ /dev/null @@ -1,29 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Error -[% INCLUDE 'doc-head-close.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'cat-search.inc' %] - - - -
- -
-
-
-

An error has occurred!

-

Error 400

-
    -
  • This error means that the link was broken and that the page doesn't exist
  • -
  • To report this error, you can email the Koha administrator.
  • -
  • Use top menu bar to navigate to another part of Koha.
  • -
-
- -
-
- -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/401.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/errors/401.tt deleted file mode 100644 index 5c0d3cf..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/401.tt +++ /dev/null @@ -1,30 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Error 401 -[% INCLUDE 'doc-head-close.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'cat-search.inc' %] - - - -
- -
-
-
-

An error has occurred!

-

Error 401

-
    -
  • This error means that you aren't authorized to view this page.
  • -
  • Please log in and try again. -
  • To report this error, you can email the Koha administrator.
  • -
  • Use top menu bar to navigate to another part of Koha.
  • -
-
- -
-
- -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/402.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/errors/402.tt deleted file mode 100644 index 8656499..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/402.tt +++ /dev/null @@ -1,29 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Error 402 -[% INCLUDE 'doc-head-close.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'cat-search.inc' %] - - - -
- -
-
-
-

An error has occurred!

-

Error 402

-
    -
  • This error means that the link was broken and that the page doesn't exist
  • -
  • To report this error, you can email the Koha administrator.
  • -
  • Use top menu bar to navigate to another part of Koha.
  • -
-
- -
-
- -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/403.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/errors/403.tt deleted file mode 100644 index 6ed5c3a..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/403.tt +++ /dev/null @@ -1,29 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Error 403 -[% INCLUDE 'doc-head-close.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'cat-search.inc' %] - - - -
- -
-
-
-

An error has occurred!

-

Error 403

-
    -
  • This error means that you are forbidden to view this page.
  • -
  • To report this error, you can email the Koha administrator.
  • -
  • Use top menu bar to navigate to another part of Koha.
  • -
-
- -
-
- -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/500.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/errors/500.tt deleted file mode 100644 index bab01b6..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/500.tt +++ /dev/null @@ -1,29 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -Koha › Error 500 -[% INCLUDE 'doc-head-close.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'cat-search.inc' %] - - - -
- -
-
-
-

An error has occurred!

-

Error 500

-
    -
  • In Koha this typically means that the Koha team is working on new features
  • -
  • Wait while system maintenance is being done or email the Koha administrator.
  • -
  • Use top menu bar to navigate to another part of Koha.
  • -
-
- -
-
- -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/404.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/errors/errorpage.tt similarity index 77% rename from koha-tmpl/intranet-tmpl/prog/en/modules/errors/404.tt rename to koha-tmpl/intranet-tmpl/prog/en/modules/errors/errorpage.tt index 422aba3..78d6059 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/errors/404.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/errors/errorpage.tt @@ -1,21 +1,21 @@ [% INCLUDE 'doc-head-open.inc' %] -Koha › Error 404 +Koha › Error [% errno %] [% INCLUDE 'doc-head-close.inc' %] - + [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] - +
- +
-
-
+
+

An error has occurred!

-

Error 404

+

Error [% errno %]

This message may have been caused by any of the following reasons:

  • You made use of an external link to an item that is no longer available
  • @@ -26,7 +26,7 @@

    What's next?

    • Use top menu bar to navigate to another part of Koha.
    • -
    • To report a broken link or any other issue, please send an email to the Koha Administrator
    • +
    • To report a broken link or any other issue, please contact the Koha Administrator Email
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/errors/404.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/errors/404.tt deleted file mode 100644 index 232ecd1..0000000 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/errors/404.tt +++ /dev/null @@ -1,54 +0,0 @@ -[% INCLUDE 'doc-head-open.inc' %] -[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › An error has occurred -[% INCLUDE 'doc-head-close.inc' %] -[% BLOCK cssinclude %][% END %] - - -[% INCLUDE 'masthead.inc' %] - -
- - -
-
- [% IF ( OpacNav || OpacNavBottom ) %] -
- -
-
- [% ELSE %] -
- [% END %] -
-

Sorry, the requested page is not available

-

Error 404

-

This message can have following reasons

-
    -
  • You made use of an external link to a catalog item that is no longer available
  • -
  • You followed an outdated link e.g. from a search engine or a bookmark
  • -
  • You tried to access a page that needs authentification
  • -
  • An internal link in our catalog home page is broken and the page does not exist
  • -
-

What's next?

-
    -
  • You can search our catalog using the search form at the top of this page
  • -
  • You can navigate to the catalog main page
  • -
-

Report broken links

- -
-
-
-
-
- -[% INCLUDE 'opac-bottom.inc' %] -[% BLOCK jsinclude %] -[% END %] -- 1.7.10.4