version 1.226, 2003/11/21 20:21:20
|
version 1.234, 2004/02/12 19:07:12
|
Line 37 use Apache::lonnet;
|
Line 37 use Apache::lonnet;
|
use Apache::File(); |
use Apache::File(); |
use Apache::lonmenu; |
use Apache::lonmenu; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonxml; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext', |
&Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext', |
Line 186 sub problem_edit_header {
|
Line 187 sub problem_edit_header {
|
<input type="submit" name="problemmode" value="'.&mt('EditXML').'" /> |
<input type="submit" name="problemmode" value="'.&mt('EditXML').'" /> |
<input type="submit" name="Undo" value="'.&mt('undo').'" /> <hr /> |
<input type="submit" name="Undo" value="'.&mt('undo').'" /> <hr /> |
<input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" /> |
<input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" /> |
<input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" /><br /><p> </p><table border="0"><tr><td bgcolor="#DDDDDD"> |
<input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" /><table><tr><td>'. |
'; |
&Apache::loncommon::help_open_topic('Problem_Editor_XML_Index', |
|
'Problem Editing Help').'</td><td>'. |
|
&Apache::loncommon::help_open_faq(5). |
|
&Apache::loncommon::help_open_bug('Authoring').'</td></tr></table>'. |
|
'<table border="0"><tr><td bgcolor="#DDDDDD">'; |
} |
} |
|
|
sub problem_edit_footer { |
sub problem_edit_footer { |
Line 208 sub problem_web_to_edit_header {
|
Line 213 sub problem_web_to_edit_header {
|
onChange="javascript:document.lonhomework.changerandseed.click()" /></nobr> |
onChange="javascript:document.lonhomework.changerandseed.click()" /></nobr> |
<input type="checkbox" name="showallfoils" '; |
<input type="checkbox" name="showallfoils" '; |
if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; } |
if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; } |
$result.= ' />'.&mt(' Show All Foils').' |
$result.= ' />'.&mt(' Show All Foils'). |
<hr />'; |
&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems'). |
|
'<hr />'; |
my $numtoanalyze=$ENV{'form.numtoanalyze'}; |
my $numtoanalyze=$ENV{'form.numtoanalyze'}; |
if (!$numtoanalyze) { $numtoanalyze=20; } |
if (!$numtoanalyze) { $numtoanalyze=20; } |
$result.= '<input type="submit" name="problemmode" value='. |
$result.= '<input type="submit" name="problemmode" value='. |
Line 429 sub start_problem {
|
Line 435 sub start_problem {
|
} |
} |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web') { |
my $name= &get_resource_name($parstack,$safeeval); |
my $name= &get_resource_name($parstack,$safeeval); |
if ($status eq 'CAN_ANSWER') { |
$result.="$head_tag_start<title>$name</title></head> |
# create a page header and exit |
|
$result.="$head_tag_start<title>$name</title></head> |
|
$body_tag_start \n $form_tag_start". |
$body_tag_start \n $form_tag_start". |
'<input type="hidden" name="submitted" value="yes" />'; |
'<input type="hidden" name="submitted" value="yes" />'; |
if ($ENV{'request.state'} eq "construct") { |
# create a page header and exit |
$result.= &problem_web_to_edit_header($ENV{'form.rndseed'}); |
if ($ENV{'request.state'} eq "construct") { |
} |
$result.= &problem_web_to_edit_header($ENV{'form.rndseed'}); |
# if we are viewing someone else preserve that info |
} |
if (defined $ENV{'form.grade_symb'}) { |
# if we are viewing someone else preserve that info |
foreach my $field ('symb','courseid','domain','username') { |
if (defined $ENV{'form.grade_symb'}) { |
$result .= '<input type="hidden" name="grade_'.$field. |
foreach my $field ('symb','courseid','domain','username') { |
'" value="'.$ENV{"form.grade_$field"}.'" />'."\n"; |
$result .= '<input type="hidden" name="grade_'.$field. |
} |
'" value="'.$ENV{"form.grade_$field"}.'" />'."\n"; |
} |
} |
} elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' |
|
|| $status eq 'CLOSED' || $status eq 'UNAVALAILABLE' || |
|
$status eq 'INVALID_ACCESS') { |
|
$result.=$head_tag_start. |
|
"<title>$name</title></head>\n$body_tag_start\n"; |
|
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
my $startminipage = ''; |
my $startminipage = ''; |
Line 461 sub start_problem {
|
Line 460 sub start_problem {
|
my @packages = split /,/,$packages; |
my @packages = split /,/,$packages; |
my $allow_print_points = 0; |
my $allow_print_points = 0; |
foreach my $partial_key (@packages) { |
foreach my $partial_key (@packages) { |
if ($partial_key=~m/part_0/) { |
if ($partial_key=~m/^part_0$/) { |
$allow_print_points=1; |
$allow_print_points=1; |
} |
} |
} |
} |
Line 477 sub start_problem {
|
Line 476 sub start_problem {
|
my @due_file_content = <$temp_file>; |
my @due_file_content = <$temp_file>; |
my $due_file_content = $due_file_content[$#due_file_content]; |
my $due_file_content = $due_file_content[$#due_file_content]; |
chomp $due_file_content; |
chomp $due_file_content; |
my $name_of_resourse= &get_resource_name($parstack,$safeeval); |
my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval)); |
if ($due_file_content ne $duedate) { |
if ($due_file_content ne $duedate) { |
$temp_file = Apache::File->new('>'.$filename); |
$temp_file = Apache::File->new('>'.$filename); |
print $temp_file "$duedate\n"; |
print $temp_file "$duedate\n"; |
Line 524 sub end_problem {
|
Line 523 sub end_problem {
|
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
$target eq 'tex') { |
$target eq 'tex') { |
if ( $target eq 'grade' && $Apache::inputtags::part eq '0' && |
if ( $target eq 'grade' && $Apache::inputtags::part eq '0' && |
$status eq 'CAN_ANSWER' ) { |
($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode)) { |
# if part is zero, no <part>s existed, so we need to the grading |
# if part is zero, no <part>s existed, so we need to the grading |
&Apache::inputtags::grade; |
&Apache::inputtags::grade; |
} elsif ( ($target eq 'web' || $target eq 'tex') && |
} elsif ( ($target eq 'web' || $target eq 'tex') && |
Line 539 sub end_problem {
|
Line 538 sub end_problem {
|
(($target eq 'web') && ($ENV{'request.state'} ne 'construct')) || |
(($target eq 'web') && ($ENV{'request.state'} ne 'construct')) || |
($target eq 'answer') || ($target eq 'tex') |
($target eq 'answer') || ($target eq 'tex') |
) { |
) { |
if ($status eq 'CAN_ANSWER') { |
if ($target ne 'tex' && |
if ($target ne 'tex' && |
$ENV{'form.answer_output_mode'} ne 'tex') { |
$ENV{'form.answer_output_mode'} ne 'tex') { |
$result.="</form></body>\n"; |
$result.="</form></body>\n"; |
|
} |
|
} elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' || |
|
$status eq 'UNCHECKEDOUT' || $status eq 'INVALID_ACCESS') { |
|
if ($target ne 'tex' && |
|
$ENV{'form.answer_output_mode'} ne 'tex') { |
|
$result.="</body>\n"; |
|
} |
|
} |
} |
if ($target eq 'web') { |
if ($target eq 'web') { |
$result.=&Apache::lonxml::xmlend(); |
$result.=&Apache::lonxml::xmlend(); |
Line 984 sub start_part {
|
Line 975 sub start_part {
|
$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; |
$result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; |
} |
} |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys'); |
my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'packages'); |
my @allkeys = split /,/,$allkeys; |
my @allkeys = split /,/,$allkeys; |
my $allow_print_points = 0; |
my $allow_print_points = 0; |
foreach my $partial_key (@allkeys) { |
foreach my $partial_key (@allkeys) { |
if ($partial_key=~m/\_(\d*)\_weight/) { |
if ($partial_key=~m/^part_(.*)$/) { |
if ($1 ne '0') {$allow_print_points=1;} |
if ($1 ne '0') {$allow_print_points=1;} |
} |
} |
} |
} |
if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
|
} elsif ($target eq 'web') { |
|
$result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />'; |
} |
} |
} |
} |
} |
} |
Line 1024 sub end_part {
|
Line 1017 sub end_part {
|
my $result=''; |
my $result=''; |
if ( $target eq 'meta' ) { |
if ( $target eq 'meta' ) { |
$result=''; |
$result=''; |
} elsif ( $target eq 'grade' && $status eq 'CAN_ANSWER' && !$hidden) { |
} elsif ($target eq 'grade' && |
|
($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) && |
|
!$hidden) { |
$result=&Apache::inputtags::grade; |
$result=&Apache::inputtags::grade; |
} elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) { |
} elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) { |
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part, |
my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part, |
Line 1059 sub end_preduedate {
|
Line 1054 sub end_preduedate {
|
|
|
sub start_postanswerdate { |
sub start_postanswerdate { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
if ($target eq 'web' || $target eq 'grade' || $target eq 'tex') { |
if ($target eq 'web' || $target eq 'grade') { |
if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { |
if ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { |
&Apache::lonxml::get_all_text("/postanswerdate",$parser); |
&Apache::lonxml::get_all_text("/postanswerdate",$parser); |
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
return '\vskip 0 mm \noindent'; |
&Apache::lonxml::get_all_text("/postanswerdate",$parser); |
} |
} |
return ''; |
return ''; |
} |
} |