Parent Directory
|
Revision Log
This commit was manufactured by cvs2svn to create branch 'rel-2-1-patches'.
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/Home.pm,v 1.5 2004/05/13 19:58:32 sh002i 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::Home; 18 use base qw(WeBWorK::ContentGenerator); 19 20 =head1 NAME 21 22 WeBWorK::ContentGenerator::Home - display a list of courses. 23 24 =cut 25 26 use strict; 27 use warnings; 28 use CGI::Pretty qw(); 29 use WeBWorK::Utils qw/readDirectory/; 30 use WeBWorK::Utils::CourseManagement qw/listCourses/; 31 32 sub loginstatus { "" } 33 sub links { "" } 34 35 sub body { 36 my ($self) = @_; 37 my $r = $self->r; 38 39 my $coursesDir = $r->ce->{webworkDirs}->{courses}; 40 my $coursesURL = $r->ce->{webworkURLs}->{root}; 41 42 my @courseIDs = listCourses($r->ce); 43 44 my $haveAdminCourse = 0; 45 foreach my $courseID (@courseIDs) { 46 if ($courseID eq "admin") { 47 $haveAdminCourse = 1; 48 last; 49 } 50 } 51 52 print CGI::p("Welcome to WeBWorK!"); 53 54 if ($haveAdminCourse) { 55 my $urlpath = $r->urlpath->newFromModule("WeBWorK::ContentGenerator::ProblemSets", courseID => "admin"); 56 print CGI::p(CGI::a({href=>$self->systemLink($urlpath, authen => 0)}, "Course Administration")); 57 } 58 59 print CGI::h2("Courses"); 60 61 print CGI::start_ul(); 62 63 foreach my $courseID (sort @courseIDs) { 64 next if $courseID eq "admin"; # done already above 65 my $urlpath = $r->urlpath->newFromModule("WeBWorK::ContentGenerator::ProblemSets", courseID => $courseID); 66 print CGI::li(CGI::a({href=>$self->systemLink($urlpath, authen => 0)}, $courseID)); 67 } 68 69 print CGI::end_ul(); 70 71 return ""; 72 } 73 74 1;
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |