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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 29 Aug 2007 00:46:39 -0000


albertel		Tue Aug 28 20:46:39 2007 EDT

  Modified files:              
    /loncom/interface	lonhelper.pm 
  Log:
  - add ability for some message to get marked as warnign or error messages
  
  
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.161 loncom/interface/lonhelper.pm:1.162
--- loncom/interface/lonhelper.pm:1.161	Wed Jul 25 19:20:38 2007
+++ loncom/interface/lonhelper.pm	Tue Aug 28 20:46:39 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.161 2007/07/25 23:20:38 albertel Exp $
+# $Id: lonhelper.pm,v 1.162 2007/08/29 00:46:39 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1008,6 +1008,9 @@
     if (defined($token->[2]{'nextstate'})) {
         $paramHash->{NEXTSTATE} = $token->[2]{'nextstate'};
     }
+    if (defined($token->[2]{'type'})) {
+        $paramHash->{TYPE} = $token->[2]{'type'};
+    }
     return '';
 }
 
@@ -1023,7 +1026,15 @@
 
 sub render {
     my $self = shift;
-
+    
+    if ($self->{TYPE} =~ /^\s*warning\s*$/i) {
+	 $self->{MESSAGE_TEXT} = 
+	     '<span class="LC_warning">'. $self->{MESSAGE_TEXT}.'</span>';
+    }
+    if ($self->{TYPE} =~ /^\s*error\s*$/i) {
+	 $self->{MESSAGE_TEXT} = 
+	     '<span class="LC_error">'. $self->{MESSAGE_TEXT}.'</span>';
+    }
     return $self->{MESSAGE_TEXT};
 }
 # If a NEXTSTATE was given, switch to it