################################################################################ # WeBWorK Online Homework Delivery System # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v 1.4 2004/05/05 22:02:12 sh002i Exp $ # # This program is free software; you can redistribute it and/or modify it under # the terms of either: (a) the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any later # version, or (b) the "Artistic License" which comes with this package. # # This program 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 either the GNU General Public License or the # Artistic License for more details. ################################################################################ package WeBWorK::ContentGenerator::CourseAdmin; use base qw(WeBWorK::ContentGenerator); =head1 NAME WeBWorK::ContentGenerator::CourseAdmin - Add, rename, and delete courses. =cut use strict; use warnings; use CGI::Pretty qw(); use Data::Dumper; use File::Temp qw/tempfile/; use WeBWorK::Utils qw(cryptPassword); use WeBWorK::Utils::CourseManagement qw(addCourse deleteCourse listCourses); use WeBWorK::Utils::DBImportExport qw(dbExport dbImport); # SKEL: If you need to do any processing before the HTTP header is sent, do it # in this method: # sub pre_header_initialize { my ($self) = @_; my $r = $self->r; my $ce = $r->ce; my $db = $r->db; my $authz = $r->authz; my $urlpath = $r->urlpath; if (defined $r->param("download_exported_database")) { my $courseID = $r->param("export_courseID"); my $random_chars = $r->param("download_exported_database"); die "courseID not specified" unless defined $courseID; die "invalid file specification" unless $random_chars =~ m/^\w+$/; my $tempdir = $ce->{webworkDirs}->{tmp}; my $export_file = "$tempdir/db_export_$random_chars"; $self->reply_with_file("text/xml", $export_file, "${courseID}_database.xml", 0); } } # SKEL: To emit your own HTTP header, uncomment this: # #sub header { # my ($self) = @_; # # # Generate your HTTP header here. # # # If you return something, it will be used as the HTTP status code for this # # request. The Apache::Constants module might be useful for gerating status # # codes. If you don't return anything, the status code "OK" will be used. # return ""; #} # SKEL: If you need to do any processing after the HTTP header is sent, but before # any template processing occurs, or you need to calculate values that will be # used in multiple methods, do it in this method: # #sub initialize { # my ($self) = @_; # # # Do your processing here! Don't print or return anything -- store data in # # the self hash for later retrieveal. #} # SKEL: If you need to add tags to the document
, uncomment this method: # #sub head { # my ($self) = @_; # # # You can print head tags here, like ,