--- loncom/interface/loncreateuser.pm 2014/01/15 18:47:56 1.386 +++ loncom/interface/loncreateuser.pm 2014/02/11 17:34:41 1.390 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.386 2014/01/15 18:47:56 bisitz Exp $ +# $Id: loncreateuser.pm,v 1.390 2014/02/11 17:34:41 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -126,9 +126,7 @@ sub user_quotas { my ($ccuname,$ccdomain) = @_; my %lt = &Apache::lonlocal::texthash( 'usrt' => "User Tools", - 'cuqu' => "Current quota", 'cust' => "Custom quota", - 'defa' => "Default", 'chqu' => "Change quota", ); @@ -211,8 +209,8 @@ END_SCRIPT ' '.$titles{$name}.''."\n". ' '."\n". &Apache::loncommon::start_data_table_row()."\n". - ' '.$lt{'cuqu'}.': '. - $currquota.' MB.  '. + ' '. + &mt('Current quota: [_1] MB',$currquota).'  '. $defaultinfo.''."\n". &Apache::loncommon::end_data_table_row()."\n". &Apache::loncommon::start_data_table_row()."\n". @@ -220,13 +218,14 @@ END_SCRIPT ':  '. + ' />'. + &mt('Default ([_1] MB)',$defquota).' '. '  '. ' MB'."\n". + ' /> '.&mt('MB').''."\n". &Apache::loncommon::end_data_table_row()."\n"; } } @@ -1230,6 +1229,7 @@ ENDFORMINFO } } } + my $title = ''; if ($newuser) { my ($portfolioform,$domroleform); if ((&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) || @@ -1243,10 +1243,6 @@ ENDFORMINFO } &initialize_authen_forms($ccdomain,$formname); my %lt=&Apache::lonlocal::texthash( - 'cnu' => 'Create New User', - 'ast' => 'as a student', - 'ame' => 'as a member', - 'ind' => 'in domain', 'lg' => 'Login Data', 'hs' => "Home Server", ); @@ -1260,19 +1256,25 @@ $loginscript // ]]> -

$lt{'cnu'} "$ccuname" $lt{'ind'} $ccdomain ENDTITLE if ($env{'form.action'} eq 'singlestudent') { if ($crstype eq 'Community') { - $r->print(' ('.$lt{'ame'}.')'); + $title = &mt('Create New User [_1] in domain [_2] as a member', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } else { - $r->print(' ('.$lt{'ast'}.')'); + $title = &mt('Create New User [_1] in domain [_2] as a student', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } + } else { + $title = &mt('Create New User [_1] in domain [_2]', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } - $r->print('

'."\n".'
'); + $r->print('

'.$title.'

'."\n"); + $r->print('
'); my $personal_table = &personal_data_display($ccuname,$ccdomain,$newuser,$context, $inst_results{$ccuname.':'.$ccdomain}); + # (Do not offer Disable Safeguard here) $r->print($personal_table); my ($home_server_pick,$numlib) = &Apache::loncommon::home_server_form_item($ccdomain,'hserver', @@ -1359,35 +1361,25 @@ ENDAUTH } $r->print('
'); } else { # user already exists - my %lt=&Apache::lonlocal::texthash( - 'cup' => "Modify existing user: ", - 'ens' => "Enroll one student: ", - 'enm' => "Enroll one member: ", - 'id' => "in domain", - ); - $r->print(< -ENDCHANGEUSER + $r->print($start_page.$forminfo); if ($env{'form.action'} eq 'singlestudent') { if ($crstype eq 'Community') { - $r->print($lt{'enm'}); + $title = &mt('Enroll one member: [_1] in domain [_2]', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } else { - $r->print($lt{'ens'}); + $title = &mt('Enroll one student: [_1] in domain [_2]', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } } else { - $r->print($lt{'cup'}); + $title = &mt('Modify existing user: [_1] in domain [_2]', + '"'.$ccuname.'"','"'.$ccdomain.'"'); } - $r->print(' "'.$ccuname.'" '.$lt{'id'}.' "'.$ccdomain.'"'. - "\n".'
'); - my ($personal_table,$showforceid) = + $r->print('

'.$title.'

'."\n"); + $r->print('
'); + my $personal_table = &personal_data_display($ccuname,$ccdomain,$newuser,$context, $inst_results{$ccuname.':'.$ccdomain}); $r->print($personal_table); - if ($showforceid) { - $r->print(''.&Apache::lonuserutils::forceid_change($context).'
'); - } if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) { $r->print('

'.&mt('User Can Request Creation of Courses/Communities in this Domain?').'

'. &Apache::loncommon::start_data_table()); @@ -2170,7 +2162,7 @@ sub modify_login_block { sub personal_data_display { my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_; - my ($output,$showforceid,%userenv,%canmodify,%canmodify_status); + my ($output,%userenv,%canmodify,%canmodify_status); my @userinfo = ('firstname','middlename','lastname','generation', 'permanentemail','id'); my $rowcount = 0; @@ -2257,8 +2249,8 @@ sub personal_data_display { } else { $row .= $userenv{$item}; } - if ($item eq 'id') { - $showforceid = $canmodify{$item}; + if (($item eq 'id') && ($canmodify{$item})) { + $row .= '
'.&Apache::lonuserutils::forceid_change($context); } } $row .= &Apache::lonhtmlcommon::row_closure(1); @@ -2294,7 +2286,7 @@ sub personal_data_display { } } if (!$hiderow) { - my $row = &Apache::lonhtmlcommon::row_title(&mt('Affliations'),undef,'LC_oddrow_value')."\n". + my $row = &Apache::lonhtmlcommon::row_title(&mt('Affiliations'),undef,'LC_oddrow_value')."\n". $shown.&Apache::lonhtmlcommon::row_closure(1); if ($context eq 'selfcreate') { $rowcount ++; @@ -2309,7 +2301,7 @@ sub personal_data_display { if ($context eq 'selfcreate') { return($output,$rowcount,$editable); } else { - return ($output,$showforceid); + return $output; } } else { return $output; @@ -2474,9 +2466,12 @@ sub update_user_data { if (! exists($env{'form.makeuser'})) { # Modifying an existing user, so check the validity of the name if ($uhome eq 'no_host') { - $r->print($error.&mt('Unable to determine home server for '). - $env{'form.ccuname'}.&mt(' in domain '). - $env{'form.ccdomain'}.'.'); + $r->print( + $error + .'

' + .&mt('Unable to determine home server for [_1] in domain [_2].', + '"'.$env{'form.ccuname'}.'"','"'.$env{'form.ccdomain'}.'"') + .'

'); return; } } @@ -2966,8 +2961,8 @@ sub update_user_data { } } foreach my $name ('portfolio','author') { - $oldsettings{'quota'}{$name} = $oldquota{$name}.' MB'; - $newsettings{'quota'}{$name} = $newquota{$name}.' MB'; + $oldsettings{'quota'}{$name} = &mt('[_1] MB',$oldquota{$name}); + $newsettings{'quota'}{$name} = &mt('[_1] MB',$newquota{$name}); } if ((keys(%namechanged) > 0) || (keys(%changed) > 0)) { my ($chgresult,$namechgresult); @@ -3066,9 +3061,12 @@ sub update_user_data { &Apache::lonnet::appenv(\%newenvhash); } } else { # error occurred - $r->print(''.&mt('Unable to successfully change environment for').' '. - $env{'form.ccuname'}.' '.&mt('in domain').' '. - $env{'form.ccdomain'}.'
'); + $r->print( + '

' + .&mt('Unable to successfully change environment for [_1] in domain [_2].', + '"'.$env{'form.ccuname'}.'"', + '"'.$env{'form.ccdomain'}.'"') + .'

'); } } else { # End of if ($env ... ) logic # They did not want to change the users name, quota, tool availability, @@ -4436,25 +4434,43 @@ sub set_custom_role { $sysrole.=':'.$item; } } - $r->print('
Defining Role: '. - &Apache::lonnet::definerole($rolename,$sysrole,$domrole,$courole)); + # Assign role; Compile and show result + my $errmsg; + my $result = + &Apache::lonnet::definerole($rolename,$sysrole,$domrole,$courole); + if ($result ne 'ok') { + $errmsg = ': '.$result; + } + my $message = + &Apache::lonhtmlcommon::confirm_success( + &mt('Defining Role').$errmsg, ($result eq 'ok' ? 0 : 1)); if ($env{'request.course.id'}) { my $url='/'.$env{'request.course.id'}; $url=~s/\_/\//g; - $r->print('
'.&mt('Assigning Role to Self').': '. - &Apache::lonnet::assigncustomrole($env{'user.domain'}, - $env{'user.name'}, - $url, - $env{'user.domain'}, - $env{'user.name'}, - $rolename,undef,undef,undef,$context)); + $result = + &Apache::lonnet::assigncustomrole( + $env{'user.domain'},$env{'user.name'}, + $url, + $env{'user.domain'},$env{'user.name'}, + $rolename,undef,undef,undef,$context); + if ($result ne 'ok') { + $errmsg = ': '.$result; + } + $message .= + '
' + .&Apache::lonhtmlcommon::confirm_success( + &mt('Assigning Role to Self').$errmsg, ($result eq 'ok' ? 0 : 1)); } $r->print( - '

' - .&mt('Create or edit another custom role') - .'

' + &Apache::loncommon::confirmwrapper($message) + .'
' + .&Apache::lonhtmlcommon::actionbox([ + '' + .&mt('Create or edit another custom role') + .'']) .'
' - .&Apache::lonhtmlcommon::echo_form_input([]).'
' + .&Apache::lonhtmlcommon::echo_form_input([]) + .'' ); } @@ -6978,22 +6994,22 @@ sub course_level_dc { my $otheritems = &Apache::loncommon::start_data_table_row()."\n". '
'. $courseform.(' ' x4).''."\n". - '
'."\n"; foreach my $role (@roles) { my $plrole=&Apache::lonnet::plaintext($role); - $otheritems .= ' '; } if ( keys %customroles > 0) { foreach my $cust (sort keys %customroles) { my $custrole='cr_cr_'.$env{'user.domain'}. '_'.$env{'user.name'}.'_'.$cust; - $otheritems .= ' '; } } $otheritems .= ''. ''. ''. + ' '. ''. '
'.$lt{'exs'}.'
   '.$lt{'new'}.'
'. ''.