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

raeburn raeburn@source.lon-capa.org
Thu, 15 Oct 2009 23:53:46 -0000


raeburn		Thu Oct 15 23:53:46 2009 EDT

  Modified files:              
    /loncom/interface	slotrequest.pm 
  Log:
  - Only show text about slot listing if there are any resources with slot control.
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.103 loncom/interface/slotrequest.pm:1.104
--- loncom/interface/slotrequest.pm:1.103	Thu Aug 13 10:32:29 2009
+++ loncom/interface/slotrequest.pm	Thu Oct 15 23:53:46 2009
@@ -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.103 2009/08/13 10:32:29 raeburn Exp $
+# $Id: slotrequest.pm,v 1.104 2009/10/15 23:53:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1435,8 +1435,6 @@
              .&mt('Instructors may use a reservation system to place restrictions on when and where assignments can be worked on.')
              .'<br />'
              .&mt('One example is for management of laboratory space, which is only available at certain times, and has a limited number of seats.')
-             .'</p><p>'
-             .&mt('Your reservation status for any such assignments is listed below:')
              .'</p>'
     );
     if (!defined($navmap)) {
@@ -1451,7 +1449,11 @@
     my @backgrounds = ("LC_odd_row","LC_even_row");
     my $numcolors = scalar(@backgrounds);
     my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif");
-    $r->print('<table class="LC_data_table LC_tableOfContent">'."\n");
+    my $slotheader = '<p>'.
+                 &mt('Your reservation status for any such assignments is listed below:').
+                 '</p>'.
+                 '<table class="LC_data_table LC_tableOfContent">'."\n";
+    my $shownheader = 0;
     my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
     while (my $resource = $it->next()) {
         if ($resource == $it->BEGIN_MAP()) {
@@ -1546,11 +1548,19 @@
                     foreach my $item (@maprows) {
                         $rownum ++;
                         my $bgcolor = $backgrounds[$rownum % $numcolors];
+                        if (!$shownheader) {
+                            $r->print($slotheader);
+                            $shownheader = 1;
+                        }
                         $r->print('<tr class="'.$bgcolor.'">'.$item.'</tr>'."\n");
                     }
                 }
                 $rownum ++;
                 my $bgcolor = $backgrounds[$rownum % $numcolors];
+                if (!$shownheader) {
+                    $r->print($slotheader);
+                    $shownheader = 1;
+                }
                 $r->print('<tr class="'.$bgcolor.'"><td>'."\n");
                 for (my $i=0; $i<$depth; $i++) {
                     $r->print('<img src="'.$location.'" alt="" />');
@@ -1585,11 +1595,13 @@
             }
         }
     }
+    if ($shownheader) {
+        $r->print('</table>');
+    }
     if (!$reservable) {
         $r->print('<span class="LC_info">'.&mt('No course items currently require a reservation to gain access.').'</span>');
     }
-    $r->print('</table>'.
-              '<p><a href="/adm/slotrequest?command=showresv">'.
+    $r->print('<p><a href="/adm/slotrequest?command=showresv">'.
               &mt('Reservation History').'</a></p>');
 }