';
+ '';
}
sub problem_edit_footer {
return ' |
'.
-
- &Apache::lonhtmlcommon::htmlareaselectactive(&Apache::lonhtmlcommon::get_htmlareafields()).
"\n\n".&Apache::loncommon::end_page();
}
@@ -424,12 +581,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.= ' /> '.$show_all_foils_text
+ .'';
@@ -455,7 +614,11 @@ 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")."
+ ".&option('randomizetry' ,'problemtype').&mt("New Randomization Each Try")."
$show_all
@@ -502,11 +665,11 @@ $show_all
-
+
- ';
@@ -526,7 +689,8 @@ $show_all
$result.='
- ';
return $result;
@@ -611,9 +776,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');
@@ -633,7 +796,7 @@ item store_aggregates()
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'};
@@ -643,28 +806,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 {
@@ -678,9 +873,7 @@ sub checkout_msg {
return (<$lt{'resource'}
$lt{'id_expln'}
-
-$lt{'warning'}
-
+$lt{'warning'}
";
- $result.= &Apache::lonhtmlcommon::htmlareaselectactive(&Apache::lonhtmlcommon::get_htmlareafields());
}
if ($target eq 'web') {
$result.= &Apache::loncommon::end_page({'discussion' => 1});
@@ -1171,6 +1380,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();
@@ -1228,7 +1440,7 @@ 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);
@@ -1327,54 +1539,100 @@ sub end_block {
}
return $result;
}
-
+#
+#
+# ...
+#
+#
+# This declares the intent to provide content that can be rendered in the
+# set of languages in the include specificatino but not in the exclude
+# specification. If a currently preferred language is in the include list
+# the content in the ... is rendered
+# If the currently preferred language is in the exclude list,
+# the content in the ..>[2]->{'include'};
my $exclude = $token->[2]->{'exclude'};
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
+
+ # 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
+
foreach my $preferred_language (@preferred_languages) {
-# If the languageblock has no arguments, show the contents
- $result=1;
+
+ # If neither include/nor exlude is present the block is going
+ # to get rendered.
+
+ my $render=1;
my $found=0;
-# Do we have an include argument?
+
+ # If include is specified, don't render the block
+ # unless the preferred language is included in the set.
+
if ($include) {
-# If include is specified, by default, don't render the block
- $result=0;
+ $render=0;
foreach my $included_language (split(/\,/,$include)) {
-# ... but if my preferred language is included, render it
if ($included_language eq $preferred_language) {
- $result=1;
+ $render=1;
$found=1;
+ last; # Only need to find the first.
}
}
}
-# Do we have an exclude argument?
+ # Do we have an exclude argument?
+ # If so, and one of the languages matches a preferred language
+ # inhibit rendering the block. Note that in the pathalogical case the
+ # author has specified a preferred language in both the include and exclude
+ # attribte exclude is preferred.
+
if ($exclude) {
- $result=1;
+ $render=1;
foreach my $excluded_language (split(/\,/,$exclude)) {
if ($excluded_language eq $preferred_language) {
- $result=0;
+ $render=0;
$found=1;
+ last; # Only need to find the first.
}
}
}
- if ($found) { last; }
+ if ($found) {
+ last; # Done on any match of include or exclude.
+ }
}
- if ( ! $result ) {
+ # If $render not true skip the entire block until
+ #
+
+ if ( ! $render ) {
my $skip=&Apache::lonxml::get_all_text("/languageblock",$parser,
$style);
&Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
}
- $result='';
+ # If $render is true, we've not skipped the contents of the
+ # and the normal loncapa processing flow will render it as a matter of course.
+
} elsif ($target eq 'edit') {
$result .=&Apache::edit::tag_start($target,$token);
$result .=&Apache::edit::text_arg(&mt('Include Language:'),'include',
@@ -1467,7 +1725,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);
@@ -1672,6 +1930,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) {
@@ -1756,9 +2057,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{'.&mt('[quant,_1,pt,pt]',$weight ).'}}';
+
+ }
} elsif ($target eq 'web') {
- $result.='".&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::loncommon::helpLatexCheatsheet().
+ .' | '
+ .''
+ .&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);
@@ -2038,15 +2364,17 @@ sub start_simpleeditbutton {
my $url=$env{'request.noversionuri'};
$url=~s/\?.*$//;
my ($symb) = &Apache::lonnet::whichuser();
-# Warning make more sense and is more important on edit screen
+# 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::lontemplate::start_functionslist()
- .&Apache::lontemplate::item_functionslist(
- ''.&mt('Edit').'')
- .&Apache::lontemplate::end_functionslist();
+ $result.=&Apache::loncommon::head_subbox(
+ &Apache::lonhtmlcommon::start_funclist()
+ .&Apache::lonhtmlcommon::add_item_funclist(
+ ''
+ .&mt('Edit').'')
+ .&Apache::lonhtmlcommon::end_funclist());
}
return $result;
@@ -2062,6 +2390,63 @@ sub practice_problem_header {
'';
}
+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__
|