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

raeburn raeburn@source.lon-capa.org
Sat, 13 Dec 2008 19:44:52 -0000


raeburn		Sat Dec 13 19:44:52 2008 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  - style
    - eliminate $_ (except in map {}).
    - cuddled else.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.219 loncom/interface/lonmeta.pm:1.220
--- loncom/interface/lonmeta.pm:1.219	Fri Dec 12 10:01:25 2008
+++ loncom/interface/lonmeta.pm	Sat Dec 13 19:44:52 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.219 2008/12/12 10:01:25 bisitz Exp $
+# $Id: lonmeta.pm,v 1.220 2008/12/13 19:44:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -555,12 +555,13 @@
         $functionref=\&direct;
     }
     my $selout='<select name="'.$name.'">';
-    foreach (@idlist) {
-        $selout.='<option value=\''.$_.'\'';
-        if ($_ eq $value) {
-	    $selout.=' selected>'.&{$functionref}($_).'</option>';
-	}
-        else {$selout.='>'.&{$functionref}($_).'</option>';}
+    foreach my $id (@idlist) {
+        $selout.='<option value=\''.$id.'\'';
+        if ($id eq $value) {
+	    $selout.=' selected>'.&{$functionref}($id).'</option>';
+        } else {
+            $selout.='>'.&{$functionref}($id).'</option>';
+        }
     }
     return $selout.'</select>';
 }
@@ -832,11 +833,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 />');
             }
         }
@@ -859,8 +860,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
@@ -970,13 +971,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()
             );
         }
@@ -1000,9 +1001,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()
                 );
             }
@@ -1041,10 +1042,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 .= '';
                     }
@@ -1076,9 +1077,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()
             );
         }
@@ -1112,8 +1113,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');
@@ -1121,12 +1121,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)