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

raeburn raeburn at source.lon-capa.org
Sun Oct 23 21:13:54 EDT 2016


raeburn		Mon Oct 24 01:13:54 2016 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	slotrequest.pm 
  Log:
  - For 2.11
    - Backport 1.133
  
  
Index: loncom/interface/slotrequest.pm
diff -u loncom/interface/slotrequest.pm:1.125.2.2 loncom/interface/slotrequest.pm:1.125.2.3
--- loncom/interface/slotrequest.pm:1.125.2.2	Mon Aug  8 21:18:31 2016
+++ loncom/interface/slotrequest.pm	Mon Oct 24 01:13:54 2016
@@ -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.125.2.2 2016/08/08 21:18:31 raeburn Exp $
+# $Id: slotrequest.pm,v 1.125.2.3 2016/10/24 01:13:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1476,15 +1476,16 @@
     $r->print('</div>');
     $r->print('<p><input type="submit" name="start" value="'.&mt('Update Display').'" /></p>');
     my $linkstart='<a href="/adm/slotrequest?command=showslots&order=';
-    $r->print(&Apache::loncommon::start_data_table().
-	      &Apache::loncommon::start_data_table_header_row().'
-	       <th></th>');
+    my $tableheader = &Apache::loncommon::start_data_table().
+                      &Apache::loncommon::start_data_table_header_row().'
+                      <th></th>';
     foreach my $which (@show_order) {
 	if ($which ne 'proctor' && exists($show{$which})) {
-	    $r->print('<th>'.$linkstart.$which.'">'.$show_fields{$which}.'</a></th>');
+	    $tableheader .= '<th>'.$linkstart.$which.'">'.$show_fields{$which}.'</a></th>';
 	}
     }
-    $r->print(&Apache::loncommon::end_data_table_header_row());
+    $tableheader .= &Apache::loncommon::end_data_table_header_row();
+    my $shownheader = 0;
 
     my %name_cache;
     my $slotsort = sub {
@@ -1633,30 +1634,39 @@
                                                delete => 'Delete',
                                                slotlog => 'History',
         );
-	my $edit=(<<"EDITLINK");
+        my ($edit,$delete,$showlog,$remove_all);
+        if ($mgr) {
+	    $edit=(<<"EDITLINK");
 <a href="/adm/helper/newslot.helper?name=$slot">$lt{'edit'}</a>
 EDITLINK
 
-	my $delete=(<<"DELETELINK");
+	    $delete=(<<"DELETELINK");
 <a href="/adm/slotrequest?command=delete&slotname=$slot">$lt{'delete'}</a>
 DELETELINK
 
-        my $showlog=(<<"LOGLINK");
+            $remove_all=&remove_link($slot,'remove all').'<br />';
+
+            if ($ids eq '') {
+                undef($remove_all);
+            } else {
+                undef($delete);
+            }
+        }
+
+        $showlog=(<<"LOGLINK");
 <a href="/adm/slotrequest?command=slotlog&slotname=$slot">$lt{'slotlog'}</a>
 LOGLINK
 
-        my $remove_all=&remove_link($slot,'remove all').'<br />';
-
-        if ($ids eq '') {
-            undef($remove_all);
-        } else {
-            undef($delete);
-        }
 	if ($slots{$slot}{'type'} ne 'schedulable_student') {
             undef($showlog); 
 	    undef($remove_all);
 	}
 
+        unless ($shownheader) {
+            $r->print($tableheader);
+            $shownheader = 1;
+        }
+
 	my $row_start=&Apache::loncommon::start_data_table_row();
 	my $row_end=&Apache::loncommon::end_data_table_row();
         $r->print($row_start.
@@ -1725,7 +1735,12 @@
 STUFF
         }
     }
-    $r->print(&Apache::loncommon::end_data_table().'</form>');
+    if ($shownheader) {
+        $r->print(&Apache::loncommon::end_data_table());
+    } else {
+        $r->print('<p>'.&mt('No slots meet the criteria for display').'</p>');
+    }
+    $r->print('</form>');
     return;
 }
 
@@ -2081,14 +2096,16 @@
     if ($showntablehdr) {
         $r->print(&Apache::loncommon::end_data_table().'<br />');
         if (($curr{'page'} > 1) || ($more_records)) {
-            $r->print('<table><tr>');
+            $r->print('<p>');
             if ($curr{'page'} > 1) {
-                $r->print('<td><a href="javascript:chgPage('."'previous'".');">'.&mt('Previous [_1] changes',$curr{'show'}).'</a></td>');
+                $r->print('<input type="button" onclick="javascript:chgPage('."'previous'".');" value="'.
+                          &mt('Previous [_1] changes',$curr{'show'}).'" />');
             }
             if ($more_records) {
-                $r->print('<td><a href="javascript:chgPage('."'next'".');">'.&mt('Next [_1] changes',$curr{'show'}).'</a></td>');
+                $r->print('<input type="button" onclick="javascript:chgPage('."'next'".');" value="'.
+                          &mt('Next [_1] changes',$curr{'show'}).'" />');
             }
-            $r->print('</tr></table>');
+            $r->print('</p>');
             $r->print(<<"ENDSCRIPT");
 <script type="text/javascript">
 // <![CDATA[
@@ -2292,14 +2309,16 @@
     if ($showntablehdr) {
         $r->print(&Apache::loncommon::end_data_table().'<br />');
         if (($curr{'page'} > 1) || ($more_records)) {
-            $r->print('<table><tr>');
+            $r->print('<p>');
             if ($curr{'page'} > 1) {
-                $r->print('<td><a href="javascript:chgPage('."'previous'".');">'.&mt('Previous [_1] changes',$curr{'show'}).'</a></td>');
+                $r->print('<input type="button" onclick="javascript:chgPage('."'previous'".');" value="'.
+                          &mt('Previous [_1] changes',$curr{'show'}).'" />');
             }
             if ($more_records) {
-                $r->print('<td><a href="javascript:chgPage('."'next'".');">'.&mt('Next [_1] changes',$curr{'show'}).'</a></td>');
+                $r->print('<input type="button" onclick="javascript:chgPage('."'next'".');" value="'.
+                          &mt('Next [_1] changes',$curr{'show'}).'" />');
             }
-            $r->print('</tr></table>');
+            $r->print('</p>');
             $r->print(<<"ENDSCRIPT");
 <script type="text/javascript">
 function chgPage(caller) {
@@ -2439,8 +2458,9 @@
         }
         $output .= '</select></td>';
     }
-    $output .= '<td>  </td><td valign="middle"><input type="submit" value="'.
-               &mt('Update Display').'" /></tr></table>'.
+    $output .= '<td>  </td></tr></table>'.
+               '<p><input type="submit" value="'.
+               &mt('Update Display').'" /></p>'.
                '<p class="LC_info">'.
                &mt('Only changes made from servers running LON-CAPA [_1] or later are displayed.'
                   ,'2.9.0');
@@ -3004,7 +3024,7 @@
 	    }
 	    &csv_upload_map($r);
 	}
-    } elsif ($env{'form.command'} eq 'slotlog' && $mgr eq 'F') {
+    } elsif (($env{'form.command'} eq 'slotlog') && ($vgr eq 'F')) {
         &show_reservations_log($r);
     } else {
 	my $symb=&unescape($env{'form.symb'});




More information about the LON-CAPA-cvs mailing list