From: Mike G. v. a. <we...@ma...> - 2005-09-08 17:52:17
|
Log Message: ----------- Display the information in site_info.txt on the webwork2 homepage as well as on login pages. Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator: Home.pm Revision Data ------------- Index: Home.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Home.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -Llib/WeBWorK/ContentGenerator/Home.pm -Llib/WeBWorK/ContentGenerator/Home.pm -u -r1.8 -r1.9 --- lib/WeBWorK/ContentGenerator/Home.pm +++ lib/WeBWorK/ContentGenerator/Home.pm @@ -26,13 +26,44 @@ use strict; use warnings; use CGI::Pretty qw(); -use WeBWorK::Utils qw/readDirectory/; +use WeBWorK::Utils qw(readFile readDirectory); use WeBWorK::Utils::CourseManagement qw/listCourses/; sub loginstatus { "" } sub links { "" } sub options { "" }; +sub info { + my ($self) = @_; + my $r = $self->r; + my $ce = $r->ce; + my $site_info = $ce->{webworkFiles}->{site_info}; + + if (defined $site_info and $site_info) { + my $site_info_path = $site_info; + + # deal with previewing a temporary file + if (defined $r->param("editMode") and $r->param("editMode") eq "temporaryFile" + and defined $r->param("editFileSuffix")) { + $site_info_path .= $r->param("editFileSuffix"); + } + + if (-f $site_info_path) { + my $text = eval { readFile($site_info_path) }; + if ($@) { + print CGI::div({class=>"ResultsWithError"}, + CGI::p("$@"), + ); + } elsif ($text) { + print CGI::p(CGI::b("Important Message")), $text,CGI::hr(); + } + } + + + } + return ""; + +} sub body { my ($self) = @_; my $r = $self->r; |