--- loncom/interface/loncreateuser.pm 2009/10/26 15:54:34 1.317
+++ loncom/interface/loncreateuser.pm 2009/10/30 03:51:15 1.318
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.317 2009/10/26 15:54:34 bisitz Exp $
+# $Id: loncreateuser.pm,v 1.318 2009/10/30 03:51:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -468,7 +468,7 @@ sub courserequest_display {
# =================================================================== Phase one
sub print_username_entry_form {
- my ($r,$context,$response,$srch,$forcenewuser) = @_;
+ my ($r,$context,$response,$srch,$forcenewuser,$crstype) = @_;
my $defdom=$env{'request.role.domain'};
my $formtoset = 'crtuser';
if (exists($env{'form.startrolename'})) {
@@ -490,7 +490,7 @@ sub print_username_entry_form {
my %loaditems = (
'onload' => "javascript:setFormElements(document.$formtoset)",
);
- my %breadcrumb_text = &singleuser_breadcrumb();
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype);
my $start_page =
&Apache::loncommon::start_page('User Management',
$jscript,{'add_entries' => \%loaditems,});
@@ -517,6 +517,7 @@ sub print_username_entry_form {
('make new role' => 'Generate new role ...',%existingroles));
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",
@@ -540,20 +541,24 @@ ENDCUSTOM
} else {
my $actiontext = $lt{'srad'};
if ($env{'form.action'} eq 'singlestudent') {
- $actiontext = $lt{'srst'};
+ if ($crstype eq 'Community') {
+ $actiontext = $lt{'srme'};
+ } else {
+ $actiontext = $lt{'srst'};
+ }
}
$r->print("
$actiontext
");
if ($env{'form.origform'} ne 'crtusername') {
$r->print("\n".$response);
}
- $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response));
+ $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype));
}
$r->print(&Apache::loncommon::end_page());
}
sub entry_form {
- my ($dom,$srch,$forcenewuser,$context,$responsemsg) = @_;
+ my ($dom,$srch,$forcenewuser,$context,$responsemsg,$crstype) = @_;
my %domconf = &Apache::lonnet::get_dom('configuration',['usercreation'],$dom);
my ($usertype,$inexact);
if (ref($srch) eq 'HASH') {
@@ -593,6 +598,7 @@ ENDBLOCK
my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain');
my %lt=&Apache::lonlocal::texthash(
'enro' => 'Enroll one student',
+ 'enrm' => 'Enroll one member',
'admo' => 'Add/modify a single user',
'crea' => 'create new user if required',
'uskn' => "username is known",
@@ -604,8 +610,12 @@ ENDBLOCK
);
my $sellink=&Apache::loncommon::selectstudent_link('crtusername','srchterm','srchdomain');
my ($title,$buttontext,$showresponse);
- if ($env{'form.action'} eq 'singlestudent') {
- $title = $lt{'enro'};
+ if ($env{'form.action'} eq 'singlestudent') {
+ if ($crstype eq 'Community') {
+ $title = $lt{'enrm'};
+ } else {
+ $title = $lt{'enro'};
+ }
$buttontext = $lt{'enrl'};
} else {
$title = $lt{'admo'};
@@ -676,7 +686,7 @@ END
# =================================================================== Phase two
sub print_user_selection_page {
- my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements) = @_;
+ my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype) = @_;
my @fields = ('username','domain','lastname','firstname','permanentemail');
my $sortby = $env{'form.sortby'};
@@ -704,8 +714,10 @@ ENDSCRIPT
my %lt=&Apache::lonlocal::texthash(
'usrch' => "User Search to add/modify roles",
'stusrch' => "User Search to enroll student",
+ 'memsrch' => "User Search to enroll member",
'usel' => "Select a user to add/modify roles",
- 'stusel' => "Select a user to enroll as a student",
+ 'stusel' => "Select a user to enroll as a student",
+ 'memsel' => "Select a user to enroll as a member",
'username' => "username",
'domain' => "domain",
'lastname' => "last name",
@@ -717,7 +729,7 @@ ENDSCRIPT
} else {
$r->print(&Apache::loncommon::start_page('User Management',$jscript));
- my %breadcrumb_text = &singleuser_breadcrumb();
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype);
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:backPage(document.usersrchform,'','')",
text=>$breadcrumb_text{'search'},
@@ -729,14 +741,26 @@ ENDSCRIPT
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
'Course_Change_Privileges'));
$r->print("$lt{'usrch'}
");
- $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context));
+ $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));
$r->print(''.$lt{'usel'}.'
');
} elsif ($env{'form.action'} eq 'singlestudent') {
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
'Course_Add_Student'));
- $r->print($jscript."$lt{'stusrch'}
");
- $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context));
- $r->print(''.$lt{'stusel'}.'
');
+ $r->print($jscript."");
+ if ($crstype eq 'Community') {
+ $r->print($lt{'memsrch'});
+ } else {
+ $r->print($lt{'stusrch'});
+ }
+ $r->print("
");
+ $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));
+ $r->print('');
+ if ($crstype eq 'Community') {
+ $r->print($lt{'memsel'});
+ } else {
+ $r->print($lt{'stusel'});
+ }
+ $r->print('
');
}
}
$r->print('