Diff for /loncom/homework/inputtags.pm between versions 1.166 and 1.175

version 1.166, 2005/04/08 19:39:32 version 1.175, 2005/09/09 18:45:56
Line 46  sub initialize_inputtags { Line 46  sub initialize_inputtags {
     @Apache::inputtags::response=();      @Apache::inputtags::response=();
     # list of all response ids seen in this problem      # list of all response ids seen in this problem
     @Apache::inputtags::responselist=();      @Apache::inputtags::responselist=();
       # list of all current hint ids
       @Apache::inputtags::hint=();
       # list of all hint ids seen in this problem
       @Apache::inputtags::hintlist=();
     # list of whether or not a specific response was previously used      # list of whether or not a specific response was previously used
     @Apache::inputtags::previous=();      @Apache::inputtags::previous=();
     # submission it was used in      # submission it was used in
Line 75  sub check_for_duplicate_ids { Line 79  sub check_for_duplicate_ids {
     my %check;      my %check;
     foreach my $id (@Apache::inputtags::partlist,      foreach my $id (@Apache::inputtags::partlist,
     @Apache::inputtags::responselist,      @Apache::inputtags::responselist,
       @Apache::inputtags::hintlist,
     @Apache::inputtags::importlist) {      @Apache::inputtags::importlist) {
  $check{$id}++;   $check{$id}++;
     }      }
Line 235  sub start_textline { Line 240  sub start_textline {
     }      }
  } else {   } else {
     #right or wrong don't show what was last typed in.      #right or wrong don't show what was last typed in.
     $result='<i>'.$Apache::inputtags::answertxt{$id}.'</i>';      $result='<b>'.$Apache::inputtags::answertxt{$id}.'</b>';
     #$result='';      #$result='';
  }   }
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
Line 301  sub end_hiddenline { Line 306  sub end_hiddenline {
 # $which -> 'uploadedonly'  -> only newly uploaded files  # $which -> 'uploadedonly'  -> only newly uploaded files
 #           'portfolioonly' -> only allow files from portfolio  #           'portfolioonly' -> only allow files from portfolio
 #           'both' -> allow files from either location  #           'both' -> allow files from either location
   # $extratext -> additional text to go between the link and the input box
 # returns a table row <tr>   # returns a table row <tr> 
 sub file_selector {  sub file_selector {
     my ($part,$id,$uploadedfiletypes,$which)=@_;      my ($part,$id,$uploadedfiletypes,$which,$extratext)=@_;
     if (!$uploadedfiletypes) { return ''; }      if (!$uploadedfiletypes) { return ''; }
   
       my $jspart=$part;
       $jspart=~s/\./_/g;
   
     my $result;      my $result;
           
     $result.='<tr><td>';      $result.='<tr><td>';
Line 315  sub file_selector { Line 325  sub file_selector {
     if ($which eq 'uploadonly' || $which eq 'both') {       if ($which eq 'uploadonly' || $which eq 'both') { 
  $result.=&mt('Submit a file: (only one file can be uploaded)').   $result.=&mt('Submit a file: (only one file can be uploaded)').
     ' <br /><input type="file" size="50" name="HWFILE'.      ' <br /><input type="file" size="50" name="HWFILE'.
     $part.'_'.$id.'" /><br />';      $jspart.'_'.$id.'" /><br />';
  my $uploadedfile= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.uploadedfile"},'<>&"');   my $uploadedfile= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.uploadedfile"},'<>&"');
   
  if ($uploadedfile) {   if ($uploadedfile) {
Line 334  sub file_selector { Line 344  sub file_selector {
  $result.='<br />'.'<strong>'.&mt('OR:').'</strong><br />';   $result.='<br />'.'<strong>'.&mt('OR:').'</strong><br />';
     }      }
     if ($which eq 'portfolioonly' || $which eq 'both') {       if ($which eq 'portfolioonly' || $which eq 'both') { 
  $result.='<a href='."'".'javascript:void(window.open("/adm/portfolio?mode=selectfile&amp;fieldname=HWPORT'.$part.'_'.$id.'","cat","height=600,width=800,scrollbars=1,resizable=1,menubar=2,location=1"))'."'".'>'.   $result.=$extratext.'<a href='."'".'javascript:void(window.open("/adm/portfolio?mode=selectfile&amp;fieldname=HWPORT'.$jspart.'_'.$id.'","cat","height=600,width=800,scrollbars=1,resizable=1,menubar=2,location=1"))'."'".'>'.
     &mt('Select Portfolio Files').'</a><br />'.      &mt('Select Portfolio Files').'</a><br />'.
     '<input type="text" size="50" name="HWPORT'.$part.'_'.$id.'" value="" />'.      '<input type="text" size="50" name="HWPORT'.$jspart.'_'.$id.'" value="" />'.
     '<br />';      '<br />';
  if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"}=~/[^\s]/){   if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"}=~/[^\s]/){
     my @filelist;      my @filelist;
Line 397  sub finalizeawards { Line 407  sub finalizeawards {
 }  }
   
 sub decideoutput {  sub decideoutput {
     my ($award,$awardmsg,$solved,$previous,$target)=@_;      my ($award,$awarded,$awardmsg,$solved,$previous,$target)=@_;
     my $message='';      my $message='';
     my $button=0;      my $button=0;
     my $previousmsg;      my $previousmsg;
Line 409  sub decideoutput { Line 419  sub decideoutput {
   'not_charged_try' => '#ffffaa',    'not_charged_try' => '#ffffaa',
   'no_message' => '#fffff',    'no_message' => '#fffff',
   );    );
   
     if ($previous) { $previousmsg=&mt('You have entered that answer before'); }      if ($previous) { $previousmsg=&mt('You have entered that answer before'); }
           
     if      ($solved =~ /^correct/) {      if      ($solved =~ /^correct/) {
  if ($award eq 'ASSIGNED_SCORE') {   $bgcolor=$possiblecolors{'correct'};
    $message=&mt('You are correct.');
    if ($awarded < 1 && $awarded > 0) {
       $message=&mt('You are partially correct.');
       $bgcolor=$possiblecolors{'not_charged_try'};
    } elsif ($awarded < 1) {
       $message=&mt('Incorrect.');
       $bgcolor=$possiblecolors{'charged_try'};
    }
    if ($env{'request.filename'} =~ 
       m|/res/lib/templates/examupload.problem$|) {
     $message = &mt("A score has been assigned.");      $message = &mt("A score has been assigned.");
       $added_computer_text=1;
  } else {   } else {
     if ($target eq 'tex') {      if ($target eq 'tex') {
  $message = '\textbf{'.&mt('You are correct.').'}';   $message = '\textbf{'.$message.'}';
     } else {      } else {
  $message = "<b>".&mt('You are correct.')."</b>";   $message = "<b>".$message."</b>";
  $message.=" ".&mt("Computer's answer now shown above.");   $message.=" ".&mt("Computer's answer now shown above.");
     }      }
     $added_computer_text=1;      $added_computer_text=1;
Line 430  sub decideoutput { Line 452  sub decideoutput {
     (($target eq 'web')?&Apache::loncommon::help_open_topic('Receipt'):'');      (($target eq 'web')?&Apache::loncommon::help_open_topic('Receipt'):'');
     }      }
  }   }
  $bgcolor=$possiblecolors{'correct'};  
  $button=0;   $button=0;
  $previousmsg='';   $previousmsg='';
     } elsif ($solved =~ /^excused/) {      } elsif ($solved =~ /^excused/) {
Line 783  sub gradestatus { Line 804  sub gradestatus {
     if ( $status ne 'CLOSED' && $status ne 'UNAVAILABLE' &&      if ( $status ne 'CLOSED' && $status ne 'UNAVAILABLE' &&
  $status ne 'INVALID_ACCESS') {     $status ne 'INVALID_ACCESS') {  
  my $award = $Apache::lonhomework::history{"resource.$id.award"};   my $award = $Apache::lonhomework::history{"resource.$id.award"};
    my $awarded = $Apache::lonhomework::history{"resource.$id.awarded"};
  my $solved = $Apache::lonhomework::history{"resource.$id.solved"};   my $solved = $Apache::lonhomework::history{"resource.$id.solved"};
  my $previous = $Apache::lonhomework::history{"resource.$id.previous"};   my $previous = $Apache::lonhomework::history{"resource.$id.previous"};
  my $awardmsg = $Apache::lonhomework::history{"resource.$id.awardmsg"};   my $awardmsg = $Apache::lonhomework::history{"resource.$id.awardmsg"};
Line 790  sub gradestatus { Line 812  sub gradestatus {
  if ( $award ne '' || $solved ne '' || $status eq 'SHOW_ANSWER') {   if ( $award ne '' || $solved ne '' || $status eq 'SHOW_ANSWER') {
     &Apache::lonxml::debug('Getting message');      &Apache::lonxml::debug('Getting message');
     ($showbutton,$bgcolor,$message,$previousmsg) =      ($showbutton,$bgcolor,$message,$previousmsg) =
  &decideoutput($award,$awardmsg,$solved,$previous,$target);   &decideoutput($award,$awarded,$awardmsg,$solved,$previous,
         $target);
     if ($target eq 'tex') {      if ($target eq 'tex') {
  $message='\vskip 2 mm '.$message.' ';   $message='\vskip 2 mm '.$message.' ';
     } else {      } else {

Removed from v.1.166  
changed lines
  Added in v.1.175


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