[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm

raeburn raeburn at source.lon-capa.org
Wed Dec 14 16:02:31 EST 2011


raeburn		Wed Dec 14 21:02:31 2011 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - Result of pushing "Check for role changes" button.
    - More compact display if no role or groups changes.
    - Checking for changed privileges in custom roles correct where
      role had no system or domain privs.
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.263 loncom/auth/lonroles.pm:1.264
--- loncom/auth/lonroles.pm:1.263	Tue Oct 25 15:15:02 2011
+++ loncom/auth/lonroles.pm	Wed Dec 14 21:02:30 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.263 2011/10/25 15:15:02 www Exp $
+# $Id: lonroles.pm,v 1.264 2011/12/14 21:02:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -221,7 +221,7 @@
         } else {
             $checkingtxt = &mt('Checking for new roles ...');
         }
-        $updateresult = '<div class="LC_info">'.$checkingtxt.'</div>';
+        $updateresult = '<span class="LC_info">'.$checkingtxt.'</span>';
         $updateresult .= &update_session_roles();
         &Apache::lonnet::appenv({'user.update.time'  => $now});
         $update = $now;
@@ -781,7 +781,7 @@
         if ($env{'form.showall'}) { 
             $showall .= ' checked="checked" ';
         }
-        $showall .= ' />'.&mt('Show all roles').'</label>'.
+        $showall .= ' />'.&mt('Show all roles').'</label> '.
                     '<input type="submit" value="'.&mt('Update display').'" />';
         if ($do_update) {
             $r->print('<div class="LC_left_float"><fieldset>'.
@@ -1871,7 +1871,7 @@
                                       ['active','future','previous'],
                                       undef,undef,1);
     my ($msg, at newsec,$oldsec,$currrole_expired, at changed_roles,
-        %changed_groups,%dbroles, %deletedroles,%allroles,%allgroups,
+        %changed_groups,%dbroles,%deletedroles,%allroles,%allgroups,
         %userroles,%checkedgroup,%crprivs,$hasgroups,%rolechange,
         %groupchange,%newrole,%newgroup,%customprivchg,%groups_roles,
         @rolecodes);
@@ -2108,7 +2108,9 @@
                                 foreach my $priv (@privs) {
                                     my ($blank, at prv) = split(/:/,$priv);
                                     @prv = map { $_ .= (/\&\w+$/ ? '':'&F') } @prv;
-                                    $priv = ':'.join(':',sort(@prv));
+                                    if (@prv) {
+                                        $priv = ':'.join(':',sort(@prv));
+                                    }
                                     $crprivs{$rest}{$scopes[$i]} = $priv;
                                     $i++;
                                 }
@@ -2212,21 +2214,30 @@
         $msg .= '<br />'.&mt('However you can continue to use this role until you logout, click the "Re-Select" button, or your session has been idle for more than 24 hours.').'</div>';
     }
     if (!@changed_roles || !(keys(%changed_groups))) {
-        $msg .= '<ul>';
+        my ($rolesmsg,$groupsmsg);
         if (!@changed_roles) {
-            $msg .= '<li>';
             if (&Apache::loncommon::show_course()) {
-                $msg .= &mt('No new courses or communities');
+                $rolesmsg = &mt('No new courses or communities');
             } else {
-                $msg .= &mt('No role changes');
+                $rolesmsg = &mt('No role changes');
             }
-            $msg .= '</li>';
         }
         if ($hasgroups && !(keys(%changed_groups)) && !(grep(/gr/, at changed_roles))) {
-            $msg .= '<li>'.&mt('No changes in course/community groups').'</li>';
+            $groupsmsg = &mt('No changes in course/community groups');
         }
-        $msg .= '</ul>';
         if (!@changed_roles && !(keys(%changed_groups))) {
+            if (($msg ne '') || ($groupsmsg ne '')) {
+                $msg .= '<ul>';
+                if ($rolesmsg) {
+                    $msg .= '<li>'.$rolesmsg.'</li>';
+                }
+                if ($groupsmsg) {
+                    $msg .= '<li>'.$groupsmsg.'</li>';
+                }
+                $msg .= '</ul>';
+            } else {
+                $msg = ' <span class="LC_cusr_emph">'.$rolesmsg.'</span><br />';
+            }
             return $msg;
         }
     }




More information about the LON-CAPA-cvs mailing list