';
return $result;
@@ -521,12 +580,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;
@@ -557,10 +623,16 @@ 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;
@@ -611,7 +683,7 @@ sub checkout_msg {
$lt{'warning'}
-
@@ -627,26 +699,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;
@@ -754,7 +827,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'};
@@ -836,13 +910,16 @@ sub start_problem {
}
if ($env{'request.role.adv'}) {
$form_tag_start.=
- ' '.&mt(' Show All Foils').
'';
}
+ if ($Apache::lonhomework::type eq 'practice') {
+ $form_tag_start.=&practice_problem_header();
+ }
$form_tag_start.='';
}
@@ -868,6 +945,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.').'
'.&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 +957,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 +994,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'}) {
@@ -980,7 +1064,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.'}';
@@ -1150,6 +1234,11 @@ sub start_library {
$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 +1339,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 +1446,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 '';
}
@@ -1454,7 +1553,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 +1607,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[$_] ]";
}
@@ -1814,7 +1927,8 @@ sub start_problemtype {
$result .=&Apache::edit::checked_arg('When used as type(s):','for',
[ ['exam','Exam/Quiz Problem'],
['survey','Survey'],
- ['problem','Homework Problem'] ]
+ ['problem','Homework Problem'],
+ ['practice','Practice Problem'] ]
,$token);
$result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
} elsif ($target eq 'modified') {
@@ -1847,17 +1961,23 @@ sub end_startouttext {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
my $text='';
-
if ($target eq 'edit') {
+ my $areaid = 'homework_edit_'.$Apache::lonxml::curdepth;
$text=&Apache::lonxml::get_all_text("endouttext",$parser,$style);
- $result.=&Apache::edit::start_table($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 +2040,16 @@ 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 make 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')
+# .'