version 1.30, 2005/11/14 23:21:55
|
version 1.32, 2005/11/21 17:50:45
|
Line 652 sub show_table {
|
Line 652 sub show_table {
|
} |
} |
my $proctors=join(', ',@proctors); |
my $proctors=join(', ',@proctors); |
|
|
my $edit=(<<EDITFORM); |
my $edit=(<<EDITLINK); |
<form method="POST" action="/adm/helper/newslot.helper"> |
<a href="/adm/helper/newslot.helper?name=$slot">Edit</a> |
<input type="hidden" name="name" value="$slot" /> |
EDITLINK |
<input type="submit" name="Edit" value="Edit" /> |
|
</form> |
|
EDITFORM |
|
|
|
$r->print("<tr>\n<td rowspan=\"$rowspan\">$edit</td>\n"); |
$r->print("<tr>\n<td rowspan=\"$rowspan\">$edit</td>\n"); |
if (exists($show{'name'})) { |
if (exists($show{'name'})) { |
Line 887 sub csv_upload_assign {
|
Line 884 sub csv_upload_assign {
|
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $countdone=0; |
my $countdone=0; |
|
my @errors; |
foreach my $slot (@slotdata) { |
foreach my $slot (@slotdata) { |
my %slot; |
my %slot; |
my %entries=&Apache::loncommon::record_sep($slot); |
my %entries=&Apache::loncommon::record_sep($slot); |
my $domain; |
my $domain; |
my $name=$entries{$fields{'name'}}; |
my $name=$entries{$fields{'name'}}; |
|
if ($name=~/^\s*$/) { |
|
push(@errors,"Did not create slot with no name"); |
|
next; |
|
} |
|
if ($name=~/\s/) { |
|
push(@errors,"$name not created -- Name must not contain spaces"); |
|
next; |
|
} |
|
if ($name=~/\W/) { |
|
push(@errors,"$name not created -- Name must contain only letters, numbers and _"); |
|
next; |
|
} |
if ($entries{$fields{'type'}}) { |
if ($entries{$fields{'type'}}) { |
$slot{'type'}=$entries{$fields{'type'}}; |
$slot{'type'}=$entries{$fields{'type'}}; |
} else { |
} else { |
$slot{'type'}='preassigned'; |
$slot{'type'}='preassigned'; |
} |
} |
|
if ($slot{'type'} ne 'preassigned' && |
|
$slot{'type'} ne 'schedulable_student') { |
|
push(@errors,"$name not created -- invalid type ($slot{'type'}) must be either preassigned or schedulable_student"); |
|
next; |
|
} |
if ($entries{$fields{'starttime'}}) { |
if ($entries{$fields{'starttime'}}) { |
$slot{'starttime'}=&UnixDate($entries{$fields{'starttime'}},"%s"); |
$slot{'starttime'}=&UnixDate($entries{$fields{'starttime'}},"%s"); |
} |
} |
Line 925 sub csv_upload_assign {
|
Line 940 sub csv_upload_assign {
|
$r->rflush(); |
$r->rflush(); |
$countdone++; |
$countdone++; |
} |
} |
$r->print("<br />Created $countdone slots\n"); |
$r->print("<p>Created $countdone slots\n</p>"); |
$r->print("<br />\n"); |
foreach my $error (@errors) { |
|
$r->print("<p>$error\n</p>"); |
|
} |
&show_table($r,$mgr); |
&show_table($r,$mgr); |
return ''; |
return ''; |
} |
} |