Annotation of loncom/homework/inputtags.pm, revision 1.74

1.43      albertel    1: # The LearningOnline Network with CAPA
                      2: # input  definitons
1.47      albertel    3: #
1.74    ! sakharuk    4: # $Id: inputtags.pm,v 1.73 2002/11/08 20:34:10 sakharuk Exp $
1.47      albertel    5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
1.43      albertel   28: # 2/19 Guy 
1.1       albertel   29: 
                     30: package Apache::inputtags;
1.55      albertel   31: use HTML::Entities();
1.1       albertel   32: use strict;
                     33: 
1.50      harris41   34: BEGIN {
1.65      bowersj2   35:   &Apache::lonxml::register('Apache::inputtags',('textfield','textline'));
1.1       albertel   36: }
                     37: 
1.43      albertel   38: 
1.1       albertel   39: sub initialize_inputtags {
1.43      albertel   40:   # list of current input ids
                     41:   @Apache::inputtags::input=();
                     42:   # list of all input ids seen in this problem
                     43:   @Apache::inputtags::inputlist=();
                     44:   # list of all current response ids
                     45:   @Apache::inputtags::response=();
                     46:   # list of all response ids seen in this problem
                     47:   @Apache::inputtags::responselist=();
                     48:   # list of whether or not a specific response was previously used
                     49:   @Apache::inputtags::previous=();
                     50:   # id of current part, 0 means that no part is current (inside <problem> only
                     51:   $Apache::inputtags::part='';
1.46      albertel   52:   # list of problem date statuses, the first element is for <problem>
                     53:   # if there is a second element it is for the current <part>
1.43      albertel   54:   @Apache::inputtags::status=();
1.46      albertel   55:   # hash of defined params for the current response
1.43      albertel   56:   %Apache::inputtags::params=();
1.46      albertel   57:   # list of all ids, for <import>, these get join()ed and prepended
                     58:   @Apache::inputtags::import=();
1.1       albertel   59: }
                     60: 
1.14      albertel   61: sub start_input {
1.43      albertel   62:   my ($parstack,$safeeval)=@_;
                     63:   my $id = &Apache::lonxml::get_param('id',$parstack,$safeeval);
                     64:   if ($id eq '') { $id = $Apache::lonxml::curdepth; }
                     65:   push (@Apache::inputtags::input,$id);
                     66:   push (@Apache::inputtags::inputlist,$id);
                     67:   return $id;
1.14      albertel   68: }
                     69: 
                     70: sub end_input {
1.43      albertel   71:   pop @Apache::inputtags::input;
                     72:   return '';
1.14      albertel   73: }
                     74: 
1.48      albertel   75: sub start_textfield {
1.43      albertel   76:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                     77:   my $result = "";
                     78:   my $id = &start_input($parstack,$safeeval);
1.55      albertel   79:   my $resid=$Apache::inputtags::response[-1];
1.43      albertel   80:   if ($target eq 'web') {
1.57      albertel   81:     $Apache::lonxml::evaluate--;
1.45      albertel   82:     if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
1.61      albertel   83: 	my $partid=$Apache::inputtags::part;
                     84: 	my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"});
                     85: 	my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
                     86: 	if ( $cols eq '') { $cols = 80; }
                     87: 	my $rows = &Apache::lonxml::get_param('rows',$parstack,$safeeval);
                     88: 	if ( $rows eq '') { $rows = 10; }
                     89: 	$result= '<textarea name="HWVAL'.$resid.'" '.
                     90: 	    "rows=\"$rows\" cols=\"$cols\">".$oldresponse;
                     91: 	if ($oldresponse ne '') {
                     92: 	    #get rid of any startup text if the user has already responded
                     93: 	    &Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
                     94: 	}
1.45      albertel   95:     } else {
1.61      albertel   96: 	#right or wrong don't show it
                     97: 	#$result='<table border="1"><tr><td><i>'.$oldresponse.'</i></td></tr></table>';
                     98: 	$result='';
                     99: 	#get rid of any startup text
                    100: 	&Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
1.51      albertel  101:     }
1.60      albertel  102:   } elsif ($target eq 'grade') {
1.51      albertel  103:     my $seedtext=&Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
1.55      albertel  104:     if ($seedtext eq $ENV{'form.HWVAL'.$resid}) {
1.51      albertel  105:       # if the seed text is still there it wasn't a real submission
1.55      albertel  106:       $ENV{'form.HWVAL'.$resid}='';
1.30      albertel  107:     }
1.60      albertel  108:   } elsif ($target eq 'edit') {
                    109:     $result.=&Apache::edit::tag_start($target,$token);
                    110:     $result.=&Apache::edit::text_arg('Rows:','rows',$token,4);
                    111:     $result.=&Apache::edit::text_arg('Columns:','cols',$token,4);
                    112:     my $bodytext=&Apache::lonxml::get_all_text("/textfield",$$parser[-1]);
1.62      albertel  113:     $result.=&Apache::edit::editfield($token->[1],$bodytext,'Text you want to appear by default:',80,2);
1.60      albertel  114:   } elsif ($target eq 'modified') {
                    115:     my $constructtag=&Apache::edit::get_new_args($token,$parstack,
                    116: 						 $safeeval,'rows','cols');
                    117:     if ($constructtag) {
                    118:       $result = &Apache::edit::rebuild_tag($token);
                    119:     } else {
                    120:       $result=$token->[4];
                    121:     }
                    122:     $result.=&Apache::edit::modifiedfield();
1.43      albertel  123:   }
                    124:   return $result;
1.6       albertel  125: }
                    126: 
1.48      albertel  127: sub end_textfield {
1.43      albertel  128:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.60      albertel  129:   my $result;
1.43      albertel  130:   if ($target eq 'web') {
1.57      albertel  131:     $Apache::lonxml::evaluate++;
1.45      albertel  132:     if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
                    133:       return "</textarea>";
                    134:     }
1.60      albertel  135:   } elsif ($target eq 'edit') {
                    136:     $result=&Apache::edit::end_table();
1.45      albertel  137:   }
1.43      albertel  138:   &end_input;
1.60      albertel  139:   return $result;
1.6       albertel  140: }
                    141: 
1.1       albertel  142: sub start_textline {
1.43      albertel  143:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
                    144:   my $result = "";
                    145:   if ($target eq 'web') {
1.57      albertel  146:     $Apache::lonxml::evaluate--;
1.45      albertel  147:     if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
1.61      albertel  148:       my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
1.72      albertel  149:       my $maxlength;
                    150:       if ($size eq '') { $size=20; } else {
                    151: 	if ($size < 20) { $maxlength=$size; }
                    152:       }
1.61      albertel  153:       my $partid=$Apache::inputtags::part;
                    154:       my $id=$Apache::inputtags::response[-1];
                    155:       my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"});
1.73      sakharuk  156:       if ($Apache::lonhomework::type ne 'exam') {
                    157:         $result= '<input type="text" name="HWVAL'.$id.'" value="'.
                    158: 	    $oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />';
                    159:       }
1.45      albertel  160:     } else {
1.61      albertel  161:       #right or wrong don't show what was last typed in.
                    162:       #$result='<i>'.$oldresponse.'</i>';
                    163:       $result='';
1.45      albertel  164:     }
1.44      albertel  165:   } elsif ($target eq 'edit') {
1.49      matthew   166:     $result=&Apache::edit::tag_start($target,$token);
1.43      albertel  167:     $result.=&Apache::edit::text_arg('Size:','size',$token,'5')."</td></tr>";
                    168:     $result.=&Apache::edit::end_table;
1.44      albertel  169:   } elsif ($target eq 'modified') {
1.43      albertel  170:     my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'size');
                    171:     if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
1.74    ! sakharuk  172:   } elsif ($target eq 'tex') {
        !           173:       $result='\framebox[1cm][s]{\hfill}';
1.43      albertel  174:   }
                    175:   return $result;
1.1       albertel  176: }
                    177: 
                    178: sub end_textline {
1.43      albertel  179:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
1.57      albertel  180:   if    ($target eq 'web') { $Apache::lonxml::evaluate++; }
                    181:   elsif ($target eq 'edit') { return ('','no'); }
1.43      albertel  182:   return "";
1.9       albertel  183: }
                    184: 
                    185: sub finalizeawards {
1.43      albertel  186:   my $result='';
                    187:   my $award;
                    188:   if ($#_ == '-1') { $result = "NO_RESPONSE"; }
                    189:   if ($result eq '' ) {
1.54      albertel  190:     my $blankcount;
                    191:     foreach $award (@_) {
                    192:       if ($award eq '') {
                    193: 	$result='MISSING_ANSWER';
                    194: 	$blankcount++;
                    195:       }
                    196:     }
                    197:     if ($blankcount == ($#_ + 1)) { $result = 'NO_RESPONSE'; }
1.56      albertel  198:   }
                    199:   if ($result eq '' ) {
                    200:     foreach $award (@_) { if ($award eq 'MISSING_ANSWER') {$result='MISSING_ANSWER'; last;}}
1.43      albertel  201:   }
                    202:   if ($result eq '' ) {
                    203:     foreach $award (@_) { if ($award eq 'ERROR') {$result='ERROR'; last;}}
                    204:   }
                    205:   if ($result eq '' ) {
                    206:     foreach $award (@_) { if ($award eq 'NO_RESPONSE') {$result='NO_RESPONSE'; last;} }
                    207:   }
                    208: 
                    209:   if ($result eq '' ) {
                    210:     foreach $award (@_) { 
                    211:       if ($award eq 'UNIT_FAIL' ||
                    212: 	  $award eq 'NO_UNIT' ||
                    213: 	  $award eq 'UNIT_NOTNEEDED') {
                    214: 	$result=$award; last;
                    215:       }
                    216:     }
                    217:   }
                    218:   if ($result eq '' ) {
                    219:     foreach $award (@_) { 
                    220:       if ($award eq 'WANTED_NUMERIC' || 
                    221: 	  $award eq 'BAD_FORMULA') {$result=$award; last;}
                    222:     }
                    223:   }
                    224:   if ($result eq '' ) {
                    225:     foreach $award (@_) { if ($award eq 'SIG_FAIL') {$result=$award; last;} }
                    226:   }
                    227:   if ($result eq '' ) {
                    228:     foreach $award (@_) { if ($award eq 'INCORRECT') {$result=$award; last;} }
                    229:   }
                    230:   if ($result eq '' ) {
1.59      ng        231:     foreach $award (@_) { if ($award eq 'DRAFT') {$result=$award; last;} }
                    232:   }
                    233:   if ($result eq '' ) {
1.43      albertel  234:     foreach $award (@_) { if ($award eq 'SUBMITTED') {$result=$award; last;} }
                    235:   }
                    236:   if ($result eq '' ) {
                    237:     foreach $award (@_) { if ($award eq 'APPROX_ANS') {$result=$award; last;} }
                    238:   }
                    239:   if ($result eq '' ) { $result='EXACT_ANS'; }
                    240:   return $result
1.9       albertel  241: }
                    242: 
1.10      albertel  243: sub decideoutput {
1.68      sakharuk  244:   my ($award,$solved,$previous,$target)=@_;
1.43      albertel  245:   my $message='';
                    246:   my $button=0;
                    247:   my $previousmsg;
                    248: 
                    249:   if ($previous) { $previousmsg='You have entered that answer before'; }
                    250: 
                    251:   if      ($solved =~ /^correct/) {
1.68      sakharuk  252:     if ($target eq 'tex') {
                    253:       $message = '\textbf{You are correct}. Your receipt is '.
1.43      albertel  254:       &Apache::lonnet::receipt;
1.68      sakharuk  255:     } else {
                    256:       $message = "<b>You are correct.</b> Your receipt is ".
                    257:       &Apache::lonnet::receipt;
                    258:     }
1.43      albertel  259:     $button=0;
                    260:     $previousmsg='';
                    261:   } elsif ($solved =~ /^excused/) {
                    262:     $message = "<b>You are excused from the problem.</b>";
                    263:     $button=0;
                    264:     $previousmsg='';
                    265:   } elsif ($award eq 'EXACT_ANS' || $award eq 'APPROX_ANS' ) {
                    266:     if ($solved =~ /^incorrect/ || $solved eq '') {
                    267:       $message = "Incorrect";
                    268:       $button=1;
1.37      albertel  269:     } else {
1.43      albertel  270:       $message = "<b>You are correct.</b> Your receipt is ".
                    271: 	&Apache::lonnet::receipt;
                    272:       $button=0;
                    273:       $previousmsg='';
                    274:     }
                    275:   } elsif ($award eq 'NO_RESPONSE') {
                    276:     $message = '';
                    277:     $button=1;
                    278:   } elsif ($award eq 'MISSING_ANSWER') {
                    279:     $message = 'Some parts were not submitted';
                    280:     $button = 1;
                    281:   } elsif ($award eq 'WANTED_NUMERIC') {
                    282:     $message = "This question expects a numeric answer";
                    283:     $button=1;
                    284:   } elsif ($award eq 'SIG_FAIL') {
                    285:     $message = "Please adjust significant figures.";# you provided %s significant figures";
                    286:     $button=1;
                    287:   } elsif ($award eq 'UNIT_FAIL') {
                    288:     $message = "Units incorrect."; #Computer reads units as %s";
                    289:     $button=1;
                    290:   } elsif ($award eq 'UNIT_NOTNEEDED') {
                    291:     $message = "Only a number required.";# Computer reads units of %s";
                    292:     $button=1;
                    293:   } elsif ($award eq 'NO_UNIT') {
                    294:     $message = "Units required";
                    295:     $button=1;
                    296:   } elsif ($award eq 'BAD_FORMULA') {
                    297:     $message = "Unable to understand formula";
                    298:     $button=1;
                    299:   } elsif ($award eq 'INCORRECT') {
                    300:     $message = "Incorrect";
                    301:     $button=1;
                    302:   } elsif ($award eq 'SUBMITTED') {
                    303:     $message = "Your submission has been recorded.";
                    304:     $button=1;
1.59      ng        305:   } elsif ($award eq 'DRAFT') {
                    306:     $message = "A draft copy has been saved.";
                    307:     $button=1;
1.43      albertel  308:   } else {
                    309:     $message = "Unknown message: $award";
                    310:     $button=1;
                    311:   }
                    312:   return ($button,$message,$previousmsg);
1.12      albertel  313: }
                    314: 
                    315: sub setgradedata {
1.43      albertel  316:   my ($award,$id,$previously_used) = @_;
                    317:   # if the student already has it correct, don't modify the status
1.71      albertel  318:   if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
                    319:       $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') {
1.53      albertel  320:     $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award;
                    321:     return '';
                    322:   } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~
1.43      albertel  323:        /^correct/ ) {
                    324:     #handle assignment of tries and solved status
1.53      albertel  325:     if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
                    326:       $Apache::lonhomework::results{"resource.$id.afterduedate"}='';
                    327:     }
1.43      albertel  328:     if ( $award eq 'APPROX_ANS' || $award eq 'EXACT_ANS' ) {
                    329:       $Apache::lonhomework::results{"resource.$id.tries"} =
                    330: 	$Apache::lonhomework::history{"resource.$id.tries"} + 1;
                    331:       $Apache::lonhomework::results{"resource.$id.solved"} =
                    332: 	'correct_by_student';
                    333:       $Apache::lonhomework::results{"resource.$id.awarded"} = '1';
                    334:     } elsif ( $award eq 'INCORRECT' ) {
                    335:       $Apache::lonhomework::results{"resource.$id.tries"} =
                    336: 	$Apache::lonhomework::history{"resource.$id.tries"} + 1;
                    337:       $Apache::lonhomework::results{"resource.$id.solved"} =
1.59      ng        338: 	'incorrect_attempted'
1.43      albertel  339:     } elsif ( $award eq 'SUBMITTED' ) {
                    340:       $Apache::lonhomework::results{"resource.$id.tries"} =
                    341: 	$Apache::lonhomework::history{"resource.$id.tries"} + 1;
                    342:       $Apache::lonhomework::results{"resource.$id.solved"} =
                    343: 	'ungraded_attempted';
1.59      ng        344:     } elsif ( $award eq 'DRAFT' ) {
                    345:       $Apache::lonhomework::results{"resource.$id.solved"} = '';
1.43      albertel  346:     } elsif ( $award eq 'NO_RESPONSE' ) {
                    347:       return '';
                    348:     } else {
                    349:       $Apache::lonhomework::results{"resource.$id.solved"} =
                    350: 	'incorrect_attempted';
                    351:     }
                    352: 
                    353:     # check if this was a previous submission if it was delete the
                    354:     # unneeded data and update the previously_used attribute
                    355:     if ( $previously_used eq 'PREVIOUSLY_USED') {
                    356:       delete($Apache::lonhomework::results{"resource.$id.tries"});
                    357:       $Apache::lonhomework::results{"resource.$id.previous"} = '1';
                    358:     } elsif ( $previously_used eq 'PREVIOUSLY_LAST') {
1.58      ng        359:       #delete all data as they student didn't do anything, but save
                    360:       #the list of collaborators.
1.43      albertel  361:       foreach my $key (keys(%Apache::lonhomework::results)) {
1.58      ng        362: 	if (($key =~ /^resource\.$id\./) && ($key !~ /\.collaborators$/)) {
1.43      albertel  363: 	  &Apache::lonxml::debug("Removing $key");
1.63      sakharuk  364:   delete($Apache::lonhomework::results{$key});
1.43      albertel  365: 	}
                    366:       }
                    367:       #and since they didn't do anything we were never here
                    368:       return '';
                    369:     } else {
                    370:       $Apache::lonhomework::results{"resource.$id.previous"} = '0';
1.40      albertel  371:     }
1.43      albertel  372:   }
                    373:   $Apache::lonhomework::results{"resource.$id.award"} = $award;
1.10      albertel  374: }
                    375: 
1.9       albertel  376: sub grade {
1.43      albertel  377:   my ($target) = @_;
                    378:   my $id = $Apache::inputtags::part;
                    379:   my $response='';
                    380:   if ( defined $ENV{'form.submitted'}) {
                    381:     my @awards = ();
                    382:     foreach $response (@Apache::inputtags::responselist) {
                    383:       &Apache::lonxml::debug("looking for response.$id.$response.awarddetail");
                    384:       my $value=$Apache::lonhomework::results{"resource.$id.$response.awarddetail"};
1.54      albertel  385:       &Apache::lonxml::debug("keeping $value from $response for $id");
                    386:       push (@awards,$value);
1.43      albertel  387:     }
                    388:     my $finalaward = &finalizeawards(@awards);
                    389:     my $previously_used;
                    390:     if ( $#Apache::inputtags::previous eq $#awards ) {
                    391:       $previously_used = 'PREVIOUSLY_LAST';
                    392:       foreach my $value (@Apache::inputtags::previous) {
                    393: 	if ($value eq 'PREVIOUSLY_USED' ) {
                    394: 	  $previously_used = $value;
                    395: 	  last;
                    396: 	}
                    397:       }
                    398:     }
                    399:     &Apache::lonxml::debug("final award $finalaward, $previously_used");
                    400:     &setgradedata($finalaward,$id,$previously_used);
                    401:   }
                    402:   return '';
1.1       albertel  403: }
                    404: 
1.11      albertel  405: sub gradestatus {
1.63      sakharuk  406:   my ($id,$target) = @_;
1.43      albertel  407:   my $showbutton = 1;
                    408:   my $message = '';
1.53      albertel  409:   my $latemessage = '';
1.43      albertel  410:   my $trystr='';
                    411:   my $button='';
                    412:   my $previousmsg='';
                    413: 
                    414:   my $status = $Apache::inputtags::status['-1'];
                    415:   &Apache::lonxml::debug("gradestatus has :$status:");
                    416:   if ( $status ne 'CLOSED' ) {  
                    417:     my $award = $Apache::lonhomework::history{"resource.$id.award"};
                    418:     my $solved = $Apache::lonhomework::history{"resource.$id.solved"};
                    419:     my $previous = $Apache::lonhomework::history{"resource.$id.previous"};
                    420:     &Apache::lonxml::debug("Found Award |$award|$solved|");
                    421:     if ( $award ne '' ) {
                    422:       &Apache::lonxml::debug('Getting message');
                    423:       ($showbutton,$message,$previousmsg) =
1.68      sakharuk  424: 	&decideoutput($award,$solved,$previous,$target);
1.63      sakharuk  425:       if ($target eq 'tex') {
                    426: 	$message=' '.$message.' ';
                    427:       } else {
                    428: 	$message="<td bgcolor=\"#aaffaa\">$message</td>";
                    429: 	if ($previousmsg) {
                    430: 	  $previousmsg="<td bgcolor=\"#ffaaaa\">$previousmsg</td>";
                    431: 	}
1.43      albertel  432:       }
                    433:     }
                    434:     my $tries = $Apache::lonhomework::history{"resource.$id.tries"};
                    435:     my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");
                    436:     &Apache::lonxml::debug("got maxtries of :$maxtries:");
                    437:     if ( $tries eq '' ) { $tries = '0'; }
                    438:     if ( $maxtries eq '' ) { $maxtries = '2'; } 
                    439:     if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } 
                    440:     if ( $showbutton ) {
1.63      sakharuk  441:       if ($target eq 'tex') {
1.69      sakharuk  442: 	  if ($ENV{'request.state'} ne "construct") {
1.70      sakharuk  443: 	      $trystr = ' {\small \textit{Tries} '.$tries.'/'.$maxtries.'} \vskip 0 mm ';
1.67      sakharuk  444: 	  }
1.63      sakharuk  445:       } else {
                    446:          $trystr = "<td>Tries $tries/$maxtries</td>";
                    447:       }
1.43      albertel  448:     }
                    449:     if ( $status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER') {$showbutton = 0;}
                    450:     if ( $showbutton ) { 
1.63      sakharuk  451:       if ($target ne 'tex') {
                    452:         $button = '<br /><input type="submit" name="submit" value="Submit Answer" />';
                    453:       }
1.43      albertel  454:     }
1.53      albertel  455:     if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
                    456:       #last submissions was after due date
1.63      sakharuk  457:       if ($target eq 'tex') {
                    458: 	  $latemessage=' The last submission was after the Due Date ';
                    459:       } else {
                    460:         $latemessage="<td bgcolor=\"#ffaaaa\">The last submission was after the Due Date</td>";
                    461:       }
1.53      albertel  462:     }
1.43      albertel  463:   }
1.53      albertel  464:   my $output= $previousmsg.$latemessage.$message.$trystr;
1.43      albertel  465:   if ($output =~ /^\s*$/) {
                    466:     return $button;
                    467:   } else {
1.63      sakharuk  468:     if ($target eq 'tex') {
                    469:       return $button.' \vskip 0 mm '.$output.' ';
                    470:     } else {
                    471:       return $button.'<table><tr>'.$output.'</tr></table>';
                    472:     }
1.43      albertel  473:   }
1.11      albertel  474: }
1.1       albertel  475: 1;
                    476: __END__
1.43      albertel  477:  

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>