[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /xml lonxml.pm

raeburn raeburn at source.lon-capa.org
Fri Sep 14 17:41:13 EDT 2018


raeburn		Fri Sep 14 21:41:13 2018 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/xml	lonxml.pm 
  Log:
  - For 2.11
    Backport 1.556 (part), 1.557, 1.559, 1.560
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.531.2.23 loncom/xml/lonxml.pm:1.531.2.24
--- loncom/xml/lonxml.pm:1.531.2.23	Wed Dec  6 14:23:44 2017
+++ loncom/xml/lonxml.pm	Fri Sep 14 21:41:13 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.531.2.23 2017/12/06 14:23:44 raeburn Exp $
+# $Id: lonxml.pm,v 1.531.2.24 2018/09/14 21:41:13 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -70,6 +70,7 @@
 use Math::Cephes();
 use Math::Random();
 use Math::Calculus::Expression();
+use Number::FormatEng();
 use Opcode();
 use POSIX qw(strftime);
 use Time::HiRes qw( gettimeofday tv_interval );
@@ -441,7 +442,7 @@
     } else {
 	$string=~s/\\/\\ensuremath{\\backslash}/g;
 	$string=~s/\\\%|\%/\\\%/g;
-	$string=~s/\\\{|{/\\{/g;
+	$string=~s/\\\{|\{/\\{/g;
 	$string=~s/\\}|}/\\}/g;
 	$string=~s/\\ensuremath\\\{\\backslash\\}/\\ensuremath{\\backslash}/g;
 	$string=~s/\\\$|\$/\\\$/g;
@@ -916,6 +917,8 @@
   $safehole->wrap(\&Apache::functionplotresponse::fpr_vectorlength,$safeeval,'&fpr_vectorlength');
   $safehole->wrap(\&Apache::functionplotresponse::fpr_vectorangle,$safeeval,'&fpr_vectorangle');
   $safehole->wrap(\&Math::Calculus::Expression::math_calculus_expression,$safeeval,'&math_calculus_expression');
+  $safehole->wrap(\&Number::FormatEng::format_eng,$safeeval,'&number_format_eng');
+  $safehole->wrap(\&Number::FormatEng::format_pref,$safeeval,'&number_format_pref');
 
 #  use Data::Dumper;
 #  $safehole->wrap(\&Data::Dumper::Dumper,$safeeval,'&LONCAPA_INTERNAL_Dumper');
@@ -1088,7 +1091,7 @@
 sub get_id {
     my ($parstack,$safeeval)=@_;
     my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
-    if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\d\s[:punct:]])/) {
+    if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\s\-])/) { 
 	&error(&mt('ID [_1] contains invalid characters. IDs are only allowed to contain letters, numbers, spaces and -','"<tt>'.$id.'</tt>"'));
     }
     if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }
@@ -2364,7 +2367,7 @@
 
 sub dump_insertlist {
     my ($ext) = @_;
-    open(XML,">/tmp/insertlist.xml.$ext");
+    open(XML,">","/tmp/insertlist.xml.$ext");
     print XML ("<insertlist>");
     my $i=0;
 




More information about the LON-CAPA-cvs mailing list