| 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/Instructor/ProblemSetList.pm,v 1.50 2004/05/14 18:26:11 toenail Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm,v 1.51 2004/05/17 05:06:36 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. |
| … | |
… | |
| 77 | foreach my $wannaDelete ($r->param('selectedSet')) { |
77 | foreach my $wannaDelete ($r->param('selectedSet')) { |
| 78 | $db->deleteGlobalSet($wannaDelete); |
78 | $db->deleteGlobalSet($wannaDelete); |
| 79 | } |
79 | } |
| 80 | } elsif (defined $r->param('scoreSelected')) { |
80 | } elsif (defined $r->param('scoreSelected')) { |
| 81 | # FIXME: this doesn't do anything! |
81 | # FIXME: this doesn't do anything! |
|
|
82 | } elsif (defined $r->param('publishSelected')) { |
|
|
83 | my @selectedSets = $r->param('selectedSet'); |
|
|
84 | foreach my $selectedSet (@selectedSets) { |
|
|
85 | my $setRecord = $db->getGlobalSet($selectedSet); |
|
|
86 | if ($setRecord) { |
|
|
87 | unless ($setRecord->published eq "1") { |
|
|
88 | $setRecord->published("1"); |
|
|
89 | $db->putGlobalSet($setRecord); |
|
|
90 | } |
|
|
91 | } else { |
|
|
92 | $self->addmessage(CGI::div({class=>"ResultsWithError"}, CGI::p("Set $selectedSet was selected but no such set record exists!"))); |
|
|
93 | } |
|
|
94 | } |
|
|
95 | } elsif (defined $r->param('unpublishSelected')) { |
|
|
96 | my @selectedSets = $r->param('selectedSet'); |
|
|
97 | foreach my $selectedSet (@selectedSets) { |
|
|
98 | my $setRecord = $db->getGlobalSet($selectedSet); |
|
|
99 | if ($setRecord) { |
|
|
100 | unless ($setRecord->published eq "0") { |
|
|
101 | $setRecord->published("0"); |
|
|
102 | $db->putGlobalSet($setRecord); |
|
|
103 | } |
|
|
104 | } else { |
|
|
105 | $self->addmessage(CGI::div({class=>"ResultsWithError"}, CGI::p("Set $selectedSet was selected but no such set record exists!"))); |
|
|
106 | } |
|
|
107 | } |
| 82 | } elsif (defined $r->param('makeNewSet')) { |
108 | } elsif (defined $r->param('makeNewSet')) { |
| 83 | my $newSetRecord = $db->{set}->{record}->new(); |
109 | my $newSetRecord = $db->{set}->{record}->new(); |
| 84 | my $newSetName = $r->param('newSetName'); |
110 | my $newSetName = $r->param('newSetName'); |
| 85 | $newSetRecord->set_id($newSetName); |
111 | $newSetRecord->set_id($newSetName); |
| 86 | $newSetRecord->set_header(""); |
112 | $newSetRecord->set_header(""); |
| … | |
… | |
| 330 | # Set table form (for deleting checked sets) |
356 | # Set table form (for deleting checked sets) |
| 331 | CGI::start_form({"method"=>"POST", "action"=>$problemSetListURL}), |
357 | CGI::start_form({"method"=>"POST", "action"=>$problemSetListURL}), |
| 332 | $self->hidden_authen_fields, |
358 | $self->hidden_authen_fields, |
| 333 | $table, |
359 | $table, |
| 334 | CGI::br(), |
360 | CGI::br(), |
| 335 | |
361 | CGI::submit({"name"=>"publishSelected", "label"=>"Publish Selected"}), |
|
|
362 | CGI::submit({"name"=>"unpublishSelected", "label"=>"Unpublished Selected"}), |
|
|
363 | CGI::br(), |
|
|
364 | "Publishing or Unpublishing several sets at once may take some time.", |
|
|
365 | CGI::br(), CGI::br(), |
| 336 | CGI::submit({"name"=>"scoreSelected", "label"=>"Score Selected"}), |
366 | CGI::submit({"name"=>"scoreSelected", "label"=>"Score Selected"}), |
| 337 | CGI::div( {class=>'ResultsWithError'}, |
367 | CGI::div( {class=>'ResultsWithError'}, |
| 338 | "There is NO undo when deleting sets. Use cautiously. All data for the set is lost. |
368 | "There is NO undo when deleting sets. Use cautiously. All data for the set is lost. |
| 339 | <br>If the set is re-assigned (rebuilt) all of the problem versions will be different.", |
369 | <br>If the set is re-assigned (rebuilt) all of the problem versions will be different.", |
| 340 | CGI::br(), |
370 | CGI::br(), |
| 341 | CGI::submit({"name"=>"deleteSelected", "label"=>"Delete Selected"}), |
371 | CGI::submit({"name"=>"deleteSelected", "label"=>"Delete Selected"}), |
| 342 | CGI::radio_group(-name=>"deleteSelectedSafety", -values=>[0,1], -default=>0, -labels=>{0=>'Read only', 1=>'Allow delete'}), |
372 | CGI::radio_group(-name=>"deleteSelectedSafety", -values=>[0,1], -default=>0, -labels=>{0=>'Read only', 1=>'Allow delete'}), |
| 343 | |
373 | |
| 344 | ), |
374 | ), |
| 345 | CGI::end_form(), |
375 | CGI::end_form(), |
| 346 | CGI::br(), |
376 | CGI::br(), |
| 347 | |
377 | |
| 348 | # Empty set creation form |
378 | # Empty set creation form |
|
|
379 | CGI::hr(), |
| 349 | CGI::start_form({"method"=>"POST", "action"=>$problemSetListURL}), |
380 | CGI::start_form({"method"=>"POST", "action"=>$problemSetListURL}), |
| 350 | $self->hidden_authen_fields, |
381 | $self->hidden_authen_fields, |
| 351 | CGI::b("Create an Empty Set"), |
382 | CGI::b("Create an Empty Set"), |
| 352 | CGI::br(), |
383 | CGI::br(), |
| 353 | "New Set Name: ", |
384 | "New Set Name: ", |