| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v 1.6 2004/05/07 14:12:20 gage Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v 1.7 2004/05/07 22:26:49 gage Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
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 |
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 |
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. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 30 | use File::Temp qw/tempfile/; |
30 | use File::Temp qw/tempfile/; |
| 31 | use WeBWorK::Utils qw(cryptPassword); |
31 | use WeBWorK::Utils qw(cryptPassword); |
| 32 | use WeBWorK::Utils::CourseManagement qw(addCourse deleteCourse listCourses); |
32 | use WeBWorK::Utils::CourseManagement qw(addCourse deleteCourse listCourses); |
| 33 | use WeBWorK::Utils::DBImportExport qw(dbExport dbImport); |
33 | use WeBWorK::Utils::DBImportExport qw(dbExport dbImport); |
| 34 | |
34 | |
| 35 | # SKEL: If you need to do any processing before the HTTP header is sent, do it |
|
|
| 36 | # in this method: |
|
|
| 37 | # |
|
|
| 38 | sub pre_header_initialize { |
35 | sub pre_header_initialize { |
| 39 | my ($self) = @_; |
36 | my ($self) = @_; |
| 40 | my $r = $self->r; |
37 | my $r = $self->r; |
| 41 | my $ce = $r->ce; |
38 | my $ce = $r->ce; |
| 42 | my $db = $r->db; |
39 | my $db = $r->db; |
| … | |
… | |
| 62 | |
59 | |
| 63 | $self->reply_with_file("text/xml", $export_file, "${courseID}_database.xml", 0); |
60 | $self->reply_with_file("text/xml", $export_file, "${courseID}_database.xml", 0); |
| 64 | } |
61 | } |
| 65 | } |
62 | } |
| 66 | |
63 | |
| 67 | # SKEL: To emit your own HTTP header, uncomment this: |
|
|
| 68 | # |
|
|
| 69 | #sub header { |
|
|
| 70 | # my ($self) = @_; |
|
|
| 71 | # |
|
|
| 72 | # # Generate your HTTP header here. |
|
|
| 73 | # |
|
|
| 74 | # # If you return something, it will be used as the HTTP status code for this |
|
|
| 75 | # # request. The Apache::Constants module might be useful for gerating status |
|
|
| 76 | # # codes. If you don't return anything, the status code "OK" will be used. |
|
|
| 77 | # return ""; |
|
|
| 78 | #} |
|
|
| 79 | |
|
|
| 80 | # SKEL: If you need to do any processing after the HTTP header is sent, but before |
|
|
| 81 | # any template processing occurs, or you need to calculate values that will be |
|
|
| 82 | # used in multiple methods, do it in this method: |
|
|
| 83 | # |
|
|
| 84 | #sub initialize { |
|
|
| 85 | # my ($self) = @_; |
|
|
| 86 | # |
|
|
| 87 | # # Do your processing here! Don't print or return anything -- store data in |
|
|
| 88 | # # the self hash for later retrieveal. |
|
|
| 89 | #} |
|
|
| 90 | |
|
|
| 91 | # SKEL: If you need to add tags to the document <HEAD>, uncomment this method: |
|
|
| 92 | # |
|
|
| 93 | #sub head { |
|
|
| 94 | # my ($self) = @_; |
|
|
| 95 | # |
|
|
| 96 | # # You can print head tags here, like <META>, <SCRIPT>, etc. |
|
|
| 97 | # |
|
|
| 98 | # return ""; |
|
|
| 99 | #} |
|
|
| 100 | |
|
|
| 101 | # SKEL: To fill in the "info" box (to the right of the main body), use this |
|
|
| 102 | # method: |
|
|
| 103 | # |
|
|
| 104 | #sub info { |
|
|
| 105 | # my ($self) = @_; |
|
|
| 106 | # |
|
|
| 107 | # # Print HTML here. |
|
|
| 108 | # |
|
|
| 109 | # return ""; |
|
|
| 110 | #} |
|
|
| 111 | |
|
|
| 112 | # SKEL: To provide navigation links, use this method: |
|
|
| 113 | # |
|
|
| 114 | #sub nav { |
|
|
| 115 | # my ($self, $args) = @_; |
|
|
| 116 | # |
|
|
| 117 | # # See the documentation of path() and pathMacro() in |
|
|
| 118 | # # WeBWorK::ContentGenerator for more information. |
|
|
| 119 | # |
|
|
| 120 | # return ""; |
|
|
| 121 | #} |
|
|
| 122 | |
|
|
| 123 | # SKEL: For a little box for display options, etc., use this method: |
|
|
| 124 | # |
|
|
| 125 | #sub options { |
|
|
| 126 | # my ($self) = @_; |
|
|
| 127 | # |
|
|
| 128 | # # Print HTML here. |
|
|
| 129 | # |
|
|
| 130 | # return ""; |
|
|
| 131 | #} |
|
|
| 132 | |
|
|
| 133 | # SKEL: For a list of sibling objects, use this method: |
|
|
| 134 | # |
|
|
| 135 | #sub siblings { |
|
|
| 136 | # my ($self, $args) = @_; |
|
|
| 137 | # |
|
|
| 138 | # # See the documentation of siblings() and siblingsMacro() in |
|
|
| 139 | # # WeBWorK::ContentGenerator for more information. |
|
|
| 140 | # # |
|
|
| 141 | # # Refer to implementations in ProblemSet and Problem. |
|
|
| 142 | # |
|
|
| 143 | # return ""; |
|
|
| 144 | #} |
|
|
| 145 | |
|
|
| 146 | # SKEL: Okay, here's the body. Most of your stuff will go here: |
|
|
| 147 | # |
|
|
| 148 | sub body { |
64 | sub body { |
| 149 | my ($self) = @_; |
65 | my ($self) = @_; |
| 150 | my $r = $self->r; |
66 | my $r = $self->r; |
| 151 | my $ce = $r->ce; |
67 | my $ce = $r->ce; |
| 152 | my $db = $r->db; |
68 | my $db = $r->db; |