[system] / trunk / webwork2 / lib / WeBWorK / ContentGenerator / Problem.pm Repository:
ViewVC logotype

Diff of /trunk/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm

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

Revision 942 Revision 2278
1################################################################################ 1################################################################################
2# WeBWorK mod_perl (c) 2000-2002 WeBWorK Project 2# WeBWorK Online Homework Delivery System
3# $Id$ 3# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.142 2004/06/04 23:21:48 jj Exp $
5#
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
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.
10#
11# This program is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13# FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the
14# Artistic License for more details.
4################################################################################ 15################################################################################
5 16
6package WeBWorK::ContentGenerator::Problem; 17package WeBWorK::ContentGenerator::Problem;
7use base qw(WeBWorK::ContentGenerator); 18use base qw(WeBWorK::ContentGenerator);
8 19
9=head1 NAME 20=head1 NAME
10 21
11WeBWorK::ContentGenerator::Problem - Allow a student to interact with a problem. 22WeBWorK::ContentGenerator::Problem - Allow a student to interact with a problem.
12 23
13=cut 24=cut
14 25
15use strict; 26use strict;
16use warnings; 27use warnings;
17use CGI qw(); 28use CGI qw();
18use File::Path qw(rmtree); 29use File::Path qw(rmtree);
19use File::Temp qw(tempdir);
20use WeBWorK::Form; 30use WeBWorK::Form;
21use WeBWorK::PG; 31use WeBWorK::PG;
32use WeBWorK::PG::ImageGenerator;
22use WeBWorK::PG::IO; 33use WeBWorK::PG::IO;
23use WeBWorK::Utils qw(writeLog encodeAnswers decodeAnswers ref2string); 34use WeBWorK::Utils qw(writeLog writeCourseLog encodeAnswers decodeAnswers ref2string makeTempDirectory);
35use WeBWorK::DB::Utils qw(global2user user2global findDefaults);
36use WeBWorK::Timing;
37
38use WeBWorK::Utils::Tasks qw(fake_set fake_problem);
24 39
25############################################################ 40############################################################
26# 41#
27# user 42# user
28# effectiveUser 43# effectiveUser
38# 53#
39# redisplay - name of the "Redisplay Problem" button 54# redisplay - name of the "Redisplay Problem" button
40# submitAnswers - name of "Submit Answers" button 55# submitAnswers - name of "Submit Answers" button
41# checkAnswers - name of the "Check Answers" button 56# checkAnswers - name of the "Check Answers" button
42# previewAnswers - name of the "Preview Answers" button 57# previewAnswers - name of the "Preview Answers" button
58#
59# FIXME: this table is heinously out of date
43# 60#
44############################################################ 61############################################################
45 62
63# FIXME: what is this?
64sub templateName {
65 "problem";
66}
67
46sub pre_header_initialize { 68sub pre_header_initialize {
47 my ($self, $setName, $problemNumber) = @_; 69 my ($self) = @_;
48 my $r = $self->{r}; 70 my $r = $self->r;
49 my $courseEnv = $self->{ce}; 71 my $ce = $r->ce;
50 my $db = $self->{db}; 72 my $db = $r->db;
73 my $urlpath = $r->urlpath;
74
75 my $setName = $urlpath->arg("setID");
76 my $problemNumber = $r->urlpath->arg("problemID");
51 my $userName = $r->param('user'); 77 my $userName = $r->param('user');
52 my $effectiveUserName = $r->param('effectiveUser'); 78 my $effectiveUserName = $r->param('effectiveUser');
79 my $key = $r->param('key');
53 80
54 my $user = $db->getUser($userName); 81 my $user = $db->getUser($userName); # checked
82 die "record for user $userName (real user) does not exist."
83 unless defined $user;
84
55 my $effectiveUser = $db->getUser($effectiveUserName); 85 my $effectiveUser = $db->getUser($effectiveUserName); # checked
86 die "record for user $effectiveUserName (effective user) does not exist."
87 unless defined $effectiveUser;
88
89 my $PermissionLevel = $db->getPermissionLevel($userName); # checked
90 die "permission level record for user $userName does not exist (but the user does? odd...)"
91 unless defined $PermissionLevel;
92 my $permissionLevel = $PermissionLevel->permission;
93
94 # obtain the merged set for $effectiveUser
56 my $set = $db->getGlobalUserSet($effectiveUserName, $setName); 95 my $set = $db->getMergedSet($effectiveUserName, $setName); # checked
96
97 # obtain the merged problem for $effectiveUser
57 my $problem = $db->getGlobalUserProblem($effectiveUserName, $setName, $problemNumber); 98 my $problem = $db->getMergedProblem($effectiveUserName, $setName, $problemNumber); # checked
58 my $psvn = $set->psvn(); 99
59 my $permissionLevel = $db->getPermissionLevel($userName)->permission(); 100 my $editMode = $r->param("editMode");
60 101
102 if ($permissionLevel > 0) {
103 # professors are allowed to fabricate sets and problems not
104 # assigned to them (or anyone). this allows them to use the
105 # editor to
106
107 # if that is not yet defined obtain the global set, convert
108 # it to a user set, and add fake user data
109 unless (defined $set) {
110 my $userSetClass = $db->{set_user}->{record};
111 my $globalSet = $db->getGlobalSet($setName); # checked
112 # if the global set doesn't exist either, bail!
113 if(not defined $globalSet) {
114 $set = fake_set($db);
115 } else {
116 $set = global2user($userSetClass, $globalSet);
117 $set->psvn(0);
118
119 # FIXME: This is a temporary fix to fill in the database
120 # We want the published field to contain either 1 or 0 so if it has not been set to 0, default to 1
121 # this will fill in all the empty fields but not change anything that has been specifically set to 1 or 0
122 $globalSet->published("1") unless $globalSet->published eq "0";
123 $db->putGlobalSet($globalSet);
124 }
125 }
126
127 # if that is not yet defined obtain the global problem,
128 # convert it to a user problem, and add fake user data
129 unless (defined $problem) {
130 my $userProblemClass = $db->{problem_user}->{record};
131 my $globalProblem = $db->getGlobalProblem($setName, $problemNumber); # checked
132 # if the global problem doesn't exist either, bail!
133 if(not defined $globalProblem) {
134 my $sourceFilePath = $r->param("sourceFilePath");
135 die "Problem $problemNumber in set $setName does not exist"
136 unless defined $sourceFilePath;
137 $problem = fake_problem($db);
138 $problem->problem_id(1);
139 $problem->source_file($sourceFilePath);
140 $problem->user_id($effectiveUserName);
141 } else {
142 $problem = global2user($userProblemClass, $globalProblem);
143 $problem->user_id($effectiveUserName);
144 $problem->problem_seed(0);
145 $problem->status(0);
146 $problem->attempted(0);
147 $problem->last_answer("");
148 $problem->num_correct(0);
149 $problem->num_incorrect(0);
150 }
151 }
152
153 # now we're sure we have valid UserSet and UserProblem objects
154 # yay!
155
156 # now deal with possible editor overrides:
157
158 # if the caller is asking to override the source file, and
159 # editMode calls for a temporary file, do so
160 my $sourceFilePath = $r->param("sourceFilePath");
161 if (defined $sourceFilePath and
162 (not defined $editMode or $editMode eq "temporaryFile")) {
163 $problem->source_file($sourceFilePath);
164 }
165
166 # if the caller is asking to override the problem seed, do so
167 my $problemSeed = $r->param("problemSeed");
168 if (defined $problemSeed) {
169 $problem->problem_seed($problemSeed);
170 }
171
172 my $publishedClass = ($set->published) ? "Published" : "Unpublished";
173 my $publishedText = ($set->published) ? "visible to students." : "hidden from students.";
174 $self->addmessage(CGI::p("This set is " . CGI::font({class=>$publishedClass}, $publishedText)));
175 } else {
176
177 $self->addmessage(CGI::div({class=>"ResultsWithError"}, CGI::p("This problem will not count towards your grade."))) unless $problem->value;;
178 # students can't view problems not assigned to them
179
180 # A set is valid if it exists and if it is either published or the user is privileged.
181 $self->{invalidSet} = (grep /$setName/, $db->listUserSets($effectiveUserName)) == 0 || !($set->published || $permissionLevel->permission > 0); # this is redundant because of the above if
182 $self->{invalidProblem} = (grep /$problemNumber/, $db->listUserProblems($effectiveUserName, $setName)) == 0 || !($set->published || $permissionLevel->permission > 0);;
183
184 }
185
61 $self->{userName} = $userName; 186 $self->{userName} = $userName;
187 $self->{effectiveUserName} = $effectiveUserName;
62 $self->{user} = $user; 188 $self->{user} = $user;
63 $self->{effectiveUser} = $effectiveUser; 189 $self->{effectiveUser} = $effectiveUser;
64 $self->{set} = $set;
65 $self->{problem} = $problem;
66 $self->{permissionLevel} = $permissionLevel; 190 $self->{permissionLevel} = $permissionLevel;
191 $self->{set} = $set;
192 $self->{problem} = $problem;
193 $self->{editMode} = $editMode;
67 194
68 ##### form processing ##### 195 ##### form processing #####
69 196
70 # set options from form fields (see comment at top of file for names) 197 # set options from form fields (see comment at top of file for names)
71 my $displayMode = $r->param("displayMode") || $courseEnv->{pg}->{options}->{displayMode}; 198 my $displayMode = $r->param("displayMode") || $ce->{pg}->{options}->{displayMode};
72 my $redisplay = $r->param("redisplay"); 199 my $redisplay = $r->param("redisplay");
73 my $submitAnswers = $r->param("submitAnswers"); 200 my $submitAnswers = $r->param("submitAnswers");
74 my $checkAnswers = $r->param("checkAnswers"); 201 my $checkAnswers = $r->param("checkAnswers");
75 my $previewAnswers = $r->param("previewAnswers"); 202 my $previewAnswers = $r->param("previewAnswers");
76 203
77 # fields which may be defined when using Problem Editor
78 my $override_seed = ($permissionLevel>=10) ? $r->param('problemSeed') : undef;
79 my $override_problem_source = ($permissionLevel>=10) ? $r->param('sourceFilePath') : undef;
80 my $editMode = undef;
81 my $submit_button = $r->param('submit_button');
82 if ( defined($submit_button ) ) {
83 $editMode = "temporaryFile" if $submit_button eq 'Refresh';
84 $editMode = 'savedFile' if $submit_button eq 'Save';
85 }
86 # coerce form fields into CGI::Vars format
87 my $formFields = { WeBWorK::Form->new_from_paramable($r)->Vars }; 204 my $formFields = { WeBWorK::Form->new_from_paramable($r)->Vars };
88 205
89 $self->{displayMode} = $displayMode; 206 $self->{displayMode} = $displayMode;
90 $self->{redisplay} = $redisplay; 207 $self->{redisplay} = $redisplay;
91 $self->{submitAnswers} = $submitAnswers; 208 $self->{submitAnswers} = $submitAnswers;
92 $self->{checkAnswers} = $checkAnswers; 209 $self->{checkAnswers} = $checkAnswers;
93 $self->{previewAnswers} = $previewAnswers; 210 $self->{previewAnswers} = $previewAnswers;
94 $self->{formFields} = $formFields; 211 $self->{formFields} = $formFields;
212
213 # get result and send to message
214 my $success = $r->param("sucess");
215 my $failure = $r->param("failure");
216 $self->addmessage(CGI::div({class=>"ResultsWithError"}, CGI::p($failure))) if $failure;
217 $self->addmessage(CGI::div({class=>"ResultsWithoutError"}, CGI::p($success))) if $success;
218
219 # now that we've set all the necessary variables quit out if the set or problem is invalid
220 return if $self->{invalidSet} || $self->{invalidProblem};
95 221
96 $self->{current_problem_source} = (defined($override_problem_source) ) ?
97 $override_problem_source :
98 $problem->source_file;
99 $self->{edit_mode} = $editMode;
100 ##### permissions ##### 222 ##### permissions #####
101 223
102 # are we allowed to view this problem? 224 # are we allowed to view this problem?
103 $self->{isOpen} = time >= $set->open_date || $permissionLevel > 0; 225 $self->{isOpen} = time >= $set->open_date || $permissionLevel > 0;
104 return unless $self->{isOpen}; 226 return unless $self->{isOpen};
105 227
106 # what does the user want to do? 228 # what does the user want to do?
107 my %want = ( 229 my %want = (
108 showOldAnswers => $r->param("showOldAnswers") || $courseEnv->{pg}->{options}->{showOldAnswers}, 230 showOldAnswers => $r->param("showOldAnswers") || $ce->{pg}->{options}->{showOldAnswers},
109 showCorrectAnswers => $r->param("showCorrectAnswers") || $courseEnv->{pg}->{options}->{showCorrectAnswers}, 231 showCorrectAnswers => $r->param("showCorrectAnswers") || $ce->{pg}->{options}->{showCorrectAnswers},
110 showHints => $r->param("showHints") || $courseEnv->{pg}->{options}->{showHints}, 232 showHints => $r->param("showHints") || $ce->{pg}->{options}->{showHints},
111 showSolutions => $r->param("showSolutions") || $courseEnv->{pg}->{options}->{showSolutions}, 233 showSolutions => $r->param("showSolutions") || $ce->{pg}->{options}->{showSolutions},
112 recordAnswers => $submitAnswers, 234 recordAnswers => $submitAnswers,
113 checkAnswers => $checkAnswers, 235 checkAnswers => $checkAnswers,
114 ); 236 );
115 237
116 # are certain options enforced? 238 # are certain options enforced?
130 showHints => 1, 252 showHints => 1,
131 showSolutions => canShowSolutions($permissionLevel, $set->answer_date), 253 showSolutions => canShowSolutions($permissionLevel, $set->answer_date),
132 recordAnswers => canRecordAnswers($permissionLevel, $set->open_date, $set->due_date, 254 recordAnswers => canRecordAnswers($permissionLevel, $set->open_date, $set->due_date,
133 $problem->max_attempts, $problem->num_correct + $problem->num_incorrect + 1), 255 $problem->max_attempts, $problem->num_correct + $problem->num_incorrect + 1),
134 # attempts=num_correct+num_incorrect+1, as this happens before updating $problem 256 # attempts=num_correct+num_incorrect+1, as this happens before updating $problem
135 checkAnswers => canCheckAnswers($permissionLevel, $set->answer_date), 257 checkAnswers => canCheckAnswers($permissionLevel, $set->due_date),
258 );
259
260 # more complicated logic for showing check answer button:
261 # checkAnswers button shows up after due date -- once a student can't record anymore
262 # checkAnswers button always shows up when an instructor or TA is acting
263 # as someone else (the $user and $effectiveUserName aren't the same).
264 $can{checkAnswers} = (
265 # $can{recordAnswers} will be false if the due date has passed OR the
266 # student has used up all of her attempts
267 ($can{checkAnswers} and not $can{recordAnswers})
268 or
269 (
270 # FIXME: this is not the right way to check for this.
271 # also, canCheckAnswers() will show this button if the permission
272 # level is positive, which is always true when an instructor is
273 # acting as a student
274 defined($userName)
275 and
276 defined($effectiveUserName)
277 and
278 ($userName ne $effectiveUserName)
279 )
280 );
281
282 # more complicated logif for showing "submit answer" button:
283 # We hide the submit answer button if someone is acting as a student
284 # This prevents errors where you accidently submit the answer for a student
285 # Not sure whether this a feature or a bug
286 $can{recordAnswers} = (
287 $can{recordAnswers}
288 and not
289 (
290 # FIXME: this is not the right way to check for this.
291 defined($userName)
292 and
293 defined($effectiveUserName)
294 and
295 ($userName ne $effectiveUserName)
296 )
136 ); 297 );
137 298
138 # final values for options 299 # final values for options
139 my %will; 300 my %will;
140 foreach (keys %must) { 301 foreach (keys %must) {
141 $will{$_} = $can{$_} && ($want{$_} || $must{$_}); 302 $will{$_} = $can{$_} && ($want{$_} || $must{$_});
142 } 303 }
143 304
144 ##### sticky answers ##### 305 ##### sticky answers #####
145 306
146 if (not $submitAnswers and $will{showOldAnswers}) { 307 if (not ($submitAnswers or $previewAnswers or $checkAnswers) and $will{showOldAnswers}) {
147 # do this only if new answers are NOT being submitted 308 # do this only if new answers are NOT being submitted
148 my %oldAnswers = decodeAnswers($problem->last_answer); 309 my %oldAnswers = decodeAnswers($problem->last_answer);
149 $formFields->{$_} = $oldAnswers{$_} foreach keys %oldAnswers; 310 $formFields->{$_} = $oldAnswers{$_} foreach keys %oldAnswers;
150 } 311 }
151 312
152 ##### translation ##### 313 ##### translation #####
153 314
315 $WeBWorK::timer->continue("begin pg processing") if defined($WeBWorK::timer);
154 my $pg = WeBWorK::PG->new( 316 my $pg = WeBWorK::PG->new(
155 $courseEnv, 317 $ce,
156 $effectiveUser, 318 $effectiveUser,
157 $r->param('key'), 319 $key,
158 $set, 320 $set,
159 $problem, 321 $problem,
160 $psvn, 322 $set->psvn, # FIXME: this field should be removed
161 $formFields, 323 $formFields,
162 { # translation options 324 { # translation options
163 displayMode => $displayMode, 325 displayMode => $displayMode,
164 override_seed => $override_seed,
165 override_problem_source =>$override_problem_source,
166 showHints => $will{showHints}, 326 showHints => $will{showHints},
167 showSolutions => $will{showSolutions}, 327 showSolutions => $will{showSolutions},
168 refreshMath2img => $will{showHints} || $will{showSolutions}, 328 refreshMath2img => $will{showHints} || $will{showSolutions},
169 processAnswers => 1, 329 processAnswers => 1,
170 }, 330 },
171 ); 331 );
172 332
333 $WeBWorK::timer->continue("end pg processing") if defined($WeBWorK::timer);
173 ##### fix hint/solution options ##### 334 ##### fix hint/solution options #####
174 335
175 $can{showHints} &&= $pg->{flags}->{hintExists}; 336 $can{showHints} &&= $pg->{flags}->{hintExists}
337 &&= $pg->{flags}->{showHintLimit}<=$pg->{state}->{num_of_incorrect_ans};
176 $can{showSolutions} &&= $pg->{flags}->{solutionExists}; 338 $can{showSolutions} &&= $pg->{flags}->{solutionExists};
177 339
178 ##### store fields ##### 340 ##### store fields #####
179 341
180 $self->{want} = \%want; 342 $self->{want} = \%want;
181 $self->{must} = \%must; 343 $self->{must} = \%must;
182 $self->{can} = \%can; 344 $self->{can} = \%can;
183 $self->{will} = \%will; 345 $self->{will} = \%will;
184
185 $self->{pg} = $pg; 346 $self->{pg} = $pg;
186}
187
188sub if_warnings($$) {
189 my ($self, $arg) = @_;
190 return 0 unless $self->{isOpen};
191 return $self->{pg}->{warnings} ne "";
192} 347}
193 348
194sub if_errors($$) { 349sub if_errors($$) {
195 my ($self, $arg) = @_; 350 my ($self, $arg) = @_;
196 return 0 unless $self->{isOpen}; 351
352 if ($self->{isOpen}) {
197 return $self->{pg}->{flags}->{error_flag}; 353 return $self->{pg}->{flags}->{error_flag} ? $arg : !$arg;
354 } else {
355 return !$arg;
356 }
198} 357}
199 358
200sub head { 359sub head {
201 my $self = shift; 360 my ($self) = @_;
361
202 return "" unless $self->{isOpen}; 362 return "" unless $self->{isOpen};
203 return $self->{pg}->{head_text} if $self->{pg}->{head_text}; 363 return $self->{pg}->{head_text} if $self->{pg}->{head_text};
204} 364}
205 365
206sub path { 366sub options {
207 my $self = shift; 367 my ($self) = @_;
208 my $args = $_[-1];
209 my $setName = $self->{set}->set_id;
210 my $problemNumber = $self->{problem}->problem_id;
211 368
212 my $ce = $self->{ce}; 369 return "" if $self->{invalidProblem};
213 my $root = $ce->{webworkURLs}->{root}; 370 my $sourceFilePathfield = '';
214 my $courseName = $ce->{courseName}; 371 if($self->r->param("sourceFilePath")) {
215 return $self->pathMacro($args, 372 $sourceFilePathfield = CGI::hidden(-name => "sourceFilePath",
216 "Home" => "$root", 373 -value => $self->r->param("sourceFilePath"));
217 $courseName => "$root/$courseName", 374 }
218 $setName => "$root/$courseName/$setName", 375
219 "Problem $problemNumber" => "", 376 return join("",
377 CGI::start_form("POST", $self->{r}->uri),
378 $self->hidden_authen_fields,
379 $sourceFilePathfield,
380 CGI::hr(),
381 CGI::start_div({class=>"viewOptions"}),
382 $self->viewOptions(),
383 CGI::end_div(),
384 CGI::end_form()
220 ); 385 );
221} 386}
222 387
388#sub path {
389# my $self = shift;
390# my $args = $_[-1];
391# my $setName = $self->{set}->set_id;
392# my $problemNumber = $self->{problem}->problem_id;
393#
394# my $ce = $self->{ce};
395# my $root = $ce->{webworkURLs}->{root};
396# my $courseName = $ce->{courseName};
397# return $self->pathMacro($args,
398# "Home" => "$root",
399# $courseName => "$root/$courseName",
400# $setName => "$root/$courseName/$setName",
401# "Problem $problemNumber" => "",
402# );
403#}
404
223sub siblings { 405sub siblings {
224 my $self = shift; 406 my ($self) = @_;
407 my $r = $self->r;
408 my $db = $r->db;
409 my $urlpath = $r->urlpath;
410
411 # can't show sibling problems if the set is invalid
412 return "" if $self->{invalidSet};
413
414 my $courseID = $urlpath->arg("courseID");
225 my $setName = $self->{set}->set_id; 415 my $setID = $self->{set}->set_id;
226 my $problemNumber = $self->{problem}->problem_id;
227
228 my $ce = $self->{ce};
229 my $db = $self->{db};
230 my $root = $ce->{webworkURLs}->{root};
231 my $courseName = $ce->{courseName};
232
233 print CGI::strong("Problems"), CGI::br();
234
235 my $effectiveUser = $self->{r}->param("effectiveUser"); 416 my $eUserID = $r->param("effectiveUser");
236 my @problems; 417 my @problemIDs = sort { $a <=> $b } $db->listUserProblems($eUserID, $setID);
237 push @problems, $db->getGlobalUserProblem($effectiveUser, $setName, $_) 418
238 foreach ($db->listUserProblems($effectiveUser, $setName)); 419 print CGI::start_ul({class=>"LinksMenu"});
239 foreach my $problem (sort { $a->problem_id <=> $b->problem_id } @problems) { 420 print CGI::start_li();
240 print CGI::a({-href=>"$root/$courseName/$setName/".$problem->problem_id."/?" 421 print CGI::span({style=>"font-size:larger"}, "Problems");
241 . $self->url_authen_args . "&displayMode=" . $self->{displayMode}}, 422 print CGI::start_ul();
242 "Problem ".$problem->problem_id), CGI::br(); 423
424 foreach my $problemID (@problemIDs) {
425 my $problemPage = $urlpath->newFromModule("WeBWorK::ContentGenerator::Problem",
426 courseID => $courseID, setID => $setID, problemID => $problemID);
427 print CGI::li(CGI::a({href=>$self->systemLink($problemPage, params=>{displayMode => $self->{displayMode}})}, "Problem $problemID"));
243 } 428 }
429
430 print CGI::end_ul();
431 print CGI::end_li();
432 print CGI::end_ul();
433
434 return "";
244} 435}
245 436
246sub nav { 437sub nav {
247 my $self = shift; 438 my ($self, $args) = @_;
248 my $args = $_[-1];
249 my $setName = $self->{set}->set_id;
250 my $problemNumber = $self->{problem}->problem_id;
251
252 my $ce = $self->{ce}; 439 my $r = $self->r;
253 my $db = $self->{db}; 440 my $db = $r->db;
254 my $root = $ce->{webworkURLs}->{root}; 441 my $urlpath = $r->urlpath;
255 my $courseName = $ce->{courseName};
256 442
257 my $wwdb = $self->{wwdb}; 443 my $courseID = $urlpath->arg("courseID");
444 my $setID = $self->{set}->set_id if !($self->{invalidSet});
445 my $problemID = $self->{problem}->problem_id if !($self->{invalidProblem});
258 my $effectiveUser = $self->{r}->param("effectiveUser"); 446 my $eUserID = $r->param("effectiveUser");
447
448 my ($prevID, $nextID);
449
450 if (!$self->{invalidProblem}) {
451 my @problemIDs = $db->listUserProblems($eUserID, $setID);
452 foreach my $id (@problemIDs) {
453 $prevID = $id if $id < $problemID
454 and (not defined $prevID or $id > $prevID);
455 $nextID = $id if $id > $problemID
456 and (not defined $nextID or $id < $nextID);
457 }
458 }
459
460 my @links;
461
462 if ($prevID) {
463 my $prevPage = $urlpath->newFromModule(__PACKAGE__,
464 courseID => $courseID, setID => $setID, problemID => $prevID);
465 push @links, "Previous Problem", $r->location . $prevPage->path, "navPrev";
466 } else {
467 push @links, "Previous Problem", "", "navPrev";
468 }
469
470 push @links, "Problem List", $r->location . $urlpath->parent->path, "navProbList";
471
472 if ($nextID) {
473 my $nextPage = $urlpath->newFromModule(__PACKAGE__,
474 courseID => $courseID, setID => $setID, problemID => $nextID);
475 push @links, "Next Problem", $r->location . $nextPage->path, "navNext";
476 } else {
477 push @links, "Next Problem", "", "navNext";
478 }
479
259 my $tail = "&displayMode=".$self->{displayMode}; 480 my $tail = "&displayMode=".$self->{displayMode};
260
261 my @links = ("Problem List" , "$root/$courseName/$setName", "navProbList");
262
263 my $prevProblem = $db->getGlobalUserProblem($effectiveUser, $setName, $problemNumber-1);
264 my $nextProblem = $db->getGlobalUserProblem($effectiveUser, $setName, $problemNumber+1);
265 unshift @links, "Previous Problem" , ($prevProblem
266 ? "$root/$courseName/$setName/".$prevProblem->problem_id
267 : "") , "navPrev";
268 push @links, "Next Problem" , ($nextProblem
269 ? "$root/$courseName/$setName/".$nextProblem->problem_id
270 : "") , "navNext";
271
272 return $self->navMacro($args, $tail, @links); 481 return $self->navMacro($args, $tail, @links);
273} 482}
274 483
275sub title { 484sub title {
276 my $self = shift; 485 my ($self) = @_;
486
487 # using the url arguments won't break if the set/problem are invalid
488 my $setID = $self->r->urlpath->arg("setID");
489 my $problemID = $self->r->urlpath->arg("problemID");
490
277 my $setName = $self->{set}->set_id; 491 #my $setID = $self->{set}->set_id;
492 #my $problemID = $self->{problem}->problem_id;
278 493
279 my $file_action; 494 return "$setID : $problemID";
280 my $edit_mode = $self->{edit_mode};
281 if ( not defined($edit_mode) ) {
282 $file_action = '';
283 } elsif ( $edit_mode eq 'temporaryFile') {
284 $file_action .= 'Editing temporary file : '. CGI::br() . $self->{current_problem_source};
285 } elsif ( $edit_mode eq 'savedFile' ){
286 $file_action .= 'Problem saved to : '. CGI::br() . $self->{current_problem_source};
287 }
288 my $problemNumber = $self->{problem}->problem_id . " : " . $file_action;
289
290 return "$setName : Problem $problemNumber";
291} 495}
292 496
293sub body { 497sub body {
294 my $self = shift; 498 my $self = shift;
499 my $r = $self->r;
500 my $ce = $r->ce;
501 my $db = $r->db;
502 my $urlpath = $r->urlpath;
503
504 if ($self->{invalidSet}) {
505 return CGI::div({class=>"ResultsWithError"},
506 CGI::p("The selected problem set (" . $urlpath->arg("setID") . ") is not a valid set for " . $r->param("effectiveUser") . "."));
507 }
295 508
296 return CGI::p(CGI::font({-color=>"red"}, "This problem is not available because the problem set that contains it is not yet open.")) 509 if ($self->{invalidProblem}) {
510 return CGI::div({class=>"ResultsWithError"},
511 CGI::p("The selected problem (" . $urlpath->arg("problemID") . ") is not a valid problem for set " . $self->{set}->set_id . "."));
512 }
513
297 unless $self->{isOpen}; 514 unless ($self->{isOpen}) {
298 515 return CGI::div({class=>"ResultsWithError"},
516 CGI::p("This problem is not available because the problem set that contains it is not yet open."));
517 }
299 # unpack some useful variables 518 # unpack some useful variables
300 my $r = $self->{r};
301 my $db = $self->{db};
302 my $set = $self->{set}; 519 my $set = $self->{set};
303 my $problem = $self->{problem}; 520 my $problem = $self->{problem};
521 my $editMode = $self->{editMode};
304 my $permissionLevel = $self->{permissionLevel}; 522 my $permissionLevel = $self->{permissionLevel};
305 my $submitAnswers = $self->{submitAnswers}; 523 my $submitAnswers = $self->{submitAnswers};
306 my $checkAnswers = $self->{checkAnswers}; 524 my $checkAnswers = $self->{checkAnswers};
307 my $previewAnswers = $self->{previewAnswers}; 525 my $previewAnswers = $self->{previewAnswers};
308 my %want = %{ $self->{want} }; 526 my %want = %{ $self->{want} };
309 my %can = %{ $self->{can} }; 527 my %can = %{ $self->{can} };
310 my %must = %{ $self->{must} }; 528 my %must = %{ $self->{must} };
311 my %will = %{ $self->{will} }; 529 my %will = %{ $self->{will} };
312 my $pg = $self->{pg}; 530 my $pg = $self->{pg};
313 531
532 #my $root = $ce->{webworkURLs}->{root};
533 my $courseName = $urlpath->arg("courseID");
534
535 #####create Editor link #####
536 ## print editor link if the user is an instructor AND the file is not in temporary editing mode
537 #my $editorLinkMessage = '';
538 ## and ( (not defined($self->{editMode})) or $self->{editMode} eq 'savedFile') # FIXME is this needed?
539 #if ($self->{permissionLevel}>=10 ) {
540 # $editorLinkMessage = CGI::a({-href=>$ce->{webworkURLs}->{root}."/$courseName/instructor/pgProblemEditor/".
541 # $set->set_id.'/'.$problem->problem_id.'?'.$self->url_authen_args},'Edit this problem');
542 #}
543
544 my $editorLink = "";
545 # if we are here without a real problem set, carry that through
546 my $forced_field = [];
547 $forced_field = ['sourceFilePath' => $r->param("sourceFilePath")] if
548 ($set->set_id eq 'Undefined_Set');
549 if ($self->{permissionLevel}>=10) {
550 my $editorPage = $urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::PGProblemEditor",
551 courseID => $courseName, setID => $set->set_id, problemID => $problem->problem_id);
552 my $editorURL = $self->systemLink($editorPage, params=>$forced_field);
553 $editorLink = CGI::a({href=>$editorURL}, "Edit this problem");
554 }
555
314 ##### translation errors? ##### 556 ##### translation errors? #####
315 557
316 if ($pg->{flags}->{error_flag}) { 558 if ($pg->{flags}->{error_flag}) {
317 return $self->errorOutput($pg->{errors}, $pg->{body_text}); 559 print $self->errorOutput($pg->{errors}, $pg->{body_text});
560 print $editorLink;
561 return "";
318 } 562 }
319 563
320 ##### answer processing ##### 564 ##### answer processing #####
321 565 $WeBWorK::timer->continue("begin answer processing") if defined($WeBWorK::timer);
322 # if answers were submitted: 566 # if answers were submitted:
567 my $scoreRecordedMessage;
568 my $pureProblem;
323 if ($submitAnswers) { 569 if ($submitAnswers) {
324 # get a "pure" (unmerged) UserProblem to modify 570 # get a "pure" (unmerged) UserProblem to modify
571 # this will be undefined if the problem has not been assigned to this user
325 my $pureProblem = $db->getUserProblem($problem->user_id, $problem->set_id, $problem->problem_id); 572 $pureProblem = $db->getUserProblem($problem->user_id, $problem->set_id, $problem->problem_id); # checked
573 if (defined $pureProblem) {
326 # store answers in DB for sticky answers 574 # store answers in DB for sticky answers
327 my %answersToStore; 575 my %answersToStore;
328 my %answerHash = %{ $pg->{answers} }; 576 my %answerHash = %{ $pg->{answers} };
329 $answersToStore{$_} = $answerHash{$_}->{original_student_ans} 577 $answersToStore{$_} = $self->{formFields}->{$_} #$answerHash{$_}->{original_student_ans} -- this may have been modified for fields with multiple values. Don't use it!!
330 foreach (keys %answerHash); 578 foreach (keys %answerHash);
579
580 # There may be some more answers to store -- one which are auxiliary entries to a primary answer. Evaluating
581 # matrices works in this way, only the first answer triggers an answer evaluator, the rest are just inputs
582 # however we need to store them. Fortunately they are still in the input form.
583 my @extra_answer_names = @{ $pg->{flags}->{KEPT_EXTRA_ANSWERS}};
584 $answersToStore{$_} = $self->{formFields}->{$_} foreach (@extra_answer_names);
585
586 # Now let's encode these answers to store them -- append the extra answers to the end of answer entry order
587 my @answer_order = (@{$pg->{flags}->{ANSWER_ENTRY_ORDER}}, @extra_answer_names);
331 my $answerString = encodeAnswers(%answersToStore, 588 my $answerString = encodeAnswers(%answersToStore,
332 @{ $pg->{flags}->{ANSWER_ENTRY_ORDER} }); 589 @answer_order);
590
591 # store last answer to database
592 $problem->last_answer($answerString);
333 $pureProblem->last_answer($answerString); 593 $pureProblem->last_answer($answerString);
334 $problem->last_answer($answerString);
335 $db->putUserProblem($pureProblem);
336
337 # store state in DB if it makes sense
338 if ($will{recordAnswers}) {
339 $problem->status($pg->{state}->{recorded_score});
340 $problem->attempted(1);
341 $problem->num_correct($pg->{state}->{num_of_correct_ans});
342 $problem->num_incorrect($pg->{state}->{num_of_incorrect_ans});
343 $pureProblem->status($pg->{state}->{recorded_score});
344 $pureProblem->attempted(1);
345 $pureProblem->num_correct($pg->{state}->{num_of_correct_ans});
346 $pureProblem->num_incorrect($pg->{state}->{num_of_incorrect_ans});
347 $db->putUserProblem($pureProblem); 594 $db->putUserProblem($pureProblem);
595
596 # store state in DB if it makes sense
597 if ($will{recordAnswers}) {
598 $problem->status($pg->{state}->{recorded_score});
599 $problem->attempted(1);
600 $problem->num_correct($pg->{state}->{num_of_correct_ans});
601 $problem->num_incorrect($pg->{state}->{num_of_incorrect_ans});
602 $pureProblem->status($pg->{state}->{recorded_score});
603 $pureProblem->attempted(1);
604 $pureProblem->num_correct($pg->{state}->{num_of_correct_ans});
605 $pureProblem->num_incorrect($pg->{state}->{num_of_incorrect_ans});
606 if ($db->putUserProblem($pureProblem)) {
607 $scoreRecordedMessage = "Your score was recorded.";
608 } else {
609 $scoreRecordedMessage = "Your score was not recorded because there was a failure in storing the problem record to the database.";
610 }
348 # write to the transaction log, just to make sure 611 # write to the transaction log, just to make sure
349 writeLog($self->{ce}, "transaction", 612 writeLog($self->{ce}, "transaction",
350 $problem->problem_id."\t". 613 $problem->problem_id."\t".
351 $problem->set_id."\t". 614 $problem->set_id."\t".
352 $problem->user_id."\t". 615 $problem->user_id."\t".
353 $problem->source_file."\t". 616 $problem->source_file."\t".
354 $problem->value."\t". 617 $problem->value."\t".
355 $problem->max_attempts."\t". 618 $problem->max_attempts."\t".
356 $problem->problem_seed."\t". 619 $problem->problem_seed."\t".
357 $pureProblem->status."\t". 620 $pureProblem->status."\t".
358 $pureProblem->attempted."\t". 621 $pureProblem->attempted."\t".
359 $pureProblem->last_answer."\t". 622 $pureProblem->last_answer."\t".
360 $pureProblem->num_correct."\t". 623 $pureProblem->num_correct."\t".
361 $pureProblem->num_incorrect 624 $pureProblem->num_incorrect
362 ); 625 );
626 } else {
627 if (time < $set->open_date or time > $set->due_date) {
628 $scoreRecordedMessage = "Your score was not recorded because this problem set is closed.";
629 } else {
630 $scoreRecordedMessage = "Your score was not recorded.";
631 }
632 }
633 } else {
634 $scoreRecordedMessage = "Your score was not recorded because this problem has not been built for you.";
363 } 635 }
364 } 636 }
637
365 # logging student answers 638 # logging student answers
366 my $pastAnswerLog = undef; 639
367 if (defined( $self->{ce}->{webworkFiles}->{logs}->{'pastAnswerList'} )) { 640 my $answer_log = $self->{ce}->{courseFiles}->{logs}->{'answer_log'};
368 641 if ( defined($answer_log ) and defined($pureProblem)) {
369 $pastAnswerLog = $self->{ce}->{webworkFiles}->{logs}->{'pastAnswerList'}; 642 if ($submitAnswers ) {
370
371 if ($submitAnswers and defined($pastAnswerLog) ) {
372 my $answerString = ""; 643 my $answerString = "";
373 my %answerHash = %{ $pg->{answers} }; 644 my %answerHash = %{ $pg->{answers} };
374 $answerString = $answerString . $answerHash{$_}->{original_student_ans}."\t" 645 # FIXME this is the line 552 error. make sure original student ans is defined.
646 # The fact that it is not defined is probably due to an error in some answer evaluator.
647 # But I think it is useful to suppress this error message in the log.
375 foreach (sort keys %answerHash); 648 foreach (sort keys %answerHash) {
649 my $student_ans = $answerHash{$_}->{original_student_ans} ||'';
650 $answerString .= $student_ans."\t"
651 }
652 $answerString = '' unless defined($answerString); # insure string is defined.
376 writeLog($self->{ce}, "pastAnswerList", 653 writeCourseLog($self->{ce}, "answer_log",
654 join("",
377 '|'.$problem->user_id. 655 '|', $problem->user_id,
378 '|'.$problem->set_id. 656 '|', $problem->set_id,
379 '|'.$problem->problem_id.'|'."\t". 657 '|', $problem->problem_id,
658 '|',"\t",
380 time()."\t". 659 time(),"\t",
381 $answerString, 660 $answerString,
382 661 ),
383 ); 662 );
384 663
385 } 664 }
386
387 } 665 }
388 # end logging student answers 666
667 $WeBWorK::timer->continue("end answer processing") if defined($WeBWorK::timer);
389 668
390 ##### output ##### 669 ##### output #####
670
391 print CGI::start_div({class=>"problemHeader"}); 671 print CGI::start_div({class=>"problemHeader"});
672
673 # custom message for editor
674 if ($permissionLevel >= 10 and defined $editMode) {
675 if ($editMode eq "temporaryFile") {
676 print CGI::p(CGI::i("Editing temporary file: ", $problem->source_file));
677 } elsif ($editMode eq "savedFile") {
678 # FIXME: this is all done automatically if submitError exists.
679 #if ( defined($r->param('submiterror')) and $r->param('submiterror') ) {
680 # FIXME The following line doesn't work because the submiterror hook has already been called.
681 # The actions below should take place during the initialization phase.
682 # $self->{submiterror} .= $r->param('submiterror');
683 # print CGI::p(CGI::div({class=>'ResultsWithError'},$self->{submiterror}));
684 #} else {
685 # print CGI::p(CGI::div({ class=>'ResultsWithoutError'}, "Problem saved to: ", $problem->source_file));
686 #}
687 }
688 }
689 #FIXME we need error messages here if the problem was really not saved.
392 # attempt summary 690 # attempt summary
393 if ($submitAnswers or $will{showCorrectAnswers}) { 691 #FIXME -- the following is a kludge: if showPartialCorrectAnswers is negative don't show anything.
692 # until after the due date
693 # do I need to check $wills{howCorrectAnswers} to make preflight work??
694 if (($pg->{flags}->{showPartialCorrectAnswers}>= 0 and $submitAnswers) ) {
394 # print this if user submitted answers OR requested correct answers 695 # print this if user submitted answers OR requested correct answers
696
395 print $self->attemptResults($pg, $submitAnswers, 697 print $self->attemptResults($pg, 1,
396 $will{showCorrectAnswers}, 698 $will{showCorrectAnswers},
397 $pg->{flags}->{showPartialCorrectAnswers}, 1, 1); 699 $pg->{flags}->{showPartialCorrectAnswers}, 1, 1);
398 } elsif ($checkAnswers) { 700 } elsif ($checkAnswers) {
399 # print this if user previewed answers 701 # print this if user previewed answers
702 print CGI::div({class=>'ResultsWithError'},"ANSWERS ONLY CHECKED -- ",CGI::br(),"ANSWERS NOT RECORDED", CGI::br() );
400 print $self->attemptResults($pg, 1, 0, 1, 1, 1); 703 print $self->attemptResults($pg, 1, $will{showCorrectAnswers}, 1, 1, 1);
401 # show attempt answers 704 # show attempt answers
402 # don't show correct answers 705 # show correct answers if asked
403 # show attempt results (correctness) 706 # show attempt results (correctness)
404 # don't show attempt previews 707 # show attempt previews
405 } elsif ($previewAnswers) { 708 } elsif ($previewAnswers) {
406 # print this if user previewed answers 709 # print this if user previewed answers
407 print $self->attemptResults($pg, 1, 0, 0, 0, 1); 710 print CGI::div({class=>'ResultsWithError'},"PREVIEW ONLY -- NOT RECORDED"),CGI::br(),$self->attemptResults($pg, 1, 0, 0, 0, 1);
408 # show attempt answers 711 # show attempt answers
409 # don't show correct answers 712 # don't show correct answers
410 # don't show attempt results (correctness) 713 # don't show attempt results (correctness)
411 # show attempt previews 714 # show attempt previews
412 } 715 }
413 716
414 print CGI::end_div(); 717 print CGI::end_div();
415 718
416 print CGI::start_div({class=>"problem"}); 719 print CGI::start_div({class=>"problem"});
417 #print CGI::hr(); 720
418 # main form 721 # main form
419 print 722 print
420 CGI::startform("POST", $r->uri), 723 CGI::startform("POST", $r->uri),
421 $self->hidden_authen_fields, 724 $self->hidden_authen_fields,
422 CGI::p($pg->{body_text}), 725 CGI::p($pg->{body_text}),
423 CGI::p($pg->{result}->{msg} ? CGI::b("Note: ") : "", CGI::i($pg->{result}->{msg})), 726 CGI::p($pg->{result}->{msg} ? CGI::b("Note: ") : "", CGI::i($pg->{result}->{msg})),
424 CGI::p( 727 CGI::p(
728 ($can{showCorrectAnswers}
729 ? CGI::checkbox(
730 -name => "showCorrectAnswers",
731 -checked => $will{showCorrectAnswers},
732 -label => "Show correct answers",
733 ) ." "
734 : "" ),
735 ($can{showHints}
736 ? '<div style="color:red">'. CGI::checkbox(
737 -name => "showHints",
738 -checked => $will{showHints},
739 -label => "Show Hints",
740 ) . "</div> "
741 : " " ),
742 ($can{showSolutions}
743 ? CGI::checkbox(
744 -name => "showSolutions",
745 -checked => $will{showSolutions},
746 -label => "Show Solutions",
747 ) . " "
748 : " " ),CGI::br(),
749 CGI::submit(-name=>"previewAnswers",
750 -label=>"Preview Answers"),
425 ($can{recordAnswers} 751 ($can{recordAnswers}
426 ? CGI::submit(-name=>"submitAnswers", 752 ? CGI::submit(-name=>"submitAnswers",
427 -label=>"Submit Answers") 753 -label=>"Submit Answers")
428 : ""), 754 : ""),
429 ($can{checkAnswers} 755 ( $can{checkAnswers}
430 ? CGI::submit(-name=>"checkAnswers", 756 ? CGI::submit(-name=>"checkAnswers",
431 -label=>"Check Answers") 757 -label=>"Check Answers")
432 : ""), 758 : ""),
433 CGI::submit(-name=>"previewAnswers",
434 -label=>"Preview Answers"),
435 ); 759 );
436 print CGI::end_div(); 760 print CGI::end_div();
437 761
438 print CGI::start_div({class=>"scoreSummary"}); 762 print CGI::start_div({class=>"scoreSummary"});
763
439 # score summary 764 # score summary
440 my $attempts = $problem->num_correct + $problem->num_incorrect; 765 my $attempts = $problem->num_correct + $problem->num_incorrect;
441 my $attemptsNoun = $attempts != 1 ? "times" : "time"; 766 my $attemptsNoun = $attempts != 1 ? "times" : "time";
442 my $lastScore = int ($problem->status * 100) . "%"; 767 my $lastScore = sprintf("%.0f%%", $problem->status * 100); # Round to whole number
443 my ($attemptsLeft, $attemptsLeftNoun); 768 my ($attemptsLeft, $attemptsLeftNoun);
444 if ($problem->max_attempts == -1) { 769 if ($problem->max_attempts == -1) {
445 # unlimited attempts 770 # unlimited attempts
446 $attemptsLeft = "unlimited"; 771 $attemptsLeft = "unlimited";
447 $attemptsLeftNoun = "attempts"; 772 $attemptsLeftNoun = "attempts";
454 my $setClosedMessage; 779 my $setClosedMessage;
455 if (time < $set->open_date or time > $set->due_date) { 780 if (time < $set->open_date or time > $set->due_date) {
456 $setClosed = 1; 781 $setClosed = 1;
457 $setClosedMessage = "This problem set is closed."; 782 $setClosedMessage = "This problem set is closed.";
458 if ($permissionLevel > 0) { 783 if ($permissionLevel > 0) {
459 $setClosedMessage .= " Since you are a privileged user, additional attempts will be recorded."; 784 $setClosedMessage .= " However, since you are a privileged user, additional attempts will be recorded.";
460 } else { 785 } else {
461 $setClosedMessage .= " Additional attempts will not be recorded."; 786 $setClosedMessage .= " Additional attempts will not be recorded.";
462 } 787 }
463 } 788 }
789
790 my $notCountedMessage = ($problem->value) ? "" : "(This problem will not count towards your grade.)";
464 print CGI::p( 791 print CGI::p(
792 $submitAnswers ? $scoreRecordedMessage . CGI::br() : "",
465 "You have attempted this problem $attempts $attemptsNoun.", CGI::br(), 793 "You have attempted this problem $attempts $attemptsNoun.", CGI::br(),
466 $problem->attempted 794 $problem->attempted
467 ? "Your recorded score is $lastScore." . CGI::br() 795 ? "Your recorded score is $lastScore. $notCountedMessage" . CGI::br()
468 : "", 796 : "",
469 $setClosed ? $setClosedMessage : "You have $attemptsLeft $attemptsLeftNoun remaining." 797 $setClosed ? $setClosedMessage : "You have $attemptsLeft $attemptsLeftNoun remaining."
470 ); 798 );
471 print CGI::end_div(); 799 print CGI::end_div();
472# print CGI::hr(), CGI::start_div({class=>"viewOptions"}); 800
473# print $self->viewOptions(),CGI::end_div(),
474# save state for viewOptions 801 # save state for viewOptions
475 print CGI::hidden(-name => "showOldAnswers", 802 print CGI::hidden(
803 -name => "showOldAnswers",
476 -value => $will{showOldAnswers}, 804 -value => $will{showOldAnswers}
477 ), 805 ),
478 CGI::hidden(-name => "showCorrectAnswers", 806
479 -value => $will{showCorrectAnswers}, 807 CGI::hidden(
480 ), 808 -name => "displayMode",
481 CGI::hidden(-name => "showHints",
482 -value => $will{showHints},
483 ),
484 CGI::hidden(-name => "showSolutions",
485 -value => $will{showSolutions},
486 ),
487 CGI::hidden(-name => "displayMode",
488 -value => $self->{displayMode} 809 -value => $self->{displayMode}
489 ); 810 );
811 print( CGI::hidden(
812 -name => 'editMode',
813 -value => $self->{editMode},
814 )
815 ) if defined($self->{editMode}) and $self->{editMode} eq 'temporaryFile';
816 print( CGI::hidden(
817 -name => 'sourceFilePath',
818 -value => $self->{problem}->{source_file}
819 )) if defined($self->{problem}->{source_file});
820
821 print( CGI::hidden(
822 -name => 'problemSeed',
823 -value => $r->param("problemSeed")
824 )) if defined($r->param("problemSeed"));
825
826 # end of main form
490 print CGI::endform(); 827 print CGI::endform();
491 828
492 print CGI::start_div({class=>"problemFooter"}); 829 print CGI::start_div({class=>"problemFooter"});
493 # feedback form
494 my $ce = $self->{ce};
495 my $root = $ce->{webworkURLs}->{root};
496 my $courseName = $ce->{courseName};
497 my $feedbackURL = "$root/$courseName/feedback/";
498 830
499 # arguments for answer inspection button 831 ## arguments for answer inspection button
500 my $prof_url = $ce->{webworkURLs}->{oldProf}; 832 #my $prof_url = $ce->{webworkURLs}->{oldProf};
833 #my $webworkURL = $ce->{webworkURLs}->{root};
501 my $cgi_url = $prof_url; 834 #my $cgi_url = $prof_url;
502 $cgi_url=~ s|/[^/]*$||; # clip profLogin.pl 835 #$cgi_url=~ s|/[^/]*$||; # clip profLogin.pl
503 my $authen_args = $self->url_authen_args(); 836 #my $authen_args = $self->url_authen_args();
504 my $showPastAnswersURL = "$cgi_url/showPastAnswers.pl"; 837 #my $showPastAnswersURL = "$webworkURL/$courseName/instructor/show_answers/";
505 838
506 839 my $pastAnswersPage = $urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::ShowAnswers",
507 print CGI::end_div(); 840 courseID => $courseName);
508 print CGI::start_div(); 841 my $showPastAnswersURL = $self->systemLink($pastAnswersPage, authen => 0); # no authen info for form action
842
509 # print answer inspection button 843 # print answer inspection button
510 if ($self->{permissionLevel} >0) { 844 if ($self->{permissionLevel} > 0) {
511
512
513 print "\n", 845 print "\n",
514 CGI::start_form(-method=>"POST",-action=>$showPastAnswersURL,-target=>"information"),"\n", 846 CGI::start_form(-method=>"POST",-action=>$showPastAnswersURL,-target=>"information"),"\n",
515 $self->hidden_authen_fields,"\n", 847 $self->hidden_authen_fields,"\n",
516 CGI::hidden(-name => 'course', -value=>$courseName), "\n", 848 CGI::hidden(-name => 'courseID', -value=>$courseName), "\n",
517 CGI::hidden(-name => 'probNum', -value=>$problem->problem_id), "\n", 849 CGI::hidden(-name => 'problemID', -value=>$problem->problem_id), "\n",
518 CGI::hidden(-name => 'setNum', -value=>$problem->set_id), "\n", 850 CGI::hidden(-name => 'setID', -value=>$problem->set_id), "\n",
519 CGI::hidden(-name => 'User', -value=>$problem->user_id), "\n", 851 CGI::hidden(-name => 'studentUser', -value=>$problem->user_id), "\n",
520 CGI::p( {-align=>"left"}, 852 CGI::p( {-align=>"left"},
521 CGI::submit(-name => 'action', -value=>'Show Past Answers') 853 CGI::submit(-name => 'action', -value=>'Show Past Answers')
522 ), "\n", 854 ), "\n",
523 CGI::endform(); 855 CGI::endform();
856 }
524 857
858 ## arguments for feedback form
859 #my $feedbackURL = "$root/$courseName/feedback/";
860 #
861 ##print feedback form
862 #print
863 # CGI::start_form(-method=>"POST", -action=>$feedbackURL),"\n",
864 # $self->hidden_authen_fields,"\n",
865 # CGI::hidden("module", __PACKAGE__),"\n",
866 # CGI::hidden("set", $set->set_id),"\n",
867 # CGI::hidden("problem", $problem->problem_id),"\n",
868 # CGI::hidden("displayMode", $self->{displayMode}),"\n",
869 # CGI::hidden("showOldAnswers", $will{showOldAnswers}),"\n",
870 # CGI::hidden("showCorrectAnswers", $will{showCorrectAnswers}),"\n",
871 # CGI::hidden("showHints", $will{showHints}),"\n",
872 # CGI::hidden("showSolutions", $will{showSolutions}),"\n",
873 # CGI::p({-align=>"left"},
874 # CGI::submit(-name=>"feedbackForm", -label=>"Email instructor")
875 # ),
876 # CGI::endform(),"\n";
877
878 # feedback form url
879 my $feedbackPage = $urlpath->newFromModule("WeBWorK::ContentGenerator::Feedback",
880 courseID => $courseName);
881 my $feedbackURL = $self->systemLink($feedbackPage, authen => 0); # no authen info for form action
525 882
526
527 } #print feedback form 883 #print feedback form
528
529
530 print 884 print
531 CGI::start_form(-method=>"POST", -action=>$feedbackURL),"\n", 885 CGI::start_form(-method=>"POST", -action=>$feedbackURL),"\n",
532 $self->hidden_authen_fields,"\n", 886 $self->hidden_authen_fields,"\n",
533 CGI::hidden("module", __PACKAGE__),"\n", 887 CGI::hidden("module", __PACKAGE__),"\n",
534 CGI::hidden("set", $set->set_id),"\n", 888 CGI::hidden("set", $set->set_id),"\n",
537 CGI::hidden("showOldAnswers", $will{showOldAnswers}),"\n", 891 CGI::hidden("showOldAnswers", $will{showOldAnswers}),"\n",
538 CGI::hidden("showCorrectAnswers", $will{showCorrectAnswers}),"\n", 892 CGI::hidden("showCorrectAnswers", $will{showCorrectAnswers}),"\n",
539 CGI::hidden("showHints", $will{showHints}),"\n", 893 CGI::hidden("showHints", $will{showHints}),"\n",
540 CGI::hidden("showSolutions", $will{showSolutions}),"\n", 894 CGI::hidden("showSolutions", $will{showSolutions}),"\n",
541 CGI::p({-align=>"left"}, 895 CGI::p({-align=>"left"},
542 CGI::submit(-name=>"feedbackForm", -label=>"Contact instructor") 896 CGI::submit(-name=>"feedbackForm", -label=>"Email instructor")
543 ), 897 ),
544 CGI::endform(),"\n"; 898 CGI::endform(),"\n";
545 899
546 # FIXME print editor link 900 # FIXME print editor link
547 # print editor link if the user is an instructor AND the file is not in temporary editing mode 901 print $editorLink; #empty unless it is appropriate to have an editor link.
548 if ($self->{permissionLevel}>=10 and ( (not defined($self->{edit_mode})) or $self->{edit_mode} eq 'savedFile') ) {
549 print CGI::a({-href=>"/webwork/$courseName/instructor/pgProblemEditor/".$set->set_id.
550 '/'.$problem->problem_id.'?'.$self->url_authen_args},'Edit this problem');
551 }
552 902
553 print CGI::end_div(); 903 print CGI::end_div();
554 904
555 # end answer inspection button
556 # warning output 905 # warning output
557 if ($pg->{warnings} ne "") { 906 #if ($pg->{warnings} ne "") {
558 print CGI::hr(), $self->warningOutput($pg->{warnings}); 907 # print CGI::hr(), $self->warningOutput($pg->{warnings});
559 } 908 #}
560 909
561 # debugging stuff 910 # debugging stuff
562 if (0) { 911 if (0) {
563 print 912 print
564 CGI::hr(), 913 CGI::hr(),
578 return ""; 927 return "";
579} 928}
580 929
581##### output utilities ##### 930##### output utilities #####
582 931
583sub attemptResults($$$$$$) { 932sub attemptResults {
584 my $self = shift; 933 my $self = shift;
585 my $pg = shift; 934 my $pg = shift;
586 my $showAttemptAnswers = shift; 935 my $showAttemptAnswers = shift;
587 my $showCorrectAnswers = shift; 936 my $showCorrectAnswers = shift;
588 my $showAttemptResults = $showAttemptAnswers && shift; 937 my $showAttemptResults = $showAttemptAnswers && shift;
589 my $showSummary = shift; 938 my $showSummary = shift;
590 my $showAttemptPreview = shift || 0; 939 my $showAttemptPreview = shift || 0;
940
941 my $ce = $self->r->ce;
942
591 my $problemResult = $pg->{result}; # the overall result of the problem 943 my $problemResult = $pg->{result}; # the overall result of the problem
592 my @answerNames = @{ $pg->{flags}->{ANSWER_ENTRY_ORDER} }; 944 my @answerNames = @{ $pg->{flags}->{ANSWER_ENTRY_ORDER} };
593 945
594 my $showMessages = $showAttemptAnswers && grep { $pg->{answers}->{$_}->{ans_message} } @answerNames; 946 my $showMessages = $showAttemptAnswers && grep { $pg->{answers}->{$_}->{ans_message} } @answerNames;
595 947
948 my $basename = "equation-" . $self->{set}->psvn. "." . $self->{problem}->problem_id . "-preview";
949 my $imgGen = WeBWorK::PG::ImageGenerator->new(
950 tempDir => $ce->{webworkDirs}->{tmp},
951 latex => $ce->{externalPrograms}->{latex},
952 dvipng => $ce->{externalPrograms}->{dvipng},
953 useCache => 1,
954 cacheDir => $ce->{webworkDirs}->{equationCache},
955 cacheURL => $ce->{webworkURLs}->{equationCache},
956 cacheDB => $ce->{webworkFiles}->{equationCacheDB},
957 );
958
959 my $header;
596 my $header = CGI::th("Part"); 960 #$header .= CGI::th("Part");
597 $header .= $showAttemptAnswers ? CGI::th("Entered") : ""; 961 $header .= $showAttemptAnswers ? CGI::th("Entered") : "";
598 $header .= $showAttemptPreview ? CGI::th("Answer Preview") : ""; 962 $header .= $showAttemptPreview ? CGI::th("Answer Preview") : "";
599 $header .= $showCorrectAnswers ? CGI::th("Correct") : ""; 963 $header .= $showCorrectAnswers ? CGI::th("Correct") : "";
600 $header .= $showAttemptResults ? CGI::th("Result") : ""; 964 $header .= $showAttemptResults ? CGI::th("Result") : "";
601 $header .= $showMessages ? CGI::th("messages") : ""; 965 $header .= $showMessages ? CGI::th("Messages") : "";
602 my @tableRows = ( $header ); 966 my @tableRows = ( $header );
603 my $numCorrect; 967 my $numCorrect;
604 foreach my $name (@answerNames) { 968 foreach my $name (@answerNames) {
605 my $answerResult = $pg->{answers}->{$name}; 969 my $answerResult = $pg->{answers}->{$name};
606 my $studentAnswer = $answerResult->{student_ans}; # original_student_ans 970 my $studentAnswer = $answerResult->{student_ans}; # original_student_ans
607 my $preview = ($showAttemptPreview 971 my $preview = ($showAttemptPreview
608 ? $self->previewAnswer($answerResult) 972 ? $self->previewAnswer($answerResult, $imgGen)
609 : ""); 973 : "");
610 my $correctAnswer = $answerResult->{correct_ans}; 974 my $correctAnswer = $answerResult->{correct_ans};
611 my $answerScore = $answerResult->{score}; 975 my $answerScore = $answerResult->{score};
612 my $answerMessage = $showMessages ? $answerResult->{ans_message} : ""; 976 my $answerMessage = $showMessages ? $answerResult->{ans_message} : "";
613 977 #FIXME --Can we be sure that $answerScore is an integer-- could the problem give partial credit?
614 $numCorrect += $answerScore > 0; 978 $numCorrect += $answerScore > 0;
615 my $resultString = $answerScore ? "correct" : "incorrect"; 979 my $resultString = $answerScore == 1 ? "correct" : "incorrect";
616 980
617 # get rid of the goofy prefix on the answer names (supposedly, the format 981 # get rid of the goofy prefix on the answer names (supposedly, the format
618 # of the answer names is changeable. this only fixes it for "AnSwEr" 982 # of the answer names is changeable. this only fixes it for "AnSwEr"
619 $name =~ s/^AnSwEr//; 983 #$name =~ s/^AnSwEr//;
620 984
985 my $row;
621 my $row = CGI::td($name); 986 #$row .= CGI::td($name);
622 $row .= $showAttemptAnswers ? CGI::td($studentAnswer) : ""; 987 $row .= $showAttemptAnswers ? CGI::td($self->nbsp($studentAnswer)) : "";
623 $row .= $showAttemptPreview ? CGI::td($preview) : ""; 988 $row .= $showAttemptPreview ? CGI::td($self->nbsp($preview)) : "";
624 $row .= $showCorrectAnswers ? CGI::td($correctAnswer) : ""; 989 $row .= $showCorrectAnswers ? CGI::td($self->nbsp($correctAnswer)) : "";
625 $row .= $showAttemptResults ? CGI::td($resultString) : ""; 990 $row .= $showAttemptResults ? CGI::td($self->nbsp($resultString)) : "";
626 $row .= $answerMessage ? CGI::td($answerMessage) : ""; 991 $row .= $showMessages ? CGI::td($self->nbsp($answerMessage)) : "";
627 push @tableRows, $row; 992 push @tableRows, $row;
628 } 993 }
629 994
995 # render equation images
996 $imgGen->render(refresh => 1);
997
630 my $numIncorrectNoun = scalar @answerNames == 1 ? "question" : "questions"; 998# my $numIncorrectNoun = scalar @answerNames == 1 ? "question" : "questions";
631 my $scorePercent = int ($problemResult->{score} * 100) . "\%"; 999 my $scorePercent = sprintf("%.0f%%", $problemResult->{score} * 100);
1000# FIXME -- I left the old code in in case we have to back out.
632 my $summary = "On this attempt, you answered $numCorrect out of " 1001# my $summary = "On this attempt, you answered $numCorrect out of "
633 . scalar @answerNames . " $numIncorrectNoun correct, for a score of $scorePercent."; 1002# . scalar @answerNames . " $numIncorrectNoun correct, for a score of $scorePercent.";
634 return CGI::table({-class=>"attemptResults"}, CGI::Tr(\@tableRows)) . ($showSummary ? CGI::p($summary) : ""); 1003 my $summary = "";
1004 if (scalar @answerNames == 1) {
1005 if ($numCorrect == scalar @answerNames) {
1006 $summary .= CGI::div({class=>"ResultsWithoutError"},"The above answer is correct.");
1007 } else {
1008 $summary .= CGI::div({class=>"ResultsWithError"},"The above answer is NOT correct.");
1009 }
1010 } else {
1011 if ($numCorrect == scalar @answerNames) {
1012 $summary .= CGI::div({class=>"ResultsWithoutError"},"All of the above answers are correct.");
1013 } else {
1014 $summary .= CGI::div({class=>"ResultsWithError"},"At least one of the above answers is NOT correct.");
1015 }
1016 }
1017
1018 return
1019 CGI::table({-class=>"attemptResults"}, CGI::Tr(\@tableRows))
1020 . ($showSummary ? CGI::p({class=>'emphasis'},$summary) : "");
635} 1021}
636 1022
1023#sub nbsp {
1024# my $str = shift;
1025# ($str =~/\S/) ? $str : '&nbsp;' ; # returns non-breaking space for empty strings
1026# # tricky cases: $str =0;
1027# # $str is a complex number
1028#}
1029
637sub viewOptions($) { 1030sub viewOptions {
638 my $self = shift; 1031 my ($self) = @_;
1032 my $ce = $self->r->ce;
1033
639 my $displayMode = $self->{displayMode}; 1034 my $displayMode = $self->{displayMode};
640 my %must = %{ $self->{must} }; 1035 my %must = %{ $self->{must} };
641 my %can = %{ $self->{can} }; 1036 my %can = %{ $self->{can} };
642 my %will = %{ $self->{will} }; 1037 my %will = %{ $self->{will} };
643 1038
647 CGI::checkbox( 1042 CGI::checkbox(
648 -name => "showOldAnswers", 1043 -name => "showOldAnswers",
649 -checked => $will{showOldAnswers}, 1044 -checked => $will{showOldAnswers},
650 -label => "Saved answers", 1045 -label => "Saved answers",
651 ), "&nbsp;&nbsp;".CGI::br(); 1046 ), "&nbsp;&nbsp;".CGI::br();
652 $can{showCorrectAnswers} and $optionLine .= join "", 1047
653 CGI::checkbox(
654 -name => "showCorrectAnswers",
655 -checked => $will{showCorrectAnswers},
656 -label => "Correct answers",
657 ), "&nbsp;&nbsp;".CGI::br();
658 $can{showHints} and $optionLine .= join "",
659 CGI::checkbox(
660 -name => "showHints",
661 -checked => $will{showHints},
662 -label => "Hints",
663 ), "&nbsp;&nbsp;".CGI::br();
664 $can{showSolutions} and $optionLine .= join "",
665 CGI::checkbox(
666 -name => "showSolutions",
667 -checked => $will{showSolutions},
668 -label => "Solutions",
669 ), "&nbsp;&nbsp;".CGI::br();
670 $optionLine and $optionLine .= join "", CGI::br(); 1048 $optionLine and $optionLine .= join "", CGI::br();
671 1049
672 return CGI::div({-style=>"border: thin groove; padding: 1ex; margin: 2ex align: left"}, 1050 my %display_modes = %{WeBWorK::PG::DISPLAY_MODES()};
1051 my @active_modes = grep { exists $display_modes{$_} }
1052 @{$ce->{pg}->{displayModes}};
1053 my $modeLine = (scalar(@active_modes)>1) ?
673 "View&nbsp;equations&nbsp;as:&nbsp;&nbsp;&nbsp;&nbsp;".CGI::br(), 1054 "View&nbsp;equations&nbsp;as:&nbsp;&nbsp;&nbsp;&nbsp;".CGI::br().
674 CGI::radio_group( 1055 CGI::radio_group(
675 -name => "displayMode", 1056 -name => "displayMode",
676 -values => ['plainText', 'formattedText', 'images'], 1057 -values => \@active_modes,
677 -default => $displayMode, 1058 -default => $displayMode,
678 -linebreak=>'true', 1059 -linebreak=>'true',
679 -labels => { 1060 -labels => {
680 plainText => "plain", 1061 plainText => "plain",
681 formattedText => "formatted", 1062 formattedText => "formatted",
682 images => "images", 1063 images => "images",
1064 jsMath => "jsMath",
1065 asciimath => "asciimath",
683 } 1066 },
684 ), CGI::br(),CGI::hr(), 1067 ). CGI::br().CGI::hr() : '';
1068
1069 return CGI::div({-style=>"border: thin groove; padding: 1ex; margin: 2ex align: left"},
1070 $modeLine,
685 $optionLine, 1071 $optionLine,
686 CGI::submit(-name=>"redisplay", -label=>"Save Options"), 1072 CGI::submit(-name=>"redisplay", -label=>"Save Options"),
687 ); 1073 );
688} 1074}
689 1075
690sub previewAnswer($$) { 1076sub previewAnswer {
691 my ($self, $answerResult) = @_; 1077 my ($self, $answerResult, $imgGen) = @_;
692 my $ce = $self->{ce}; 1078 my $ce = $self->r->ce;
693 my $effectiveUser = $self->{effectiveUser}; 1079 my $effectiveUser = $self->{effectiveUser};
694 my $set = $self->{set}; 1080 my $set = $self->{set};
695 my $problem = $self->{problem}; 1081 my $problem = $self->{problem};
696 my $displayMode = $self->{displayMode}; 1082 my $displayMode = $self->{displayMode};
697 1083
700 # so we'll just deal with each case explicitly here. there's some code 1086 # so we'll just deal with each case explicitly here. there's some code
701 # duplication that can be dealt with later by abstracting out tth/dvipng/etc. 1087 # duplication that can be dealt with later by abstracting out tth/dvipng/etc.
702 1088
703 my $tex = $answerResult->{preview_latex_string}; 1089 my $tex = $answerResult->{preview_latex_string};
704 1090
705 return "" if $tex eq ""; 1091 return "" unless defined $tex and $tex ne "";
706 1092
707 if ($displayMode eq "plainText") { 1093 if ($displayMode eq "plainText") {
708 return $tex; 1094 return $tex;
709 } elsif ($displayMode eq "formattedText") { 1095 } elsif ($displayMode eq "formattedText") {
710 my $tthCommand = $ce->{externalPrograms}->{tth} 1096 my $tthCommand = $ce->{externalPrograms}->{tth}
717 if ($?) { 1103 if ($?) {
718 return "<b>[tth failed: $? $@]</b>"; 1104 return "<b>[tth failed: $? $@]</b>";
719 } 1105 }
720 return $result; 1106 return $result;
721 } elsif ($displayMode eq "images") { 1107 } elsif ($displayMode eq "images") {
722 # how are we going to name this? 1108 $imgGen->add($tex);
723 my $targetPathCommon = "/png/" 1109 } elsif ($displayMode eq "jsMath") {
724 . $effectiveUser->user_id . "." 1110
725 . $set->set_id . "." 1111 return '<DIV CLASS="math">'.$tex.'</DIV>' ;
726 . $problem->problem_id . "." 1112
727 . $answerResult->{ans_name} . ".png"; 1113
728 1114
729 # figure out where to put things 1115
730 my $wd = tempdir("webwork-dvipng-XXXXXXXX", DIR => $ce->{courseDirs}->{html_temp});
731 my $latex = $ce->{externalPrograms}->{latex};
732 my $dvipng = $ce->{externalPrograms}->{dvipng};
733 my $targetPath = $ce->{courseDirs}->{html_temp} . $targetPathCommon;
734 # should use surePathToTmpFile, but we have to
735 # isolate it from the problem enivronment first
736 my $targetURL = $ce->{courseURLs}->{html_temp} . $targetPathCommon;
737
738 # call dvipng to generate a preview
739 dvipng($wd, $latex, $dvipng, $tex, $targetPath);
740 rmtree($wd, 0, 0);
741 if (-e $targetPath) {
742 return "<img src=\"$targetURL\" alt=\"$tex\" />";
743 } else {
744 return "<b>[math2img failed]</b>";
745 }
746 } 1116 }
747} 1117}
748
749sub options {
750 my $self=shift;
751 my $out;
752 $out .=join("",
753 CGI::startform("POST", $self->{r}->uri),
754 $self->hidden_authen_fields,
755 CGI::hr(),
756 CGI::start_div({class=>"viewOptions"}),
757 $self->viewOptions(),CGI::end_div(),
758 );
759return $out;
760
761}
762##### logging subroutine ####
763
764
765 1118
766##### permission queries ##### 1119##### permission queries #####
767 1120
768# this stuff should be abstracted out into the permissions system 1121# this stuff should be abstracted out into the permissions system
769# however, the permission system only knows about things in the 1122# however, the permission system only knows about things in the
770# course environment and the username. hmmm... 1123# course environment and the username. hmmm...
771 1124
772# also, i should fix these so that they have a consistent calling 1125# also, i should fix these so that they have a consistent calling
773# format -- perhaps: 1126# format -- perhaps:
774# canPERM($courseEnv, $user, $set, $problem, $permissionLevel) 1127# canPERM($ce, $user, $set, $problem, $permissionLevel)
775 1128
776sub canShowCorrectAnswers($$) { 1129sub canShowCorrectAnswers($$) {
777 my ($permissionLevel, $answerDate) = @_; 1130 my ($permissionLevel, $answerDate) = @_;
778 return $permissionLevel > 0 || time > $answerDate; 1131 return $permissionLevel > 0 || time > $answerDate;
779} 1132}
791 my $recordAnswers = $permHigh || ($timeOK && $attemptsOK); 1144 my $recordAnswers = $permHigh || ($timeOK && $attemptsOK);
792 return $recordAnswers; 1145 return $recordAnswers;
793} 1146}
794 1147
795sub canCheckAnswers($$) { 1148sub canCheckAnswers($$) {
796 my ($permissionLevel, $answerDate) = @_; 1149 my ($permissionLevel, $dueDate) = @_;
797 my $permHigh = $permissionLevel > 0; 1150 my $permHigh = $permissionLevel > 0;
798 my $timeOK = time >= $answerDate; 1151 my $timeOK = time >= $dueDate;
799 my $recordAnswers = $permHigh || $timeOK; 1152 my $recordAnswers = $permHigh || $timeOK;
800 return $recordAnswers; 1153 return $recordAnswers;
801} 1154}
802 1155
803sub mustRecordAnswers($) { 1156sub mustRecordAnswers($) {
804 my ($permissionLevel) = @_; 1157 my ($permissionLevel) = @_;
805 return $permissionLevel == 0; 1158 return $permissionLevel == 0;
806} 1159}
807 1160
1161
1162# FIXME: does this even get used?
1163sub submiterror {
1164 my $self = shift;
1165 my $submiterror = (defined($self->{submiterror}) ) ? $self->{submiterror} : '';
1166 $submiterror;
1167}
8081; 11681;

Legend:
Removed from v.942  
changed lines
  Added in v.2278

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9