[LON-CAPA-cvs] cvs: loncom(version_2_8_X) /interface lonmeta.pm

raeburn raeburn@source.lon-capa.org
Sat, 13 Dec 2008 22:17:15 -0000


raeburn		Sat Dec 13 22:17:15 2008 EDT

  Modified files:              (Branch: version_2_8_X)
    /loncom/interface	lonmeta.pm 
  Log:
  - Backport 1.220, 1.223.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.212.2.1 loncom/interface/lonmeta.pm:1.212.2.2
--- loncom/interface/lonmeta.pm:1.212.2.1	Sat Dec 13 21:07:46 2008
+++ loncom/interface/lonmeta.pm	Sat Dec 13 22:17:15 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.212.2.1 2008/12/13 21:07:46 raeburn Exp $
+# $Id: lonmeta.pm,v 1.212.2.2 2008/12/13 22:17:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -573,12 +573,13 @@
         $functionref=\&direct;
     }
     my $selout='<select name="'.$name.'">';
-    foreach (@idlist) {
-        $selout.='<option value=\''.$_.'\'';
-        if ($_ eq $value) {
+    foreach my $id (@idlist) {
+        $selout.='<option value="'.$id.'"';
+        if ($id eq $value) {
 	    $selout.=' selected>'.&{$functionref}($_).'</option>';
-	}
-        else {$selout.='>'.&{$functionref}($_).'</option>';}
+        } else {
+            $selout.='>'.&{$functionref}($id).'</option>';
+        }
     }
     return $selout.'</select>';
 }
@@ -850,11 +851,11 @@
 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
-                    ('<a href="'.&Apache::lonnet::clutter($_).'">'.$_.'</a>'.
-                     &Apache::lonmsg::retrieve_author_res_msg($_).
+                    ('<a href="'.&Apache::lonnet::clutter($key).'">'.$key.'</a>'.
+                     &Apache::lonmsg::retrieve_author_res_msg($key).
                      '<hr />');
             }
         }
@@ -877,8 +878,8 @@
     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
@@ -988,13 +989,13 @@
         exists($dynmeta{'course'})) {
         $r->print('<h4>'.&mt('Access and Usage Statistics').'</h4>'.
                   &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{$_})
+        foreach my $item ('count',
+                          'sequsage','sequsage_list',
+                          'comefrom','comefrom_list',
+                          'goto','goto_list',
+                          'course','course_list') {
+            $r->print(&Apache::lonhtmlcommon::row_title($lt{$item})
+                      .&prettyprint($item,$dynmeta{$item})
                       .&Apache::lonhtmlcommon::row_closure()
             );
         }
@@ -1018,9 +1019,9 @@
                       .&prettyprint('stdno',$dynmeta{'stdno'})
                       .&Apache::lonhtmlcommon::row_closure()
             );
-            foreach ('avetries','difficulty','disc') {
-                $r->print(&Apache::lonhtmlcommon::row_title($lt{$_})
-                          .&prettyprint($_,sprintf('%5.2f',$dynmeta{$_})).
+            foreach my $item ('avetries','difficulty','disc') {
+                $r->print(&Apache::lonhtmlcommon::row_title($lt{$item})
+                          .&prettyprint($item,sprintf('%5.2f',$dynmeta{$item})).
                           .&Apache::lonhtmlcommon::row_closure()
                 );
             }
@@ -1059,10 +1060,10 @@
                     '<td align="right">'.$data->{'sections'}.'</td>';
                 $table .=
                     '<td align="right">'.$data->{'stdno'}.'</td>';
-                foreach ('avetries','difficulty','disc') {
+                foreach my $item ('avetries','difficulty','disc') {
                     $table .= '<td align="right">';
-                    if (exists($data->{$_})) {
-                        $table .= sprintf('%.2f',$data->{$_}).'&nbsp;';
+                    if (exists($data->{$item})) {
+                        $table .= sprintf('%.2f',$data->{$item}).'&nbsp;';
                     } else {
                         $table .= '';
                     }
@@ -1094,9 +1095,9 @@
         exists($dynmeta{'technical'})){ 
         $r->print('<h4>'.&mt('Evaluation Data').'</h4>'.
                   &Apache::lonhtmlcommon::start_pick_box());
-        foreach ('clear','depth','helpful','correct','technical') {
-            $r->print(&Apache::lonhtmlcommon::row_title($lt{$_})
-                      .&prettyprint($_,$dynmeta{$_})
+        foreach my $item ('clear','depth','helpful','correct','technical') {
+            $r->print(&Apache::lonhtmlcommon::row_title($lt{$item})
+                      .&prettyprint($item,$dynmeta{$item})
                       .&Apache::lonhtmlcommon::row_closure()
             );
         }
@@ -1130,8 +1131,7 @@
               &mt('Additional Metadata (non-standard, parameters, exports)').
               '</h3>');
     $r->print(&Apache::lonhtmlcommon::start_pick_box());
-    foreach (sort(keys(%content))) {
-        my $name=$_;
+    foreach my $name (sort(keys(%content))) {
         if ($name!~/\.display$/) {
             my $display=&Apache::lonnet::metadata($uri,
                                                   $name.'.display');
@@ -1139,12 +1139,12 @@
                 $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)