version 1.22, 2005/10/14 20:00:34
|
version 1.28, 2005/11/02 22:46:12
|
Line 53 sub fail {
|
Line 53 sub fail {
|
} |
} |
|
|
sub start_page { |
sub start_page { |
my ($r)=@_; |
my ($r,$title)=@_; |
my $html=&Apache::lonxml::xmlbegin(); |
my $html=&Apache::lonxml::xmlbegin(); |
$r->print($html.'<head><title>'. |
$r->print($html.'<head><title>'.&mt($title).'</title></head>'); |
&mt('Request another Worktime').'</title></head>'); |
$r->print(&Apache::loncommon::bodytag($title)); |
$r->print(&Apache::loncommon::bodytag('Requesting another Worktime')); |
|
} |
} |
|
|
sub end_page { |
sub end_page { |
Line 465 sub show_table {
|
Line 464 sub show_table {
|
<input type="hidden" name="command" value="uploadstart" /> |
<input type="hidden" name="command" value="uploadstart" /> |
<input type="submit" name="start" value="'.&mt('Upload Slot List').'" /> |
<input type="submit" name="start" value="'.&mt('Upload Slot List').'" /> |
</form>'); |
</form>'); |
|
$r->print('<form method="POST" action="/adm/helper/newslot.helper"> |
|
<input type="submit" name="newslot" value="'.&mt('Create a New Slot').'" /> |
|
</form>'); |
} |
} |
my $linkstart='<a href="/adm/slotrequest?command=showslots&order='; |
my $linkstart='<a href="/adm/slotrequest?command=showslots&order='; |
$r->print('<table border="1"> |
$r->print('<table border="1"> |
<tr> |
<tr> |
<th></th> |
<th></th> |
<th>'.$linkstart.'name" >Slot name</a></th> |
<th>'.$linkstart.'name" >Slot name</a></th> |
<th>'.$linkstart.'type" >Type</a></th> |
<th>'.$linkstart.'type" >Type</a></th> |
<th>'.$linkstart.'description">Description</a></th> |
<th>'.$linkstart.'description" >Description</a></th> |
<th>'.$linkstart.'starttime" >Start Time</a></th> |
<th>'.$linkstart.'starttime" >Start Time</a></th> |
<th>'.$linkstart.'endtime" >End Time</a></th> |
<th>'.$linkstart.'endtime" >End Time</a></th> |
<th>'.$linkstart.'secret" >Secret</a></th> |
<th>'.$linkstart.'startreserve">Time Students Can Start Reserving</a></th> |
<th>'.$linkstart.'maxspace" >Max space</a></th> |
<th>'.$linkstart.'secret" >Secret</a></th> |
<th> Scheduled Students</th> |
<th>'.$linkstart.'maxspace" >Max space</a></th> |
<th>'.$linkstart.'unique" >Unique Period</a></th> |
<th> Scheduled Students</th> |
|
<th>'.$linkstart.'unique" >Unique Period</a></th> |
</tr>'); |
</tr>'); |
my %name_cache; |
my %name_cache; |
my $slotsort = sub { |
my $slotsort = sub { |
if ($env{'form.order'}=~/^(type|name|description|endtime|maxspace)$/) { |
if ($env{'form.order'}=~/^(type|description|endtime|maxspace)$/) { |
if (lc($slots{$a}->{$env{'form.order'}}) |
if (lc($slots{$a}->{$env{'form.order'}}) |
ne lc($slots{$b}->{$env{'form.order'}})) { |
ne lc($slots{$b}->{$env{'form.order'}})) { |
return (lc($slots{$a}->{$env{'form.order'}}) |
return (lc($slots{$a}->{$env{'form.order'}}) |
cmp lc($slots{$b}->{$env{'form.order'}})); |
cmp lc($slots{$b}->{$env{'form.order'}})); |
} |
} |
|
} elsif ($env{'form.order'} eq 'name') { |
|
if (lc($a) cmp lc($b)) { |
|
return lc($a) cmp lc($b); |
|
} |
} elsif ($env{'form.order'} eq 'unique') { |
} elsif ($env{'form.order'} eq 'unique') { |
|
|
if ($slots{$a}->{'uniqueperiod'}[0] |
if ($slots{$a}->{'uniqueperiod'}[0] |
Line 516 sub show_table {
|
Line 523 sub show_table {
|
my (undef,$id)=split("\0",$entry); |
my (undef,$id)=split("\0",$entry); |
$ids.= $id.'-> '.$consumed{$entry}->{'name'}.'<br />'; |
$ids.= $id.'-> '.$consumed{$entry}->{'name'}.'<br />'; |
} |
} |
my $start=localtime($slots{$slot}->{'starttime'}); |
my $start=($slots{$slot}->{'starttime'}? |
my $end=localtime($slots{$slot}->{'endtime'}); |
&Apache::lonlocal::locallocaltime($slots{$slot}->{'starttime'}):''); |
|
my $end=($slots{$slot}->{'endtime'}? |
|
&Apache::lonlocal::locallocaltime($slots{$slot}->{'endtime'}):''); |
|
my $start_reserve=($slots{$slot}->{'startreserve'}? |
|
&Apache::lonlocal::locallocaltime($slots{$slot}->{'startreserve'}):''); |
|
|
my $unique; |
my $unique; |
if (ref($slots{$slot}{'uniqueperiod'})) { |
if (ref($slots{$slot}{'uniqueperiod'})) { |
$unique=localtime($slots{$slot}{'uniqueperiod'}[0]).','. |
$unique=localtime($slots{$slot}{'uniqueperiod'}[0]).','. |
Line 533 sub show_table {
|
Line 545 sub show_table {
|
$name_cache{$_} = $fullname; |
$name_cache{$_} = $fullname; |
} |
} |
&Apache::loncommon::aboutmewrapper($fullname,$uname,$udom); |
&Apache::loncommon::aboutmewrapper($fullname,$uname,$udom); |
} (split(/\s*,\s*/,$slots{$slot}->{'proctor'})); |
} (sort(split(/\s*,\s*/,$slots{$slot}->{'proctor'}))); |
|
|
my $proctors=join(', ',@proctors); |
my $proctors=join(', ',@proctors); |
|
|
my $edit=(<<EDITFORM); |
my $edit=(<<EDITFORM); |
<form method="POST"> |
<form method="POST" action="/adm/helper/newslot.helper"> |
<input type="hidden" name="command" value="editslot" /> |
<input type="hidden" name="name" value="$slot" /> |
<input type="hidden" name="slot" value="$slot" /> |
|
<input type="submit" name="Edit" value="Edit" /> |
<input type="submit" name="Edit" value="Edit" /> |
</form> |
</form> |
EDITFORM |
EDITFORM |
Line 552 EDITFORM
|
Line 563 EDITFORM
|
<td>$description</td> |
<td>$description</td> |
<td>$start</td> |
<td>$start</td> |
<td>$end</td> |
<td>$end</td> |
|
<td>$start_reserve</td> |
<td>$slots{$slot}->{'secret'}</td> |
<td>$slots{$slot}->{'secret'}</td> |
<td>$slots{$slot}->{'maxspace'}</td> |
<td>$slots{$slot}->{'maxspace'}</td> |
<td>$ids</td> |
<td>$ids</td> |
<td>$unique</td> |
<td>$unique</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td colspan="8">$proctors</td> |
<td colspan="10">$proctors</td> |
</tr> |
</tr> |
STUFF |
STUFF |
} |
} |
Line 763 sub csv_upload_assign {
|
Line 775 sub csv_upload_assign {
|
if ($entries{$fields{'endtime'}}) { |
if ($entries{$fields{'endtime'}}) { |
$slot{'endtime'}=&UnixDate($entries{$fields{'endtime'}},"%s"); |
$slot{'endtime'}=&UnixDate($entries{$fields{'endtime'}},"%s"); |
} |
} |
|
if ($entries{$fields{'startreserve'}}) { |
|
$slot{'startreserve'}= |
|
&UnixDate($entries{$fields{'startreserve'}},"%s"); |
|
} |
foreach my $key ('ip','proctor','description','maxspace', |
foreach my $key ('ip','proctor','description','maxspace', |
'secret','symb') { |
'secret','symb') { |
if ($entries{$fields{$key}}) { |
if ($entries{$fields{$key}}) { |
Line 791 sub handler {
|
Line 807 sub handler {
|
my $r=shift; |
my $r=shift; |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&start_page($r); |
|
my $vgr=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $vgr=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $mgr=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
my $mgr=&Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
|
my $title='Requesting Another Worktime'; |
|
if ($env{'form.command'} =~ /^(showslots|uploadstart|csvuploadmap|csvuploadassign)$/ && $vgr eq 'F') { |
|
$title = 'Managing Slots'; |
|
} |
|
&start_page($r,$title); |
|
|
if ($env{'form.command'} eq 'showslots' && $vgr eq 'F') { |
if ($env{'form.command'} eq 'showslots' && $vgr eq 'F') { |
&show_table($r,$mgr); |
&show_table($r,$mgr); |
} elsif ($env{'form.command'} eq 'uploadstart' && $mgr eq 'F') { |
} elsif ($env{'form.command'} eq 'uploadstart' && $mgr eq 'F') { |
Line 811 sub handler {
|
Line 833 sub handler {
|
} |
} |
&csv_upload_map($r); |
&csv_upload_map($r); |
} |
} |
} elsif ($env{'form.command'} eq 'editslot' && $mgr eq 'F') { |
|
&show_slot_edit($r); |
|
} else { |
} else { |
my $symb=&Apache::lonnet::unescape($env{'form.symb'}); |
my $symb=&Apache::lonnet::unescape($env{'form.symb'}); |
my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb); |
my (undef,undef,$res)=&Apache::lonnet::decode_symb($symb); |