| 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.4 2004/05/05 22:02:12 sh002i Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v 1.5 2004/05/07 04:28:54 jj 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. |
| … | |
… | |
| 40 | my $r = $self->r; |
40 | my $r = $self->r; |
| 41 | my $ce = $r->ce; |
41 | my $ce = $r->ce; |
| 42 | my $db = $r->db; |
42 | my $db = $r->db; |
| 43 | my $authz = $r->authz; |
43 | my $authz = $r->authz; |
| 44 | my $urlpath = $r->urlpath; |
44 | my $urlpath = $r->urlpath; |
|
|
45 | my $user = $r->param('user'); |
| 45 | |
46 | |
|
|
47 | # check permissions |
|
|
48 | unless ($authz->hasPermissions($user, "create_and_delete_courses")) { |
|
|
49 | $self->addmessage( CGI::div({class=>'ResultsWithError'},"$user is not authorized to create or delete courses") ); |
|
|
50 | return; |
|
|
51 | } |
|
|
52 | |
| 46 | if (defined $r->param("download_exported_database")) { |
53 | if (defined $r->param("download_exported_database")) { |
| 47 | my $courseID = $r->param("export_courseID"); |
54 | my $courseID = $r->param("export_courseID"); |
| 48 | my $random_chars = $r->param("download_exported_database"); |
55 | my $random_chars = $r->param("download_exported_database"); |
| 49 | |
56 | |
| 50 | die "courseID not specified" unless defined $courseID; |
57 | die "courseID not specified" unless defined $courseID; |
| … | |
… | |
| 143 | my $r = $self->r; |
150 | my $r = $self->r; |
| 144 | my $ce = $r->ce; |
151 | my $ce = $r->ce; |
| 145 | my $db = $r->db; |
152 | my $db = $r->db; |
| 146 | my $authz = $r->authz; |
153 | my $authz = $r->authz; |
| 147 | my $urlpath = $r->urlpath; |
154 | my $urlpath = $r->urlpath; |
|
|
155 | |
|
|
156 | my $user = $r->param('user'); |
|
|
157 | |
|
|
158 | # check permissions |
|
|
159 | unless ($authz->hasPermissions($user, "create_and_delete_courses")) { |
|
|
160 | return ""; |
|
|
161 | } |
| 148 | |
162 | |
| 149 | print CGI::p({style=>"text-align: center"}, |
163 | print CGI::p({style=>"text-align: center"}, |
| 150 | CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"add_course"})}, "Add Course"), |
164 | CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"add_course"})}, "Add Course"), |
| 151 | #" | ", |
165 | #" | ", |
| 152 | #CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"rename_course"})}, "Rename Course"), |
166 | #CGI::a({href=>$self->systemLink($urlpath, params=>{subDisplay=>"rename_course"})}, "Rename Course"), |