[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface lonuserutils.pm
raeburn
raeburn@source.lon-capa.org
Wed, 20 Jan 2010 21:42:30 -0000
raeburn Wed Jan 20 21:42:30 2010 EDT
Modified files: (Branch: version_2_9_X)
/loncom/interface lonuserutils.pm
Log:
- Backport 1.112, 1.113.
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.97.2.12 loncom/interface/lonuserutils.pm:1.97.2.13
--- loncom/interface/lonuserutils.pm:1.97.2.12 Wed Jan 20 21:37:37 2010
+++ loncom/interface/lonuserutils.pm Wed Jan 20 21:42:30 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.97.2.12 2010/01/20 21:37:37 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.97.2.13 2010/01/20 21:42:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1731,7 +1731,7 @@
}
if (@options > 0) {
my $currsel;
- $markup = '<select name="'.$name{$item}.'" />'."\n";
+ $markup = '<select name="'.$name{$item}.'">'."\n";
foreach my $option ('all','none',@options) {
$currsel = '';
if ($env{'form.'.$name{$item}} eq $option) {
@@ -2942,7 +2942,7 @@
$output = $in->{'username'};
} else {
$output = '<a href="javascript:username_display_launch('.
- "'$in->{'username'}','$in->{'domain'}'".')" />'.
+ "'$in->{'username'}','$in->{'domain'}'".')">'.
$in->{'username'}.'</a>';
}
return $output;
@@ -4828,11 +4828,13 @@
plch => 'Please choose a different section name.',
mnot => 'may not be used as a section name, as it is the name of a course group.',
secn => 'Section names and group names must be distinct. Please choose a different section name.',
+ nonw => 'Section names may only contain letters or numbers.',
);
$setsection_js .= <<"ENDSECCODE";
function setSections(formname,crstype) {
var re1 = /^currsec_/;
+ var re2 =/\\W/;
var groups = new Array($groupslist);
for (var i=0;i<formname.elements.length;i++) {
var str = formname.elements[i].name;
@@ -4876,9 +4878,23 @@
}
var newsecs = formname.elements[i+1].value;
var numsplit;
+ var validsecs = new Array();
+ var badsecs = new Array();
if (newsecs != null && newsecs != "") {
numsplit = newsecs.split(/,/g);
numsec = numsec + numsplit.length;
+ for (var i=0; i<numsplit.length; i++) {
+ if (re2.test(numsplit[i]) == true) {
+ badsecs.push(numsplit[i]);
+ } else {
+ validsecs.push(numsplit[i]);
+ }
+ }
+ if (badsecs.length > 0) {
+ alert("$alerts{'nonw'}\\n$alerts{'plch'}");
+ return;
+ }
+ numsec = numsec + validsecs.length;
}
if ((role == 'st') && (numsec > 1)) {