--- loncom/interface/loncommon.pm 2007/08/25 19:52:29 1.569 +++ loncom/interface/loncommon.pm 2007/08/26 21:09:43 1.570 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.569 2007/08/25 19:52:29 raeburn Exp $ +# $Id: loncommon.pm,v 1.570 2007/08/26 21:09:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -5609,7 +5609,7 @@ sub get_secgrprole_info { } sub user_picker { - my ($dom,$srch,$forcenewuser) = @_; + my ($dom,$srch,$forcenewuser,$caller) = @_; my $currdom = $dom; my %curr_selected = ( srchin => 'dom', @@ -5692,29 +5692,29 @@ sub user_picker { my ($newuserscript,$new_user_create); if ($forcenewuser) { - $new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\');" /> </p>'; + $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>'; $newuserscript = <<"ENDSCRIPT"; -function setSearch(createnew) { +function setSearch(createnew,callingForm) { if (createnew == 1) { - for (var i=0; i<document.crtuser.srchby.length; i++) { - if (document.crtuser.srchby.options[i].value == 'uname') { - document.crtuser.srchby.selectedIndex = i; + for (var i=0; i<callingForm.srchby.length; i++) { + if (callingForm.srchby.options[i].value == 'uname') { + callingForm.srchby.selectedIndex = i; } } - for (var i=0; i<document.crtuser.srchin.length; i++) { - if ( document.crtuser.srchin.options[i].value == 'dom') { - document.crtuser.srchin.selectedIndex = i; + for (var i=0; i<callingForm.srchin.length; i++) { + if ( callingForm.srchin.options[i].value == 'dom') { + callingForm.srchin.selectedIndex = i; } } - for (var i=0; i<document.crtuser.srchtype.length; i++) { - if (document.crtuser.srchtype.options[i].value == 'exact') { - document.crtuser.srchtype.selectedIndex = i; + for (var i=0; i<callingForm.srchtype.length; i++) { + if (callingForm.srchtype.options[i].value == 'exact') { + callingForm.srchtype.selectedIndex = i; } } - for (var i=0; i<document.crtuser.srchdomain.length; i++) { - if (document.crtuser.srchdomain.options[i].value == '$env{'request.role.domain'}') { - document.crtuser.srchdomain.selectedIndex = i; + for (var i=0; i<callingForm.srchdomain.length; i++) { + if (callingForm.srchdomain.options[i].value == '$env{'request.role.domain'}') { + callingForm.srchdomain.selectedIndex = i; } } } @@ -5725,21 +5725,21 @@ ENDSCRIPT my $output = <<"END_BLOCK"; <script type="text/javascript"> -function validateEntry() { +function validateEntry(callingForm) { var checkok = 1; var srchin; - for (var i=0; i<document.crtuser.srchin.length; i++) { - if ( document.crtuser.srchin[i].checked ) { - srchin = document.crtuser.srchin[i].value; + for (var i=0; i<callingForm.srchin.length; i++) { + if ( callingForm.srchin[i].checked ) { + srchin = callingForm.srchin[i].value; } } - var srchtype = document.crtuser.srchtype.options[document.crtuser.srchtype.selectedIndex].value; - var srchby = document.crtuser.srchby.options[document.crtuser.srchby.selectedIndex].value; - var srchdomain = document.crtuser.srchdomain.options[document.crtuser.srchdomain.selectedIndex].value; - var srchterm = document.crtuser.srchterm.value; - var srchin = document.crtuser.srchin.options[document.crtuser.srchin.selectedIndex].value; + var srchtype = callingForm.srchtype.options[callingForm.srchtype.selectedIndex].value; + var srchby = callingForm.srchby.options[callingForm.srchby.selectedIndex].value; + var srchdomain = callingForm.srchdomain.options[callingForm.srchdomain.selectedIndex].value; + var srchterm = callingForm.srchterm.value; + var srchin = callingForm.srchin.options[callingForm.srchin.selectedIndex].value; var msg = ""; if (srchterm == "") { @@ -5787,7 +5787,7 @@ function validateEntry() { return; } if (checkok == 1) { - document.crtuser.submit(); + callingForm.submit(); } }