';
+ '';
}
sub problem_edit_footer {
@@ -400,7 +402,7 @@ sub problem_edit_footer {
'.
@@ -470,6 +472,9 @@ sub problem_web_to_edit_header {
".&option('exam' ,'problemtype').&mt("Exam 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")."
@@ -628,9 +633,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');
@@ -650,7 +653,7 @@ item store_aggregates()
sub store_aggregates {
my ($symb,$courseid) = @_;
- my %aggregate;
+ my (%aggregate,%anoncounter);
my @parts;
my $cdomain = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $cname = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -660,28 +663,51 @@ 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')) {
+ $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::cinc('nohist_anonsurveys',\%anoncounter,
+ $cdomain,$cname);
+ }
}
sub checkout_msg {
@@ -922,13 +948,14 @@ sub start_problem {
value="'.$env{'form.username'}.'" />';
}
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();
@@ -1123,7 +1150,9 @@ sub end_problem {
'\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{'.$duedate_text.'} \\\\\\\\'.$startminipage;
@@ -1131,7 +1160,9 @@ sub end_problem {
} 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;
}
@@ -1484,7 +1515,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);
@@ -1689,6 +1720,44 @@ 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) {
@@ -1773,7 +1842,10 @@ 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.=' ';
}
@@ -1942,6 +2014,9 @@ sub start_problemtype {
$result .=&Apache::edit::checked_arg('When used as type(s):','for',
[ ['exam','Exam/Quiz Problem'],
['survey','Survey'],
+ ['surveycred','Survey (with credit)'],
+ ['anonsurvey','Anonymous Survey'],
+ ['anonsurveycred','Anonymous Survey (with credit)'],
['problem','Homework Problem'],
['practice','Practice Problem'] ]
,$token);