Diff for /loncom/homework/inputtags.pm between versions 1.262 and 1.263

version 1.262, 2010/06/05 01:38:43 version 1.263, 2010/06/06 21:42:04
Line 1255  sub get_grade_messages { Line 1255  sub get_grade_messages {
     if ( $tries eq '' ) { $tries = '0'; }      if ( $tries eq '' ) { $tries = '0'; }
     if ( $maxtries eq '' ) { $maxtries = '2'; }       if ( $maxtries eq '' ) { $maxtries = '2'; } 
     if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; }       if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } 
     my $tries_text=&mt('Tries');      my $tries_text= &get_tries_text();;
     if ( $Apache::lonhomework::type eq 'survey' ||  
          $Apache::lonhomework::type eq 'surveycred' ||  
          $Apache::lonhomework::type eq 'anonsurvey' ||  
          $Apache::lonhomework::type eq 'anonsurveycred' ||  
  $Apache::lonhomework::parsing_a_task) {  
  $tries_text=&mt('Submissions');  
     }  
   
     if ($showbutton) {      if ($showbutton) {
  if ($target eq 'tex') {   if ($target eq 'tex') {
     if ($env{'request.state'} ne "construct"      if ($env{'request.state'} ne "construct"
Line 1275  sub get_grade_messages { Line 1267  sub get_grade_messages {
  $trystr = '\vskip 0 mm ';   $trystr = '\vskip 0 mm ';
     }      }
  } else {   } else {
     $trystr = '<td><span class="LC_nobreak">'.$tries_text." $tries";      $trystr = '<td><span class="LC_nobreak">'.&mt($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";
Line 1362  sub previous_tries { Line 1354  sub previous_tries {
   
     foreach my $i (1..$Apache::lonhomework::history{'version'}) {      foreach my $i (1..$Apache::lonhomework::history{'version'}) {
  my $prefix = $i.":resource.$id";   my $prefix = $i.":resource.$id";
           my $is_anon; 
           if (defined($env{'form.grade_symb'})) {
               if (($Apache::lonhomework::history{"$prefix.type"} eq 'anonsurvey') || 
                   ($Apache::lonhomework::history{"$prefix.type"} eq 'anonsurveycred')) {
                   $is_anon = 1;
               }
           }
  next if (!exists($Apache::lonhomework::history{"$prefix.award"}));   next if (!exists($Apache::lonhomework::history{"$prefix.award"}));
  $count++;   $count++;
  $count_lookup{$i} = $count;   $count_lookup{$i} = $count;
Line 1407  sub previous_tries { Line 1405  sub previous_tries {
     $submission =       $submission = 
  $Apache::lonhomework::history{"$prefix.submission"};   $Apache::lonhomework::history{"$prefix.submission"};
  }   }
  $output.='<td>'.$submission.'</td>';                  if ($is_anon) {
                       $output.='<td>'.&mt('(only shown to submitter)').'</td>';
                   } else {
       $output.='<td>'.$submission.'</td>';
                   }
     } else {      } else {
  $output.='<td></td>';   $output.='<td></td>';
     }      }
Line 1425  sub previous_tries { Line 1427  sub previous_tries {
     $output.='<br /><form action=""><center><input type="button" name="close" value="'.&mt('Close Window').'" onClick="window.close()" /></center></form>';      $output.='<br /><form action=""><center><input type="button" name="close" value="'.&mt('Close Window').'" onClick="window.close()" /></center></form>';
   
     my $windowopen=&Apache::lonhtmlcommon::javascript_docopen();      my $windowopen=&Apache::lonhtmlcommon::javascript_docopen();
       my $tries_text = &get_tries_text('link');
     my $start_page =      my $start_page =
  &Apache::loncommon::start_page('Previous Tries', undef,   &Apache::loncommon::start_page($tries_text, undef,
        {'only_body'      => 1,         {'only_body'      => 1,
  'bgcolor'        => '#FFFFFF',   'bgcolor'        => '#FFFFFF',
  'js_ready'       => 1,   'js_ready'       => 1,
Line 1441  sub previous_tries { Line 1444  sub previous_tries {
 // <![CDATA[  // <![CDATA[
     function $function_name() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('$start_page $output $end_page');newWindow.document.close();newWindow.focus()}      function $function_name() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('$start_page $output $end_page');newWindow.document.close();newWindow.focus()}
 // ]]>  // ]]>
 </script><a href=\"javascript:$function_name();void(0);\">".&mt("Previous Tries")."</a><br />";  </script><a href=\"javascript:$function_name();void(0);\">".&mt($tries_text)."</a><br />";
     #use Data::Dumper;      #use Data::Dumper;
     #&Apache::lonnet::logthis(&Dumper(\%Apache::inputtags::submission_display));      #&Apache::lonnet::logthis(&Dumper(\%Apache::inputtags::submission_display));
     return $result;      return $result;
 }  }
   
   sub get_tries_text {
       my ($context) = @_;
       my $tries_text;
       if ($context eq 'link') {
           $tries_text = 'Previous Tries';
       } else {
           $tries_text = 'Tries';
       }
       if ( $Apache::lonhomework::type eq 'survey' ||
            $Apache::lonhomework::type eq 'surveycred' ||
            $Apache::lonhomework::type eq 'anonsurvey' ||
            $Apache::lonhomework::type eq 'anonsurveycred' ||
            $Apache::lonhomework::parsing_a_task) {
           if ($context eq 'link') {
               $tries_text = 'Previous Submissions';
           } else {
               $tries_text = 'Submissions';
           }
       }
       return $tries_text;
   }
   
 1;  1;
 __END__  __END__
   

Removed from v.1.262  
changed lines
  Added in v.1.263


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