[LON-CAPA-cvs] cvs: loncom /interface slotrequest.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 17 Oct 2005 18:23:46 -0000


albertel		Mon Oct 17 14:23:46 2005 EDT

  Modified files:              
    /loncom/interface	slotrequest.pm 
  Log:
  - show slot reserve time
  - name sort works now
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.22 loncom/interface/slotrequest.pm:1.23
--- loncom/interface/slotrequest.pm:1.22	Fri Oct 14 16:00:34 2005
+++ loncom/interface/slotrequest.pm	Mon Oct 17 14:23:46 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.22 2005/10/14 20:00:34 albertel Exp $
+# $Id: slotrequest.pm,v 1.23 2005/10/17 18:23:46 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -470,24 +470,29 @@
     $r->print('<table border="1">
 <tr>
   <th></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.'secret"     >Secret</a></th>
-  <th>'.$linkstart.'maxspace"   >Max space</a></th>
-  <th>                           Scheduled Students</th>
-  <th>'.$linkstart.'unique"     >Unique Period</a></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.'startreserve">Time Students Can Start Reserving</a></th>
+  <th>'.$linkstart.'secret"      >Secret</a></th>
+  <th>'.$linkstart.'maxspace"    >Max space</a></th>
+  <th>                            Scheduled Students</th>
+  <th>'.$linkstart.'unique"      >Unique Period</a></th>
 </tr>');
     my %name_cache;
     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'}})
 		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 'name') {
+	    if (lc($a) cmp lc($b)) {
+		return lc($a) cmp lc($b);
+	    }
 	} elsif ($env{'form.order'} eq 'unique') {
 	    
 	    if ($slots{$a}->{'uniqueperiod'}[0] 
@@ -516,8 +521,9 @@
 	    my (undef,$id)=split("\0",$entry);
 	    $ids.= $id.'-> '.$consumed{$entry}->{'name'}.'<br />';
 	}
-	my $start=localtime($slots{$slot}->{'starttime'});
-	my $end=localtime($slots{$slot}->{'endtime'});
+	my $start=&Apache::lonlocal::locallocaltime($slots{$slot}->{'starttime'});
+	my $end=&Apache::lonlocal::locallocaltime($slots{$slot}->{'endtime'});
+	my $start_reserve=&Apache::lonlocal::locallocaltime($slots{$slot}->{'startreserve'});
 	my $unique;
 	if (ref($slots{$slot}{'uniqueperiod'})) {
 	    $unique=localtime($slots{$slot}{'uniqueperiod'}[0]).','.
@@ -552,13 +558,14 @@
  <td>$description</td>
  <td>$start</td>
  <td>$end</td>
+ <td>$start_reserve</td>
  <td>$slots{$slot}->{'secret'}</td>
  <td>$slots{$slot}->{'maxspace'}</td>
  <td>$ids</td>
  <td>$unique</td>
 </tr>
 <tr>
- <td colspan="8">$proctors</td>
+ <td colspan="10">$proctors</td>
 </tr>
 STUFF
     }
@@ -763,6 +770,10 @@
 	if ($entries{$fields{'endtime'}}) {
 	    $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',
 			 'secret','symb') {
 	    if ($entries{$fields{$key}}) {