--- loncom/homework/structuretags.pm 2010/05/18 21:03:15 1.465.2.1
+++ loncom/homework/structuretags.pm 2010/08/08 02:00:50 1.474
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.465.2.1 2010/05/18 21:03:15 raeburn Exp $
+# $Id: structuretags.pm,v 1.474 2010/08/08 02:00:50 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -66,7 +66,7 @@ use lib '/home/httpd/lib/perl/';
use LONCAPA;
BEGIN {
- &Apache::lonxml::register('Apache::structuretags',('block','languageblock','translated','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startouttext','endouttext','simpleeditbutton','definetag'));
+ &Apache::lonxml::register('Apache::structuretags',('block','languageblock','translated','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startpartmarker','startouttext','endpartmarker','endouttext','simpleeditbutton','definetag'));
}
sub start_web {
@@ -177,12 +177,13 @@ sub page_start {
$parstack,$parser,$safeeval);
}
- $extra_head .= &homework_js();
-
- if ($env{'environment.wysiwygeditor'} eq 'on') {
- $extra_head .= &Apache::lonhtmlcommon::dragmath_js("FCKEditMathPopup");
- } else {
- $extra_head .= &Apache::lonhtmlcommon::dragmath_js("EditMathPopup");
+ $extra_head .= &homework_js().
+ &Apache::lonhtmlcommon::dragmath_js("EditMathPopup");
+ if (&Apache::lonhtmlcommon::htmlareabrowser()) {
+ my %textarea_args = (
+ dragmath => 'math',
+ );
+ $extra_head .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args);
}
my %body_args;
@@ -209,9 +210,6 @@ sub page_start {
} elsif (!defined($found{'body'})
&& $env{'request.state'} eq 'construct') {
if ($target eq 'web' || $target eq 'edit') {
- if ($env{'environment.remote'} ne 'off') {
- $body_args{'only_body'} = 1;
- }
# Breadcrumbs for Construction Space
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({
@@ -245,8 +243,7 @@ sub page_start {
# $body_args{'no_title'} = 1;
$body_args{'force_register'} = 1;
$body_args{'add_entries'} = \%add_entries;
- if ($env{'environment.remote'} eq 'off'
- && $env{'request.state'} eq 'construct') {
+ if ( $env{'request.state'} eq 'construct') {
$body_args{'only_body'} = 1;
}
}
@@ -405,8 +402,6 @@ sub problem_edit_footer {
'.
-
- &Apache::lonhtmlcommon::htmlareaselectactive(&Apache::lonhtmlcommon::get_htmlareafields()).
"\n\n".&Apache::loncommon::end_page();
}
@@ -633,9 +628,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');
@@ -655,7 +648,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'};
@@ -665,28 +658,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 {
@@ -897,17 +913,6 @@ sub start_problem {
if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval); }
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]);
@@ -1177,7 +1182,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});
@@ -1699,6 +1703,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) {
@@ -1998,17 +2045,15 @@ sub end_startouttext {
$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::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);
|