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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 08 Mar 2006 22:15:48 -0000


albertel		Wed Mar  8 17:15:48 2006 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - being more insistant about correct id
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.398 loncom/xml/lonxml.pm:1.399
--- loncom/xml/lonxml.pm:1.398	Wed Mar  8 16:49:26 2006
+++ loncom/xml/lonxml.pm	Wed Mar  8 17:15:47 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.398 2006/03/08 21:49:26 albertel Exp $
+# $Id: lonxml.pm,v 1.399 2006/03/08 22:15:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -971,6 +971,16 @@
 #print "<br />e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n";
 }
 
+sub get_id {
+    my ($parstack,$safeeval)=@_;
+    my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
+    if ($env{'request.state'} eq 'construct' && $id =~ /(\.|_)/) {
+	&error(&mt("IDs are not allowed to contain &quot;<tt>_</tt>&quot; or &quot;<tt>.</tt>&quot;"));
+    }
+    if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }
+    return $id;
+}
+
 sub get_all_text_unbalanced {
 #there is a copy of this in lonpublisher.pm
     my($tag,$pars)= @_;