--- loncom/interface/lonmeta.pm 2008/12/10 18:43:32 1.218
+++ loncom/interface/lonmeta.pm 2008/12/13 21:56:57 1.222
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.218 2008/12/10 18:43:32 bisitz Exp $
+# $Id: lonmeta.pm,v 1.222 2008/12/13 21:56:57 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -164,7 +164,7 @@ sub evalgraph {
my $val=int($value*10.+0.5)-10;
my $output='
';
if ($val>=20) {
- $output.='  | ';
+ $output.=''.(' ' x2).' | ';
} else {
$output.=' | '.
' | ';
@@ -174,7 +174,7 @@ sub evalgraph {
$output.=' | '.
' | ';
} else {
- $output.='  | ';
+ $output.=''.(' ' x2).' | ';
}
$output.=' ('.sprintf("%5.2f",$value).') |
';
return $output;
@@ -555,12 +555,13 @@ sub selectbox {
$functionref=\&direct;
}
my $selout='';
}
@@ -832,11 +833,11 @@ sub report_bombs {
ENDCLEAR
my %brokenurls =
&Apache::lonmsg::all_url_author_res_msg($author,$domain);
- foreach (sort(keys(%brokenurls))) {
- if ($_=~/^\Q$uri\E/) {
+ foreach my $key (sort(keys(%brokenurls))) {
+ if ($key=~/^\Q$uri\E/) {
$r->print
- (''.$_.''.
- &Apache::lonmsg::retrieve_author_res_msg($_).
+ (''.$key.''.
+ &Apache::lonmsg::retrieve_author_res_msg($key).
'
');
}
}
@@ -859,8 +860,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
@@ -926,10 +927,14 @@ sub present_uneditable_metadata {
'obsolete',
'obsoletereplacement');
}
+ my $rownum = 0;
foreach my $field (@fields) {
+ my $lastrow = '';
+ $rownum ++;
+ $lastrow = 1 if ($rownum == @fields);
$table.=&Apache::lonhtmlcommon::row_title($lt{$field})
.&prettyprint($field,$content{$field})
- .&Apache::lonhtmlcommon::row_closure();
+ .&Apache::lonhtmlcommon::row_closure($lastrow);
delete($content{$field});
}
#
@@ -970,14 +975,17 @@ sub print_dynamic_metadata {
exists($dynmeta{'course'})) {
$r->print(''.&mt('Access and Usage Statistics').'
'.
&Apache::lonhtmlcommon::start_pick_box());
- foreach ('count',
- 'sequsage','sequsage_list',
- 'comefrom','comefrom_list',
- 'goto','goto_list',
- 'course','course_list') {
- $r->print(&Apache::lonhtmlcommon::row_title($lt{$_})
- .&prettyprint($_,$dynmeta{$_})
- .&Apache::lonhtmlcommon::row_closure()
+ my @counts = ('count','sequsage','sequsage_list',
+ 'comefrom','comefrom_list','goto',
+ 'goto_list','course','course_list');
+ my $rownum = 0;
+ foreach my $item (@counts) {
+ my $lastrow = '';
+ $rownum ++;
+ $lastrow = 1 if ($rownum == @counts);
+ $r->print(&Apache::lonhtmlcommon::row_title($lt{$item})
+ .&prettyprint($item,$dynmeta{$item})
+ .&Apache::lonhtmlcommon::row_closure($lastrow)
);
}
$r->print(&Apache::lonhtmlcommon::end_pick_box());
@@ -1000,10 +1008,15 @@ sub print_dynamic_metadata {
.&prettyprint('stdno',$dynmeta{'stdno'})
.&Apache::lonhtmlcommon::row_closure()
);
- foreach ('avetries','difficulty','disc') {
- $r->print(&Apache::lonhtmlcommon::row_title($lt{$_})
- .&prettyprint($_,sprintf('%5.2f',$dynmeta{$_}))
- .&Apache::lonhtmlcommon::row_closure()
+ my @stats = ('avetries','difficulty','disc');
+ my $rownum = 0;
+ foreach my $item (@stats) {
+ my $lastrow = '';
+ $rownum ++;
+ $lastrow = 1 if ($rownum == @stats);
+ $r->print(&Apache::lonhtmlcommon::row_title($lt{$item})
+ .&prettyprint($item,sprintf('%5.2f',$dynmeta{$item}))
+ .&Apache::lonhtmlcommon::row_closure($lastrow)
);
}
$r->print(&Apache::lonhtmlcommon::end_pick_box());
@@ -1041,10 +1054,10 @@ sub print_dynamic_metadata {
''.$data->{'sections'}.' | ';
$table .=
''.$data->{'stdno'}.' | ';
- foreach ('avetries','difficulty','disc') {
+ 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 .= '';
}
@@ -1076,10 +1089,15 @@ sub print_dynamic_metadata {
exists($dynmeta{'technical'})){
$r->print(''.&mt('Evaluation Data').''.
&Apache::lonhtmlcommon::start_pick_box());
- foreach ('clear','depth','helpful','correct','technical') {
- $r->print(&Apache::lonhtmlcommon::row_title($lt{$_})
- .&prettyprint($_,$dynmeta{$_})
- .&Apache::lonhtmlcommon::row_closure()
+ my @criteria = ('clear','depth','helpful','correct','technical');
+ my $rownum = 0;
+ foreach my $item (@criteria) {
+ my $lastrow = '';
+ $rownum ++;
+ $lastrow = 1 if ($rownum == @criteria);
+ $r->print(&Apache::lonhtmlcommon::row_title($lt{$item})
+ .&prettyprint($item,$dynmeta{$item})
+ .&Apache::lonhtmlcommon::row_closure($lastrow)
);
}
$r->print(&Apache::lonhtmlcommon::end_pick_box());
@@ -1112,21 +1130,31 @@ sub print_dynamic_metadata {
&mt('Additional Metadata (non-standard, parameters, exports)').
'');
$r->print(&Apache::lonhtmlcommon::start_pick_box());
- foreach (sort(keys(%content))) {
- my $name=$_;
- if ($name!~/\.display$/) {
+ my @names;
+ foreach my $key (sort(keys(%content))) {
+ if ($key!~/\.display$/) {
+ push(@names,$key);
+ }
+ }
+ if (@names > 0) {
+ my $rownum = 0;
+ foreach my $name (@names) {
+ my $lastrow = '';
+ $rownum ++;
+ $lastrow = 1 if ($rownum == @names);
+
my $display=&Apache::lonnet::metadata($uri,
$name.'.display');
if (! $display) {
$display=$name;
};
my $otherinfo='';
- foreach ('name','part','type','default') {
+ foreach my $item ('name','part','type','default') {
if (defined(&Apache::lonnet::metadata($uri,
- $name.'.'.$_))) {
- $otherinfo.=' '.$_.'='.
+ $name.'.'.$item))) {
+ $otherinfo.=' '.$item.'='.
&Apache::lonnet::metadata($uri,
- $name.'.'.$_).'; ';
+ $name.'.'.$item).'; ';
}
}
$r->print(&Apache::lonhtmlcommon::row_title($display)
@@ -1135,7 +1163,7 @@ sub print_dynamic_metadata {
if ($otherinfo) {
$r->print(' ('.$otherinfo.')');
}
- $r->print(&Apache::lonhtmlcommon::row_closure());
+ $r->print(&Apache::lonhtmlcommon::row_closure($lastrow));
}
}
$r->print(&Apache::lonhtmlcommon::end_pick_box());
|