';
+ '';
}
sub problem_edit_footer {
return '
'.
-
- &Apache::lonhtmlcommon::htmlareaselectactive(&Apache::lonhtmlcommon::get_htmlareafields()).
"\n\n".&Apache::loncommon::end_page();
}
@@ -373,12 +532,14 @@ sub problem_web_to_edit_header {
my $show_all_foils_text =
($Apache::lonhomework::parsing_a_task) ?
- &mt(' Show All Instances')
- : &mt(' Show All Foils');
+ &mt('Show All Instances')
+ : &mt('Show All Foils');
- my $show_all= ' '.$show_all_foils_text.' ';
+ my $show_all= ''
+ .' '.$show_all_foils_text
+ .' ';
@@ -402,8 +563,13 @@ sub problem_web_to_edit_header {
".&option('exam' ,'problemtype').&mt("Exam Problem")."
- ".&option('problem','problemtype').&mt("Homework problem")."
+ ".&option('problem','problemtype').&mt("Homework Problem")."
".&option('survey' ,'problemtype').&mt("Survey Question")."
+ ".&option('surveycred' ,'problemtype').&mt("Survey Question (with credit)")."
+ ".&option('anonsurvey' ,'problemtype').&mt("Anonymous Survey Question")."
+ ".&option('anonsurveycred' ,'problemtype').&mt("Anonymous Survey Question (with credit)")."
+ ".&option('practice' ,'problemtype').&mt("Practice Problem")."
+ ".&option('randomizetry' ,'problemtype').&mt("New Randomization Each Try")."
$show_all
@@ -436,7 +602,6 @@ $show_all
$show_all
";
}
-
$result.='
'.&mt('Apply style file: ').'
@@ -444,11 +609,14 @@ $show_all
'.&mt('Select').'
+
-
+
@@ -461,8 +629,9 @@ $show_all
if (!$numtoanalyze) { $numtoanalyze=20; }
$result .= ''.
&mt('[_1] for [_2] versions.',
- ' ',
- ' '
+ ,' ').
&Apache::loncommon::help_open_topic("Analyze_Problem",'',undef,undef,300).
' ';
@@ -471,12 +640,16 @@ $show_all
$result.='
- ';
return $result;
@@ -521,12 +694,19 @@ sub initialize_storage {
if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); }
}
-# -------------------------------------------------------------finalize_storage
-# Stores away the result has to a student's environment
-# checks form.grade_ for specific values, other wises stores
-# to the running users environment
-# Will increment totals for attempts, students, and corrects
-# if running user has student role.
+=pod
+
+=item finalize_storage()
+
+ Stores away the result has to a student's environment
+ checks form.grade_ for specific values, other wises stores
+ to the running users environment
+ Will increment totals for attempts, students, and corrects
+ if running user has student role.
+
+=cut
+
+
sub finalize_storage {
my ($given_symb) = @_;
my $result;
@@ -547,9 +727,7 @@ sub finalize_storage {
$result=&Apache::lonnet::cstore(\%Apache::lonhomework::results,
$symb,$courseid,$domain,$name);
&Apache::lonxml::debug('Store return message:'.$result);
- if ($env{'request.role'} =~/^st/) {
- &store_aggregates($symb,$courseid);
- }
+ &store_aggregates($symb,$courseid);
}
} else {
&Apache::lonxml::debug('Nothing to store');
@@ -557,13 +735,19 @@ sub finalize_storage {
return $result;
}
-# -------------------------------------------------------------store_aggregates
-# Sends hash of values to be incremented in nohist_resourcetracker.db
-# for the course. Increments total number of attempts, unique students
-# and corrects for each part for an instance of a problem, as appropriate.
+=pod
+
+item store_aggregates()
+
+ Sends hash of values to be incremented in nohist_resourcetracker.db
+ for the course. Increments total number of attempts, unique students
+ and corrects for each part for an instance of a problem, as appropriate.
+
+=cut
+
sub store_aggregates {
my ($symb,$courseid) = @_;
- my %aggregate;
+ my (%aggregate,%anoncounter,%randtrycounter);
my @parts;
my $cdomain = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $cname = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -573,28 +757,60 @@ sub store_aggregates {
}
}
foreach my $part (@parts) {
- if ($Apache::lonhomework::results{'resource.'.$part.'.award'}
- eq 'APPROX_ANS' ||
- $Apache::lonhomework::results{'resource.'.$part.'.award'}
- eq 'EXACT_ANS') {
- $aggregate{$symb."\0".$part."\0correct"} = 1;
+ if ($env{'request.role'} =~/^st/) {
+ if ($Apache::lonhomework::results{'resource.'.$part.'.award'}
+ eq 'APPROX_ANS' ||
+ $Apache::lonhomework::results{'resource.'.$part.'.award'}
+ eq 'EXACT_ANS') {
+ $aggregate{$symb."\0".$part."\0correct"} = 1;
+ }
+ if ($Apache::lonhomework::results{'resource.'.$part.'.tries'} == 1) {
+ $aggregate{$symb."\0".$part."\0users"} = 1;
+ } else {
+ my (undef,$last_reset) = &Apache::grades::get_last_resets($symb,$env{'request.course.id'},[$part]);
+ if ($last_reset) {
+ if (&Apache::grades::get_num_tries(\%Apache::lonhomework::history,$last_reset,$part) == 0) {
+ $aggregate{$symb."\0".$part."\0users"} = 1;
+ }
+ }
+ }
+ $aggregate{$symb."\0".$part."\0attempts"} = 1;
}
- if ($Apache::lonhomework::results{'resource.'.$part.'.tries'} == 1) {
- $aggregate{$symb."\0".$part."\0users"} = 1;
- } else {
- my (undef,$last_reset) = &Apache::grades::get_last_resets($symb,$env{'request.course.id'},[$part]);
- if ($last_reset) {
- if (&Apache::grades::get_num_tries(\%Apache::lonhomework::history,$last_reset,$part) == 0) {
- $aggregate{$symb."\0".$part."\0users"} = 1;
+ if (($Apache::lonhomework::results{'resource.'.$part.'.type'} eq 'anonsurvey') ||
+ ($Apache::lonhomework::results{'resource.'.$part.'.type'} eq 'anonsurveycred') ||
+ ($Apache::lonhomework::results{'resource.'.$part.'.type'} eq 'randomizetry')) {
+ if ($Apache::lonhomework::results{'resource.'.$part.'.type'} eq 'randomizetry') {
+ $randtrycounter{$symb."\0".$part} = 1;
+ } else {
+ $anoncounter{$symb."\0".$part} = 1;
+ }
+ my $needsrelease = $Apache::lonnet::needsrelease{'parameter:type:'.$Apache::lonhomework::results{'resource.'.$part.'.type'}};
+ if ($needsrelease) {
+ my $curr_required = $env{'course.'.$env{'request.course.id'}.'.internal.releaserequired'};
+ if ($curr_required eq '') {
+ &Apache::lonnet::update_released_required($needsrelease);
+ } else {
+ my ($currmajor,$currminor) = split(/\./,$curr_required);
+ my ($needsmajor,$needsminor) = split(/\./,$needsrelease);
+ if (($currmajor < $needsmajor) || ($currmajor == $needsmajor && $currminor < $needsminor)) {
+ &Apache::lonnet::update_released_required($needsrelease);
+ }
}
}
}
- $aggregate{$symb."\0".$part."\0attempts"} = 1;
}
if (keys (%aggregate) > 0) {
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
$cdomain,$cname);
}
+ if (keys(%anoncounter) > 0) {
+ &Apache::lonnet::cput('nohist_anonsurveys',\%anoncounter,
+ $cdomain,$cname);
+ }
+ if (keys(%randtrycounter) > 0) {
+ &Apache::lonnet::cput('nohist_randomizetry',\%randtrycounter,
+ $cdomain,$cname);
+ }
}
sub checkout_msg {
@@ -608,10 +824,8 @@ sub checkout_msg {
return (<$lt{'resource'}
$lt{'id_expln'}
-
-$lt{'warning'}
-
-
@@ -627,26 +841,27 @@ sub firstaccess_msg {
my $foldertitle=&Apache::lonnet::gettitle($map);
&Apache::lonxml::debug("map is $map title is $foldertitle");
- $result .= (<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".
-ENDCHECKOUT
+ $result .= "".&mt('The resources in "[_1]" are open for a limited time.'
+ .' Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".'
+ ,$foldertitle,$time)." ";
} elsif ($interval[1] eq 'course') {
my $course = $env{'course.'.$env{'request.course.id'}.'.description'};
- $result .= (<The resources in "$course" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources in "$course".
-ENDCHECKOUT
+ $result .= "".&mt('The resources in "[_1]" are open for a limited time.'
+ .' Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".'
+ ,$course,$time)." ";
} else {
my $title=&Apache::lonnet::gettitle($symb);
- $result .= (<This resource "$title" is open for a limited time. Once you click the 'Show Resource' button below you have $time to complete this resource "$title".
-ENDCHECKOUT
-
+ $result .= "".&mt('This resource "[_1]" is open for a limited time.'
+ .' Once you click the "Show Resource" button below you have [_2] to complete this resource "[_1]".'
+ ,$title,$time)." ";
}
my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'});
+ my $buttontext = &mt('Show Resource');
+ my $timertext = &mt('Start Timer?');
$result .= (<
+
ENDCHECKOUT
return $result;
@@ -676,6 +891,7 @@ sub init_problem_globals {
&Apache::lonhomework::reset_show_problem_status();
$Apache::lonhomework::ignore_response_errors=1;
}
+ @Apache::functionplotresponse::callscripts=();
@Apache::inputtags::responselist = ();
@Apache::inputtags::importlist = ();
@Apache::inputtags::previous=();
@@ -703,6 +919,7 @@ sub reset_problem_globals {
undef($Apache::lonhomework::type);
undef($Apache::lonhomework::scantronmode);
undef($Apache::lonhomework::ignore_response_errors);
+ undef(@Apache::functionplotresponse::callscripts);
&Apache::lonhomework::reset_show_problem_status();
}
@@ -754,7 +971,8 @@ sub start_problem {
}
if ($target ne 'analyze') {
- $Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type');
+ my $type = &Apache::lonnet::EXT('resource.0.type');
+ $Apache::lonhomework::type=$type;
if (($env{'request.state'} eq 'construct') &&
$env{'form.problemtype'} =~ /\S/) {
$Apache::lonhomework::type=$env{'form.problemtype'};
@@ -802,27 +1020,22 @@ sub start_problem {
if ($target eq 'tex' and $env{'request.symb'} =~ m/\.page_/) {$result='';}
- if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval); }
+ if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval,$target); }
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
$target eq 'tex') {
- #handle exam checkout
- if ($Apache::lonhomework::type eq 'exam') {
- my $token=
- $Apache::lonhomework::history{"resource.0.outtoken"};
- if (($env{'form.doescheckout'}) && (!$token)) {
- $token=&Apache::lonxml::maketoken();
- $Apache::lonhomework::history{"resource.0.outtoken"}=
- $token;
- }
- $result.=&Apache::lonxml::printtokenheader($target,$token);
- }
if ($env{'form.markaccess'}) {
my @interval=&Apache::lonnet::EXT("resource.0.interval");
&Apache::lonnet::set_first_access($interval[1]);
}
+
+ ($status,$accessmsg,my $slot_name,my $slot) =
+ &Apache::lonhomework::check_slot_access('0','problem');
+ push (@Apache::inputtags::status,$status);
+
#handle rand seed in construction space
- my $rndseed=&setup_rndseed($safeeval);
+ my $rndseed=&setup_rndseed($safeeval,$target);
my ($symb)=&Apache::lonnet::whichuser();
+
if ($env{'request.state'} ne "construct" &&
($symb eq '' || $Apache::lonhomework::type eq 'practice')) {
$form_tag_start.=' ';
}
if ($env{'request.role.adv'}) {
- $form_tag_start.=
- ' '
+ .' '.&mt(' Show All Foils').
- ' ';
+ $form_tag_start.= ' /> '
+ .&mt('Show All Foils')
+ .'';
}
+ if ($Apache::lonhomework::type eq 'practice') {
+ $form_tag_start.=&practice_problem_header();
+ }
$form_tag_start.=' ';
- }
-
- ($status,$accessmsg,my $slot_name,my $slot) =
- &Apache::lonhomework::check_slot_access('0','problem');
- push (@Apache::inputtags::status,$status);
+ } elsif (($env{'request.state'} ne "construct") &&
+ ($Apache::lonhomework::type eq 'randomizetry') &&
+ ($status eq 'CAN_ANSWER')) {
+ my $reqtries = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.randomizeontries");
+ my $problemstatus = &get_problem_status($Apache::inputtags::part);
+ $form_tag_start.=&randomizetry_problem_header($problemstatus,$reqtries);
+ }
my $expression='$external::datestatus="'.$status.'";';
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';
@@ -868,6 +1087,8 @@ sub start_problem {
my $msg;
if ($status eq 'UNAVAILABLE') {
$msg.=''.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').' ';
+ } elsif ($status eq 'NOT_IN_A_SLOT') {
+ $msg.=''.&mt('You are not currently signed up to work at this time and/or place.').' ';
} elsif ($status ne 'NOT_YET_VIEWED') {
$msg.=''.&mt('Not open to be viewed').' ';
}
@@ -878,13 +1099,13 @@ sub start_problem {
} elsif ($status eq 'NOT_YET_VIEWED') {
$msg.=&firstaccess_msg($accessmsg,$symb);
} elsif ($status eq 'NOT_IN_A_SLOT') {
- $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work.");
+ $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work");
}
$result.=$msg.' ';
} elsif ($target eq 'tex') {
my $startminipage = ($env{'form.problem_split'}=~/yes/i)? ''
: '\begin{minipage}{\textwidth}';
- $result.='\begin{document}\noindent \vskip 1 mm '.
+ $result.='\noindent \vskip 1 mm '.
$startminipage.'\vskip 0 mm';
if ($status eq 'UNAVAILABLE') {
$result.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm ';
@@ -915,6 +1136,11 @@ sub start_problem {
# create a page header and exit
if ($env{'request.state'} eq "construct") {
$result.= &problem_web_to_edit_header($env{'form.rndseed'});
+ if ($Apache::lonhomework::type eq 'practice') {
+ $result.= ' '.
+ &practice_problem_header().' ';
+ }
}
# if we are viewing someone else preserve that info
if (defined $env{'form.grade_symb'}) {
@@ -922,6 +1148,12 @@ sub start_problem {
$result .= ' '."\n";
}
+ foreach my $field ('trial','questiontype') {
+ if ($env{"form.grade_$field"} ne '') {
+ $result .= ' '."\n";
+ }
+ }
}
} elsif ($target eq 'tex') {
$result .= 'INSERTTEXFRONTMATTERHERE';
@@ -980,7 +1212,7 @@ sub end_problem {
$allow_print_points=0;
}
my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');
- my $begin_doc='\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource "'.$name_of_resourse.'" located in '.$env{'request.uri'}.' STAMPOFPASSEDRESOURCEEND} \noindent ';
+ my $begin_doc=' \typeout{STAMPOFPASSEDRESOURCESTART Resource "'.$name_of_resourse.'" located in '.$env{'request.uri'}.' STAMPOFPASSEDRESOURCEEND} \noindent ';
my $toc_line='\vskip 1 mm\noindent '.$startminipage.
'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
@@ -990,6 +1222,8 @@ sub end_problem {
my $duetime = &Apache::lonnet::EXT("resource.$id.duedate");
my $duedate = POSIX::strftime("%c",localtime($duetime));
+ my $duedate_text = &mt('Due date: [_1]'
+ ,&Apache::lonlocal::locallocaltime($duetime));
my $temp_file;
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due";
@@ -1021,18 +1255,22 @@ sub end_problem {
if (not $env{'request.symb'} =~ m/\.page_/) {
if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
$frontmatter .= $begin_doc.
- '\textit{Due date: '.$duedate.'} '.$toc_line;
+ '\textit{'.$duedate_text.'} '.$toc_line;
} else {
$frontmatter.= $begin_doc.$toc_line;
- if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $frontmatter .= '\fbox{\textit{'.$weight.' pt}}';}
+ if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) {
+ $frontmatter .= '\fbox{\textit{'.$weight.' pt}}';
+ }
}
} else {
- $frontmatter .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\'.$startminipage;
+ $frontmatter .= '\vskip 1mm\textit{'.$duedate_text.'} \\\\\\\\'.$startminipage;
}
} else {
if (not $env{'request.symb'} =~ m/\.page_/) {
$frontmatter .= $begin_doc.$toc_line;
- if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $frontmatter .= '\fbox{\textit{'.$weight.' pt}}';}
+ if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) {
+ $frontmatter .= '\fbox{\textit{'.$weight.' pt}}';
+ }
} else {
$frontmatter .= '\vskip 1mm \\\\\\\\'.$startminipage;
}
@@ -1068,7 +1306,6 @@ sub end_problem {
if ($target ne 'tex' &&
$env{'form.answer_output_mode'} ne 'tex') {
$result.="";
- $result.= &Apache::lonhtmlcommon::htmlareaselectactive(&Apache::lonhtmlcommon::get_htmlareafields());
}
if ($target eq 'web') {
$result.= &Apache::loncommon::end_page({'discussion' => 1});
@@ -1089,6 +1326,9 @@ sub end_problem {
}
}
}
+ if ($target eq 'web') {
+ $result.=&Apache::functionplotresponse::init_script();
+ }
if ($target eq 'grade') {
&Apache::lonhomework::showhash(%Apache::lonhomework::results);
&finalize_storage();
@@ -1146,10 +1386,15 @@ sub start_library {
($result,$form_tag_start)=
&page_start($target,$token,$tagstack,$parstack,$parser,$safeeval,
$name);
- my $rndseed=&setup_rndseed($safeeval);
+ my $rndseed=&setup_rndseed($safeeval,$target);
$result.=" \n $form_tag_start".
' ';
$result.=&problem_web_to_edit_header($rndseed);
+ if ($Apache::lonhomework::type eq 'practice') {
+ $result.= ' '.
+ &practice_problem_header().' ';
+ }
}
return $result;
}
@@ -1250,7 +1495,7 @@ sub start_languageblock {
$target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
my $include = $token->[2]->{'include'};
my $exclude = $token->[2]->{'exclude'};
- my @preferred_languages=&Apache::loncommon::preferred_languages();
+ my @preferred_languages=&Apache::lonlocal::preferred_languages();
# This should not even happen, since we should at least have the server language
if (!$preferred_languages[0]) { $preferred_languages[0]='en'; }
# Now loop over all languages in order of preference
@@ -1357,7 +1602,17 @@ sub end_languageblock {
my $result = &Apache::lonxml::endredirection();
my $which = &Apache::lonxml::get_param('which',$parstack,
$safeeval);
- $available_texts{$which} = $result;
+ if ($which=~/\w/) {
+ $available_texts{$which} = $result;
+ }
+ my $otherlangs = &Apache::lonxml::get_param('other',$parstack,
+ $safeeval);
+ foreach my $language (split(/\s*\,\s*/,$otherlangs)) {
+ if ($language=~/\w/) {
+ $available_texts{$language} = $result;
+ }
+ }
+
}
return '';
}
@@ -1370,7 +1625,7 @@ sub start_instructorcomment {
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze' || $target eq 'webgrade') {
- $result=($env{'request.role'}=~/^(in|cc|au|ca|li)/);
+ $result=($env{'request.role'}=~/^(in|cc|co|au|ca|li)/);
if ( (! $result) or ($env{'form.instructor_comments'} eq 'hide')) {
my $skip=&Apache::lonxml::get_all_text("/instructorcomment",
$parser,$style);
@@ -1454,7 +1709,7 @@ sub end_while {
$return = &Apache::run::run($code,$safeeval);
}
if ($error) {
- &Apache::lonxml::error(''.&mt('Code ran too long. It ran for more than').' '.$Apache::lonnet::perlvar{'lonScriptTimeout'}.' '.&mt('seconds occured while running <while> on line').' '.$line.' ');
+ &Apache::lonxml::error(''.&mt('Code ran too long. It ran for more than').' '.$Apache::lonnet::perlvar{'lonScriptTimeout'}.' '.&mt('seconds occurred while running <while> on line').' '.$line.' ');
}
} elsif ($target eq "edit") {
$result.= &Apache::edit::tag_end($target,$token,'');
@@ -1508,6 +1763,20 @@ sub start_randomlist {
my $showarg=&Apache::lonxml::get_param('show',$parstack,$safeeval);
$showarg--;
if ( ($showarg >= 0) && ($showarg < $show) ) { $show = $showarg; }
+ if (($target eq 'analyze') && ($env{'form.check_parts_withrandomlist'})) {
+ my @currlist;
+ my $part = $Apache::inputtags::part;
+ if ($part ne '') {
+ if (ref($Apache::lonhomework::analyze{'parts_withrandomlist'}) eq 'ARRAY') {
+ my @currlist = @{$Apache::lonhomework::analyze{'parts_withrandomlist'}};
+ if (!(grep(/^\Q$part\E$/,@currlist))) {
+ push(@{$Apache::lonhomework::analyze{'parts_withrandomlist'}},$part);
+ }
+ } else {
+ push(@{$Apache::lonhomework::analyze{'parts_withrandomlist'}},$part);
+ }
+ }
+ }
for(0 .. $show) {
$bodytext .= "$randomlist[ $idx_arr[$_] ]";
}
@@ -1561,6 +1830,49 @@ sub ordered_show_check {
return $in_order_show;
}
+
+sub start_startpartmarker {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my $result='';
+ if ($target eq 'edit') {
+ $result=&Apache::edit::tag_start($target,$token);
+ $result.=&mt('Marker for the start of a part. Place end marker below to wrap in-between tags into a new part.').' ';
+ $result.=&Apache::edit::end_table();
+
+ }
+ return $result;
+}
+
+sub end_startpartmarker {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my @result;
+ if ($target eq 'edit') { $result[1]='no'; }
+ return @result;
+}
+
+sub start_endpartmarker {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my $result='';
+ if ($target eq 'edit') {
+ $result=&Apache::edit::tag_start($target,$token);
+ $result.=&mt('Marker for the end of a part. Place start marker above to wrap in-between tags into a new part.').'';
+ $result.=&Apache::edit::end_table();
+
+ }
+ return $result;
+}
+
+sub end_endpartmarker {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my @result;
+ if ($target eq 'edit') { $result[1]='no'; }
+ return @result;
+}
+
+
+
+
+
sub start_part {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
if (!$Apache::lonxml::metamode) {
@@ -1645,9 +1957,31 @@ sub start_part {
'.disableexampointprint'}) eq 'yes') {
$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 .= '\vskip 10mm\fbox{\textit{'.$weight.' pt}}';
+
+ }
} elsif ($target eq 'web') {
- $result.='".&mt('Text Block')." "
+ .''.&mt('Delete?').' '
+ .&Apache::edit::deletelist($target,$token)
+ .' '
+ .' '
+ .&Apache::lonhtmlcommon::dragmath_button($areaid,1)
+ .' '
+ .''
+ .&Apache::edit::insertlist($target,$token)
+ .' '
+ .'' .
+ &Apache::loncommon::helpLatexCheatsheet().
&Apache::edit::end_row().
&Apache::edit::start_spanning_row()."\n".
&Apache::edit::editfield($token->[1],$text,"",80,8,1);
@@ -1920,9 +2263,17 @@ sub start_simpleeditbutton {
my $url=$env{'request.noversionuri'};
$url=~s/\?.*$//;
my ($symb) = &Apache::lonnet::whichuser();
- $result=''.
- ''.&mt('Edit').' - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.').
-&Apache::loncommon::help_open_topic('Caching').'
';
+# Warning makes more sense and is more important on edit screen
+# $result=''
+# .&mt('Note: it can take up to 10 minutes for changes to take effect for all users.')
+# .&Apache::loncommon::help_open_topic('Caching')
+# .'
';
+ $result.=&Apache::lonhtmlcommon::start_funclist()
+ .&Apache::lonhtmlcommon::add_item_funclist(
+ ''
+ .&mt('Edit').' ')
+ .&Apache::lonhtmlcommon::end_funclist();
+
}
return $result;
}
@@ -1931,5 +2282,74 @@ sub end_simpleeditbutton {
return '';
}
+sub practice_problem_header {
+ return ''.&mt('Practice Problem').' '.
+ ''.&mt('Submissions are not permanently recorded').
+ ' ';
+}
+
+sub randomizetry_problem_header {
+ my ($problemstatus,$reqtries) = @_;
+ my ($header,$text);
+ if ($reqtries > 1) {
+ $header = &mt('New Problem Variation After Every [quant,_1,Try,Tries]',$reqtries);
+ if (($problemstatus eq 'no') ||
+ ($problemstatus eq 'no_feedback_ever')) {
+ $text = &mt('A new variation will be generated after every [quant,_1,try,tries], until the tries limit is reached.',$reqtries);
+ } else {
+ $text = &mt('A new variation will be generated after every [quant,_1,try,tries], until correct or tries limit is reached.',$reqtries);
+ }
+ } else {
+ $header = &mt('New Problem Variation Each Try');
+ if (($problemstatus eq 'no') ||
+ ($problemstatus eq 'no_feedback_ever')) {
+ $text = &mt('A new variation will be generated after each try until the tries limit is reached.');
+
+ } else {
+ $text = &mt('A new variation will be generated after each try until correct or tries limit is reached.');
+ }
+ }
+ return ''.$header.' '.
+ ''.$text.' ';
+}
+
+sub randomizetry_part_header {
+ my ($problemstatus,$reqtries,$num) = @_;
+ my ($header,$text);
+ if ($reqtries eq 'none') {
+ $header = &mt('No Question Variation');
+ $text = &mt('For this question there will no new variation after a try.');
+ } elsif ($reqtries > 1) {
+ $header = &mt('New Question Variation After Every [quant,_1,Try,Tries]',$reqtries);
+ if (($problemstatus eq 'no') ||
+ ($problemstatus eq 'no_feedback_ever')) {
+ $text = &mt('For this question a new variation will be generated after every [quant,_1,try,tries], until the tries limit is reached.',$reqtries);
+ } else {
+ $text = &mt('For this question a new variation will be generated after every [quant,_1,try,tries], until correct or tries limit is reached.',$reqtries);
+ }
+ } else {
+ $header = &mt('New Question Variation For Each Try');
+ if (($problemstatus eq 'no') ||
+ ($problemstatus eq 'no_feedback_ever')) {
+ $text = &mt('For this question a new variation will be generated after each try until the tries limit is reached.');
+ } else {
+ $text = &mt('For this question a new variation will be generated after each try until correct or tries limit is reached.');
+ }
+ }
+ my $output;
+ if ($num > 1) {
+ $output .= ' ';
+ }
+ $output .= ''.$header.' '.
+ ''.$text.' ';
+ return $output;
+}
+
1;
__END__
+
+=pod
+
+=back
+
+=cut