--- loncom/interface/loncreateuser.pm 2010/01/20 14:59:27 1.295.2.29
+++ loncom/interface/loncreateuser.pm 2009/12/29 20:00:26 1.331
@@ -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.331 2009/12/29 20:00:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -219,7 +219,7 @@ END_SCRIPT
sub build_tools_display {
my ($ccuname,$ccdomain,$context) = @_;
my (@usertools,%userenv,$output,@options,%validations,%reqtitles,%reqdisplay,
- $colspan,$isadv,%domconfig);
+ $colspan);
my %lt = &Apache::lonlocal::texthash (
'blog' => "Personal User Blog",
'aboutme' => "Personal Information Page",
@@ -243,9 +243,6 @@ sub build_tools_display {
%reqtitles = &courserequest_titles();
%reqdisplay = &courserequest_display();
$colspan = ' colspan="2"';
- %domconfig =
- &Apache::lonnet::get_dom('configuration',['requestcourses'],$ccdomain);
- $isadv = &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);
} else {
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
'tools.aboutme','tools.portfolio','tools.blog');
@@ -292,14 +289,7 @@ sub build_tools_display {
&Apache::loncommon::start_data_table_row()."\n";
if ($context eq 'requestcourses') {
my ($curroption,$currlimit);
- if ($userenv{$context.'.'.$item} ne '') {
- $curroption = $userenv{$context.'.'.$item};
- } else {
- my (@inststatuses);
- $curroption =
- &Apache::loncoursequeueadmin::get_processtype($ccuname,$ccdomain,$isadv,$ccdomain,
- $item,\@inststatuses,\%domconfig);
- }
+ $curroption = $userenv{$context.'.'.$item};
if (!$curroption) {
$curroption = 'norequest';
}
@@ -531,7 +521,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 +675,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 +935,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 +1043,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 +1418,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)) {
@@ -1498,9 +1487,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 +1513,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 +1529,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 +1542,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))) &&
@@ -1619,7 +1607,7 @@ sub display_existing_roles {
'
'.$lt{'del'}.
@@ -2285,7 +2274,7 @@ sub update_user_data {
$env{'form.ccuname'}, $env{'form.ccdomain'}).'');
my (%alerts,%rulematch,%inst_results,%curr_rules);
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'});
if ($env{'form.makeuser'}) {
@@ -2691,7 +2680,7 @@ sub update_user_data {
$newenvhash{'environment.requestcourses.'.$key} =
$changeHash{'requestcourses.'.$key};
if ($changeHash{'requestcourses.'.$key} ne '') {
- $newenvhash{'environment.canrequest.'.$key} = 1;
+ $newenvhash{'environment.canrequest.'.$key} = 1
} else {
$newenvhash{'environment.canrequest.'.$key} =
&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
@@ -3494,8 +3483,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 +3610,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 +3647,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 +3688,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 +3755,7 @@ sub custom_role_editor {
'dml' => "Domain Level",
'ssl' => "System Level");
+
$r->print('