version 1.158, 2005/03/01 03:23:16
|
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&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++) { |
Line 429 sub decideoutput {
|
Line 485 sub decideoutput {
|
} elsif ($award eq 'MISORDERED_RANK') { |
} elsif ($award eq 'MISORDERED_RANK') { |
$message = &mt('You have provided an invalid ranking'); |
$message = &mt('You have provided an invalid ranking'); |
if ($target ne 'tex') { |
if ($target ne 'tex') { |
$message.=', '.&mt('please refer to').' '.&Apache::loncommon::help_open_topic('Ranking_Problems','help on ranking problems').'.'; |
$message.=', '.&mt('please refer to').' '.&Apache::loncommon::help_open_topic('Ranking_Problems','help on ranking problems'); |
} |
} |
$bgcolor=$possiblecolors{'not_charged_try'}; |
$bgcolor=$possiblecolors{'not_charged_try'}; |
$button=1; |
$button=1; |