';
+ '';
}
sub problem_edit_footer {
return ' |
'.
@@ -387,12 +441,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= '';
+ my $show_all= '';
@@ -465,7 +521,7 @@ $show_all
-
+
@@ -489,7 +545,8 @@ $show_all
$result.='
- ';
return $result;
@@ -541,12 +599,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;
@@ -577,13 +642,23 @@ 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,%subtracker);
+ my $tracksub;
+ if ($symb =~ m{^uploaded/gcitest/$LONCAPA::match_courseid/default_1261144274.sequence___\d+___gci/gci/}) {
+ $tracksub = 1;
+ }
my @parts;
my $cdomain = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $cname = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -598,6 +673,9 @@ sub store_aggregates {
$Apache::lonhomework::results{'resource.'.$part.'.award'}
eq 'EXACT_ANS') {
$aggregate{$symb."\0".$part."\0correct"} = 1;
+ if ($tracksub) {
+ $subtracker{$env{'user.name'}.':'.$env{'user.domain'}."\0correct"} ++;
+ }
}
if ($Apache::lonhomework::results{'resource.'.$part.'.tries'} == 1) {
$aggregate{$symb."\0".$part."\0users"} = 1;
@@ -610,11 +688,22 @@ sub store_aggregates {
}
}
$aggregate{$symb."\0".$part."\0attempts"} = 1;
+ if ($tracksub) {
+ if ($Apache::lonhomework::type eq 'survey') {
+ $subtracker{$env{'user.name'}.':'.$env{'user.domain'}."\0surveysubs"} ++;
+ } else {
+ $subtracker{$env{'user.name'}.':'.$env{'user.domain'}."\0attempts"} ++;
+ }
+ }
}
if (keys (%aggregate) > 0) {
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
$cdomain,$cname);
}
+ if (keys(%subtracker) > 0) {
+ &Apache::lonnet::cinc('nohist_submissiontracker',\%subtracker,
+ $cdomain,$cname);
+ }
}
sub checkout_msg {
@@ -628,10 +717,8 @@ sub checkout_msg {
return (<$lt{'resource'}
$lt{'id_expln'}
-
-$lt{'warning'}
-
-
@@ -665,7 +752,7 @@ sub firstaccess_msg {
my $buttontext = &mt('Show Resource');
my $timertext = &mt('Start Timer?');
$result .= (<
+
@@ -848,27 +935,34 @@ sub start_problem {
if ($env{'request.state'} ne "construct" &&
($symb eq '' || $Apache::lonhomework::type eq 'practice')) {
$form_tag_start.=''.
- '';
+ $rndseed.'" />';
+ unless ($env{'request.gcicontext'} eq 'buildtest') {
+ $form_tag_start .= '';
+ }
if (exists($env{'form.username'})) {
$form_tag_start.=
'';
}
- if ($env{'request.role.adv'}) {
- $form_tag_start.=
- ' ';
- }
+ unless ($env{'request.gcicontext'} eq 'buildtest') {
+ if ($env{'request.role.adv'}) {
+ $form_tag_start.= ' ';
+ }
+ }
if ($Apache::lonhomework::type eq 'practice') {
$form_tag_start.=&practice_problem_header();
}
- $form_tag_start.=' ';
+ unless ($env{'request.gcicontext'} eq 'buildtest') {
+ $form_tag_start.=' ';
+ }
}
($status,$accessmsg,my $slot_name,my $slot) =
@@ -893,6 +987,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').'';
}
@@ -903,13 +999,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 ';
@@ -1010,7 +1106,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.'}';
@@ -1020,6 +1116,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";
@@ -1051,13 +1149,13 @@ 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}}';}
}
} else {
- $frontmatter .= '\vskip 1mm\textit{Due date: '.$duedate.'} \\\\\\\\'.$startminipage;
+ $frontmatter .= '\vskip 1mm\textit{'.$duedate_text.'} \\\\\\\\'.$startminipage;
}
} else {
if (not $env{'request.symb'} =~ m/\.page_/) {
@@ -1285,7 +1383,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
@@ -1392,9 +1490,15 @@ sub end_languageblock {
my $result = &Apache::lonxml::endredirection();
my $which = &Apache::lonxml::get_param('which',$parstack,
$safeeval);
- foreach my $language (split(/\s*\,\s*/,$which)) {
- unless ($language=~/\w/) { next; }
- $available_texts{$language} = $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;
+ }
}
}
@@ -1493,7 +1597,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,'');
@@ -1547,6 +1651,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[$_] ]";
}
@@ -1890,20 +2008,20 @@ sub end_startouttext {
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)."".&mt('Text Block')." |
-".&mt('Delete:').
- &Apache::edit::deletelist($target,$token)
- ." | ";
+ $result.=&Apache::edit::start_table($token)." ".&mt('Text Block')." | "
+ .''.&mt('Delete?').' '
+ .&Apache::edit::deletelist($target,$token)
+ .' | ';
unless ($env{'environment.wysiwygeditor'} eq 'on') {
- $result.=''
- .&Apache::lonhtmlcommon::dragmath_button($areaid,1)
- .' | '
- .''
- .&Apache::edit::insertlist($target,$token)
- .' | ';
- }
+ $result .= ''
+ .&Apache::lonhtmlcommon::dragmath_button($areaid,1)
+ .' | '
+ .''
+ .&Apache::edit::insertlist($target,$token)
+ .' | ';
+ }
$result.='' .
- &Apache::loncommon::helpLatexCheatsheet().
+ &Apache::loncommon::helpLatexCheatsheet().
&Apache::edit::end_row().
&Apache::edit::start_spanning_row()."\n".
&Apache::edit::editfield($token->[1],$text,"",80,8,1);
@@ -1966,9 +2084,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;
}
@@ -1985,3 +2111,9 @@ sub practice_problem_header {
1;
__END__
+
+=pod
+
+=back
+
+=cut
| |