version 1.329.2.3, 2010/08/09 23:39:43
|
version 1.329.2.4, 2010/09/19 16:44:44
|
Line 472 sub print_username_entry_form {
|
Line 472 sub print_username_entry_form {
|
my ($r,$context,$response,$srch,$forcenewuser,$crstype) = @_; |
my ($r,$context,$response,$srch,$forcenewuser,$crstype) = @_; |
my $defdom=$env{'request.role.domain'}; |
my $defdom=$env{'request.role.domain'}; |
my $formtoset = 'crtuser'; |
my $formtoset = 'crtuser'; |
|
my $is_custom = &Apache::loncommon::needs_gci_custom(); |
if (exists($env{'form.startrolename'})) { |
if (exists($env{'form.startrolename'})) { |
$formtoset = 'docustom'; |
$formtoset = 'docustom'; |
$env{'form.rolename'} = $env{'form.startrolename'}; |
$env{'form.rolename'} = $env{'form.startrolename'}; |
Line 499 sub print_username_entry_form {
|
Line 500 sub print_username_entry_form {
|
my %breadcrumb_text = &singleuser_breadcrumb($crstype); |
my %breadcrumb_text = &singleuser_breadcrumb($crstype); |
my $title = 'User Management'; |
my $title = 'User Management'; |
if ($context eq 'course') { |
if ($context eq 'course') { |
if (&Apache::loncommon::needs_gci_custom()) { |
if ($is_custom) { |
$title = 'Enrollment and Student Activity'; |
$title = 'Enrollment and Student Activity'; |
} |
} |
} |
} |
Line 666 $userpicker
|
Line 667 $userpicker
|
ENDBLOCK |
ENDBLOCK |
if ($env{'form.phase'} eq '') { |
if ($env{'form.phase'} eq '') { |
my $defdom=$env{'request.role.domain'}; |
my $defdom=$env{'request.role.domain'}; |
my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain'); |
my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain','',1); |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'enro' => 'Enroll one student', |
'enro' => 'Enroll one student', |
'enrm' => 'Enroll one member', |
'enrm' => 'Enroll one member', |
Line 715 $showresponse
|
Line 716 $showresponse
|
<table> |
<table> |
<tr> |
<tr> |
<td>$lt{'usr'}:</td> |
<td>$lt{'usr'}:</td> |
<td><input type="text" size="15" name="srchterm" /></td> |
<td><input type="text" size="25" name="srchterm" /></td> |
<td> $lt{'dom'}:</td><td>$domform</td> |
<td> $lt{'dom'}:</td><td>$domform</td> |
<td> $sellink </td> |
<td> $sellink </td> |
<td> <input name="userrole" type="submit" value="$buttontext" /></td> |
<td> <input name="userrole" type="submit" value="$buttontext" /></td> |
Line 760 sub print_user_selection_page {
|
Line 761 sub print_user_selection_page {
|
my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype) = @_; |
my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype) = @_; |
my @fields = ('username','domain','lastname','firstname','permanentemail'); |
my @fields = ('username','domain','lastname','firstname','permanentemail'); |
my $sortby = $env{'form.sortby'}; |
my $sortby = $env{'form.sortby'}; |
|
my $is_custom = &Apache::loncommon::needs_gci_custom(); |
|
|
if (!grep(/^\Q$sortby\E$/,@fields)) { |
if (!grep(/^\Q$sortby\E$/,@fields)) { |
$sortby = 'lastname'; |
$sortby = 'lastname'; |
Line 800 ENDSCRIPT
|
Line 802 ENDSCRIPT
|
} else { |
} else { |
my $title = 'User Management'; |
my $title = 'User Management'; |
if ($context eq 'course') { |
if ($context eq 'course') { |
if (&Apache::loncommon::needs_gci_custom()) { |
if ($is_custom) { |
$title = 'Enrollment and Student Activity'; |
$title = 'Enrollment and Student Activity'; |
} |
} |
} |
} |
Line 930 sub print_user_modification_page {
|
Line 932 sub print_user_modification_page {
|
my %abv_auth = &auth_abbrev(); |
my %abv_auth = &auth_abbrev(); |
my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules); |
my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules); |
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); |
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); |
|
my $is_custom = &Apache::loncommon::needs_gci_custom(); |
|
if ($is_custom) { |
|
if ($uhome eq 'no_host') { |
|
my $lc_ccuname = lc($ccuname); |
|
if ($lc_ccuname ne $ccuname) { |
|
$uhome = &Apache::lonnet::homeserver($lc_ccuname,$ccdomain); |
|
$ccuname = $lc_ccuname; |
|
} |
|
} |
|
} |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
my $usertype; |
|
my ($rules,$ruleorder) = |
my ($rules,$ruleorder) = |
&Apache::lonnet::inst_userrules($ccdomain,'username'); |
&Apache::lonnet::inst_userrules($ccdomain,'username'); |
$usertype = |
my $usertype = |
&Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules); |
&Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules); |
my $cancreate = |
my $cancreate = |
&Apache::lonuserutils::can_create_user($ccdomain,$context, |
&Apache::lonuserutils::can_create_user($ccdomain,$context, |
$usertype); |
$usertype); |
Line 945 sub print_user_modification_page {
|
Line 956 sub print_user_modification_page {
|
official => 'institutional', |
official => 'institutional', |
unofficial => 'non-institutional', |
unofficial => 'non-institutional', |
); |
); |
|
if ($ccdomain eq 'gci') { |
|
$usertypetext{'unofficial'} = 'institutional', |
|
} |
my $response; |
my $response; |
if ($env{'form.origform'} eq 'crtusername') { |
if ($env{'form.origform'} eq 'crtusername') { |
$response = '<span class="LC_warning">'.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain). |
if ($is_custom) { |
'</span><br />'; |
$response = '<span class="LC_warning">'.&mt('Invalid format for username for new user: [_1]','<b>'.$ccuname.'</b>'). |
|
'</span><br />'; |
|
} else { |
|
$response = '<span class="LC_warning">'.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain).'</span><br />'; |
|
} |
} |
} |
$response .= '<p class="LC_warning">' |
$response .= '<p class="LC_warning">' |
.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.") |
.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.") |
.' ' |
.'<br />'; |
.&mt('Please contact the [_1]helpdesk[_2] for assistance.' |
if ($ccdomain eq 'gcitest') { |
,'<a href="'.$helplink.'">','</a>') |
$response .= &mt('Enter a valid e-mail address as the username for the new user.').' '.&mt('Please contact the [_1]helpdesk[_2] for assistance.' |
.'</p><br />'; |
,'<a href="'.$helplink.'">','</a>') |
|
.'</p><br />'; |
|
} |
$env{'form.phase'} = ''; |
$env{'form.phase'} = ''; |
&print_username_entry_form($r,$context,$response,undef,undef,$crstype); |
&print_username_entry_form($r,$context,$response,undef,undef,$crstype); |
return; |
return; |
Line 1008 sub print_user_modification_page {
|
Line 1028 sub print_user_modification_page {
|
} |
} |
my $title = 'User Management'; |
my $title = 'User Management'; |
if ($context eq 'course') { |
if ($context eq 'course') { |
if (&Apache::loncommon::needs_gci_custom()) { |
if ($is_custom) { |
$title = 'Enrollment and Student Activity'; |
$title = 'Enrollment and Student Activity'; |
} |
} |
} |
} |
Line 2169 sub get_inststatuses {
|
Line 2189 sub get_inststatuses {
|
|
|
# ================================================================= Phase Three |
# ================================================================= Phase Three |
sub update_user_data { |
sub update_user_data { |
my ($r,$context,$crstype) = @_; |
my ($r,$context,$crstype) = @_; |
|
my $is_custom = &Apache::loncommon::needs_gci_custom(); |
my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'}, |
my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'}, |
$env{'form.ccdomain'}); |
$env{'form.ccdomain'}); |
# Error messages |
# Error messages |
Line 2224 sub update_user_data {
|
Line 2245 sub update_user_data {
|
} |
} |
my $title = 'User Management'; |
my $title = 'User Management'; |
if ($context eq 'course') { |
if ($context eq 'course') { |
if (&Apache::loncommon::needs_gci_custom()) { |
if ($is_custom) { |
$title = 'Enrollment and Student Activity'; |
$title = 'Enrollment and Student Activity'; |
} |
} |
} |
} |
Line 2719 sub update_user_data {
|
Line 2740 sub update_user_data {
|
$changeHash{'tools.'.$key}; |
$changeHash{'tools.'.$key}; |
} else { |
} else { |
$newenvhash{'environment.availabletools.'.$key} = |
$newenvhash{'environment.availabletools.'.$key} = |
&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'}, $key,'reload','tools'); |
&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'}, |
|
$key,'reload','tools'); |
} |
} |
} |
} |
} |
} |
Line 3655 sub custom_role_editor {
|
Line 3677 sub custom_role_editor {
|
$context = 'domain'; |
$context = 'domain'; |
$crstype = $env{'form.templatecrstype'}; |
$crstype = $env{'form.templatecrstype'}; |
} |
} |
|
my $is_custom = &Apache::loncommon::needs_gci_custom(); |
my $title = 'User Management'; |
my $title = 'User Management'; |
if ($context eq 'course') { |
if ($context eq 'course') { |
if (&Apache::loncommon::needs_gci_custom()) { |
if ($is_custom) { |
$title = 'Enrollment and Student Activity'; |
$title = 'Enrollment and Student Activity'; |
} |
} |
} |
} |
Line 3930 sub set_custom_role {
|
Line 3953 sub set_custom_role {
|
.'// ]]>'."\n" |
.'// ]]>'."\n" |
.'</script>'."\n"; |
.'</script>'."\n"; |
my $title = 'User Management'; |
my $title = 'User Management'; |
|
my $is_custom = &Apache::loncommon::needs_gci_custom(); |
if ($context eq 'course') { |
if ($context eq 'course') { |
if (&Apache::loncommon::needs_gci_custom()) { |
if ($is_custom) { |
$title = 'Enrollment and Student Activity'; |
$title = 'Enrollment and Student Activity'; |
} |
} |
} |
} |
Line 4025 sub handler {
|
Line 4049 sub handler {
|
$context = 'domain'; |
$context = 'domain'; |
} |
} |
my $title = 'User Management'; |
my $title = 'User Management'; |
|
my $is_custom = &Apache::loncommon::needs_gci_custom(); |
if ($context eq 'course') { |
if ($context eq 'course') { |
if (&Apache::loncommon::needs_gci_custom()) { |
if ($is_custom) { |
$title = 'Enrollment and Student Activity'; |
$title = 'Enrollment and Student Activity'; |
} |
} |
} |
} |
Line 4073 sub handler {
|
Line 4098 sub handler {
|
if (! exists($env{'form.state'})) { |
if (! exists($env{'form.state'})) { |
&Apache::lonuserutils::print_first_users_upload_form($r,$context); |
&Apache::lonuserutils::print_first_users_upload_form($r,$context); |
} elsif ($env{'form.state'} eq 'got_file') { |
} elsif ($env{'form.state'} eq 'got_file') { |
|
my $formname; |
|
if ($env{'form.caller'} eq 'requestcrs') { |
|
$formname = 'studentform'; |
|
} |
&Apache::lonuserutils::print_upload_manager_form($r,$context, |
&Apache::lonuserutils::print_upload_manager_form($r,$context, |
$permission,$crstype); |
$permission,$crstype,$formname); |
} elsif ($env{'form.state'} eq 'enrolling') { |
} elsif ($env{'form.state'} eq 'enrolling') { |
if ($env{'form.datatoken'}) { |
if ($env{'form.datatoken'}) { |
&Apache::lonuserutils::upfile_drop_add($r,$context,$permission); |
&Apache::lonuserutils::upfile_drop_add($r,$context,$permission); |
Line 4097 sub handler {
|
Line 4126 sub handler {
|
if ($env{'form.phase'} eq 'createnewuser') { |
if ($env{'form.phase'} eq 'createnewuser') { |
my $response; |
my $response; |
if ($env{'form.srchterm'} !~ /^$match_username$/) { |
if ($env{'form.srchterm'} !~ /^$match_username$/) { |
my $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'); |
my $response = '<p class="LC_warning">'.&mt('You must specify a valid username. Only the following are allowed: letters numbers - . @').'</p>'; |
$env{'form.phase'} = ''; |
$env{'form.phase'} = ''; |
&print_username_entry_form($r,$context,$response,$srch,undef,$crstype); |
&print_username_entry_form($r,$context,$response,$srch,undef,$crstype); |
} else { |
} else { |
Line 4359 END
|
Line 4388 END
|
# Menu Phase One |
# Menu Phase One |
sub print_main_menu { |
sub print_main_menu { |
my ($permission,$context,$crstype) = @_; |
my ($permission,$context,$crstype) = @_; |
if (($context eq 'course') && (&Apache::loncommon::needs_gci_custom())) { |
my $is_custom = &Apache::loncommon::needs_gci_custom(); |
|
if (($context eq 'course') && ($is_custom)) { |
return &print_gci_main_menu($permission,$context,$crstype) |
return &print_gci_main_menu($permission,$context,$crstype) |
} |
} |
my $linkcontext = $context; |
my $linkcontext = $context; |
Line 5673 sub user_search_result {
|
Line 5703 sub user_search_result {
|
if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) { |
if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) { |
if (($srch->{'srchdomain'} eq '') || |
if (($srch->{'srchdomain'} eq '') || |
! (&Apache::lonnet::domain($srch->{'srchdomain'}))) { |
! (&Apache::lonnet::domain($srch->{'srchdomain'}))) { |
$response = &mt('You must specify a valid domain when searching in a domain or institutional directory.') |
$response = '<p class="LC_warning">'.&mt('You must specify a valid domain when searching in a domain or institutional directory.').'</p>'; |
} |
} |
} |
} |
if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') || |
if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') || |
Line 5686 sub user_search_result {
|
Line 5716 sub user_search_result {
|
} |
} |
} |
} |
if ($unamecheck !~ /^$match_username$/) { |
if ($unamecheck !~ /^$match_username$/) { |
$response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'); |
$response = '<p class="LC_warning">'.&mt('You must specify a valid username. Only the following are allowed: letters numbers - . @').'</p>'; |
} |
} |
} |
} |
} |
} |
Line 5861 sub user_search_result {
|
Line 5891 sub user_search_result {
|
($currstate,$response,$forcenewuser) = |
($currstate,$response,$forcenewuser) = |
&build_search_response($context,$srch,%srch_results); |
&build_search_response($context,$srch,%srch_results); |
} else { |
} else { |
my $showdom = &display_domain_info($srch->{'srchdomain'}); $response = '<span class="LC_warning">'. |
my $showdom = &display_domain_info($srch->{'srchdomain'}); |
|
$response = '<span class="LC_warning">'. |
&mt('Institutional directory search is not available in domain: [_1]',$showdom). |
&mt('Institutional directory search is not available in domain: [_1]',$showdom). |
'</span><br />'. |
'</span><br />'. |
&mt('You may want to search in the LON-CAPA domain instead of the institutional directory.'). |
&mt('You may want to search in the LON-CAPA domain instead of the institutional directory.'). |