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

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

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

Revision 4160 Revision 4198
1################################################################################ 1################################################################################
2# WeBWorK Online Homework Delivery System 2# WeBWorK Online Homework Delivery System
3# Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ 3# Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v 1.62 2006/01/25 23:13:53 sh002i Exp $ 4# $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v 1.63 2006/06/24 20:01:25 dpvc 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.
938 my @past_marks = map {$_->[1]} @{$self->{past_problems}}; 938 my @past_marks = map {$_->[1]} @{$self->{past_problems}};
939 my $none_shown = scalar(@{$self->{past_problems}})==0; 939 my $none_shown = scalar(@{$self->{past_problems}})==0;
940 my @pg_files=(); 940 my @pg_files=();
941 my $use_previous_problems = 1; 941 my $use_previous_problems = 1;
942 my $first_shown = $r->param('first_shown') || 0; 942 my $first_shown = $r->param('first_shown') || 0;
943 my $last_shown = $r->param('last_shown'); 943 my $last_shown = $r->param('last_shown'); debug("last_shown 1: ", $last_shown);
944 if (not defined($last_shown)) { 944 if (not defined($last_shown)) {
945 $last_shown = -1; 945 $last_shown = -1; debug("last_shown 2: ", $last_shown);
946 } 946 }
947 my @all_past_list = (); # these are include requested, but not shown 947 my @all_past_list = (); # these are include requested, but not shown
948 my $j = 0; 948 my $j = 0;
949 while (defined($r->param("all_past_list$j"))) { 949 while (defined($r->param("all_past_list$j"))) {
950 push @all_past_list, $r->param("all_past_list$j"); 950 push @all_past_list, $r->param("all_past_list$j");
1157 @past_marks = map {$_->[1]} @pg_files; 1157 @past_marks = map {$_->[1]} @pg_files;
1158 @pg_files = map {$_->[0]} @pg_files; 1158 @pg_files = map {$_->[0]} @pg_files;
1159 @all_past_list = (@all_past_list[0..($first_shown-1)], 1159 @all_past_list = (@all_past_list[0..($first_shown-1)],
1160 @pg_files, 1160 @pg_files,
1161 @all_past_list[($last_shown+1)..(scalar(@all_past_list)-1)]); 1161 @all_past_list[($last_shown+1)..(scalar(@all_past_list)-1)]);
1162 $last_shown = $first_shown+$maxShown -1; 1162 $last_shown = $first_shown+$maxShown -1; debug("last_shown 3: ", $last_shown);
1163 $last_shown = (scalar(@all_past_list)-1) if($last_shown>=scalar(@all_past_list)); 1163 $last_shown = (scalar(@all_past_list)-1) if($last_shown>=scalar(@all_past_list)); debug("last_shown 4: ", $last_shown);
1164 1164
1165 } elsif ($r->param('next_page')) { 1165 } elsif ($r->param('next_page')) {
1166 $first_shown = $last_shown+1; 1166 $first_shown = $last_shown+1;
1167 $last_shown = $first_shown+$maxShown-1; 1167 $last_shown = $first_shown+$maxShown-1; debug("last_shown 5: ", $last_shown);
1168 $last_shown = (scalar(@all_past_list)-1) if($last_shown>=scalar(@all_past_list)); 1168 $last_shown = (scalar(@all_past_list)-1) if($last_shown>=scalar(@all_past_list)); debug("last_shown 6: ", $last_shown);
1169 @past_marks = (); 1169 @past_marks = ();
1170 } elsif ($r->param('prev_page')) { 1170 } elsif ($r->param('prev_page')) {
1171 $last_shown = $first_shown-1; 1171 $last_shown = $first_shown-1; debug("last_shown 7: ", $last_shown);
1172 $first_shown = $last_shown - $maxShown+1; 1172 $first_shown = $last_shown - $maxShown+1;
1173 1173
1174 $first_shown = 0 if($first_shown<0); 1174 $first_shown = 0 if($first_shown<0);
1175 @past_marks = (); 1175 @past_marks = ();
1176 1176
1206 1206
1207 if ($use_previous_problems) { 1207 if ($use_previous_problems) {
1208 @pg_files = @all_past_list; 1208 @pg_files = @all_past_list;
1209 } else { 1209 } else {
1210 $first_shown = 0; 1210 $first_shown = 0;
1211 $last_shown = scalar(@pg_files)<$maxShown ? scalar(@pg_files) : $maxShown; 1211 $last_shown = scalar(@pg_files)<$maxShown ? scalar(@pg_files) : $maxShown; debug("last_shown 8: ", $last_shown);
1212 $last_shown--; # to make it an array index 1212 $last_shown--; debug("last_shown 9: ", $last_shown); # to make it an array index
1213 @past_marks = (); 1213 @past_marks = ();
1214 } 1214 }
1215 ############# Now store data in self for retreival by body 1215 ############# Now store data in self for retreival by body
1216 $self->{first_shown} = $first_shown; 1216 $self->{first_shown} = $first_shown;
1217 $self->{last_shown} = $last_shown; 1217 $self->{last_shown} = $last_shown;
1258 } 1258 }
1259 1259
1260 ########## Extract information computed in pre_header_initialize 1260 ########## Extract information computed in pre_header_initialize
1261 1261
1262 my $first_shown = $self->{first_shown}; 1262 my $first_shown = $self->{first_shown};
1263 my $last_shown = $self->{last_shown}; 1263 my $last_shown = $self->{last_shown}; debug("last_shown 10: ", $last_shown);
1264 my $browse_which = $self->{browse_which}; 1264 my $browse_which = $self->{browse_which};
1265 my $problem_seed = $self->{problem_seed}; 1265 my $problem_seed = $self->{problem_seed};
1266 my @pg_files = @{$self->{pg_files}}; 1266 my @pg_files = @{$self->{pg_files}};
1267 my @all_db_sets = @{$self->{all_db_sets}}; 1267 my @all_db_sets = @{$self->{all_db_sets}};
1268 1268
1294 for ($j = 0 ; $j < scalar(@pg_files) ; $j++) { 1294 for ($j = 0 ; $j < scalar(@pg_files) ; $j++) {
1295 print CGI::hidden(-name=>"all_past_list$j", -default=>$pg_files[$j]); 1295 print CGI::hidden(-name=>"all_past_list$j", -default=>$pg_files[$j]);
1296 } 1296 }
1297 1297
1298 print CGI::hidden(-name=>'first_shown', -default=>[$first_shown]); 1298 print CGI::hidden(-name=>'first_shown', -default=>[$first_shown]);
1299 debug("last_shown 11: ", $last_shown);
1300 debug("last_shown hidden field: ", CGI::hidden(-name=>'last_shown', -default=>[$last_shown]));
1299 print CGI::hidden(-name=>'last_shown', -default=>[$last_shown]); 1301 print CGI::hidden(-name=>'last_shown', -default=>[$last_shown]);
1300 1302
1301 1303
1302 ########## Now print problems 1304 ########## Now print problems
1303 my $jj; 1305 my $jj;

Legend:
Removed from v.4160  
changed lines
  Added in v.4198

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9