--- loncom/homework/structuretags.pm 2008/11/25 13:16:17 1.435 +++ loncom/homework/structuretags.pm 2010/08/09 23:39:50 1.461.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.435 2008/11/25 13:16:17 jms Exp $ +# $Id: structuretags.pm,v 1.461.2.1 2010/08/09 23:39:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -203,6 +203,7 @@ sub page_start { } } + my $pageheader = ''; if (defined($found{'body'})) { $body_args{'skip_phases'}{'body'}=1; } elsif (!defined($found{'body'}) @@ -211,6 +212,22 @@ sub page_start { if ($env{'environment.remote'} ne 'off') { $body_args{'only_body'} = 1; } + # Breadcrumbs for Construction Space + &Apache::lonhtmlcommon::clear_breadcrumbs(); + &Apache::lonhtmlcommon::add_breadcrumb({ + 'text' => 'Construction Space', + 'href' => &Apache::loncommon::authorspace(), + }); + # breadcrumbs (and tools) will be created + # in start_page->bodytag->innerregister + +# FIXME Where are we? +# &Apache::lonhtmlcommon::add_breadcrumb({ +# 'text' => 'Problem Editing', # 'Problem Testing' +# 'href' => '', +# }); + $pageheader =&Apache::loncommon::head_subbox( + &Apache::loncommon::CSTR_pageheader()); } } elsif (!defined($found{'body'})) { my %add_entries; @@ -222,31 +239,34 @@ sub page_start { my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack, $safeeval); - if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; } + if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; } - $body_args{'bgcolor'} = $bgcolor; - $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') { - $body_args{'only_body'} = 1; - } + $body_args{'bgcolor'} = $bgcolor; + # $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') { + $body_args{'only_body'} = 1; + } } $body_args{'no_auto_mt_title'} = 1; my $page_start = &Apache::loncommon::start_page($name,$extra_head, \%body_args); + $page_start .= $pageheader; - if (!defined($found{'body'}) - && $env{'request.state'} ne 'construct' - && ($target eq 'web' || $target eq 'webgrade')) { - - my ($symb,undef,undef,undef,$publicuser)= &Apache::lonnet::whichuser(); - if ($symb eq '' && !$publicuser) { - my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference"); - $help=&mt("Browsing resource, all submissions are temporary.")."
"; - $page_start .= $help; - } + unless ($env{'request.gcicontext'} eq 'buildtest') { + if (!defined($found{'body'}) + && $env{'request.state'} ne 'construct' + && ($target eq 'web' || $target eq 'webgrade')) { + + my ($symb,undef,undef,undef,$publicuser)= &Apache::lonnet::whichuser(); + if ($symb eq '' && !$publicuser) { + $page_start .= '

' + .&mt('Browsing resource, all submissions are temporary.') + .'

'; + } + } } if (!defined($found{'body'}) && $env{'request.state'} ne 'construct') { @@ -256,7 +276,8 @@ sub page_start { my $form_tag_start; if (!defined($found{'form'})) { $form_tag_start='
'. &problem_edit_buttons().' -
+
'.&Apache::lonxml::message_location().' '. - ' -"; + $result.=&Apache::edit::start_table($token)."" + .''; unless ($env{'environment.wysiwygeditor'} eq 'on') { $result .= '
'; + '
'; } sub problem_edit_footer { return '

'. @@ -420,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= ''; @@ -498,7 +521,7 @@ $show_all -
+
@@ -522,7 +545,8 @@ $show_all $result.='
-
'; +
+
'; $result.=''; $result .= ''; @@ -530,6 +554,7 @@ $show_all 'onclick="javascript:setmode(this.form,'."'editxml'".')" />'; $result.='
+
'.&Apache::lonxml::message_location().'
'; return $result; @@ -629,7 +654,11 @@ item store_aggregates() 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'}; @@ -644,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; @@ -656,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 { @@ -674,10 +717,8 @@ sub checkout_msg { return (<$lt{'resource'}

$lt{'id_expln'}

- -

$lt{'warning'}

-
- +

$lt{'warning'}

+ @@ -711,7 +752,7 @@ sub firstaccess_msg { my $buttontext = &mt('Show Resource'); my $timertext = &mt('Start Timer?'); $result .= (< +
@@ -894,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.= - '
".&mt('Text Block')."".&mt('Delete:'). - &Apache::edit::deletelist($target,$token) - ."
".&mt('Text Block')."'.&mt('Delete?').' ' + .&Apache::edit::deletelist($target,$token) + .'' .&Apache::lonhtmlcommon::dragmath_button($areaid,1) @@ -2019,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; }