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

raeburn raeburn at source.lon-capa.org
Fri Nov 11 19:39:40 EST 2016


raeburn		Sat Nov 12 00:39:40 2016 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  - Appropriate text for breadcrumbs and header lines when Domain Helpdesk role
    is searching for a user for whom to display roles and user information.
  
  
-------------- next part --------------
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.421 loncom/interface/loncreateuser.pm:1.422
--- loncom/interface/loncreateuser.pm:1.421	Sat Nov 12 00:16:24 2016
+++ loncom/interface/loncreateuser.pm	Sat Nov 12 00:39:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.421 2016/11/12 00:16:24 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.422 2016/11/12 00:39:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -757,7 +757,7 @@
     } elsif ($env{'form.action'} eq 'accesslogs') {
         $helpitem = 'Domain_User_Access_Logs';
     }
-    my %breadcrumb_text = &singleuser_breadcrumb($crstype);
+    my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$defdom);
     if ($env{'form.action'} eq 'custom') {
         push(@{$brcrum},
                  {href=>"javascript:backPage(document.crtuser)",       
@@ -785,6 +785,7 @@
                     'srst' => 'Search for a user and enroll as a student',
                     'srme' => 'Search for a user and enroll as a member',
                     'srad' => 'Search for a user and modify/add user information or roles',
+                    'srvu' => 'Search for a user and view user information and roles',
                     'srva' => 'Search for a user and view access log information',
 		    'usr'  => "Username",
                     'dom'  => "Domain",
@@ -840,6 +841,9 @@
             }
         } elsif ($env{'form.action'} eq 'accesslogs') {
             $actiontext = $lt{'srva'};
+        } elsif (($env{'form.action'} eq 'singleuser') &&
+                 ($context eq 'domain') && (!&Apache::lonnet::allowed('mau',$defdom))) {
+            $actiontext = $lt{'srvu'};
         }
         $r->print("<h3>$actiontext</h3>");
         if ($env{'form.origform'} ne 'crtusername') {
@@ -933,7 +937,9 @@
     } else {
         $output = '<p>'.$userpicker.'</p>';
     }
-    if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs')) {
+    if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs') &&
+        (!(($env{'form.action'} eq 'singleuser') && ($context eq 'domain') && 
+        (!&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))))) {
         my $defdom=$env{'request.role.domain'};
         my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain');
         my %lt=&Apache::lonlocal::texthash(
@@ -1050,7 +1056,9 @@
                                        'stusrch'        => "User Search to enroll student",
                                        'memsrch'        => "User Search to enroll member",
                                        'srcva'          => "Search for a user and view access log information",
+                                       'usrvu'          => "User Search to view user roles",
                                        'usel'           => "Select a user to add/modify roles",
+                                       'suvr'           => "Select a user to view roles",
                                        'stusel'         => "Select a user to enroll as a student",
                                        'memsel'         => "Select a user to enroll as a member",
                                        'vacsel'         => "Select a user to view access log",
@@ -1063,7 +1071,7 @@
     if ($context eq 'requestcrs') {
         $r->print('<div>');
     } else {
-        my %breadcrumb_text = &singleuser_breadcrumb($crstype);
+        my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$srch->{'srchdomain'});
         my $helpitem;
         if ($env{'form.action'} eq 'singleuser') {
             $helpitem = 'Course_Change_Privileges';
@@ -1083,9 +1091,19 @@
                   );
         $r->print(&Apache::loncommon::start_page('User Management',$jscript,{bread_crumbs => $brcrum}));
         if ($env{'form.action'} eq 'singleuser') {
-            $r->print("<b>$lt{'usrch'}</b><br />");
+            my $readonly;
+            if (($context eq 'domain') && (!&Apache::lonnet::allowed('mau',$srch->{'srchdomain'}))) {
+                $readonly = 1;
+                $r->print("<b>$lt{'usrvu'}</b><br />");
+            } else {
+                $r->print("<b>$lt{'usrch'}</b><br />");
+            }
             $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));
-            $r->print('<h3>'.$lt{'usel'}.'</h3>');
+            if ($readonly) {
+                $r->print('<h3>'.$lt{'suvr'}.'</h3>');
+            } else {
+                $r->print('<h3>'.$lt{'usel'}.'</h3>');
+            }
         } elsif ($env{'form.action'} eq 'singlestudent') {
             $r->print($jscript."<b>");
             if ($crstype eq 'Community') {
@@ -1279,7 +1297,7 @@
 
     my $js = &validation_javascript($context,$ccdomain,$pjump_def,$crstype,
                                $groupslist,$newuser,$formname,\%loaditem);
-    my %breadcrumb_text = &singleuser_breadcrumb($crstype);
+    my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$ccdomain);
     my $helpitem = 'Course_Change_Privileges';
     if ($env{'form.action'} eq 'singlestudent') {
         $helpitem = 'Course_Add_Student';
@@ -1654,7 +1672,7 @@
 }
 
 sub singleuser_breadcrumb {
-    my ($crstype) = @_;
+    my ($crstype,$context,$domain) = @_;
     my %breadcrumb_text;
     if ($env{'form.action'} eq 'singlestudent') {
         if ($crstype eq 'Community') {
@@ -1662,16 +1680,21 @@
         } else {
             $breadcrumb_text{'search'} = 'Enroll a student';
         }
-        $breadcrumb_text{'userpicked'} = 'Select a user',
-        $breadcrumb_text{'modify'} = 'Set section/dates',
+        $breadcrumb_text{'userpicked'} = 'Select a user';
+        $breadcrumb_text{'modify'} = 'Set section/dates';
     } elsif ($env{'form.action'} eq 'accesslogs') {
         $breadcrumb_text{'search'} = 'View access logs for a user';
-        $breadcrumb_text{'userpicked'} = 'Select a user',
-        $breadcrumb_text{'activity'} = 'Activity',
+        $breadcrumb_text{'userpicked'} = 'Select a user';
+        $breadcrumb_text{'activity'} = 'Activity';
+    } elsif (($env{'form.action'} eq 'singleuser') && ($context eq 'domain') &&
+             (!&Apache::lonnet::allowed('mau',$domain))) {
+        $breadcrumb_text{'search'} = "View user's roles";
+        $breadcrumb_text{'userpicked'} = 'Select a user';
+        $breadcrumb_text{'modify'} = 'User roles';
     } else {
         $breadcrumb_text{'search'} = 'Create/modify a user';
-        $breadcrumb_text{'userpicked'} = 'Select a user',
-        $breadcrumb_text{'modify'} = 'Set user role',
+        $breadcrumb_text{'userpicked'} = 'Select a user';
+        $breadcrumb_text{'modify'} = 'Set user role';
     }
     return %breadcrumb_text;
 }
@@ -2689,7 +2712,7 @@
                   $jsback."\n".
                   '// ]]>'."\n".
                   '</script>'."\n";
-    my %breadcrumb_text = &singleuser_breadcrumb($crstype);
+    my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$env{'form.ccdomain'});
     push (@{$brcrum},
              {href => "javascript:backPage(document.userupdate)",
               text => $breadcrumb_text{'search'},
@@ -6814,7 +6837,7 @@
     my $form = 'document.accesslog';
 
 # set breadcrumbs
-    my %breadcrumb_text = &singleuser_breadcrumb();
+    my %breadcrumb_text = &singleuser_breadcrumb('','domain',$udom);
     push (@{$brcrum},
         {href => "javascript:backPage($form)",
          text => $breadcrumb_text{'search'}});
@@ -7762,18 +7785,21 @@
                                 .&mt("Click 'Search'")
                                 .'</li></ul><br />';
                 } else {
-                    my $helplink = ' href="javascript:helpMenu('."'display'".')"';
-                    $response .= '<br /><br />';
-                    if ($context eq 'requestcrs') {
-                        $response .= &mt("You are not authorized to define new users in the new course's domain - [_1].",$targetdom);
-                    } else {
-                        $response .= &mt("You are not authorized to create new users in your current role's domain - [_1].",$targetdom);
+                    unless (($context eq 'domain') && ($env{'form.action'} eq 'singleuser')) {
+                        my $helplink = ' href="javascript:helpMenu('."'display'".')"';
+                        $response .= '<br /><br />';
+                        if ($context eq 'requestcrs') {
+                            $response .= &mt("You are not authorized to define new users in the new course's domain - [_1].",$targetdom);
+                        } else {
+                            $response .= &mt("You are not authorized to create new users in your current role's domain - [_1].",$targetdom);
+                        }
+                        $response .= '<br />'
+                                     .&mt('Please contact the [_1]helpdesk[_2] if you need to create a new user.'
+                                        ,' <a'.$helplink.'>'
+                                        ,'</a>')
+                                     .'<br />';
+                    
                     }
-                    $response .= '<br />'
-                                 .&mt('Please contact the [_1]helpdesk[_2] if you need to create a new user.'
-                                    ,' <a'.$helplink.'>'
-                                    ,'</a>')
-                                 .'<br />';
                 }
             }
         }


More information about the LON-CAPA-cvs mailing list