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

raeburn raeburn@source.lon-capa.org
Wed, 05 Jan 2011 19:57:18 -0000


raeburn		Wed Jan  5 19:57:18 2011 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/interface	loncommon.pm 
  Log:
  - Backport 1.994.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.948.2.22 loncom/interface/loncommon.pm:1.948.2.23
--- loncom/interface/loncommon.pm:1.948.2.22	Mon Jan  3 14:58:05 2011
+++ loncom/interface/loncommon.pm	Wed Jan  5 19:57:17 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.948.2.22 2011/01/03 14:58:05 raeburn Exp $
+# $Id: loncommon.pm,v 1.948.2.23 2011/01/05 19:57:17 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7820,7 +7820,7 @@
 }
 
 sub user_picker {
-    my ($dom,$srch,$forcenewuser,$caller,$cancreate,$usertype) = @_;
+    my ($dom,$srch,$forcenewuser,$caller,$cancreate,$usertype,$context) = @_;
     my $currdom = $dom;
     my %curr_selected = (
                         srchin => 'dom',
@@ -7911,10 +7911,15 @@
     $srchtypesel .= "\n  </select>\n";
 
     my ($newuserscript,$new_user_create);
-
+    my $context_dom = $env{'request.role.domain'};
+    if ($context eq 'requestcrs') {
+        if ($env{'form.coursedom'} ne '') {
+            $context_dom = $env{'form.coursedom'};
+        }
+    }
     if ($forcenewuser) {
         if (ref($srch) eq 'HASH') {
-            if ($srch->{'srchby'} eq 'uname' && $srch->{'srchtype'} eq 'exact' && $srch->{'srchin'} eq 'dom' && $srch->{'srchdomain'} eq $env{'request.role.domain'}) {
+            if ($srch->{'srchby'} eq 'uname' && $srch->{'srchtype'} eq 'exact' && $srch->{'srchin'} eq 'dom' && $srch->{'srchdomain'} eq $context_dom) {
                 if ($cancreate) {
                     $new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" /> </p>';
                 } else {
@@ -7953,7 +7958,7 @@
             }
         }
         for (var i=0; i<callingForm.srchdomain.length; i++) {
-            if (callingForm.srchdomain.options[i].value == '$env{'request.role.domain'}') {
+            if (callingForm.srchdomain.options[i].value == '$context_dom') {
                 callingForm.srchdomain.selectedIndex = i;
             }
         }