[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm scripttag.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 22 May 2003 21:05:01 -0000


albertel		Thu May 22 17:05:01 2003 EDT

  Modified files:              
    /loncom/xml	lonxml.pm scripttag.pm 
  Log:
  - tags inside style file definitions use both the tags args and the style defintion args to do variable interpolation
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.256 loncom/xml/lonxml.pm:1.257
--- loncom/xml/lonxml.pm:1.256	Thu May 22 16:19:18 2003
+++ loncom/xml/lonxml.pm	Thu May 22 17:05:01 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.256 2003/05/22 20:19:18 albertel Exp $
+# $Id: lonxml.pm,v 1.257 2003/05/22 21:05:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -521,6 +521,7 @@
 	    my $string=$$style_for_target{$token->[1]}.
 	      '<LONCAPA_INTERNAL_TURN_STYLE_ON />';
 	    &Apache::lonxml::newparser($pars,\$string);
+	    $Apache::lonxml::style_values=$$parstack[-1];
 	} else {
 	  $result = &callsub("start_$token->[1]", $target, $token, $stack,
 			     $parstack, $pars, $safeeval, $style_for_target);
@@ -544,6 +545,7 @@
 	    my $string=$$style_for_target{'/'.$token->[1]}.
 	      '<LONCAPA_INTERNAL_TURN_STYLE_ON />';
 	    &Apache::lonxml::newparser($pars,\$string);
+	    $Apache::lonxml::style_values=$$parstack[-1];
 	} else {
 	  $result = &callsub("end_$token->[1]", $target, $token, $stack,
 			     $parstack, $pars,$safeeval, $style_for_target);
@@ -553,10 +555,14 @@
       }
       #evaluate variable refs in result
       if ($result ne "") {
+	  my $extras;
+	  if (!$Apache::lonxml::usestyle) {
+	      $extras=$Apache::lonxml::style_values;
+	  }
 	if ( $#$parstack > -1 ) {
-	  $result=&Apache::run::evaluate($result,$safeeval,$$parstack[-1]);
+	  $result=&Apache::run::evaluate($result,$safeeval,$extras.$$parstack[-1]);
 	} else {
-	  $result= &Apache::run::evaluate($result,$safeeval,'');
+	  $result= &Apache::run::evaluate($result,$safeeval,$extras);
 	}
       }
       if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
@@ -1308,7 +1314,7 @@
 
 sub warning {
   $warningcount++;
-  if ($ENV{'request.state'} eq 'construct') {
+  if ($ENV{'request.state'} eq 'construct' || $Apache::lonxml::debug) {
     print "<b>W</b>ARNING<b>:</b>".join('<br />',@_)."<br />\n";
   }
 }
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.88 loncom/xml/scripttag.pm:1.89
--- loncom/xml/scripttag.pm:1.88	Wed May 14 09:33:00 2003
+++ loncom/xml/scripttag.pm	Thu May 22 17:05:01 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # <script> definiton
 #
-# $Id: scripttag.pm,v 1.88 2003/05/14 13:33:00 albertel Exp $
+# $Id: scripttag.pm,v 1.89 2003/05/22 21:05:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,6 +50,7 @@
 
 sub start_LONCAPA_INTERNAL_TURN_STYLE_ON {
     $Apache::lonxml::usestyle=1;
+    $Apache::lonxml::style_values='';
     return ('','no');
 }