--- loncom/interface/loncreateuser.pm 2007/11/15 21:24:51 1.196 +++ loncom/interface/loncreateuser.pm 2007/12/05 17:40:29 1.201 @@ -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.201 2007/12/05 17:40:29 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,9 +1197,11 @@ $lt{'uuas'} ($currentauth). $lt{'adcs'}. ENDBADAUTH } } else { # Authentication type is valid - my $authformcurrent=''; - my $authform_other=''; &initialize_authen_forms($ccdomain,$currentauth); + my $authformnop_row; + if (&Apache::lonnet::allowed('mau',$ccdomain)) { + $authformnop_row = &Apache::loncommon::start_data_table_row(); + } my ($authformcurrent,$authform_other,$can_modify) = &modify_login_block($ccdomain,$currentauth); if (&Apache::lonnet::allowed('mau',$ccdomain)) { @@ -1289,7 +1217,7 @@ ENDBADAUTH ''."\n". '

'.$lt{'ld'}.'

'. &Apache::loncommon::start_data_table(). - &Apache::loncommon::start_data_table_row(). + $authformnop_row. ''.$authformnop; if ($can_modify) { $outcome .= ''."\n". @@ -1298,7 +1226,8 @@ ENDBADAUTH ''.$authformcurrent.''. &Apache::loncommon::end_data_table_row()."\n"; } else { - $outcome .= ' ('.$authformcurrent.')'; + $outcome .= ' ('.$authformcurrent.')'. + &Apache::loncommon::end_data_table_row()."\n"; } if ($authform_other ne '') { $outcome .= $authform_other; @@ -1771,18 +1700,23 @@ sub update_user_data { 'prvs' => "Previous", 'chto' => "Changed To" ); + $r->print('

'.$lt{'uic'}.'

'. + &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row()); $r->print(<<"END"); - - - + - - + +END + $r->print(&Apache::loncommon::end_data_table_header_row(). + &Apache::loncommon::start_data_table_row()); + $r->print(<<"END"); + @@ -1790,17 +1724,21 @@ sub update_user_data { - - +END + $r->print(&Apache::loncommon::end_data_table_row(). + &Apache::loncommon::start_data_table_row()); + $r->print(<<"END"); + - -
$lt{'uic'}
   $lt{'frst'} $lt{'mddl'} $lt{'lst'} $lt{'gen'} $lt{'id'} $lt{'mail'}$lt{'disk'}
$lt{'prvs'}$lt{'disk'}$lt{'prvs'} $userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'id'} $userenv{'permanentemail'} $oldportfolioquota Mb
$lt{'chto'}$lt{'chto'} $env{'form.cfirstname'} $env{'form.cmiddlename'} $env{'form.clastname'} $env{'form.cgeneration'} $env{'form.cid'} $env{'form.cpermanentemail'} $newportfolioquota Mb $defquotatext
+ $newportfolioquota Mb $defquotatext END + $r->print(&Apache::loncommon::end_data_table_row(). + &Apache::loncommon::end_data_table()); if (($forceid) && ($recurseid) && (!$disallowed_id) && (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) { my %userupdate = ( @@ -1878,8 +1816,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 +1843,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 +2045,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 +3150,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 +3192,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 +3238,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();