--- loncom/interface/loncreateuser.pm 2012/12/20 16:22:59 1.368
+++ loncom/interface/loncreateuser.pm 2012/12/28 04:12:32 1.370
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.368 2012/12/20 16:22:59 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.370 2012/12/28 04:12:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3343,8 +3343,13 @@ sub update_roles {
$env{'form.ccuname'},
$scope,$role,'','',$context);
$r->print(&Apache::lonhtmlcommon::confirm_success(
- &mt('Revoking [_1] in [_2]', &Apache::lonnet::plaintext($role), '"'.&cid_to_cname($scope).'"
'),
- $result ne "ok"));
+ &mt('Revoking [_1] in [_2]',
+ &Apache::lonnet::plaintext($role),
+ '"'.&cid_to_cname($scope).'"'),
+ $result ne "ok").'
');
+ if ($result ne "ok") {
+ $r->print(&mt('Error: [_1]',$result).'
');
+ }
if ($role eq 'st') {
my $result =
&Apache::lonuserutils::classlist_drop($scope,
@@ -3358,10 +3363,15 @@ sub update_roles {
}
if ($key=~m{^form\.rev\:([^_]+)_cr\.cr/($match_domain)/($match_username)/(\w+)$}s) {
# Revoke custom role
+ my $result = &Apache::lonnet::revokecustomrole(
+ $env{'form.ccdomain'},$env{'form.ccuname'},$1,$2,$3,$4,'','',$context);
$r->print(&Apache::lonhtmlcommon::confirm_success(
- &mt('Revoking custom role [_1] by [_2]:[_3] in [_4]',$4,$3,$2,'"'.&cid_to_cname($1).'"
'),
- &Apache::lonnet::revokecustomrole($env{'form.ccdomain'},$env{'form.ccuname'},$1,$2,$3,$4,'','',$context) ne 'ok'));
-
+ &mt('Revoking custom role [_1] by [_2] in [_3]',
+ $4,$3.':'.$2,'"'.&cid_to_cname($1).'"'),
+ $result ne 'ok').'
');
+ if ($result ne "ok") {
+ $r->print(&mt('Error: [_1]',$result).'
');
+ }
if (!grep(/^cr$/,@rolechanges)) {
push(@rolechanges,'cr');
}
@@ -3377,14 +3387,19 @@ sub update_roles {
$context);
$r->print(&Apache::lonhtmlcommon::confirm_success(
&mt('Deleting [_1] in [_2]',
- &Apache::lonnet::plaintext($role),'"'.&cid_to_cname($scope).'"
'),$result ne 'ok'));
+ &Apache::lonnet::plaintext($role),
+ '"'.&cid_to_cname($scope).'"'),
+ $result ne 'ok').'
');
+ if ($result ne "ok") {
+ $r->print(&mt('Error: [_1]',$result).'
');
+ }
if ($role eq 'st') {
my $result =
&Apache::lonuserutils::classlist_drop($scope,
$env{'form.ccuname'},$env{'form.ccdomain'},
$now);
- $r->print($result);
+ $r->print(&Apache::lonhtmlcommon::confirm_success($result));
}
if (!grep(/^\Q$role\E$/,@rolechanges)) {
push(@rolechanges,$role);
@@ -3393,11 +3408,16 @@ sub update_roles {
if ($key=~m{^form\.del\:([^_]+)_cr\.cr/($match_domain)/($match_username)/(\w+)$}) {
my ($url,$rdom,$rnam,$rolename) = ($1,$2,$3,$4);
# Delete custom role
- $r->print(&confirm_success(&mt('Deleting custom role [_1] by [_2] in [_3]',
- $rolename,$rnam.':'.$rdom,'"'.&cid_to_cname($1).'"').'
'));
- &Apache::lonnet::assigncustomrole($env{'form.ccdomain'},
- $env{'form.ccuname'},$url,$rdom,$rnam,$rolename,$now,
- 0,1,$context);
+ my $result =
+ &Apache::lonnet::assigncustomrole($env{'form.ccdomain'},
+ $env{'form.ccuname'},$url,$rdom,$rnam,$rolename,$now,
+ 0,1,$context);
+ $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Deleting custom role [_1] by [_2] in [_3]',
+ $rolename,$rnam.':'.$rdom,'"'.&cid_to_cname($1).'"'),
+ $result ne "ok").'
');
+ if ($result ne "ok") {
+ $r->print(&mt('Error: [_1]',$result).'
');
+ }
if (!grep(/^cr$/,@rolechanges)) {
push(@rolechanges,'cr');
@@ -3419,7 +3439,7 @@ sub update_roles {
if ($result eq 'refused' && $logmsg) {
$output = $logmsg;
} else {
- $output = "Error: $result\n";
+ $output = &mt('Error: [_1]',$result)."\n";
}
} else {
$output = &Apache::lonhtmlcommon::confirm_success(&mt('Assigning [_1] in [_2] starting [_3]',&Apache::lonnet::plaintext($role),
@@ -3431,8 +3451,11 @@ sub update_roles {
$env{'form.ccuname'},$url,$role,0,$now,'','',
$context);
$output = &Apache::lonhtmlcommon::confirm_success(&mt('Re-enabling [_1] in [_2]',
- &Apache::lonnet::plaintext($role),'"'.&cid_to_cname($url).'"').'
',$result ne "ok");
- }
+ &Apache::lonnet::plaintext($role),'"'.&cid_to_cname($url).'"'),$result ne "ok").'
';
+ if ($result ne "ok") {
+ $output .= &mt('Error: [_1]',$result).'
';
+ }
+ }
$r->print($output);
if (!grep(/^\Q$role\E$/,@rolechanges)) {
push(@rolechanges,$role);
@@ -3444,8 +3467,13 @@ sub update_roles {
my $result = &Apache::lonnet::assigncustomrole(
$env{'form.ccdomain'}, $env{'form.ccuname'},
$url,$rdom,$rnam,$rolename,0,$now,undef,$context);
- $r->print(&Apache::lonhtmlcommon::confirm_success(&mt('Re-enabling custom role [_1] by [_2] in [_3]',
- $rolename,$rnam.':'.$rdom,'"'.&cid_to_cname($1).'"').'
'),$result ne "ok");
+ $r->print(&Apache::lonhtmlcommon::confirm_success(
+ &mt('Re-enabling custom role [_1] by [_2] in [_3]',
+ $rolename,$rnam.':'.$rdom,'"'.&cid_to_cname($1).'"'),
+ $result ne "ok").'
');
+ if ($result ne "ok") {
+ $r->print(&mt('Error: [_1]',$result).'
');
+ }
if (!grep(/^cr$/,@rolechanges)) {
push(@rolechanges,'cr');
}
@@ -4826,6 +4854,7 @@ sub print_main_menu {
);
}
} elsif ($context eq 'author') {
+ push(@{ $menu[2]->{items} }, #Category: Administration
{
linktext => 'Change Log',
icon => 'document-properties.png',
@@ -4834,6 +4863,7 @@ sub print_main_menu {
permission => $permission->{'cusr'},
linktitle => 'View change log.',
},
+ );
}
return Apache::lonhtmlcommon::generate_menu(@menu);
# { text => 'View Log-in History',