--- loncom/interface/lonmeta.pm 2007/01/02 11:38:28 1.191 +++ loncom/interface/lonmeta.pm 2012/10/29 17:38:56 1.247 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Metadata display handler # -# $Id: lonmeta.pm,v 1.191 2007/01/02 11:38:28 raeburn Exp $ +# $Id: lonmeta.pm,v 1.247 2012/10/29 17:38:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,24 +42,6 @@ use Apache::lonmsg; use LONCAPA qw(:DEFAULT :match); -############################################################ -############################################################ -## -## &get_dynamic_metadata_from_sql($url) -## -## Queries sql database for dynamic metdata -## Returns a hash of hashes, with keys of urls which match $url -## Returned fields are given below. -## -## Examples: -## -## %DynamicMetadata = &Apache::lonmeta::get_dynmaic_metadata_from_sql -## ('/res/msu/korte/'); -## -## $DynamicMetadata{'/res/msu/korte/example.problem'}->{$field} -## -############################################################ -############################################################ sub get_dynamic_metadata_from_sql { my ($url) = shift(); my ($authordom,$author)=($url=~m{^/res/($match_domain)/($match_username)/}); @@ -182,7 +164,7 @@ sub evalgraph { my $val=int($value*10.+0.5)-10; my $output='
  | '; + $output.=''.(' ' x2).' | '; } else { $output.=''. ' | '; @@ -192,7 +174,7 @@ sub evalgraph { $output.=' | '. ' | '; } else { - $output.=' |   | '; + $output.=''.(' ' x2).' | '; } $output.='('.sprintf("%5.2f",$value).') |
'.&mt('Not authorized').'
'); + return; + } + + my $showbuttons=1; + my $message=''; + if ($env{'form.clearbombs'}) { + my $rc=&Apache::lonmsg::clear_author_res_msg($uri); + if ($rc eq 'ok') { + $message=&Apache::lonhtmlcommon::confirm_success( + &mt('Messages cleared.')); + $showbuttons=0; + } else { + $message=&Apache::lonhtmlcommon::confirm_success( + &mt('Error clearing messages'),1) + .''.$functions.'
'); } return; } @@ -832,8 +946,8 @@ sub present_uneditable_metadata { my $uploaded = ($uri =~ m|/uploaded/|); my %content=(); # Read file - foreach (split(/\,/,&Apache::lonnet::metadata($uri,'keys'))) { - $content{$_}=&Apache::lonnet::metadata($uri,$_); + foreach my $key (split(/\,/,&Apache::lonnet::metadata($uri,'keys'))) { + $content{$key}=&Apache::lonnet::metadata($uri,$key); } # Render Output # displayed url @@ -854,16 +968,15 @@ sub present_uneditable_metadata { $versiondisplay='Version: '.$currentversion; } } - # crumbify displayed URL uri target prefix form size - $disuri=&Apache::lonhtmlcommon::crumbs($disuri,undef, undef, undef,'+1'); - $disuri =~ s:'.
+ $obsoletewarning=' '.
&mt('This resource has been marked obsolete by the author(s)').
- '
-$disuri
-$obsoletewarning
-$versiondisplay
-
'
+ .$disuri.'
'
+ .$obsoletewarning
+ .$versiondisplay
+ .'
'.$lt{$_}.' | '. - ''. - &prettyprint($_,$dynmeta{$_})." |
' + .&mt('No Access or Usages Statistics are available for this resource.') + .'
' + ); } # # Assessment statistics - if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/) { + if ($uri=~/$LONCAPA::assess_re/) { if (exists($dynmeta{'stdno'}) || exists($dynmeta{'avetries'}) || exists($dynmeta{'difficulty'}) || @@ -968,35 +1091,42 @@ sub print_dynamic_metadata { $r->print(''.$lt{'stdno'}.' | '. - ''. - &prettyprint('stdno',$dynmeta{'stdno'}). - ' | '."
'.$lt{$_}.' | '. - ''. - &prettyprint($_,sprintf('%5.2f',$dynmeta{$_})). - ' | '."
Course | '. - 'Section(s) | '. - 'Num Students | '. - 'Mean Tries | '. - 'Degree of Difficulty | '. - 'Degree of Discrimination | '. - 'Time of computation | '. - ''.&mt('Course').' | ' + .''.&mt('Section(s)').' | ' + .''.&mt('Num Students').' | ' + .''.&mt('Part').' | ' + .''.&mt('Mean Tries').' | ' + .''.&mt('Degree of Difficulty').' | ' + .''.&mt('Degree of Discrimination').' | ' + .''.&mt('Time of computation').' | ' + .&Apache::loncommon::end_data_table_header_row().$/; foreach my $identifier (sort(keys(%{$dynmeta{'stats'}}))) { my $data = $dynmeta{'stats'}->{$identifier}; my $course = $data->{'course'}; @@ -1007,33 +1137,37 @@ sub print_dynamic_metadata { &Apache::lonnet::logthis('lookup for '.$course.' failed'); next; } - $table .= '
---|---|---|---|---|---|---|---|
'.$courseinfo{'description'}.' | '; $table .= ''.$data->{'sections'}.' | '; $table .= ''.$data->{'stdno'}.' | '; - foreach ('avetries','difficulty','disc') { + $table .= + ''.$data->{'part'}.' | '; + foreach my $item ('avetries','difficulty','disc') { $table .= ''; - if (exists($data->{$_})) { - $table .= sprintf('%.2f',$data->{$_}).' '; + if (exists($data->{$item})) { + $table .= sprintf('%.2f',$data->{$item}).' '; } else { $table .= ''; } $table .= ' | '; } $table .= - ''.
&Apache::lonlocal::locallocaltime($data->{'timestamp'}).
- ' | ';
- $table .=
- ' |
' + .&mt('No new dynamic data found.') + .'
' + ); } } else { $r->print(''.$lt{$_}.' | '. - ''. - &prettyprint($_,$dynmeta{$_})." |
' + .&mt('No Evaluation Data is available for this resource.') + .'
' + ); } + # Evaluation Comments $uri=~/^\/res\/($match_domain)\/($match_username)\//; if ((($env{'user.domain'} eq $1) && ($env{'user.name'} eq $2)) || ($env{'user.role.ca./'.$1.'/'.$2})) { + $r->print(''.$dynmeta{'comments'}.''); + $r->print('
'.$dynmeta{'comments'}.''); } else { - $r->print('
' + .&mt('There are no Evaluation Comments on this resource.') + .'
' + ); } my $bombs = &Apache::lonmsg::retrieve_author_res_msg($uri); if (defined($bombs) && $bombs ne '') { - $r->print(''.$display.' | '.$content{$name}); + $r->print(&Apache::lonhtmlcommon::row_title($display) + .$content{$name} + ); if ($otherinfo) { $r->print(' ('.$otherinfo.')'); } - $r->print(" |