[LON-CAPA-cvs] cvs: loncom /interface lonbulletin.pm lonhtmlcommon.pm lonsyllabus.pm lontemplate.pm

www www@source.lon-capa.org
Thu, 03 Dec 2009 02:13:28 -0000


www		Thu Dec  3 02:13:28 2009 EDT

  Modified files:              
    /loncom/interface	lonbulletin.pm lonhtmlcommon.pm lonsyllabus.pm 
                     	lontemplate.pm 
  Log:
  Bug #2069 - do not turn hard-coded <a>-links into link-links (and thus make a mess)
  
  
Index: loncom/interface/lonbulletin.pm
diff -u loncom/interface/lonbulletin.pm:1.51 loncom/interface/lonbulletin.pm:1.52
--- loncom/interface/lonbulletin.pm:1.51	Mon Nov 30 11:22:54 2009
+++ loncom/interface/lonbulletin.pm	Thu Dec  3 02:13:28 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Bulletin Board Handler
 #
-# $Id: lonbulletin.pm,v 1.51 2009/11/30 11:22:54 wenzelju Exp $
+# $Id: lonbulletin.pm,v 1.52 2009/12/03 02:13:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -252,8 +252,7 @@
                 if (!&Apache::lonfeedback::contains_block_html($message)) {
                 	&Apache::lonfeedback::newline_to_br(\$message);
                 }
-                $message
-                    =~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
+                $message=&Apache::lonhtmlcommon::raw_href_to_link($message);
                 if ($allowed) {
                     $message=&Apache::lonspeller::markeduptext($message);
                 }
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.252 loncom/interface/lonhtmlcommon.pm:1.253
--- loncom/interface/lonhtmlcommon.pm:1.252	Tue Dec  1 18:07:50 2009
+++ loncom/interface/lonhtmlcommon.pm	Thu Dec  3 02:13:28 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.252 2009/12/01 18:07:50 bisitz Exp $
+# $Id: lonhtmlcommon.pm,v 1.253 2009/12/03 02:13:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -72,6 +72,12 @@
    }
 }
 
+sub raw_href_to_link {
+   my ($message)=@_;
+   $message=~s/(https?\:\/\/[^\s\'\"]+)(\s|$)/<a href="$1"><tt>$1<\/tt><\/a>$2/gi;
+   return $message;
+}
+
 ##############################################
 ##############################################
 
Index: loncom/interface/lonsyllabus.pm
diff -u loncom/interface/lonsyllabus.pm:1.102 loncom/interface/lonsyllabus.pm:1.103
--- loncom/interface/lonsyllabus.pm:1.102	Tue Dec  1 13:34:54 2009
+++ loncom/interface/lonsyllabus.pm	Thu Dec  3 02:13:28 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Syllabus
 #
-# $Id: lonsyllabus.pm,v 1.102 2009/12/01 13:34:54 wenzelju Exp $
+# $Id: lonsyllabus.pm,v 1.103 2009/12/03 02:13:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -421,7 +421,7 @@
                     if (!&Apache::lonfeedback::contains_block_html($message)) {
                     	&Apache::lonfeedback::newline_to_br(\$message);
                     }
-                    $message =~s|(https?\://[^\s]+)|<a href="$1"><tt>$1</tt></a>|g;
+                    $message=&Apache::lonhtmlcommon::raw_href_to_link($message);
                     if ($allowed) {
                         $message=&Apache::lonspeller::markeduptext($message);
                     }
Index: loncom/interface/lontemplate.pm
diff -u loncom/interface/lontemplate.pm:1.40 loncom/interface/lontemplate.pm:1.41
--- loncom/interface/lontemplate.pm:1.40	Thu Nov 26 05:21:43 2009
+++ loncom/interface/lontemplate.pm	Thu Dec  3 02:13:28 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "Template" Functions to generate html output
 #
-# $Id: lontemplate.pm,v 1.40 2009/11/26 05:21:43 faziophi Exp $
+# $Id: lontemplate.pm,v 1.41 2009/12/03 02:13:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -65,8 +65,7 @@
               if (!&Apache::lonfeedback::contains_block_html($message)) {
               	&Apache::lonfeedback::newline_to_br(\$message);
               }
-              $message
-             =~s/(http\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
+              $message=&Apache::lonhtmlcommon::raw_href_to_link($message);
               if ($allowed) {
                   $message=&Apache::lonspeller::markeduptext($message);
               }