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

albertel lon-capa-cvs@mail.lon-capa.org
Sun, 23 Apr 2006 07:16:10 -0000


albertel		Sun Apr 23 03:16:10 2006 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  - only add the ... if its been cropped
  - remove the extra <br> from being added
  
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.50 loncom/interface/lonannounce.pm:1.51
--- loncom/interface/lonannounce.pm:1.50	Sat Apr 22 12:35:31 2006
+++ loncom/interface/lonannounce.pm	Sun Apr 23 03:16:07 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.50 2006/04/22 16:35:31 albertel Exp $
+# $Id: lonannounce.pm,v 1.51 2006/04/23 07:16:07 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -160,7 +160,7 @@
 
 sub normalcell {
     my ($day,$month,$year,$text)=@_;
-    my $output='';
+    my $output;
     my @items=&order($text);
     foreach my $item (@items) {
         if ($item) {
@@ -190,8 +190,9 @@
             $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
             $fullmsg=~s/&/\\&/g;
 	    my $short_msg = substr($msg,0,20).((length($msg) > 20)?'...':'');
+	    if (defined($output)) { $output.='<br />'; }
             $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
-	       $short_msg.'</a><br />';
+	       $short_msg.'</a>';
        }
     }
     return '<td class="LC_calendar_day'.
@@ -203,7 +204,7 @@
 
 sub plaincell {
     my ($text)=@_;
-    my $output='';
+    my $output;
     my @items=&order($text);
     foreach my $item (@items) {
         if ($item) {
@@ -218,8 +219,10 @@
  	    $fullmsg=~s/[\n\r]/\\n/gs;
             $fullmsg=&HTML::Entities::encode($fullmsg,'<>&"\'');
             $fullmsg=~s/&/\\&/g;
+	    my $short_msg = substr($msg,0,80).((length($msg) > 80)?'...':'');
+	    if (defined($output)) { $output.='<br />'; }
             $output.='<a href="javascript:alert('."'$fullmsg'".')">'.
-	       substr($msg,0,80).'...</a><br />';
+	       $short_msg.'</a>';
        }
     }
     return $output;