version 1.186, 2006/01/04 05:56:16
|
version 1.189, 2006/03/09 00:43:05
|
Line 222 sub end_textfield {
|
Line 222 sub end_textfield {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub exam_box { |
|
my ($target) = @_; |
|
my $result; |
|
|
|
if ($target eq 'tex') { |
|
$result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}'; |
|
my $repetition = &Apache::response::repetition(); |
|
$result.='\begin{enumerate}'; |
|
foreach my $i (0..$repetition-1) { |
|
$result.='\item[\textbf{'. |
|
($Apache::lonxml::counter+$i). |
|
'}.]\textit{Leave blank on scoring form}\vskip 0 mm'; |
|
} |
|
$result.= '\end{enumerate}'; |
|
|
|
} elsif ($target eq 'web') { |
|
my $id=$Apache::inputtags::response[-1]; |
|
$result.= '<br /><br /> |
|
<textarea name="HWVAL_'.$id.'" rows="4" cols="50"> |
|
</textarea> <br /><br />'; |
|
} |
|
return $result; |
|
} |
|
|
|
sub needs_exam_box { |
|
my ($tagstack) = @_; |
|
my @tags = ('formularesponse', |
|
'stringresponse', |
|
'reactionresponse', |
|
'organicresponse', |
|
'imageresponse', |
|
); |
|
|
|
foreach my $tag (@tags) { |
|
if (grep(/\Q$tag\E/,@$tagstack)) { |
|
return 1; |
|
} |
|
} |
|
return 0; |
|
} |
|
|
sub start_textline { |
sub start_textline { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $result = ""; |
my $result = ""; |
Line 252 sub start_textline {
|
Line 293 sub start_textline {
|
$result.= '<input type="text" '.$readonly.' name="HWVAL_'.$id.'" value="'. |
$result.= '<input type="text" '.$readonly.' name="HWVAL_'.$id.'" value="'. |
$oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />'; |
$oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />'; |
} |
} |
|
if ($Apache::lonhomework::type eq 'exam' |
|
&& &needs_exam_box($tagstack)) { |
|
$result.=&exam_box($target); |
|
} |
} 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='<b>'.$Apache::inputtags::answertxt{$id}.'</b>'; |
$result='<b>'.$Apache::inputtags::answertxt{$id}.'</b>'; |
Line 271 sub start_textline {
|
Line 316 sub start_textline {
|
$safeeval,'size', |
$safeeval,'size', |
'addchars','readonly'); |
'addchars','readonly'); |
if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); } |
if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); } |
} elsif ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') { |
} elsif ($target eq 'tex' |
|
&& $Apache::lonhomework::type ne 'exam') { |
my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval); |
my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval); |
if ($size != 0) {$size=$size*2; $size.=' mm';} else {$size='40 mm';} |
if ($size != 0) {$size=$size*2; $size.=' mm';} else {$size='40 mm';} |
$result='\framebox['.$size.'][s]{\tiny\strut}'; |
$result='\framebox['.$size.'][s]{\tiny\strut}'; |
|
|
|
} elsif ($target eq 'tex' |
|
&& $Apache::lonhomework::type eq 'exam' |
|
&& &needs_exam_box($tagstack)) { |
|
$result.=&exam_box($target); |
} |
} |
return $result; |
return $result; |
} |
} |
Line 304 sub start_hiddenline {
|
Line 355 sub start_hiddenline {
|
$result=&Apache::edit::tag_start($target,$token); |
$result=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::end_table; |
$result.=&Apache::edit::end_table; |
} |
} |
|
|
|
if ( ($target eq 'web' || $target eq 'tex') |
|
&& $Apache::lonhomework::type eq 'exam' |
|
&& &needs_exam_box($tagstack)) { |
|
$result.=&exam_box($target); |
|
} |
return $result; |
return $result; |
} |
} |
|
|
Line 363 sub file_selector {
|
Line 420 sub file_selector {
|
'<input type="text" size="50" name="HWPORT'.$jspart.'_'.$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,@bad_file_list); |
foreach my $file (split(',',&Apache::lonnet::unescape($Apache::lonhomework::history{"resource.$part.$id.portfiles"}))) { |
foreach my $file (split(',',&Apache::lonnet::unescape($Apache::lonhomework::history{"resource.$part.$id.portfiles"}))) { |
my (undef,undef,$domain,$user)=&Apache::lonxml::whichuser(); |
my (undef,undef,$domain,$user)=&Apache::lonxml::whichuser(); |
my $url="/uploaded/$domain/$user/portfolio$file"; |
my $url="/uploaded/$domain/$user/portfolio$file"; |
my $icon=&Apache::loncommon::icon($url); |
my $icon=&Apache::loncommon::icon($url); |
push(@filelist,'<a href="'.$url.'"><img src="'.$icon. |
push(@filelist,'<a href="'.$url.'"><img src="'.$icon. |
'" border="0" />'.$file.'</a>'); |
'" border="0" />'.$file.'</a>'); |
|
if (! &Apache::lonnet::stat_file($url)) { |
|
push(@bad_file_list,'<a href="'.$url.'"><img src="'.$icon. |
|
'" border="0" />'.$file.'</a>'); |
|
} |
} |
} |
$result.=&mt("Portfolio files previously selected: <strong>[_1]</strong>",join(', ',@filelist)); |
$result.=&mt("Portfolio files previously selected: <strong>[_1]</strong>",join(', ',@filelist)); |
|
if (@bad_file_list) { |
|
$result.='<br />'.&mt('<font color="red">These file(s) don\'t exist:</font> <strong>[_1]</strong>',join(', ',@bad_file_list)); |
|
} |
} |
} |
} |
} |
$result.='</td></tr>'; |
$result.='</td></tr>'; |