--- loncom/html/adm/helper/newslot.helper 2005/11/02 22:14:53 1.8 +++ loncom/html/adm/helper/newslot.helper 2005/11/18 16:51:13 1.10 @@ -7,6 +7,8 @@ if (exists($env{'form.name'}) || $env{'form.name'} =~ /\S/) { $helper->{'VARS'}{'name'}=$env{'form.name'}; + $helper->{VARS}{'origname'}=$env{'form.name'}; + $helper->{DATA}{copy} = 1; } } $helper->{DATA}{origslot} = sub { @@ -17,7 +19,7 @@ } my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $name=$helper->{'VARS'}{'name'}; + my $name=$helper->{VARS}{'origname'}; my %slot=&Apache::lonnet::get('slots', [$name], $cdom, $cnum); if (!ref($slot{$name})) { return $default; } if (!exists($slot{$name}{$which})) { return $default; } @@ -27,18 +29,27 @@ Name:
    -
+
if ($val=~/^\s*$/) { return 'Must specify a name'; } - if ($val=~/\s$/) { return 'Must not contain spaces'; } + if ($val=~/\s/) { return 'Must not contain spaces'; } + if ($val=~/\W/) { return 'Must contain only letters, numbers and _'; } return undef; return $helper->{'VARS'}{'name'}; + + $helper->{DATA}{copy} + + +

Changing the Name will create a new slot with the new name, and not rename the existing slot.

+
+
+

Start time: