Diff for /loncom/homework/inputtags.pm between versions 1.164 and 1.168

version 1.164, 2005/04/05 15:39:41 version 1.168, 2005/06/20 19:54:28
Line 30  use HTML::Entities(); Line 30  use HTML::Entities();
 use strict;  use strict;
 use Apache::loncommon;  use Apache::loncommon;
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::lonnet;
   
 BEGIN {  BEGIN {
     &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline'));      &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline'));
Line 148  sub start_textfield { Line 149  sub start_textfield {
  }   }
     } elsif ($target eq 'grade') {      } elsif ($target eq 'grade') {
  my $seedtext=&Apache::lonxml::get_all_text("/textfield",$parser);   my $seedtext=&Apache::lonxml::get_all_text("/textfield",$parser);
  if ($seedtext eq $ENV{'form.HWVAL_'.$resid}) {   if ($seedtext eq $env{'form.HWVAL_'.$resid}) {
     # if the seed text is still there it wasn't a real submission      # if the seed text is still there it wasn't a real submission
     $ENV{'form.HWVAL_'.$resid}='';      $env{'form.HWVAL_'.$resid}='';
  }   }
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
  $result.=&Apache::edit::tag_start($target,$token);   $result.=&Apache::edit::tag_start($target,$token);
Line 234  sub start_textline { Line 235  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 304  sub end_hiddenline { Line 305  sub end_hiddenline {
 sub file_selector {  sub file_selector {
     my ($part,$id,$uploadedfiletypes,$which)=@_;      my ($part,$id,$uploadedfiletypes,$which)=@_;
     if (!$uploadedfiletypes) { return ''; }      if (!$uploadedfiletypes) { return ''; }
   
       my $jspart=$part;
       $jspart=~s/\./_/g;
   
     my $result;      my $result;
           
     $result.='<tr><td>';      $result.='<tr><td>';
Line 314  sub file_selector { Line 319  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 333  sub file_selector { Line 338  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.='<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 421  sub decideoutput { Line 426  sub decideoutput {
  $message.=" ".&mt("Computer's answer now shown above.");   $message.=" ".&mt("Computer's answer now shown above.");
     }      }
     $added_computer_text=1;      $added_computer_text=1;
     unless ($ENV{'course.'.      unless ($env{'course.'.
      $ENV{'request.course.id'}.       $env{'request.course.id'}.
      '.disable_receipt_display'} eq 'yes') {        '.disable_receipt_display'} eq 'yes') { 
  $message.=(($target eq 'web')?'<br />':' ').   $message.=(($target eq 'web')?'<br />':' ').
     &mt('Your receipt is').' '.&Apache::lonnet::receipt($Apache::inputtags::part).      &mt('Your receipt is').' '.&Apache::lonnet::receipt($Apache::inputtags::part).
Line 454  sub decideoutput { Line 459  sub decideoutput {
  $message.=" ".&mt("Computer's answer now shown above.");   $message.=" ".&mt("Computer's answer now shown above.");
     }      }
     $added_computer_text=1;      $added_computer_text=1;
     unless ($ENV{'course.'.      unless ($env{'course.'.
      $ENV{'request.course.id'}.       $env{'request.course.id'}.
      '.disable_receipt_display'} eq 'yes') {        '.disable_receipt_display'} eq 'yes') { 
  $message.=(($target eq 'web')?'<br />':' ').   $message.=(($target eq 'web')?'<br />':' ').
     'Your receipt is '.&Apache::lonnet::receipt($Apache::inputtags::part).      'Your receipt is '.&Apache::lonnet::receipt($Apache::inputtags::part).
Line 493  sub decideoutput { Line 498  sub decideoutput {
  $bgcolor=$possiblecolors{'not_charged_try'};   $bgcolor=$possiblecolors{'not_charged_try'};
  $button=1;   $button=1;
     } elsif ($award eq 'INVALID_FILETYPE') {      } elsif ($award eq 'INVALID_FILETYPE') {
  $message = &mt('The filetype extension of the file you uploaded is not allowed.');   $message = &mt('Submission won\'t be graded. The type of file submitted is not allowed.');
  $bgcolor=$possiblecolors{'not_charged_try'};   $bgcolor=$possiblecolors{'not_charged_try'};
  $button=1;   $button=1;
     } elsif ($award eq 'SIG_FAIL') {      } elsif ($award eq 'SIG_FAIL') {
Line 609  sub hidealldata { Line 614  sub hidealldata {
 sub setgradedata {  sub setgradedata {
     my ($award,$msg,$id,$previously_used) = @_;      my ($award,$msg,$id,$previously_used) = @_;
     if ($Apache::lonhomework::scantronmode &&       if ($Apache::lonhomework::scantronmode && 
  &Apache::lonnet::validCODE($ENV{'form.CODE'})) {   &Apache::lonnet::validCODE($env{'form.CODE'})) {
  $Apache::lonhomework::results{"resource.CODE"}=$ENV{'form.CODE'};   $Apache::lonhomework::results{"resource.CODE"}=$env{'form.CODE'};
     } elsif ($Apache::lonhomework::scantronmode &&       } elsif ($Apache::lonhomework::scantronmode && 
      $ENV{'form.CODE'} eq '' &&       $env{'form.CODE'} eq '' &&
      $Apache::lonhomework::history{"resource.CODE"} ne '') {       $Apache::lonhomework::history{"resource.CODE"} ne '') {
  $Apache::lonhomework::results{"resource.CODE"}='';   $Apache::lonhomework::results{"resource.CODE"}='';
     }      }
Line 729  sub grade { Line 734  sub grade {
     my ($target) = @_;      my ($target) = @_;
     my $id = $Apache::inputtags::part;      my $id = $Apache::inputtags::part;
     my $response='';      my $response='';
     if ( defined $ENV{'form.submitted'}) {      if ( defined $env{'form.submitted'}) {
  my (@awards,@msgs);   my (@awards,@msgs);
  foreach $response (@Apache::inputtags::response) {   foreach $response (@Apache::inputtags::response) {
     &Apache::lonxml::debug("looking for response.$id.$response.awarddetail");      &Apache::lonxml::debug("looking for response.$id.$response.awarddetail");
Line 814  sub gradestatus { Line 819  sub gradestatus {
  }   }
  if ( $showbutton ) {   if ( $showbutton ) {
     if ($target eq 'tex') {      if ($target eq 'tex') {
  if ($ENV{'request.state'} ne "construct" && $Apache::lonhomework::type ne 'exam' && $ENV{'form.suppress_tries'} ne 'yes') {   if ($env{'request.state'} ne "construct" && $Apache::lonhomework::type ne 'exam' && $env{'form.suppress_tries'} ne 'yes') {
     $trystr = ' {\vskip 1 mm \small \textit{'.$tries_text.'} '.$tries.'/'.$maxtries.'} \vskip 2 mm ';      $trystr = ' {\vskip 1 mm \small \textit{'.$tries_text.'} '.$tries.'/'.$maxtries.'} \vskip 2 mm ';
  } else {   } else {
     $trystr = '\vskip 0 mm ';      $trystr = '\vskip 0 mm ';
Line 822  sub gradestatus { Line 827  sub gradestatus {
     } else {      } else {
  $trystr = "<td><nobr>".$tries_text." $tries";   $trystr = "<td><nobr>".$tries_text." $tries";
  if ($Apache::lonhomework::parsing_a_task) {   if ($Apache::lonhomework::parsing_a_task) {
  } elsif($ENV{'request.state'} ne 'construct') {   } elsif($env{'request.state'} ne 'construct') {
     $trystr.="/$maxtries";      $trystr.="/$maxtries";
  } else {   } else {
     if (defined($Apache::inputtags::params{'maxtries'})) {      if (defined($Apache::inputtags::params{'maxtries'})) {

Removed from v.1.164  
changed lines
  Added in v.1.168


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