--- trunk/webwork2/lib/WeBWorK/ContentGenerator/CourseAdmin.pm 2004/05/07 04:28:54 2023 +++ trunk/webwork2/lib/WeBWorK/ContentGenerator/CourseAdmin.pm 2005/09/15 20:24:44 3621 @@ -1,7 +1,7 @@ ################################################################################ # 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 $ +# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v 1.40 2005/08/14 16:51:15 gage 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 @@ -28,230 +28,305 @@ 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::CourseEnvironment; +use IO::File; +use WeBWorK::Utils qw(cryptPassword writeLog listFilesRecursive); +use WeBWorK::Utils::CourseManagement qw(addCourse renameCourse deleteCourse listCourses archiveCourse); 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 ,