[LON-CAPA-cvs] cvs: loncom /homework randomlabel.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 08 Sep 2003 19:17:34 -0000
albertel Mon Sep 8 15:17:34 2003 EDT
Modified files:
/loncom/homework randomlabel.pm
Log:
- the labelgroup name is a variable name, so we need to make sure they make good variable names
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.47 loncom/homework/randomlabel.pm:1.48
--- loncom/homework/randomlabel.pm:1.47 Mon Sep 8 15:08:57 2003
+++ loncom/homework/randomlabel.pm Mon Sep 8 15:17:34 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.47 2003/09/08 19:08:57 albertel Exp $
+# $Id: randomlabel.pm,v 1.48 2003/09/08 19:17:34 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -193,6 +193,9 @@
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval);
$type =~tr/A-Z/a-z/;
+ if ($target ne 'modified' && ($name =~ /\W/ || $name =~ /^[0-9]/)) {
+ &Apache::lonxml::error("Only _ a-z A-Z and 0-9 are allowed in the name to a labelgroup, and the first character can not be a number.<br />");
+ }
if ($target eq 'web' || $target eq 'tex' ||
$target eq 'grade' || $target eq 'answer' || $target eq 'analyze') {
$Apache::randomlabel::groupname=$name;