version 1.169, 2003/05/09 22:24:05
|
version 1.178, 2003/05/27 18:58:51
|
Line 38 use Apache::File();
|
Line 38 use Apache::File();
|
use Apache::lonmenu; |
use Apache::lonmenu; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::structuretags',('block','languageblock','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')); |
} |
} |
|
|
sub start_web { |
sub start_web { |
Line 146 sub setup_rndseed {
|
Line 146 sub setup_rndseed {
|
$ENV{'form.rndseed'}=$rndseed; |
$ENV{'form.rndseed'}=$rndseed; |
} |
} |
} |
} |
if ($ENV{'form.resetdata'} eq 'New Problem Variation') { |
if ($ENV{'form.resetdata'} eq 'New Problem Variation' || |
|
$ENV{'form.newrandomization'} eq 'New Randomization') { |
$rndseed=time; |
$rndseed=time; |
|
if ($rndseed eq $ENV{'form.rndseed'}) { |
|
srand($rndseed); |
|
$rndseed=int(rand(1000000000)); |
|
} |
$ENV{'form.rndseed'}=$rndseed; |
$ENV{'form.rndseed'}=$rndseed; |
} |
} |
&Apache::lonxml::debug("Setting rndseed to $rndseed"); |
&Apache::lonxml::debug("Setting rndseed to $rndseed"); |
Line 177 sub problem_web_to_edit_header {
|
Line 182 sub problem_web_to_edit_header {
|
my $result.='<input type="hidden" name="problemmode" value="View" /> |
my $result.='<input type="hidden" name="problemmode" value="View" /> |
<input type="submit" name="problemmode" value="Edit" /> |
<input type="submit" name="problemmode" value="Edit" /> |
<input type="submit" name="problemmode" value="EditXML" /> |
<input type="submit" name="problemmode" value="EditXML" /> |
Random Seed:<input type="text" name="rndseed" width="10" value="'. |
<input type="submit" name="newrandomization" value="New Randomization" /> |
$rndseed.'" /> |
|
<input type="submit" name="changerandseed" value="Change" /> |
|
<input type="submit" name="resetdata" value="Reset Submissions" /> |
<input type="submit" name="resetdata" value="Reset Submissions" /> |
|
<nobr><input type="submit" name="changerandseed" value="Change Random Seed To:" /> |
|
<input type="text" name="rndseed" width="10" value="'. |
|
$rndseed.'" |
|
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.= ' /> Show All Foils |
$result.= ' /> Show All Foils |
<hr />'; |
<hr />'; |
my $numtoanalyze=$ENV{'form.numtoanalyze'}; |
my $numtoanalyze=$ENV{'form.numtoanalyze'}; |
if (!$numtoanalyze) { $numtoanalyze=100; } |
if (!$numtoanalyze) { $numtoanalyze=20; } |
$result.= '<input type="submit" name="problemmode" value="Answer Distribution" /> |
$result.= '<input type="submit" name="problemmode" value="Calculate answers" /> for |
<input type="text" name="numtoanalyze" value="'. |
<input type="text" name="numtoanalyze" value="'. |
$numtoanalyze.'" size="5" /> <hr />'; |
$numtoanalyze.'" size="5" /> versions of this problem.'. |
|
&Apache::loncommon::help_open_topic("Analyze_Problem", |
|
'',undef,undef,300). |
|
'<hr />'; |
return $result; |
return $result; |
} |
} |
|
|
Line 264 sub start_problem {
|
Line 274 sub start_problem {
|
} |
} |
#initialize globals |
#initialize globals |
$Apache::inputtags::part='0'; |
$Apache::inputtags::part='0'; |
|
@Apache::inputtags::partlist=('0'); |
@Apache::inputtags::responselist = (); |
@Apache::inputtags::responselist = (); |
|
@Apache::inputtags::importlist = (); |
@Apache::inputtags::previous=(); |
@Apache::inputtags::previous=(); |
@Apache::inputtags::previous_version=(); |
@Apache::inputtags::previous_version=(); |
$Apache::structuretags::printanswer='No'; |
$Apache::structuretags::printanswer='No'; |
Line 391 sub start_problem {
|
Line 403 sub start_problem {
|
"<title>$name</title></head>\n$body_tag_start\n"; |
"<title>$name</title></head>\n$body_tag_start\n"; |
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
my $startminipage = ''; |
|
if ($ENV{'form.problem_split'} ne 'yes') { |
|
$startminipage = '\begin{minipage}{\textwidth}'; |
|
} |
my $name= &Apache::lonxml::get_param('name',$parstack,$safeeval); |
my $name= &Apache::lonxml::get_param('name',$parstack,$safeeval); |
if ($name eq '') { |
if ($name eq '') { |
$name=&Apache::lonnet::EXT('resource.title'); |
$name=&Apache::lonnet::EXT('resource.title'); |
Line 425 sub start_problem {
|
Line 441 sub start_problem {
|
print $temp_file "$duedate\n"; |
print $temp_file "$duedate\n"; |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') { |
if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') { |
$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent \begin{minipage}{\textwidth}'; |
$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent '.$startminipage; |
} else { |
} else { |
$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm \noindent\begin{minipage}{\textwidth}'; |
$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm \noindent'.$startminipage; |
if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
} |
} |
} else { |
} else { |
Line 435 sub start_problem {
|
Line 451 sub start_problem {
|
} |
} |
} else { |
} else { |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm\noindent\begin{minipage}{\textwidth}'; |
$result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$ENV{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm\noindent'.$startminipage; |
if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} |
} else { |
} else { |
$result .= '\vskip 1mm \\\\\\\\'; |
$result .= '\vskip 1mm \\\\\\\\'; |
Line 480 sub end_problem {
|
Line 496 sub end_problem {
|
($target eq 'answer') || ($target eq 'tex') |
($target eq 'answer') || ($target eq 'tex') |
) { |
) { |
if ($status eq 'CAN_ANSWER') { |
if ($status eq 'CAN_ANSWER') { |
if ($target ne 'tex') { |
if ($target 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' || |
} elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' || |
Line 492 sub end_problem {
|
Line 509 sub end_problem {
|
if ($target eq 'web') { |
if ($target eq 'web') { |
$result.=&Apache::lonxml::xmlend(); |
$result.=&Apache::lonxml::xmlend(); |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$result .= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}'; |
my $endminipage = ''; |
|
if ($ENV{'form.problem_split'} ne 'yes') { |
|
$endminipage = '\end{minipage}'; |
|
} |
|
$result .= '\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}'; |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
if (not $ENV{'request.symb'} =~ m/\.page_/) { |
$result .= '\end{minipage}\end{document} '; |
$result .= $endminipage.'\end{document} '; |
} else { |
} else { |
$result .= ''; |
$result .= ''; |
} |
} |
Line 504 sub end_problem {
|
Line 525 sub end_problem {
|
&Apache::lonhomework::showhash(%Apache::lonhomework::results); |
&Apache::lonhomework::showhash(%Apache::lonhomework::results); |
&finalize_storage(); |
&finalize_storage(); |
} |
} |
if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct') ) { |
if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct') |
$result.='</html>'; #normally we get it from xmlend, but in CSTR |
&& $ENV{'form.answer_output_mode'} ne 'tex') { |
|
$result.='</html>'; # normally we get it from xmlend, but in CSTR |
# we always show answer mode too. |
# we always show answer mode too. |
} |
} |
} elsif ($target eq 'meta') { |
} elsif ($target eq 'meta') { |
Line 517 sub end_problem {
|
Line 539 sub end_problem {
|
$result = &problem_edit_footer(); |
$result = &problem_edit_footer(); |
} |
} |
|
|
|
if ($ENV{'request.state'} eq 'construct' && $target eq 'web') { |
|
&Apache::inputtags::check_for_duplicate_ids(); |
|
} |
undef(%Apache::lonhomework::history); |
undef(%Apache::lonhomework::history); |
undef(%Apache::lonhomework::results); |
undef(%Apache::lonhomework::results); |
undef($Apache::inputtags::part); |
undef($Apache::inputtags::part); |
Line 662 sub end_languageblock {
|
Line 687 sub end_languageblock {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub start_instructorcomment { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
|
|
my $result; |
|
|
|
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
|
$target eq 'tex' || $target eq 'analyze') { |
|
$result=($ENV{'request.role'}=~/^(in|cc|au|ca|li)/); |
|
if ( ! $result ) { |
|
my $skip=&Apache::lonxml::get_all_text("/instructorcomment",$parser); |
|
&Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]"); |
|
} |
|
$result=''; |
|
} elsif ($target eq 'edit') { |
|
$result .=&Apache::edit::tag_start($target,$token); |
|
$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
|
} |
|
return $result; |
|
} |
|
|
|
sub end_instructorcomment { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
my $result; |
|
if ($target eq "edit") { |
|
$result.= &Apache::edit::tag_end($target,$token,''); |
|
} |
|
return $result; |
|
} |
|
|
sub start_while { |
sub start_while { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
|
|
Line 813 sub start_part {
|
Line 867 sub start_part {
|
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
if ($id eq '') { $id = $Apache::lonxml::curdepth; } |
if ($id eq '') { $id = $Apache::lonxml::curdepth; } |
$Apache::inputtags::part=$id; |
$Apache::inputtags::part=$id; |
@Apache::inputtags::responselist = (); |
push(@Apache::inputtags::partlist,$id); |
|
@Apache::inputtags::response=(); |
@Apache::inputtags::previous=(); |
@Apache::inputtags::previous=(); |
@Apache::inputtags::previous_version=(); |
@Apache::inputtags::previous_version=(); |
$Apache::lonhomework::problemstatus= |
$Apache::lonhomework::problemstatus= |