[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /interface domainprefs.pm

raeburn raeburn@source.lon-capa.org
Tue, 05 Oct 2010 18:44:09 -0000


raeburn		Tue Oct  5 18:44:09 2010 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - Backport 1.140.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.138.2.3 loncom/interface/domainprefs.pm:1.138.2.4
--- loncom/interface/domainprefs.pm:1.138.2.3	Thu Aug 26 08:27:38 2010
+++ loncom/interface/domainprefs.pm	Tue Oct  5 18:44:08 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.138.2.3 2010/08/26 08:27:38 raeburn Exp $
+# $Id: domainprefs.pm,v 1.138.2.4 2010/10/05 18:44:08 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -512,7 +512,7 @@
         } elsif ($action eq 'helpsettings') {
             $output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal);
         } elsif ($action eq 'usersessions') {
-            $output .= &print_usersessions('top',$dom,$settings,\$rowtotal); 
+            $output .= &print_usersessions('top',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'rolecolors') {
             $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);
         }
@@ -2279,9 +2279,17 @@
 sub print_usersessions {
     my ($position,$dom,$settings,$rowtotal) = @_;
     my ($css_class,$datatable,%checked,%choices);
+    my (%by_ip,%by_location,@intdoms);
+    &build_location_hashes(\@intdoms,\%by_ip,\%by_location);
+    if (keys(%by_location) == 0) {
+        if ($position eq 'top') {
+            $datatable .= '<tr'.$css_class.'><td colspan="2">'.
+                          &mt('Nothing to set here, as the cluster to which this domain belongs only contains this institution.');
+        }
+    }
     my %lt = &usersession_titles();
     my $itemcount = 1;
-    my $numinrow = 6;
+    my $numinrow = 5;
     my $prefix;
     my @types;
     if ($position eq 'top') {
@@ -2293,8 +2301,6 @@
     }
     my (%current,%checkedon,%checkedoff);
     my @lcversions = &Apache::lonnet::all_loncaparevs();
-    my (%by_ip,%by_location,@intdoms);
-    &build_location_hashes(\@intdoms,\%by_ip,\%by_location);
     my @locations = sort(keys(%by_location));
     foreach my $type (@types) {
         $checkedon{$type} = '';
@@ -2317,6 +2323,7 @@
         }
     }
     foreach my $type (@types) {
+        next if ($type ne 'version' && !@locations);
         $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
         $datatable .= '<tr'.$css_class.'>
                        <td><span class="LC_nobreak">'.$lt{$type}.'</span><br />