[LON-CAPA-cvs] cvs: loncom /interface lonannounce.pm
www
lon-capa-cvs@mail.lon-capa.org
Wed, 18 Jun 2003 20:06:29 -0000
www Wed Jun 18 16:06:29 2003 EDT
Modified files:
/loncom/interface lonannounce.pm
Log:
Bug #1806: apostrophy in announcement produced JavaScript error. I love
escaping the escaped.
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.14 loncom/interface/lonannounce.pm:1.15
--- loncom/interface/lonannounce.pm:1.14 Wed Jun 18 11:11:20 2003
+++ loncom/interface/lonannounce.pm Wed Jun 18 16:06:29 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Announce
#
-# $Id: lonannounce.pm,v 1.14 2003/06/18 15:11:20 www Exp $
+# $Id: lonannounce.pm,v 1.15 2003/06/18 20:06:29 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -32,6 +32,7 @@
use Apache::Constants qw(:common);
use Apache::loncommon;
use Apache::lonhtmlcommon();
+use HTML::Entities();
my %todayhash;
@@ -88,6 +89,8 @@
$end.'">';
}
}
+ $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
+ $fullmsg=~s/&/\\&/g;
$output.='<a href="javascript:alert('."'$fullmsg'".')">'.
substr($msg,0,20).'...</a><br />';
}
@@ -108,6 +111,8 @@
my $msg=join('@',@msg);
my $fullmsg=$ENV{'course.'.$courseid.'.description'}.
', '.localtime($start).' - '.localtime($end).': '.$msg;
+ $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
+ $fullmsg=~s/&/\\&/g;
$output.='<a href="javascript:alert('."'$fullmsg'".')">'.
substr($msg,0,40).'...</a><br />';
}