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

version 1.159, 2005/03/15 16:50:19 version 1.160, 2005/03/31 21:24:29
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>'.
    &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);
    $filelist.='<a href="'.$url.'"><img src="'.$icon.
       '" border="0" />'.$file.'</a>';
       }
       $result.=&mt("Portfolio files previously selected: <strong>[_1]</strong>",$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++) {

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


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