[LON-CAPA-cvs] cvs: loncom /interface slotrequest.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 14 Oct 2005 19:30:37 -0000
albertel Fri Oct 14 15:30:37 2005 EDT
Modified files:
/loncom/interface slotrequest.pm
Log:
- can now sort slots by various criteria
- proctor names are links to their aboutme pages, and their name shows up
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.20 loncom/interface/slotrequest.pm:1.21
--- loncom/interface/slotrequest.pm:1.20 Fri Oct 7 16:00:20 2005
+++ loncom/interface/slotrequest.pm Fri Oct 14 15:30:36 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for requesting to have slots added to a students record
#
-# $Id: slotrequest.pm,v 1.20 2005/10/07 20:00:20 albertel Exp $
+# $Id: slotrequest.pm,v 1.21 2005/10/14 19:30:36 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -466,22 +466,43 @@
<input type="submit" name="start" value="'.&mt('Upload Slot List').'" />
</form>');
}
+ my $linkstart='<a href="/adm/slotrequest?command=showslots&order=';
$r->print('<table border="1">
<tr>
<th></th>
- <th>Slot name</th>
- <th>Type</th>
- <th>Description</th>
- <th>Start Time</th>
- <th>End Time</th>
- <th>Max space</th>
- <th>Scheduled Students</th>
- <th>Proctors</th>
- <th>Unique Period</th>
+ <th>'.$linkstart.'name" >Slot name</a></th>
+ <th>'.$linkstart.'type" >Type</a></th>
+ <th>'.$linkstart.'description">Description</a></th>
+ <th>'.$linkstart.'starttime" >Start Time</a></th>
+ <th>'.$linkstart.'endtime" >End Time</a></th>
+ <th>'.$linkstart.'maxspace" >Max space</a></th>
+ <th> Scheduled Students</th>
+ <th>'.$linkstart.'unique" >Unique Period</a></th>
</tr>');
- foreach my $slot (sort
- { return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'} }
- (keys(%slots))) {
+ my %name_cache;
+ my $slotsort = sub {
+ if ($env{'form.order'}=~/^(type|name|description|endtime|maxspace)$/) {
+ if (lc($slots{$a}->{$env{'form.order'}})
+ ne lc($slots{$b}->{$env{'form.order'}})) {
+ return (lc($slots{$a}->{$env{'form.order'}})
+ cmp lc($slots{$b}->{$env{'form.order'}}));
+ }
+ } elsif ($env{'form.order'} eq 'unique') {
+
+ if ($slots{$a}->{'uniqueperiod'}[0]
+ ne $slots{$b}->{'uniqueperiod'}[0]) {
+ return ($slots{$a}->{'uniqueperiod'}[0]
+ cmp $slots{$b}->{'uniqueperiod'}[0]);
+ }
+ if ($slots{$a}->{'uniqueperiod'}[1]
+ ne $slots{$b}->{'uniqueperiod'}[1]) {
+ return ($slots{$a}->{'uniqueperiod'}[1]
+ cmp $slots{$b}->{'uniqueperiod'}[1]);
+ }
+ }
+ return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'};
+ };
+ foreach my $slot (sort $slotsort (keys(%slots))) {
if (defined($slots{$slot}->{'type'})
&& $slots{$slot}->{'type'} ne 'schedulable_student') {
#next;
@@ -501,16 +522,19 @@
$unique=localtime($slots{$slot}{'uniqueperiod'}[0]).','.
localtime($slots{$slot}{'uniqueperiod'}[1]);
}
-
my @proctors = map {
my ($uname,$udom)=split(/@/,$_);
- my $fullname=&Apache::loncommon::plainname($uname,$udom);
- $fullname=~s/\s/ /g;
+ my $fullname=$name_cache{$_};
+ if (!defined($fullname)) {
+ &Apache::lonnet::logthis("Gettign $uname $udom");
+ $fullname = &Apache::loncommon::plainname($uname,$udom);
+ $fullname =~s/\s/ /g;
+ $name_cache{$_} = $fullname;
+ }
&Apache::loncommon::aboutmewrapper($fullname,$uname,$udom);
} (split(/\s*,\s*/,$slots{$slot}->{'proctor'}));
my $proctors=join(', ',@proctors);
-
my $edit=(<<EDITFORM);
<form method="POST">
@@ -521,7 +545,7 @@
EDITFORM
$r->print(<<STUFF);
<tr>
- <td>$edit</td>
+ <td rowspan="2">$edit</td>
<td>$slot</td>
<td>$slots{$slot}->{'type'}</td>
<td>$description</td>
@@ -529,9 +553,11 @@
<td>$end</td>
<td>$slots{$slot}->{'maxspace'}</td>
<td>$ids</td>
- <td>$proctors</td>
<td>$unique</td>
</tr>
+<tr>
+ <td colspan="8">$proctors</td>
+</tr>
STUFF
}
$r->print('</table>');