[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 31 Jan 2003 22:12:13 -0000


albertel		Fri Jan 31 17:12:13 2003 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  
  - Fixes Bug #1176, default values weren't showing up on parmset screen,
    seems the ws inside of a <responseparam></responseparam> was taken to be more important than the default arg, made it so that default with non ws char is more important than soley ws as internal test but less important then internal text, PARM screen correct and CAT screen looks correct
  
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.320 loncom/lonnet/perl/lonnet.pm:1.321
--- loncom/lonnet/perl/lonnet.pm:1.320	Mon Jan 27 19:09:57 2003
+++ loncom/lonnet/perl/lonnet.pm	Fri Jan 31 17:12:13 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.320 2003/01/28 00:09:57 albertel Exp $
+# $Id: lonnet.pm,v 1.321 2003/01/31 22:12:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3137,11 +3137,17 @@
               foreach (@{$token->[3]}) {
 		  $metacache{$uri.':'.$unikey.'.'.$_}=$token->[2]->{$_};
               }
-              unless (
-                 $metacache{$uri.':'.$unikey}=&HTML::Entities::decode($parser->get_text('/'.$entry))
-		      ) { $metacache{$uri.':'.$unikey}=
-			      $metacache{$uri.':'.$unikey.'.default'};
-		      }
+	      my $internaltext=&HTML::Entities::decode($parser->get_text('/'.$entry));
+	      my $default=$metacache{$uri.':'.$unikey.'.default'};
+	      if ( $internaltext =~ /^\s*$/ && $default !~ /^\s*$/) {
+		  # only ws inside the tag, and not in default, so use default
+                  # as value
+		  $metacache{$uri.':'.$unikey}=$default;
+	      } else {
+		  # either something interesting inside the tag or default
+                  # uninteresting
+		  $metacache{$uri.':'.$unikey}=$internaltext;
+	      }
 # end of not-a-package not-a-library import
 	   }
 # end of not-a-package start tag