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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 09 Feb 2006 18:04:51 -0000


albertel		Thu Feb  9 13:04:51 2006 EDT

  Modified files:              
    /loncom/interface	slotrequest.pm 
  Log:
  - scheduled students is an optional column now
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.46 loncom/interface/slotrequest.pm:1.47
--- loncom/interface/slotrequest.pm:1.46	Thu Feb  9 12:59:57 2006
+++ loncom/interface/slotrequest.pm	Thu Feb  9 13:04:51 2006
@@ -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.46 2006/02/09 17:59:57 albertel Exp $
+# $Id: slotrequest.pm,v 1.47 2006/02/09 18:04:51 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -714,10 +714,11 @@
 	     'ip'           => 'IP or DNS restrictions',
 	     'symb'         => 'Resource slot is restricted to.',
 	     'uniqueperiod' => 'Period of time slot is unique',
+	     'scheduled'    => 'Scheduled Students',
 	     'proctor'      => 'List of proctors');
     my @show_order=('name','description','type','starttime','endtime',
 	       'startreserve','secret','maxspace','ip','symb',
-	       'uniqueperiod','proctor');
+	       'uniqueperiod','scheduled','proctor');
     my @show = 
 	(exists($env{'form.show'})) ? &Apache::loncommon::get_env_multiple('form.show')
 	                            : keys(%show_fields);
@@ -793,7 +794,6 @@
 	    $r->print('<th>'.$linkstart.$which.'">'.$show_fields{$which}.'</a></th>');
 	}
     }
-    $r->print('<th>Scheduled Students</th></tr>');
 
     my %name_cache;
     my $slotsort = sub {
@@ -829,27 +829,28 @@
 	    #next;
 	}
 	my $description=&get_description($slot,$slots{$slot});
-	my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,
-					   "^$slot\0");
 	my $ids;
-
-	my ($tmp)=%consumed;
-	if ($tmp !~ /^error: /) {
-	    foreach my $entry (sort(keys(%consumed))) {
-		my (undef,$id)=split("\0",$entry);
-		my ($uname,$udom) = split('@',$consumed{$entry}{'name'});
-		$ids.= '<nobr>';
-		foreach my $item (@stu_display_order) {
-		    if ($stu_display{$item}) {
-			if ($item eq 'fullname') {
-			    $ids.=$fullname->{"$uname:$udom"}.' ';
-			} elsif ($item eq 'username') {
-			    $ids.="<tt>$uname\@$udom</tt> ";
+	if (exists($show{'scheduled'})) {
+	    my %consumed=&Apache::lonnet::dump('slot_reservations',$cdom,$cnum,
+					       "^$slot\0");
+	    my ($tmp)=%consumed;
+	    if ($tmp !~ /^error: /) {
+		foreach my $entry (sort(keys(%consumed))) {
+		    my (undef,$id)=split("\0",$entry);
+		    my ($uname,$udom) = split('@',$consumed{$entry}{'name'});
+		    $ids.= '<nobr>';
+		    foreach my $item (@stu_display_order) {
+			if ($stu_display{$item}) {
+			    if ($item eq 'fullname') {
+				$ids.=$fullname->{"$uname:$udom"}.' ';
+			    } elsif ($item eq 'username') {
+				$ids.="<tt>$uname\@$udom</tt> ";
+			    }
 			}
 		    }
+		    $ids.=&remove_link($slot,$entry,$uname,$udom,
+				       $consumed{$entry}{'symb'}).'</nobr><br />';
 		}
-		$ids.=&remove_link($slot,$entry,$uname,$udom,
-				   $consumed{$entry}{'symb'}).'</nobr><br />';
 	    }
 	}
 
@@ -937,7 +938,9 @@
 	if (exists($show{'uniqueperiod'})) {
 	    $colspan++;$r->print("<td>$unique</td>\n");
 	}
-	$colspan++;$r->print("<td>$ids</td>\n</tr>\n");
+	if (exists($show{'scheduled'})) {
+	    $colspan++;$r->print("<td>$ids</td>\n</tr>\n");
+	}
 	if (exists($show{'proctor'})) {
 	    $r->print(<<STUFF);
 <tr>