Parent Directory
|
Revision Log
Error.pm will now serve as 404 not found page so far only used for bad course names fedhecks for bad course names should work now for ww1 courses (bug #584) Cvs: ----------------------------------------------------------------------
1 ################################################################################ 2 # WeBWorK Online Homework Delivery System 3 # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ 4 # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator.pm,v 1.107 2004/06/21 20:11:58 toenail Exp $ 5 # 6 # This program is free software; you can redistribute it and/or modify it under 7 # the terms of either: (a) the GNU General Public License as published by the 8 # Free Software Foundation; either version 2, or (at your option) any later 9 # version, or (b) the "Artistic License" which comes with this package. 10 # 11 # This program is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 # FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the 14 # Artistic License for more details. 15 ################################################################################ 16 17 package WeBWorK::ContentGenerator::Error; 18 use base qw(WeBWorK::ContentGenerator); 19 20 =head1 NAME 21 22 WeBWorK::ContentGenerator::Error - handles invalid course requests 23 24 =cut 25 26 use strict; 27 use warnings; 28 use CGI qw(); 29 use WeBWorK::Form; 30 use WeBWorK::Utils qw(ref2string); 31 use Apache::Constants qw(:http :common); 32 33 sub loginstatus { "" } 34 sub links { "" } 35 36 sub header { 37 my $self = shift; 38 my $r = $self->r; 39 40 $r->status(HTTP_NOT_FOUND); 41 $r->content_type("text/html"); 42 $r->send_http_header(); 43 44 # normally header() would return the proper status 45 # but returning a status of HTTP_NOT_FOUND appends 46 # a 404 Not Found body as well as just a header, which we don't want 47 return; 48 } 49 50 sub title { 51 my $self = shift; 52 my $r = $self->r; 53 54 return "404 Not Found"; 55 } 56 57 sub body { 58 my $self = shift; 59 my $r = $self->r; 60 my $urlpath = $r->urlpath; 61 62 my $courseID = $urlpath->arg('courseID'); 63 64 print CGI::div({class=>"ResultsWithError"}, "The requested course \"$courseID\" does not exist or is not valid."); 65 print CGI::p("Click " . CGI::a({href => "/webwork2/"}, "here") . " for a list of valid course names."); 66 return ""; 67 } 68 1;
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |