version 1.268, 2004/09/18 17:29:29
|
version 1.280, 2005/02/25 04:56:05
|
Line 84 sub page_start {
|
Line 84 sub page_start {
|
$parstack,$parser,$safeeval); |
$parstack,$parser,$safeeval); |
$head_tag_start='<head>'.&Apache::lonmenu::registerurl(undef,$target). |
$head_tag_start='<head>'.&Apache::lonmenu::registerurl(undef,$target). |
&Apache::lonhtmlcommon::htmlareaheaders(). |
&Apache::lonhtmlcommon::htmlareaheaders(). |
&Apache::lonhtmlcommon::spellheader(); |
&Apache::lonhtmlcommon::spellheader(). |
|
&Apache::lonxml::fontsettings(); |
} |
} |
my $body_tag_start; |
my $body_tag_start; |
if (!defined($found{'body'})) { |
if (!defined($found{'body'}) && $ENV{'request.state'} eq 'construct' |
$body_tag_start='<body onLoad="'.&Apache::lonmenu::loadevents().'" '. |
&& $ENV{'environment.remote'} eq 'off') { |
'onUnload="'.&Apache::lonmenu::unloadevents().'" '; |
$body_tag_start=&Apache::loncommon::bodytag(); |
|
$body_tag_start.=&Apache::lonxml::message_location(); |
|
} elsif (!defined($found{'body'})) { |
|
$body_tag_start='<body onload="'.&Apache::lonmenu::loadevents().'" '. |
|
'onunload="'.&Apache::lonmenu::unloadevents().'" '; |
my $background=&Apache::lonxml::get_param('background',$parstack, |
my $background=&Apache::lonxml::get_param('background',$parstack, |
$safeeval); |
$safeeval); |
if ($ENV{'browser.imagesuppress'} eq 'on') { $background=''; } |
if ($ENV{'browser.imagesuppress'} eq 'on') { $background=''; } |
Line 123 sub page_start {
|
Line 128 sub page_start {
|
} |
} |
my $form_tag_start; |
my $form_tag_start; |
if (!defined($found{'form'})) { |
if (!defined($found{'form'})) { |
$form_tag_start='<form name="lonhomework" method="POST" action="'. |
$form_tag_start='<form name="lonhomework" enctype="multipart/form-data" method="post" action="'; |
$ENV{'request.uri'}.'">'; |
my $uri=$ENV{'request.uri'}; |
|
if ($ENV{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); } |
|
$form_tag_start.=$uri.'">'; |
} |
} |
return ($result,$head_tag_start,$body_tag_start,$form_tag_start); |
return ($result,$head_tag_start,$body_tag_start,$form_tag_start); |
} |
} |
Line 135 sub get_resource_name {
|
Line 142 sub get_resource_name {
|
if (defined($Apache::lonhomework::name)) { |
if (defined($Apache::lonhomework::name)) { |
return $Apache::lonhomework::name; |
return $Apache::lonhomework::name; |
} |
} |
my $name=&Apache::lonnet::gettitle(); |
my ($symb)=&Apache::lonxml::whichuser(); |
|
my $name=&Apache::lonnet::gettitle($symb); |
if ($name eq '') { |
if ($name eq '') { |
$name=&Apache::lonnet::EXT('resource.title'); |
$name=&Apache::lonnet::EXT('resource.title'); |
if ($name eq 'con_lost') { $name = ''; } |
if ($name eq 'con_lost') { $name = ''; } |
Line 209 sub problem_edit_footer {
|
Line 217 sub problem_edit_footer {
|
return '</td></tr></table><br /><input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" /> |
return '</td></tr></table><br /><input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" /> |
<input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />'. |
<input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />'. |
&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields). |
&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields). |
"\n</form>\n</body>\n</html>"; |
"\n</form>\n".&Apache::loncommon::endbodytag()."\n</html>"; |
} |
} |
|
|
sub option { |
sub option { |
Line 230 sub problem_web_to_edit_header {
|
Line 238 sub problem_web_to_edit_header {
|
<input type="submit" name="newrandomization" accesskey="a" value="'.&mt('New Randomization').'" /> |
<input type="submit" name="newrandomization" accesskey="a" value="'.&mt('New Randomization').'" /> |
<input type="submit" name="resetdata" accesskey="r" value="'.&mt('Reset Submissions').'" /> |
<input type="submit" name="resetdata" accesskey="r" value="'.&mt('Reset Submissions').'" /> |
<nobr><input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" /> |
<nobr><input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" /> |
<input type="text" name="rndseed" width="10" value="'. |
<input type="text" name="rndseed" size="10" value="'. |
$rndseed.'" |
$rndseed.'" |
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'). |
Line 242 sub problem_web_to_edit_header {
|
Line 250 sub problem_web_to_edit_header {
|
<nobr> |
<nobr> |
Problem Status: |
Problem Status: |
<select name='problemstate'> |
<select name='problemstate'> |
<option name=''></option> |
<option value=''></option> |
".&option('CLOSED' ,'problemstate').&mt("Closed")."</option> |
".&option('CLOSED' ,'problemstate').&mt("Closed")."</option> |
".&option('CAN_ANSWER' ,'problemstate').&mt("Answerable")."</option> |
".&option('CAN_ANSWER' ,'problemstate').&mt("Answerable")."</option> |
".&option('CANNOT_ANSWER_tries' ,'problemstate').&mt("Open with full tries")."</option> |
".&option('CANNOT_ANSWER_tries' ,'problemstate').&mt("Open with full tries")."</option> |
Line 253 Problem Status:
|
Line 261 Problem Status:
|
<nobr> |
<nobr> |
Problem Type: |
Problem Type: |
<select name='problemtype'> |
<select name='problemtype'> |
<option name=''></option> |
<option value=''></option> |
".&option('exam' ,'problemtype').&mt("Exam Problem")."</option> |
".&option('exam' ,'problemtype').&mt("Exam Problem")."</option> |
".&option('problem','problemtype').&mt("Homework problem")."</option> |
".&option('problem','problemtype').&mt("Homework problem")."</option> |
".&option('survey' ,'problemtype').&mt("Survey Question")."</option> |
".&option('survey' ,'problemtype').&mt("Survey Question")."</option> |
Line 335 sub checkout_msg {
|
Line 343 sub checkout_msg {
|
<font color="red"> |
<font color="red"> |
<p>$lt{'warning'}</p> |
<p>$lt{'warning'}</p> |
</font> |
</font> |
<form name="checkout" method="POST" action="$ENV{'request.uri'}"> |
<form name="checkout" method="post" action="$ENV{'request.uri'}"> |
<input type="hidden" name="doescheckout" value="yes" /> |
<input type="hidden" name="doescheckout" value="yes" /> |
<input type="button" name="checkoutbutton" value="$lt{'checkout'}" onClick="javascript:if (confirm('$lt{'checkout?'}')) { document.checkout.submit(); }" /> |
<input type="button" name="checkoutbutton" value="$lt{'checkout'}" onClick="javascript:if (confirm('$lt{'checkout?'}')) { document.checkout.submit(); }" /> |
</form> |
</form> |
Line 349 sub firstaccess_msg {
|
Line 357 sub firstaccess_msg {
|
&Apache::lonxml::debug("map is $map title is $foldertitle"); |
&Apache::lonxml::debug("map is $map title is $foldertitle"); |
return (<<ENDCHECKOUT); |
return (<<ENDCHECKOUT); |
<h2>The resources in "$foldertitle" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources "$foldertitle".</h2> |
<h2>The resources in "$foldertitle" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources "$foldertitle".</h2> |
<form name="markaccess" method="POST" action="$ENV{'request.uri'}"> |
<form name="markaccess" method="post" action="$ENV{'request.uri'}"> |
<input type="hidden" name="markaccess" value="yes" /> |
<input type="hidden" name="markaccess" value="yes" /> |
<input type="button" name="accessbutton" value="Show Resource" onClick="javascript:if (confirm('Start Timer?')) { document.markaccess.submit(); }" /> |
<input type="button" name="accessbutton" value="Show Resource" onClick="javascript:if (confirm('Start Timer?')) { document.markaccess.submit(); }" /> |
</form> |
</form> |
Line 574 sub start_problem {
|
Line 582 sub start_problem {
|
$allow_print_points=1; |
$allow_print_points=1; |
} |
} |
} |
} |
|
my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); |
|
if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; } |
my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); |
my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); |
$duedate = POSIX::strftime("%c",localtime($duedate)); |
$duedate = POSIX::strftime("%c",localtime($duedate)); |
my $temp_file; |
my $temp_file; |
Line 656 sub end_problem {
|
Line 666 sub end_problem {
|
$ENV{'form.answer_output_mode'} ne 'tex') { |
$ENV{'form.answer_output_mode'} ne 'tex') { |
$result.="</form>"; |
$result.="</form>"; |
$result.=&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields); |
$result.=&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields); |
$result.="</body>\n"; |
$result.=&Apache::loncommon::endbodytag(); |
} |
} |
if ($target eq 'web') { |
if ($target eq 'web') { |
$result.=&Apache::lonxml::xmlend(); |
$result.=&Apache::lonxml::xmlend(); |
Line 747 sub end_library {
|
Line 757 sub end_library {
|
$result=&problem_edit_footer(); |
$result=&problem_edit_footer(); |
} elsif ($target eq 'web' && $$tagstack[0] ne 'problem' && |
} elsif ($target eq 'web' && $$tagstack[0] ne 'problem' && |
$ENV{'request.state'} eq "construct") { |
$ENV{'request.state'} eq "construct") { |
$result.='</form></body>'.&Apache::lonxml::xmlend(); |
$result.='</form>'.&Apache::loncommon::endbodytag(). |
|
&Apache::lonxml::xmlend(); |
} |
} |
if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') }; |
if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') }; |
return $result; |
return $result; |
Line 882 sub start_instructorcomment {
|
Line 893 sub start_instructorcomment {
|
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
$target eq 'tex' || $target eq 'analyze') { |
$target eq 'tex' || $target eq 'analyze') { |
$result=($ENV{'request.role'}=~/^(in|cc|au|ca|li)/); |
$result=($ENV{'request.role'}=~/^(in|cc|au|ca|li)/); |
if ( ! $result ) { |
if ( (! $result) or ($ENV{'form.instructor_comments'} eq 'hide')) { |
my $skip=&Apache::lonxml::get_all_text("/instructorcomment", |
my $skip=&Apache::lonxml::get_all_text("/instructorcomment", |
$parser,$style); |
$parser,$style); |
&Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]"); |
&Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]"); |
Line 952 sub end_while {
|
Line 963 sub end_while {
|
while ($return) { |
while ($return) { |
if (time-$starttime > |
if (time-$starttime > |
$Apache::lonnet::perlvar{'lonScriptTimeout'}) { |
$Apache::lonnet::perlvar{'lonScriptTimeout'}) { |
$return = 0; $error=1; next; |
#$return = 0; $error=1; next; |
} |
} |
$result.=&Apache::scripttag::xmlparse($bodytext); |
$result.=&Apache::scripttag::xmlparse($bodytext); |
$return = &Apache::run::run($code,$safeeval); |
$return = &Apache::run::run($code,$safeeval); |
} |
} |
if ($error) { |
if ($error) { |
&Apache::lonxml::error('<pre>'.&mt('Code ran too long. It ran for more than').' '.$Apache::lonnet::perlvar{'lonScriptTimeout'}.' '.&mt('seconds occured while running <while$gt; on line').' '.$line.'</pre>'); |
&Apache::lonxml::error('<pre>'.&mt('Code ran too long. It ran for more than').' '.$Apache::lonnet::perlvar{'lonScriptTimeout'}.' '.&mt('seconds occured while running <while> on line').' '.$line.'</pre>'); |
} |
} |
} elsif ($target eq "edit") { |
} elsif ($target eq "edit") { |
$result.= &Apache::edit::tag_end($target,$token,''); |
$result.= &Apache::edit::tag_end($target,$token,''); |
Line 1120 sub start_part {
|
Line 1131 sub start_part {
|
if ($1 ne '0') {$allow_print_points=1;} |
if ($1 ne '0') {$allow_print_points=1;} |
} |
} |
} |
} |
|
my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); |
|
if (defined($maxtries) && $maxtries < 0) { |
|
$allow_print_points=0; |
|
} |
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') { |
} elsif ($target eq 'web') { |
$result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />'; |
$result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />'; |
Line 1357 sub delete_startouttext {
|
Line 1372 sub delete_startouttext {
|
sub start_simpleeditbutton { |
sub start_simpleeditbutton { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $result=''; |
my $result=''; |
if (($target eq 'web') && |
if (($ENV{'form.simple_edit_button'} ne 'off') && |
|
($target eq 'web') && |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { |
my $url=$ENV{'request.noversionuri'}; |
my $url=$ENV{'request.noversionuri'}; |
$url=~s/\?.*$//; |
$url=~s/\?.*$//; |
|
my ($symb) = &Apache::lonxml::whichuser(); |
$result='<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>'. |
$result='<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>'. |
'<a href="'.$url.'/smpedit">'.&mt('Simple Problem Editor').'</a> - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.'). |
'<a href="'.$url.'/smpedit?symb='.&Apache::lonnet::escape($symb).'">'.&mt('Edit').'</a> - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.'). |
&Apache::loncommon::help_open_topic('Caching').'</td></tr></table><br />'; |
&Apache::loncommon::help_open_topic('Caching').'</td></tr></table><br />'; |
} |
} |
return $result; |
return $result; |