--- loncom/interface/loncreateuser.pm 2010/01/20 14:59:27 1.295.2.29
+++ loncom/interface/loncreateuser.pm 2010/06/18 08:41:34 1.346
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.295.2.29 2010/01/20 14:59:27 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.346 2010/06/18 08:41:34 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -531,7 +531,6 @@ sub print_username_entry_form {
my %lt=&Apache::lonlocal::texthash(
'srst' => 'Search for a user and enroll as a student',
'srme' => 'Search for a user and enroll as a member',
-
'srad' => 'Search for a user and modify/add user information or roles',
'usr' => "Username",
'dom' => "Domain",
@@ -686,7 +685,7 @@ ENDBLOCK
);
my $sellink=&Apache::loncommon::selectstudent_link('crtusername','srchterm','srchdomain');
my ($title,$buttontext,$showresponse);
- if ($env{'form.action'} eq 'singlestudent') {
+ if ($env{'form.action'} eq 'singlestudent') {
if ($crstype eq 'Community') {
$title = $lt{'enrm'};
} else {
@@ -946,7 +945,7 @@ sub print_user_modification_page {
);
my $response;
if ($env{'form.origform'} eq 'crtusername') {
- $response = ''.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain).
+ $response = ''.&mt('No match found for the username [_1] in LON-CAPA domain: [_2]',''.$ccuname.'',$ccdomain).
' ';
}
$response .= '
'
@@ -1054,8 +1053,8 @@ ENDFORMINFO
}
} else {
foreach my $key (keys(%env)) {
- if ($key=~/^user\.priv\.cm\.\/($match_domain)\/($match_username)/) {
- $inccourses{$1.'_'.$2}=1;
+ if ($key=~/^user\.priv\.cm\.\/($match_domain)\/($match_username)/) {
+ $inccourses{$1.'_'.$2}=1;
}
}
}
@@ -1429,7 +1428,7 @@ sub display_existing_roles {
my (%rolesdump,%roletext,%sortrole,%roleclass,%rolepriv);
if ($context eq 'course' || $context eq 'author') {
my @roles = &Apache::lonuserutils::roles_by_context($context,1,$crstype);
- my %roleshash =
+ my %roleshash =
&Apache::lonnet::get_my_roles($ccuname,$ccdomain,'userroles',
['active','previous','future'],\@roles,$roledom,1);
foreach my $key (keys(%roleshash)) {
@@ -1456,6 +1455,8 @@ sub display_existing_roles {
$newkey .= '_'.$newrole;
if ($start ne '' && $end ne '') {
$newvalue .= '_'.$end.'_'.$start;
+ } elsif ($end ne '') {
+ $newvalue .= '_'.$end;
}
$rolesdump{$newkey} = $newvalue;
}
@@ -1498,9 +1499,8 @@ sub display_existing_roles {
if (defined($coursedata{'description'})) {
$carea=$coursedata{'description'}.
' '.&mt('Domain').': '.$coursedom.(' 'x8).
- &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
+ &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
$sortkey.="\0".$coursedata{'description'};
- $class=$coursedata{'type'};
} else {
if ($class eq 'Community') {
$carea=&mt('Unavailable community').': '.$area;
@@ -1525,10 +1525,10 @@ sub display_existing_roles {
$allowed = 1;
}
}
- }
+ }
if ((&Apache::lonnet::allowed('dro',$coursedom)) ||
(&Apache::lonnet::allowed('dro',$ccdomain))) {
- $delallowed=1;
+ $delallowed=1;
}
# - custom role. Needs more info, too
if ($croletitle) {
@@ -1541,11 +1541,11 @@ sub display_existing_roles {
$carea.=' Section: '.$3;
$sortkey.="\0$3";
if (!$allowed) {
- if ($env{'request.course.sec'} eq $3) {
- if (&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2.'/'.$3)) {
- $allowed = 1;
- }
- }
+ if ($env{'request.course.sec'} eq $3) {
+ if (&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2.'/'.$3)) {
+ $allowed = 1;
+ }
+ }
}
}
$area=$carea;
@@ -1554,8 +1554,8 @@ sub display_existing_roles {
# Determine if current user is able to revoke privileges
if ($area=~m{^/($match_domain)/}) {
if ((&Apache::lonnet::allowed('c'.$role_code,$1)) ||
- (&Apache::lonnet::allowed('c'.$role_code,$ccdomain))) {
- $allowed=1;
+ (&Apache::lonnet::allowed('c'.$role_code,$ccdomain))) {
+ $allowed=1;
}
if (((&Apache::lonnet::allowed('dro',$1)) ||
(&Apache::lonnet::allowed('dro',$ccdomain))) &&
@@ -1613,13 +1613,16 @@ sub display_existing_roles {
$plaintext=&Apache::lonnet::plaintext($role_code,$class)
} else {
$plaintext=
- "Customrole '$croletitle' defined by $croleuname\@$croleudom";
+ &mt('Customrole [_1][_2]defined by [_3]',
+ '"'.$croletitle.'"',
+ ' ',
+ $croleuname.':'.$croleudom);
}
$row.= '
'.&mt('User [_1] in domain [_2]',
$env{'form.ccuname'}, $env{'form.ccdomain'}).'
');
+ $r->print('
'.&mt('Please be patient').'
');
+
my (%alerts,%rulematch,%inst_results,%curr_rules);
+ my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
my @usertools = ('aboutme','blog','portfolio');
- my @requestcourses = ('official','unofficial');
+ my @requestcourses = ('official','unofficial','community');
my ($othertitle,$usertypes,$types) =
&Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});
+ my %canmodify_status =
+ &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},
+ ['inststatus']);
if ($env{'form.makeuser'}) {
$r->print('
\n");
+ }
+ }
+ }
+ $r->print(&Apache::loncommon::end_data_table_row());
+ }
+ $r->print(&Apache::loncommon::end_data_table().' ');
+ return;
+}
+
sub tool_changes {
my ($context,$usertools,$oldaccess,$oldaccesstext,$userenv,$changeHash,
$changed,$newaccess,$newaccesstext) = @_;
@@ -3494,8 +3498,8 @@ sub enroll_single_student {
$r->print(&mt('If the member is currently logged-in to LON-CAPA, the new role will be available when the member next logs in.'));
} else {
$r->print(&mt('If the student is currently logged-in to LON-CAPA, the new role will be available when the student next logs in.'));
- }
- $r->print('');
+ }
+ $r->print('');
}
} else {
$r->print(&mt('unable to enroll').": ".$enroll_result);
@@ -3621,7 +3625,7 @@ sub build_roles {
sub custom_role_editor {
my ($r) = @_;
my $action = $env{'form.customroleaction'};
- my $rolename;
+ my $rolename;
if ($action eq 'new') {
$rolename=$env{'form.newrolename'};
} else {
@@ -3658,7 +3662,7 @@ sub custom_role_editor {
# ------------------------------------------------- Get current role privileges
($syspriv,$dompriv,$coursepriv)=split(/\_/,$roledef);
if ($crstype eq 'Community') {
- $syspriv =~ s/bre\&S//;
+ $syspriv =~ s/bre\&S//;
}
} else {
$body_top .= &mt('New Role').' "';
@@ -3699,8 +3703,8 @@ sub custom_role_editor {
my ($jsback,$elements) = &crumb_utilities();
my $button_code = "\n";
my $head_script = "\n";
- $head_script .= ''."\n";
+
+ $head_script .= "\n".$jsback."\n"
+ .'// ]]>'."\n"
+ .''."\n";
$r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));
- &Apache::lonhtmlcommon::add_breadcrumb
+ &Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:backPage(document.form1,'pickrole','')",
text=>"Pick custom role",
faq=>282,bug=>'Instructor Interface',},
@@ -3765,6 +3770,7 @@ sub custom_role_editor {
'dml' => "Domain Level",
'ssl' => "System Level");
+
$r->print('
'
.'');
- return;
+ return ($nav_script,$nav_links);
}
sub role_display_filter {
@@ -5324,9 +5470,13 @@ sub role_display_filter {
$curr->{'rolelog_end_date'},undef,
undef,undef,undef,undef,undef,undef,$nolink);
my %lt = &rolechg_contexts($crstype);
- $output .= '
'.&mt('Window during which changes occurred:').'
'.&mt('After:').
- '
'.$startform.'
'.&mt('Before:').'
'.
- $endform.'
'.
+ $output .= '
'.&mt('Window during which changes occurred:').' '.
+ '