| 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/SetMaker.pm,v 1.21 2004/07/01 20:31:13 dpvc Exp $ |
4 | # $CVSHeader$ |
| 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. |
| … | |
… | |
| 27 | use strict; |
27 | use strict; |
| 28 | use warnings; |
28 | use warnings; |
| 29 | |
29 | |
| 30 | use CGI::Pretty qw(); |
30 | use CGI::Pretty qw(); |
| 31 | use WeBWorK::Form; |
31 | use WeBWorK::Form; |
| 32 | use WeBWorK::Utils qw(readDirectory max); |
32 | use WeBWorK::Utils qw(readDirectory max sortByName); |
| 33 | use WeBWorK::Utils::Tasks qw(renderProblems); |
33 | use WeBWorK::Utils::Tasks qw(renderProblems); |
| 34 | |
34 | |
| 35 | require WeBWorK::Utils::ListingDB; |
35 | require WeBWorK::Utils::ListingDB; |
| 36 | |
36 | |
| 37 | use constant MAX_SHOW_DEFAULT => 20; |
37 | use constant MAX_SHOW_DEFAULT => 20; |
| … | |
… | |
| 455 | problemID=>"1"), |
455 | problemID=>"1"), |
| 456 | params =>{effectiveUser => $self->r->param('user'), |
456 | params =>{effectiveUser => $self->r->param('user'), |
| 457 | editMode => "SetMaker", |
457 | editMode => "SetMaker", |
| 458 | sourceFilePath => "$sourceFileName"} )}, "Try it"); |
458 | sourceFilePath => "$sourceFileName"} )}, "Try it"); |
| 459 | |
459 | |
| 460 | my %add_box_data = ( -name=>"trial$cnt",-value=>1,-label=>"Add me to the current set on the next update"); |
460 | my %add_box_data = ( -name=>"trial$cnt",-value=>1,-label=>"Add this problem to the current set on the next update"); |
| 461 | if($mark & SUCCESS) { |
461 | if($mark & SUCCESS) { |
| 462 | $add_box_data{ -label } .= " (just added this problem)"; |
462 | $add_box_data{ -label } .= " (just added this problem)"; |
| 463 | } elsif($mark & ADDED) { |
463 | } elsif($mark & ADDED) { |
| 464 | $add_box_data{ -checked } = 1; |
464 | $add_box_data{ -checked } = 1; |
| 465 | } |
465 | } |
| … | |
… | |
| 472 | ), CGI::br(), |
472 | ), CGI::br(), |
| 473 | |
473 | |
| 474 | |
474 | |
| 475 | |
475 | |
| 476 | |
476 | |
| 477 | CGI::checkbox(-name=>"hideme$cnt",-value=>1,-label=>"Don't show me on the next update"), |
477 | CGI::checkbox(-name=>"hideme$cnt",-value=>1,-label=>"Don't show this problem on the next update"), |
| 478 | CGI::br(), |
478 | CGI::br(), |
| 479 | CGI::checkbox((%add_box_data)), |
479 | CGI::checkbox((%add_box_data)), |
| 480 | CGI::hidden(-name=>"filetrial$cnt", -default=>[$sourceFileName]). |
480 | CGI::hidden(-name=>"filetrial$cnt", -default=>[$sourceFileName]). |
| 481 | CGI::p($problem_output), |
481 | CGI::p($problem_output), |
| 482 | )); |
482 | )); |
| … | |
… | |
| 763 | |
763 | |
| 764 | |
764 | |
| 765 | ############# List of local sets |
765 | ############# List of local sets |
| 766 | |
766 | |
| 767 | my @all_set_defs = $db->listGlobalSets; |
767 | my @all_set_defs = $db->listGlobalSets; |
| 768 | for ($j=0; $j<scalar(@all_set_defs); $j++) { |
768 | @all_set_defs = sortByName(undef, @all_set_defs); |
| 769 | $all_set_defs[$j] =~ s|^set||; |
|
|
| 770 | $all_set_defs[$j] =~ s|\.def||; |
|
|
| 771 | } |
|
|
| 772 | |
769 | |
| 773 | if ($use_previous_problems) { |
770 | if ($use_previous_problems) { |
| 774 | @pg_files = @all_past_list; |
771 | @pg_files = @all_past_list; |
| 775 | } else { |
772 | } else { |
| 776 | $first_shown = 0; |
773 | $first_shown = 0; |