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

raeburn raeburn at source.lon-capa.org
Fri Aug 19 14:56:41 EDT 2022


raeburn		Fri Aug 19 18:56:41 2022 EDT

  Modified files:              
    /loncom/interface	lonpreferences.pm 
  Log:
  - Eliminate duplicate headers for cases where lockedname option is not
    available.
  
  
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.239 loncom/interface/lonpreferences.pm:1.240
--- loncom/interface/lonpreferences.pm:1.239	Tue Nov 30 15:55:37 2021
+++ loncom/interface/lonpreferences.pm	Fri Aug 19 18:56:41 2022
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.239 2021/11/30 15:55:37 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.240 2022/08/19 18:56:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2129,13 +2129,9 @@
 
 sub lockednameschanger {
     my $r = shift;
-    &Apache::lonhtmlcommon::add_breadcrumb(
-            {   href => '/adm/preferences?action=changelockednames',
-                text => 'Automatic name changes'});
-    $r->print(Apache::loncommon::start_page('Automatic name changes'));
-    $r->print(Apache::lonhtmlcommon::breadcrumbs('Allow/disallow name updates'));
     my %userenv = &Apache::lonnet::get('environment',['lockedname']);
     my $lockedname='';
+    my $ended;
     if (&can_toggle_namelocking()) {
         if ($userenv{'lockedname'}) {
             $lockedname = ' checked="checked"';
@@ -2153,6 +2149,11 @@
             }
         }
         if (keys(%updateable)) {
+            &Apache::lonhtmlcommon::add_breadcrumb(
+                {   href => '/adm/preferences?action=changelockednames',
+                    text => 'Automatic name changes'});
+            $r->print(Apache::loncommon::start_page('Automatic name changes'));
+            $r->print(Apache::lonhtmlcommon::breadcrumbs('Allow/disallow name updates'));
             my %longnames = &Apache::lonlocal::texthash (
                                 firstname  => 'First Name',
                                 middlename => 'Middle Name',
@@ -2179,11 +2180,14 @@
         } else {
             my $message = &mt('Based on your institutional affiliation no name information is automatically updated for your LON-CAPA account.');
             &print_main_menu($r,$message);
+            $ended = 1;
         }
     } else {
         my $message = &mt('You are not permitted to set a user preference for automatic name updates for your LON-CAPA account.');
         &print_main_menu($r,$message);
+        $ended = 1;
     }
+    return $ended;
 }
 
 sub verify_and_change_lockednames {
@@ -2524,7 +2528,7 @@
 	&print_main_menu($r);
         $ended = 1;
     } elsif ($env{'form.action'} eq 'changelockednames') {
-        &lockednameschanger($r);
+        $ended = &lockednameschanger($r);
     } elsif ($env{'form.action'} eq 'verify_and_change_lockednames') {
         &verify_and_change_lockednames($r);
         $ended = 1;




More information about the LON-CAPA-cvs mailing list