--- loncom/interface/loncreateuser.pm 2007/11/15 21:24:51 1.196 +++ loncom/interface/loncreateuser.pm 2007/12/05 17:13:34 1.199 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.196 2007/11/15 21:24:51 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.199 2007/12/05 17:13:34 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -627,82 +627,8 @@ sub print_user_modification_page { } ENDSCRIPT } else { - $nondc_setsection_code = <<"ENDSECCODE"; - function setSections() { - var re1 = /^currsec_/; - var groups = new Array($groupslist); - for (var i=0;i 0) { - if (document.cu.elements[i+1].value != "" && document.cu.elements[i+1].value != null) { - sections = sections + "," + document.cu.elements[i+1].value; - } - } - else { - sections = document.cu.elements[i+1].value; - } - var newsecs = document.cu.elements[i+1].value; - var numsplit; - if (newsecs != null && newsecs != "") { - numsplit = newsecs.split(/,/g); - numsec = numsec + numsplit.length; - } - - if ((role == 'st') && (numsec > 1)) { - alert("In each course, each user may only have one student role at a time. You had selected "+numsec+" sections.\\nPlease modify your selections so they include no more than one section.") - return; - } - else if (numsplit != null) { - for (var j=0; jprint($home_server_pick); } - if ($context eq 'domain') { - $r->print(&Apache::lonuserutils::forceid_change()); - } $r->print(''."\n".'

'. $lt{'lg'}.'

'); my ($fixedauth,$varauth,$authmsg); @@ -862,8 +785,11 @@ $forminfo ENDCHANGEUSER $r->print('
'. &personal_data_display($ccuname,$ccdomain,$newuser, - %inst_results). - '
'); + %inst_results)); + if ($context eq 'domain') { + $r->print(&Apache::lonuserutils::forceid_change()); + } + $r->print('
'); my $user_auth_text = &user_authentication($ccuname,$ccdomain,$krbdefdom,\%abv_auth); my $user_quota_text; @@ -1214,7 +1140,7 @@ ENDNOPORTPRIV } } else { $r->print(&course_level_table(%inccourses)); - $r->print('
'."\n"); + $r->print('
'."\n"); } $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain'])); $r->print(''); @@ -1271,8 +1197,6 @@ $lt{'uuas'} ($currentauth). $lt{'adcs'}. ENDBADAUTH } } else { # Authentication type is valid - my $authformcurrent=''; - my $authform_other=''; &initialize_authen_forms($ccdomain,$currentauth); my ($authformcurrent,$authform_other,$can_modify) = &modify_login_block($ccdomain,$currentauth); @@ -1878,8 +1802,10 @@ END $r->print(&mt('Revoking [_1] in [_2]: [_3]', $role,$scope,''.$result.'').'
'); if ($role eq 'st') { - my $result = &classlist_drop($scope,$env{'form.ccuname'}, - $env{'form.ccdomain'},$now); + my $result = + &Apache::lonuserutils::classlist_drop($scope, + $env{'form.ccuname'},$env{'form.ccdomain'}, + $now); $r->print($result); } } @@ -1903,8 +1829,10 @@ END $r->print(&mt('Deleting [_1] in [_2]: [_3]',$role,$scope, ''.$result.'').'
'); if ($role eq 'st') { - my $result = &classlist_drop($scope,$env{'form.ccuname'}, - $env{'form.ccdomain'},$now); + my $result = + &Apache::lonuserutils::classlist_drop($scope, + $env{'form.ccuname'},$env{'form.ccdomain'}, + $now); $r->print($result); } } @@ -2103,30 +2031,6 @@ sub update_result_form { return $outcome; } -sub classlist_drop { - my ($scope,$uname,$udom,$now) = @_; - my ($cdom,$cnum) = ($scope=~m{^/($match_domain)/($match_courseid)}); - my $cid=$cdom.'_'.$cnum; - my $user = $uname.':'.$udom; - if (!&active_student_roles($cnum,$cdom,$uname,$udom)) { - my $result = - &Apache::lonnet::cput('classlist', - { $user => $now }, - $env{'course.'.$cid.'.domain'}, - $env{'course.'.$cid.'.num'}); - return &mt('Drop from classlist: [_1]', - ''.$result.'').'
'; - } -} - -sub active_student_roles { - my ($cnum,$cdom,$uname,$udom) = @_; - my %roles = - &Apache::lonnet::get_my_roles($uname,$udom,'userroles', - ['future','active'],['st']); - return exists($roles{"$cnum:$cdom:st"}); -} - sub quota_admin { my ($setquota,$changeHash) = @_; my $quotachanged; @@ -3232,7 +3136,9 @@ sub course_level_table { '.$area.'
Domain: '.$domain.''."\n"; if ($role ne 'cc') { if (%sections_count) { - my $currsec = &course_sections(\%sections_count,$protectedcourse.'_'.$role); + my $currsec = + &Apache::lonuserutils::course_sections(\%sections_count, + $protectedcourse.'_'.$role); $table .= ''. ' @@ -3272,7 +3178,9 @@ ENDTIMEENTRY '."\n"; if (%sections_count) { - my $currsec = &course_sections(\%sections_count,$customrole); + my $currsec = + &Apache::lonuserutils::course_sections(\%sections_count, + $customrole); $table.= '
'.$plrole.' '.$area.''. '
'. @@ -3316,28 +3224,6 @@ $table. return $result; } -sub course_sections { - my ($sections_count,$role) = @_; - my $output = ''; - my @sections = (sort {$a <=> $b} keys %{$sections_count}); - if (scalar(@sections) == 1) { - $output = ''."\n"; - foreach my $sec (@sections) { - $output .= '\n"; - } - } - $output .= ''; - return $output; -} - sub course_level_dc { my ($dcdom) = @_; my %customroles=&Apache::lonuserutils::my_custom_roles();