bug 1803 - fix error page handling

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Galen Charlton 2008-02-19 11:26:08 +13:00 committed by Joshua Ferraro
parent ecdf350255
commit f53d084c00
20 changed files with 387 additions and 6 deletions

View File

@ -1,9 +1,9 @@
# .htaccess
ErrorDocument 400 /cgi-bin/koha/koha-tmpl/errors/400.pl
ErrorDocument 401 /cgi-bin/koha/koha-tmpl/errors/401.pl
ErrorDocument 403 /cgi-bin/koha/koha-tmpl/errors/403.pl
ErrorDocument 404 /cgi-bin/koha/koha-tmpl/errors/404.pl
ErrorDocument 500 /cgi-bin/koha/koha-tmpl/errors/500.pl
ErrorDocument 400 /cgi-bin/koha/errors/400.pl
ErrorDocument 401 /cgi-bin/koha/errors/401.pl
ErrorDocument 403 /cgi-bin/koha/errors/403.pl
ErrorDocument 404 /cgi-bin/koha/errors/404.pl
ErrorDocument 500 /cgi-bin/koha/errors/500.pl

View File

@ -250,7 +250,7 @@ my $target_map = {
'./help.pl' => 'INTRANET_CGI_DIR',
'./installer-CPAN.pl' => 'NONE',
'./installer' => 'INTRANET_CGI_DIR',
'./koha-tmpl/errors' => {target => 'INTRANET_CGI_DIR', trimdir => 2},
'./errors' => {target => 'INTRANET_CGI_DIR'},
'./koha-tmpl/intranet-tmpl' => {target => 'INTRANET_TMPL_DIR', trimdir => -1},
'./koha-tmpl/opac-tmpl' => {target => 'OPAC_TMPL_DIR', trimdir => -1},
'./kohaversion.pl' => 'INTRANET_CGI_DIR',

View File

@ -18,6 +18,12 @@
SetEnv PERL5LIB "__PERL_MODULE_DIR__"
Options +FollowSymLinks
ErrorDocument 400 /cgi-bin/koha/errors/400.pl
ErrorDocument 401 /cgi-bin/koha/errors/401.pl
ErrorDocument 403 /cgi-bin/koha/errors/403.pl
ErrorDocument 404 /cgi-bin/koha/errors/404.pl
ErrorDocument 500 /cgi-bin/koha/errors/500.pl
# Rewrite Rules
RewriteEngine On
@ -46,6 +52,13 @@
SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml"
SetEnv PERL5LIB "__PERL_MODULE_DIR__"
Options +FollowSymLinks
ErrorDocument 400 /cgi-bin/koha/errors/400.pl
ErrorDocument 401 /cgi-bin/koha/errors/401.pl
ErrorDocument 403 /cgi-bin/koha/errors/403.pl
ErrorDocument 404 /cgi-bin/koha/errors/404.pl
ErrorDocument 500 /cgi-bin/koha/errors/500.pl
RewriteEngine On
# Uncomment to turn on rewrite logging
# RewriteLog __LOG_DIR__/koha-intranet-rewrite.log

View File

@ -0,0 +1,29 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo; An Error Has Occurred
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
</head>
<body>
<!--TMPL_INCLUDE NAME="masthead.inc" -->
<!--TMPL_INCLUDE NAME="navigation.inc" -->
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<h3>An Error has Occurred</h3>
<h4>Error 404</h4>
<ul>
<li>This error means that the Koha is pointed an invalid link.</li>
<li>To report this error, you can
<a href="mailto:<!-- TMPL_VAR NAME="admin" -->">email the Koha Administrator</a>.</li>
<li>Use top menu bar to navigate to another part of Koha.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- <div id="main"> -->
<!-- </div> -->
</body>
</html>

View File

@ -0,0 +1,30 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo; An Error Has Occurred
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
</head>
<body>
<!--TMPL_INCLUDE NAME="masthead.inc" -->
<!--TMPL_INCLUDE NAME="navigation.inc" -->
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<h3>An Error has Occurred</h3>
<h4>Error 404</h4>
<ul>
<li>This error means that the you are trying to access a link that you're not authorized to see.</li>
<li>Try logging in to the catalog</li>
<li>To report this error, you can
<a href="mailto:<!-- TMPL_VAR NAME="admin" -->">email the Koha Administrator</a>.</li>
<li>Use top menu bar to navigate to another part of Koha.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- <div id="main"> -->
<!-- </div> -->
</body>
</html>

View File

@ -0,0 +1,29 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo; An Error Has Occurred
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
</head>
<body>
<!--TMPL_INCLUDE NAME="masthead.inc" -->
<!--TMPL_INCLUDE NAME="navigation.inc" -->
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<h3>An Error has Occurred</h3>
<h4>Error 404</h4>
<ul>
<li>This error means that you are forbidden for some reason to see this page.</li>
<li>To report this error, you can
<a href="mailto:<!-- TMPL_VAR NAME="admin" -->">email the Koha Administrator</a>.</li>
<li>Use top menu bar to navigate to another part of Koha.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- <div id="main"> -->
<!-- </div> -->
</body>
</html>

View File

@ -0,0 +1,29 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo; An Error Has Occurred
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
</head>
<body>
<!--TMPL_INCLUDE NAME="masthead.inc" -->
<!--TMPL_INCLUDE NAME="navigation.inc" -->
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<h3>An Error has Occurred</h3>
<h4>Error 404</h4>
<ul>
<li>This error means that the link was broken and that the page doesn't exist.</li>
<li>To report this error, you can
<a href="mailto:<!-- TMPL_VAR NAME="admin" -->">email the Koha Administrator</a>.</li>
<li>Use top menu bar to navigate to another part of Koha.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- <div id="main"> -->
<!-- </div> -->
</body>
</html>

View File

@ -0,0 +1,29 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo; An Error Has Occurred
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
</head>
<body>
<!--TMPL_INCLUDE NAME="masthead.inc" -->
<!--TMPL_INCLUDE NAME="navigation.inc" -->
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<h3>An Error has Occurred</h3>
<h4>Error 404</h4>
<ul>
<li>An error occurred while try to process your request.</li>
<li>To report this error, you can
<a href="mailto:<!-- TMPL_VAR NAME="admin" -->">email the Koha Administrator</a>.</li>
<li>Use top menu bar to navigate to another part of Koha.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- <div id="main"> -->
<!-- </div> -->
</body>
</html>

37
opac/errors/400.pl Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/perl
# 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 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., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Context;
my $query = new CGI;
my $admin = C4::Context->preference('KohaAdminEmailAddress');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "errors/400.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
debug => 1,
}
);
$template->param( admin => $admin );
output_html_with_http_headers $query, $cookie, $template->output;

37
opac/errors/401.pl Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/perl
# 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 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., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Context;
my $query = new CGI;
my $admin = C4::Context->preference('KohaAdminEmailAddress');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "errors/401.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
debug => 1,
}
);
$template->param( admin => $admin );
output_html_with_http_headers $query, $cookie, $template->output;

37
opac/errors/402.pl Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/perl
# 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 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., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Context;
my $query = new CGI;
my $admin = C4::Context->preference('KohaAdminEmailAddress');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "errors/402.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
debug => 1,
}
);
$template->param( admin => $admin );
output_html_with_http_headers $query, $cookie, $template->output;

37
opac/errors/403.pl Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/perl
# 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 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., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Context;
my $query = new CGI;
my $admin = C4::Context->preference('KohaAdminEmailAddress');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "errors/403.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
debug => 1,
}
);
$template->param( admin => $admin );
output_html_with_http_headers $query, $cookie, $template->output;

37
opac/errors/404.pl Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/perl
# 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 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., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Context;
my $query = new CGI;
my $admin = C4::Context->preference('KohaAdminEmailAddress');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "errors/404.tmpl",
query => $query,
type => "opac",
authnotrequired => 1,
debug => 1,
}
);
$template->param( admin => $admin );
output_html_with_http_headers $query, $cookie, $template->output;

37
opac/errors/500.pl Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/perl
# 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 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., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Context;
my $query = new CGI;
my $admin = C4::Context->preference('KohaAdminEmailAddress');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "errors/500.tmpl",
query => $query,
type => "opac",
koha-tmpl/authnotrequired => 1,
debug => 1,
}
);
$template->param( admin => $admin );
output_html_with_http_headers $query, $cookie, $template->output;