[LON-CAPA-cvs] cvs: loncom /interface lonaboutme.pm lonbulletin.pm lonsimplepage.pm lonsyllabus.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 23 Oct 2006 18:48:47 -0000


This is a MIME encoded message

--albertel1161629327
Content-Type: text/plain

albertel		Mon Oct 23 14:48:47 2006 EDT

  Modified files:              
    /loncom/interface	lonaboutme.pm lonbulletin.pm lonsimplepage.pm 
                     	lonsyllabus.pm 
  Log:
  - deathe to $_
  
  
--albertel1161629327
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20061023144847.txt"

Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.56 loncom/interface/lonaboutme.pm:1.57
--- loncom/interface/lonaboutme.pm:1.56	Thu Sep 21 11:50:10 2006
+++ loncom/interface/lonaboutme.pm	Mon Oct 23 14:48:46 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "About Me" Personal Information
 #
-# $Id: lonaboutme.pm,v 1.56 2006/09/21 15:50:10 albertel Exp $
+# $Id: lonaboutme.pm,v 1.57 2006/10/23 18:48:46 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -171,12 +171,12 @@
 	}
     }
        if (($allowed) && ($env{'form.storesyl'})) {
-	   foreach (keys %syllabusfields) {
-               my $field=$env{'form.'.$_};
+	   foreach my $syl_field (keys(%syllabusfields)) {
+               my $field=$env{'form.'.$syl_field};
                $field=~s/\s+$//s;
                $field=&Apache::lonfeedback::clear_out_html($field,
                                                            $env{'user.adv'});
-	       $syllabus{$_}=$field;
+	       $syllabus{$syl_field}=$field;
            }
            $syllabus{'uploaded.lastmodified'}=time;
            &Apache::lonnet::put('aboutme',\%syllabus,$cdom,$cnum);
@@ -209,9 +209,9 @@
 	 '</form><form method="post">');
 
        }
-       foreach (sort keys %syllabusfields) {
-          if (($syllabus{$_}) || ($allowed)) {
-              my $message=$syllabus{$_};
+       foreach my $field (sort(keys(%syllabusfields))) {
+          if (($syllabus{$field}) || ($allowed)) {
+              my $message=$syllabus{$field};
 	      &Apache::lonfeedback::newline_to_br(\$message);
               $message
              =~s/(http\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
@@ -220,15 +220,15 @@
 	      }
 	      $message=&Apache::lontexconvert::msgtexconverted($message);
 	      if ($target ne 'tex') {
-		  $r->print('<h3>'.$syllabusfields{$_}.'</h3><blockquote>'.
+		  $r->print('<h3>'.$syllabusfields{$field}.'</h3><blockquote>'.
                             $message.'</blockquote>');
 	      } else {
-		     $r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\'.
+		     $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'.
 			       &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\');
 	      }
               if ($allowed) {
-                 $r->print('<br /><textarea cols="80" rows="6" name="'.$_.'">'.
-			   &HTML::Entities::encode($syllabus{$_},'"&<>').
+                 $r->print('<br /><textarea cols="80" rows="6" name="'.$field.'">'.
+			   &HTML::Entities::encode($syllabus{$field},'"&<>').
            '</textarea><input type="submit" name="storesyl" value="'.
 			   &mt('Store').'" />');
 	      }
Index: loncom/interface/lonbulletin.pm
diff -u loncom/interface/lonbulletin.pm:1.41 loncom/interface/lonbulletin.pm:1.42
--- loncom/interface/lonbulletin.pm:1.41	Mon Aug 28 09:09:51 2006
+++ loncom/interface/lonbulletin.pm	Mon Oct 23 14:48:47 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Bulletin Board Handler
 #
-# $Id: lonbulletin.pm,v 1.41 2006/08/28 13:09:51 albertel Exp $
+# $Id: lonbulletin.pm,v 1.42 2006/10/23 18:48:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -212,11 +212,11 @@
           &Apache::lonnet::put('bulletinpage_'.$marker,\%syllabus,$dom,$crs);
        }
        if (($allowed) && ($env{'form.storesyl'})) {
-	   foreach (keys %syllabusfields) {
-               my $field=$env{'form.'.$_};
+	   foreach my $syl_field (keys(%syllabusfields)) {
+               my $field=$env{'form.'.$syl_field};
                $field=~s/\s+$//s;
                $field=&Apache::lonfeedback::clear_out_html($field,1);
-	       $syllabus{$_}=$field;
+	       $syllabus{$syl_field}=$field;
            }
            $syllabus{'uploaded.lastmodified'}=time;
            &Apache::lonnet::put('bulletinpage_'.$marker,\%syllabus,$dom,$crs);
@@ -239,9 +239,9 @@
          '<input type="submit" name="storeupl" value="'.&mt('Upload').'">'.
 	 '</form><form method="post">');
        }
-       foreach (sort keys %syllabusfields) {
-          if (($syllabus{$_}) || ($allowed)) {
-              my $message=$syllabus{$_};
+       foreach my $field (sort(keys(%syllabusfields))) {
+          if (($syllabus{$field}) || ($allowed)) {
+              my $message=$syllabus{$field};
 	      &Apache::lonfeedback::newline_to_br(\$message);
 	      $message
         =~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
@@ -249,12 +249,12 @@
 		  $message=&Apache::lonspeller::markeduptext($message);
 	      }
 	      $message=&Apache::lontexconvert::msgtexconverted($message);
-	      unless ($_ eq 'aaa_title') {
-		if (($_ ne 'bbb_content') || ($allowed)) {
+	      unless ($field eq 'aaa_title') {
+		if (($field ne 'bbb_content') || ($allowed)) {
 		    if ($target ne 'tex') {
-			$r->print('<h3>'.$syllabusfields{$_}.'</h3>');
+			$r->print('<h3>'.$syllabusfields{$field}.'</h3>');
 		    } else {
-			$r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\');
+			$r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\');
 		    }
 		}
 		if ($target ne 'tex') {
@@ -264,8 +264,8 @@
 		    $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$message).' ');
 		}
                  if ($allowed) {
-                $r->print('<br /><textarea cols="80" rows="10" name="'.$_.'">'.
-			  &HTML::Entities::encode($syllabus{$_},'&"<>').
+                $r->print('<br /><textarea cols="80" rows="10" name="'.$field.'">'.
+			  &HTML::Entities::encode($syllabus{$field},'&"<>').
            '</textarea><input type="submit" name="storesyl" value="'.&mt('Store').'" />');
 	        }
 	    } else {
@@ -276,8 +276,8 @@
 		}
                 if ($allowed) {
                  $r->print(
-                '<br />'.&mt('Topic').'<br /><textarea cols="80" rows="2" name="'.$_.'">'.
-			  &HTML::Entities::encode($syllabus{$_},'&"<>').
+                '<br />'.&mt('Topic').'<br /><textarea cols="80" rows="2" name="'.$field.'">'.
+			  &HTML::Entities::encode($syllabus{$field},'&"<>').
            '</textarea><input type="submit" name="storesyl" value="'.&mt('Store').'" />');
                 }
             }
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.47 loncom/interface/lonsimplepage.pm:1.48
--- loncom/interface/lonsimplepage.pm:1.47	Wed Aug 16 15:40:46 2006
+++ loncom/interface/lonsimplepage.pm	Mon Oct 23 14:48:47 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.47 2006/08/16 19:40:46 albertel Exp $
+# $Id: lonsimplepage.pm,v 1.48 2006/10/23 18:48:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -221,14 +221,14 @@
 	&Apache::lonnet::put($namespace,\%syllabus,$dom,$crs);
     }
     if (($allowed) && ($env{'form.storesyl'})) {
-	foreach (keys %syllabusfields) {
-	    my $field=$env{'form.'.$_};
+	foreach my $syl_field (keys(%syllabusfields)) {
+	    my $field=$env{'form.'.$syl_field};
 	    chomp($field);
 	    $field=~s/\s+$//s;
 	    $field=~s/^\s+//s;
 	    $field=~s/\<br\s*\/*\>$//s;
 	    $field=&Apache::lonfeedback::clear_out_html($field,1);
-	    $syllabus{$_}=$field;
+	    $syllabus{$syl_field}=$field;
 	}
 	$syllabus{'uploaded.lastmodified'}=time;
 	&Apache::lonnet::put($namespace,\%syllabus,$dom,$crs);
@@ -258,10 +258,10 @@
 		      '<input type="submit" name="storeupl" value="Upload">'.
 		      '</form><form method="post">');
 	}
-	foreach (sort keys %syllabusfields) {
-	    if (($syllabus{$_}) || ($allowed) || 
-                ($_ eq 'abb_links' && $group ne '')) {
-		my $message=$syllabus{$_};
+	foreach my $field (sort(keys(%syllabusfields))) {
+	    if (($syllabus{$field}) || ($allowed) || 
+                ($field eq 'abb_links' && $group ne '')) {
+		my $message=$syllabus{$field};
 		&Apache::lonfeedback::newline_to_br(\$message);
 		$message
 		    =~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
@@ -269,13 +269,13 @@
 		    $message=&Apache::lonspeller::markeduptext($message);
 		}
 		$message=&Apache::lontexconvert::msgtexconverted($message);
-                if ($_ eq 'abb_links' && $group ne '') {
-                    $r->print('<br /><input type="hidden" name="'.$_.
-                                          '" value="'.$syllabus{$_}.'" />');
+                if ($field eq 'abb_links' && $group ne '') {
+                    $r->print('<br /><input type="hidden" name="'.$field.
+                                          '" value="'.$syllabus{$field}.'" />');
                     &display_group_links($r,$target,$group,'edit',$refarg,
                                          %groupinfo);
                     $r->print('<br />');
-                } elsif ($_ eq 'aaa_title') {
+                } elsif ($field eq 'aaa_title') {
                     if ($target ne 'tex') {
                         $r->print('<h1>'.$message.'</h1>');
                     } else {
@@ -285,21 +285,21 @@
                     if ($allowed) {
                         if ($env{'form.grade_target'} ne 'tex') {
                             $r->print(
-                                      '<br />Title<br /><textarea cols="80" rows="2" name="'.$_.'">'.
-                                      &HTML::Entities::encode($syllabus{$_},'"&<>').
+                                      '<br />Title<br /><textarea cols="80" rows="2" name="'.$field.'">'.
+                                      &HTML::Entities::encode($syllabus{$field},'"&<>').
                                       '</textarea><input type="submit" name="storesyl" value="Store" />');
                         } else {
                             my $safeinit;
-                            $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$_},$safeinit));
+                            $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$field},$safeinit));
                         }
                     }
                 } else {
-		    if (($_ ne 'bbb_content') || ($allowed)) {
+		    if (($field ne 'bbb_content') || ($allowed)) {
 			if ($target ne 'tex') {
-			    $r->print('<h3>'.$syllabusfields{$_}.'</h3>');
+			    $r->print('<h3>'.$syllabusfields{$field}.'</h3>');
 			} else {
 			    my $safeinit;
-			    $r->print(&Apache::lonxml::xmlparse($r,'tex','<h3>'.$syllabusfields{$_}.'</h3>'));
+			    $r->print(&Apache::lonxml::xmlparse($r,'tex','<h3>'.$syllabusfields{$field}.'</h3>'));
 			}
 		    }
 		    if ($target ne 'tex') {
@@ -311,12 +311,12 @@
 		    }
 		    if ($allowed) {
 			if ($target ne 'tex') {
-			    $r->print('<br /><textarea cols="80" rows="24" name="'.$_.'" id="'.$_.'">'.
-                                      &HTML::Entities::encode($syllabus{$_},'"&<>').
+			    $r->print('<br /><textarea cols="80" rows="24" name="'.$field.'" id="'.$field.'">'.
+                                      &HTML::Entities::encode($syllabus{$field},'"&<>').
 				      '</textarea><input type="submit" name="storesyl" value="Store" />');
 			} else {
 			    my $safeinit;
-			    $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$_},$safeinit));
+			    $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$field},$safeinit));
 			}
 		    }
 		}
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.54 loncom/interface/lonsyllabus.pm:1.55
--- loncom/interface/lonsyllabus.pm:1.54	Wed Aug 16 15:40:46 2006
+++ loncom/interface/lonsyllabus.pm	Mon Oct 23 14:48:47 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.54 2006/08/16 19:40:46 albertel Exp $
+# $Id: lonsyllabus.pm,v 1.55 2006/10/23 18:48:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -206,26 +206,28 @@
 	  }
       }
        if (($allowed) && ($env{'form.storesyl'})) {
-	   foreach (keys %syllabusfields) {
-               my $field=$env{'form.'.$_};
+	   foreach my $syl_field (keys(%syllabusfields)) {
+               my $field=$env{'form.'.$syl_field};
 	       chomp($field);
                $field=~s/\s+$//s;
 	       $field=~s/^\s+//s;
 	       $field=~s/\<br\s*\/*\>$//s;
 	       $field=&Apache::lonfeedback::clear_out_html($field,1);
-	       $syllabus{$_}=$field;
-               if ($_ eq 'lll_includeurl') { # clean up included URLs
+	       $syllabus{$syl_field}=$field;
+               if ($syl_field eq 'lll_includeurl') { # clean up included URLs
                   my $field='';
-	          foreach (split(/\n/,$syllabus{$_})) {
-		      my $url=$_;
+	          foreach my $value (split(/\n/,$syllabus{$syl_field})) {
+		      my $url=$value;
 # get rid of leading and trailing spaces
                       $url=~s/^\s+//;
                       $url=~s/\s+$//;
-                      if ($url=~/^http\:\/\/([^\/]+)\/(.+)$/) {
+                      if ($url=~m|^http://([^/]+)/(.+)$|) {
+			  my $host = $1;
                           my $remainder=$2;
 # remove the hostname from internal URLs
-		          foreach (keys %Apache::lonnet::hostname) {
-                              if ($1=~/$Apache::lonnet::hostname{$_}/i) {
+		          foreach my $possible_host (keys(%Apache::lonnet::hostname)) {
+                              if ($possible_host =~
+				     /\Q$Apache::lonnet::hostname{$host}\E/i) {
 			         $url=$remainder;
 			      }
 		          }
@@ -239,7 +241,7 @@
 		          $field.=$url."\n";
                       }
 		  }
-                  $syllabus{$_}=$field;
+                  $syllabus{$syl_field}=$field;
 	      }
            }
            $syllabus{'uploaded.domain'}=$env{'user.domain'};
@@ -270,62 +272,60 @@
 		     '<input type="hidden" name="forceedit" value="edit" />');
        }
        my @htmlids=();
-       foreach (sort keys %syllabusfields) {
-          if (($syllabus{$_}=~/\w/) || ($allowed)) {
-              my $message=$syllabus{$_};
-              if ($_ eq 'lll_includeurl') { # this is the "included" field
-		  my $urls=$message;
-                  $message='';
-                  foreach my $filelink (split(/\n/,$urls)) {
-		      my $output='';
+       foreach my $field (sort(keys(%syllabusfields))) {
+	   if (($syllabus{$field}=~/\w/) || ($allowed)) {
+	       my $message=$syllabus{$field};
+	       if ($field eq 'lll_includeurl') { # this is the "included" field
+		   my $urls=$message;
+		   $message='';
+		   foreach my $filelink (split(/\n/,$urls)) {
+		       my $output='';
 # embed style?
-		      my ($curfext)=($filelink=~/\.([^\.]+)$/);
-                      my $embstyle=&Apache::loncommon::fileembstyle($curfext);
-	              if (($embstyle eq 'ssi') || ($curfext=~/\/$/)) {
+		       my ($curfext)=($filelink=~/\.([^\.]+)$/);
+		       my $embstyle=&Apache::loncommon::fileembstyle($curfext);
+		       if (($embstyle eq 'ssi') || ($curfext=~/\/$/)) {
 # make ssi call and remove everything but the body contents
-			  $output=&Apache::lonnet::ssi_body($filelink);
-	              } elsif ($embstyle eq 'img') {
+			   $output=&Apache::lonnet::ssi_body($filelink);
+		       } elsif ($embstyle eq 'img') {
 # embed as an image
-                         $output='<img src="'.$filelink.'" />';
-		      }
-		      if ($target ne 'tex') {
-			  $message.='<p>'.$output.'</p>';
-		      } else {
-			  $message.=' '.&Apache::lonxml::xmlparse($r,'tex','<p>'.$output.'</p>').' ';
-		      }		      
-                  }
-                  if ($allowed) {
-                     $r->print('<h3>'.$syllabusfields{$_}.
-          &Apache::loncommon::help_open_topic('Syllabus_URLs').'</h3>'.
-	  '<p><a href="'.$r->uri.'?forcestudent=1"><font size="+1">'.&mt('Show Public View').'</font></a>'.
- &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
-		 } else {
-                  $r->print($message);
-                 } 
-              } else {
-		  &Apache::lonfeedback::newline_to_br(\$message);
-                 $message
-           =~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
-		 if ($allowed) {
-		     $message=&Apache::lonspeller::markeduptext($message);
-		 }
-	         $message=&Apache::lontexconvert::msgtexconverted($message);
-		 if ($target ne 'tex') {
-		     $r->print('<h3>'.$syllabusfields{$_}.'</h3><blockquote>'.
-                               $message.'</blockquote>');
-		 } else {
-		     $r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\'.
-			       &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\');
-		 }
-		 push @htmlids,$_;
-	     }
-              if ($allowed) {
-                 $r->print(
-	   '<br /><textarea cols="80" rows="12" name="'.$_.'" id="'.$_.'">'.
-			   &HTML::Entities::encode($syllabus{$_},'"&<>').
-           '</textarea> <input type="submit" name="storesyl" value="Store" />');
-	      }
-	  }
+			   $output='<img src="'.$filelink.'" />';
+		       }
+		       if ($target ne 'tex') {
+			   $message.='<p>'.$output.'</p>';
+		       } else {
+			   $message.=' '.&Apache::lonxml::xmlparse($r,'tex','<p>'.$output.'</p>').' ';
+		       }      
+		   }
+		   if ($allowed) {
+		       $r->print('<h3>'.$syllabusfields{$field}.
+				 &Apache::loncommon::help_open_topic('Syllabus_URLs').'</h3>'.
+				 '<p><a href="'.$r->uri.'?forcestudent=1"><font size="+1">'.&mt('Show Public View').'</font></a>'.
+				 &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');
+		   } else {
+		       $r->print($message);
+		   } 
+	       } else {
+		   &Apache::lonfeedback::newline_to_br(\$message);
+		   $message =~s|(https*://[^\s]+)|<a href="$1"><tt>$1</tt></a>/g;
+		   if ($allowed) {
+		       $message=&Apache::lonspeller::markeduptext($message);
+		   }
+		   $message=&Apache::lontexconvert::msgtexconverted($message);
+		   if ($target ne 'tex') {
+		       $r->print('<h3>'.$syllabusfields{$field}.'</h3><blockquote>'.
+				 $message.'</blockquote>');
+		   } else {
+		       $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'.
+				 &Apache::lonxml::xmlparse($r,'tex',$message).'\\\\');
+		   }
+		   push(@htmlids,$field);
+	       }
+	       if ($allowed) {
+		   $r->print('<br /><textarea cols="80" rows="12" name="'.$field.'" id="'.$field.'">'.
+			     &HTML::Entities::encode($syllabus{$field},'"&<>').
+			     '</textarea> <input type="submit" name="storesyl" value="Store" />');
+	       }
+	   }
        }
        if ($allowed) {
 	   $r->print('</form>'.

--albertel1161629327--