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

raeburn raeburn@source.lon-capa.org
Fri, 14 Aug 2009 15:02:09 -0000


raeburn		Fri Aug 14 15:02:09 2009 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	loncreateuser.pm 
  Log:
  - Backport 1.305.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.295.2.5 loncom/interface/loncreateuser.pm:1.295.2.6
--- loncom/interface/loncreateuser.pm:1.295.2.5	Fri Aug 14 14:45:50 2009
+++ loncom/interface/loncreateuser.pm	Fri Aug 14 15:02:09 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.295.2.5 2009/08/14 14:45:50 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.295.2.6 2009/08/14 15:02:09 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5576,17 +5576,29 @@
                     $response .= '<br />'.&mt('You may want to broaden your search to the selected LON-CAPA domain.');
                 }
             }
-            if (!($srch->{'srchby'} eq 'uname' && $srch->{'srchin'} eq 'dom' && $srch->{'srchtype'} eq 'exact' && $srch->{'srchdomain'} eq $env{'request.role.domain'})) {
+            my $createdom = $env{'request.role.domain'};
+            if ($context eq 'requestcrs') {
+                if ($env{'form.coursedom'} ne '') {
+                    $createdom = $env{'form.coursedom'};
+                }
+            }
+
+            if (!($srch->{'srchby'} eq 'uname' && $srch->{'srchin'} eq 'dom' && $srch->{'srchtype'} eq 'exact' && $srch->{'srchdomain'} eq $createdom)) {
                 my $cancreate =
-                    &Apache::lonuserutils::can_create_user($env{'request.role.domain'},$context);
+                    &Apache::lonuserutils::can_create_user($cretedom,$context);
+                my $targetdom = '<span class="LC_cusr_emph">'.$createdom.'</span>'
                 if ($cancreate) {
-                    my $showdom = &display_domain_info($env{'request.role.domain'}); 
+                    my $showdom = &display_domain_info($createdom);
                     $response .= '<br /><br />'
                                 .'<b>'.&mt('To add a new user:').'</b>'
-                                .'<br />'
-                                .&mt("(You can only create new users in your current role's domain - [_1])"
-                                    ,'<span class="LC_cusr_emph">'.$env{'request.role.domain'}.'</span>')
-                                .'<ul><li>'
+                                .'<br />';
+                    if ($context eq 'requestcrs') {
+                        $response .= &mt("(You can only define new users i
+n the new course's domain - [_1])",$targetdom);
+                    } else {
+                        $response .= &mt("(You can only create new users i
+n your current role's domain - [_1])",$targetdom);                    }
+                    $response .= '<ul><li>'
                                 .&mt("Set 'Domain/institution to search' to: [_1]",'<span class="LC_cusr_emph">'.$showdom.'</span>')
                                 .'</li><li>'
                                 .&mt("Set 'Search criteria' to: [_1]username is ..... in selected LON-CAPA domain[_2]",'<span class="LC_cusr_emph">','</span>')
@@ -5597,10 +5609,14 @@
                                 .'</li></ul><br />';
                 } else {
                     my $helplink = ' href="javascript:helpMenu('."'display'".')"';
-                    $response .= '<br /><br />'
-                                .&mt("You are not authorized to create new users in your current role's domain - [_1]."
-                                    ,'<span class="LC_cusr_emph">'.$env{'request.role.domain'}.'</span>')
-                                .'<br />'
+                    $response .= '<br /><br />';
+                    if ($context eq 'requestcrs') {
+                        $response .= &mt("You are not authorized to define
+d 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>')