[system] / trunk / webwork-modperl / lib / WeBWorK / ContentGenerator / Hardcopy.pm Repository:
ViewVC logotype

Diff of /trunk/webwork-modperl/lib/WeBWorK/ContentGenerator/Hardcopy.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1175 Revision 1176
26 my $r = $self->{r}; 26 my $r = $self->{r};
27 my $ce = $self->{ce}; 27 my $ce = $self->{ce};
28 my $db = $self->{db}; 28 my $db = $self->{db};
29 my @sets = $r->param("hcSet"); 29 my @sets = $r->param("hcSet");
30 my @users = $r->param("hcUser"); 30 my @users = $r->param("hcUser");
31 my $hardcopy_format = $r->param('hardcopy_format'); 31 my $hardcopy_format = $r->param('hardcopy_format') ? $r->param('hardcopy_format') : '';
32 32
33 # add singleSet to the list of sets 33 # add singleSet to the list of sets
34 if (length $singleSet > 0) { 34 if (length $singleSet > 0) {
35 $singleSet =~ s/^set//; 35 $singleSet =~ s/^set//;
36 unshift @sets, $singleSet unless grep { $_ eq $singleSet } @sets; 36 unshift @sets, $singleSet unless grep { $_ eq $singleSet } @sets;
49 $self->{hardcopy_format} = $hardcopy_format; 49 $self->{hardcopy_format} = $hardcopy_format;
50 $self->{errors} = []; 50 $self->{errors} = [];
51 $self->{warnings} = []; 51 $self->{warnings} = [];
52 52
53 # security checks 53 # security checks
54 my $multiSet = $self->{permissionLevel} > 0; 54 my $multiSet = $self->{permissionLevel} > 0;
55 my $multiUser = $self->{permissionLevel} > 0; 55 my $multiUser = $self->{permissionLevel} > 0;
56
56 if (@sets > 1 and not $multiSet) { 57 if (@sets > 1 and not $multiSet) {
57 $self->{generationError} = ["SIMPLE", "You are not permitted to generate hardcopy for multiple sets. Please select a single set and try again."]; 58 $self->{generationError} = ["SIMPLE", "You are not permitted to generate hardcopy for multiple sets. Please select a single set and try again."];
58 } 59 }
59 if (@users > 1 and not $multiUser) { 60 if (@users > 1 and not $multiUser) {
60 $self->{generationError} = ["SIMPLE", "You are not permitted to generate hardcopy for multiple users. Please select a single user and try again."]; 61 $self->{generationError} = ["SIMPLE", "You are not permitted to generate hardcopy for multiple users. Please select a single user and try again."];
217 print CGI::start_p(), "Select the problem sets for which to generate hardcopy versions."; 218 print CGI::start_p(), "Select the problem sets for which to generate hardcopy versions.";
218 if ($self->{permissionLevel} > 0) { 219 if ($self->{permissionLevel} > 0) {
219 print "You may also select multiple users from the users list. You will receive hardcopy for each (set, user) pair."; 220 print "You may also select multiple users from the users list. You will receive hardcopy for each (set, user) pair.";
220 } 221 }
221 print CGI::end_p(); 222 print CGI::end_p();
223
224 my $download_texQ = $self->{permissionLevel} > 0;
222 225
223 print CGI::start_form(-method=>"POST", -action=>$r->uri); 226 print CGI::start_form(-method=>"POST", -action=>$r->uri);
224 print $self->hidden_authen_fields(); 227 print $self->hidden_authen_fields();
225 print CGI::h3("Options"); 228 print CGI::h3("Options");
226 print CGI::p("You may choose to show any of the following data. Correct answers and solutions are only available to privileged users or after the answer date of the problem set."); 229 print CGI::p("You may choose to show any of the following data. Correct answers and solutions are only available to privileged users or after the answer date of the problem set.");
312 print CGI::end_table(); 315 print CGI::end_table();
313 print CGI::end_td(); 316 print CGI::end_td();
314 } 317 }
315 318
316 print CGI::end_Tr(), CGI::end_table(); 319 print CGI::end_Tr(), CGI::end_table();
320 if ($download_texQ) { # choice of pdf or tex output
317 print CGI::p( {-align => "center"}, 321 print CGI::p( {-align => "center"},
318 CGI::radio_group( 322 CGI::radio_group(
319 -name=>"hardcopy_format", 323 -name=>"hardcopy_format",
320 -values=>['pdf', 'tex'], 324 -values=>['pdf', 'tex'],
321 -default=>'pdf', 325 -default=>'pdf',
322 -labels=>{'tex'=>'TeX','pdf'=>'PDF'} 326 -labels=>{'tex'=>'TeX','pdf'=>'PDF'}
323 ), 327 ),
324 ); 328 );
329 } else { # only pdf output available
330 print CGI::hidden(-name=>'hardcopy_format',-value=>'pdf');
331 }
325 print CGI::p({-align=>"center"}, 332 print CGI::p({-align=>"center"},
326 CGI::submit(-name=>"generateHardcopy", -label=>"Generate Hardcopy")); 333 CGI::submit(-name=>"generateHardcopy", -label=>"Generate Hardcopy"));
327 print CGI::end_form(); 334 print CGI::end_form();
328 335
329 return ""; 336 return "";

Legend:
Removed from v.1175  
changed lines
  Added in v.1176

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9