--- loncom/html/adm/helper/newslot.helper 2005/11/02 22:07:52 1.7 +++ loncom/html/adm/helper/newslot.helper 2005/11/18 16:54:01 1.11 @@ -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; } @@ -25,22 +27,27 @@ } - - Name:
    -
+ 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:
   
+
Start time:
   
@@ -48,7 +55,7 @@ -
End time:
   
+
End time:
   
@@ -56,7 +63,7 @@ -
Type:
+
Type:
Instructor asssignable. @@ -69,9 +76,7 @@ - -

Description:
    - +

Description:
    @@ -81,9 +86,7 @@ $helper->{'VARS'}{'type'} eq 'schedulable_student' - -

Time students can start reserving:
    - +

Time students can start reserving:
    @@ -91,9 +94,7 @@ - -

Maxium number of students allowed in this slot:
    - +

Maxium number of students allowed in this slot:
    @@ -105,9 +106,7 @@ - -

Period of time in which this slot is can only be uniquely chosen:
   Start: - +

Period of time in which this slot is can only be uniquely chosen:
   Start: @@ -117,7 +116,7 @@ return 'anytime'; -
   End:
+
   End:
my $default=&{$helper->{DATA}{origslot}}('uniqueperiod','anytime'); @@ -137,9 +136,7 @@ - -

Secret word proctors use to checkin users:
    - +

Secret word proctors use to checkin users:
    @@ -150,9 +147,7 @@ - -

Slot is: - +

Slot is: usable for any resource. @@ -164,9 +159,9 @@ - +

IP restrictions:
    - + @@ -176,7 +171,7 @@ return &{$helper->{DATA}{origslot}}('ip'); -

+

@@ -203,7 +198,7 @@ - Created Slot + Created Slot my $result; @@ -229,7 +224,9 @@ my ($uname,$udomain)=split(/:/,$user); push(@names,"$uname\@$udomain"); } - $slot{'proctor'}=join(',',@names); + # make sure the usenrmaes are unique + my %proctors = map { ($_,1) } @names; + $slot{'proctor'}=join(',',sort(keys(%proctors))); } my $cname = $env{'course.'.$env{'request.course.id'}.'.num'}; my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};