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

version 1.159, 2005/03/15 16:50:19 version 1.164, 2005/04/05 15:39:41
Line 294  sub end_hiddenline { Line 294  sub end_hiddenline {
     return "";      return "";
 }  }
   
   # $part -> partid
   # $id -> responseid
   # $uploadefiletypes -> comma seperated list of extensions allowed or * for any
   # $which -> 'uploadedonly'  -> only newly uploaded files
   #           'portfolioonly' -> only allow files from portfolio
   #           'both' -> allow files from either location
   # returns a table row <tr> 
   sub file_selector {
       my ($part,$id,$uploadedfiletypes,$which)=@_;
       if (!$uploadedfiletypes) { return ''; }
       my $result;
       
       $result.='<tr><td>';
       if ($uploadedfiletypes ne '*') {
    $result.=
       &mt('Allowed filetypes: <b>[_1]</b>',$uploadedfiletypes).'<br />';
       }
       if ($which eq 'uploadonly' || $which eq 'both') { 
    $result.=&mt('Submit a file: (only one file can be uploaded)').
       ' <br /><input type="file" size="50" name="HWFILE'.
       $part.'_'.$id.'" /><br />';
    my $uploadedfile= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.uploadedfile"},'<>&"');
   
    if ($uploadedfile) {
       my $url=$Apache::lonhomework::history{"resource.$part.$id.uploadedurl"};
       push (@Apache::lonxml::extlinks,$url);
       &Apache::lonnet::allowuploaded('/adm/essayresponse',$url);
       my $icon=&Apache::loncommon::icon($url);
       my $curfile='<a href="'.$url.'"><img src="'.$icon.
    '" border="0" />'.$uploadedfile.'</a>';
       $result.=&mt('Currently submitted: <tt>[_1]</tt>',$curfile);
    } else {
       #$result.=&mt('(Hand in a file you have prepared on your computer)');
    }
       }
       if ( $which eq 'both') { 
    $result.='<br />'.'<strong>'.&mt('OR:').'</strong><br />';
       }
       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"))'."'".'>'.
       &mt('Select Portfolio Files').'</a><br />'.
       '<input type="text" size="50" name="HWPORT'.$part.'_'.$id.'" value="" />'.
       '<br />';
    if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"}=~/[^\s]/){
       my @filelist;
       foreach my $file (split(',',&Apache::lonnet::unescape($Apache::lonhomework::history{"resource.$part.$id.portfiles"}))) {
    my (undef,undef,$domain,$user)=&Apache::lonxml::whichuser();
    my $url="/uploaded/$domain/$user/portfolio$file";
    my $icon=&Apache::loncommon::icon($url);
    push(@filelist,'<a href="'.$url.'"><img src="'.$icon.
        '" border="0" />'.$file.'</a>');
       }
       $result.=&mt("Portfolio files previously selected: <strong>[_1]</strong>",join(', ',@filelist));
    }
       }
       $result.='</td></tr>'; 
       return $result;
   }
   
 sub checkstatus {  sub checkstatus {
     my ($value,$awardref,$msgref)=@_;      my ($value,$awardref,$msgref)=@_;
     for (my $i=0;$i<=$#$awardref;$i++) {      for (my $i=0;$i<=$#$awardref;$i++) {
Line 749  sub gradestatus { Line 808  sub gradestatus {
  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=&mt('Tries');
  if ( $Apache::lonhomework::type eq 'survey') { $tries_text=&mt('Submissions'); }   if ( $Apache::lonhomework::type eq 'survey' ||
        $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" && $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') {
Line 759  sub gradestatus { Line 821  sub gradestatus {
  }   }
     } else {      } else {
  $trystr = "<td><nobr>".$tries_text." $tries";   $trystr = "<td><nobr>".$tries_text." $tries";
  if($ENV{'request.state'} ne 'construct') {   if ($Apache::lonhomework::parsing_a_task) {
    } elsif($ENV{'request.state'} ne 'construct') {
     $trystr.="/$maxtries";      $trystr.="/$maxtries";
  } else {   } else {
     if (defined($Apache::inputtags::params{'maxtries'})) {      if (defined($Apache::inputtags::params{'maxtries'})) {
Line 777  sub gradestatus { Line 840  sub gradestatus {
  }   }
  if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {   if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
     #last submissions was after due date      #last submissions was after due date
     if ($target eq 'tex') {      $latemessage=&mt(' The last submission was after the Due Date ');;
  $latemessage=' The last submission was after the Due Date ';      if ($target eq 'web') {
     } else {   $latemessage='<td bgcolor="#ffaaaa">'.$latemessage.'</td>';
  $latemessage="<td bgcolor=\"#ffaaaa\">The last submission was after the Due Date</td>";  
     }      }
  }   }
     }      }

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


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