');
+ } else {
+ $r->print($response.''.&Apache::loncommon::end_page());
+ }
}
sub print_user_query_page {
@@ -546,7 +820,7 @@ sub print_user_modification_page {
&Apache::lonuserutils::can_create_user($ccdomain,$context,
$usertype);
if (!$cancreate) {
- my $helplink = ' href="javascript:helpMenu('."'display'".')"';
+ my $helplink = 'javascript:helpMenu('."'display'".')';
my %usertypetext = (
official => 'institutional',
unofficial => 'non-institutional',
@@ -556,7 +830,12 @@ sub print_user_modification_page {
$response = ''.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain).
' ';
}
- $response .= ''.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.").' '.&mt('Contact the helpdesk for assistance.',$helplink).'
';
+ $response .= '
'
+ .&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")
+ .' '
+ .&mt('Please contact the [_1]helpdesk[_2] for assistance.'
+ ,'','')
+ .'
';
$env{'form.phase'} = '';
&print_username_entry_form($r,$context,$response);
return;
@@ -649,8 +928,9 @@ ENDFORMINFO
}
if ($newuser) {
my $portfolioform;
- if (&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) {
- # Current user has quota modification privileges
+ if ((&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) ||
+ (&Apache::lonnet::allowed('mut',$env{'request.role.domain'}))) {
+ # Current user has quota or user tools modification privileges
$portfolioform = ' '.&portfolio_quota($ccuname,$ccdomain);
}
&initialize_authen_forms($ccdomain,$formname);
@@ -667,7 +947,9 @@ $crumbs
$response
$forminfo
');
my $user_auth_text = &user_authentication($ccuname,$ccdomain,$formname);
- my $user_quota_text;
- if (&Apache::lonnet::allowed('mpq',$ccdomain)) {
+ my ($user_quota_text,$user_tools_text,$user_reqcrs_text);
+ if ((&Apache::lonnet::allowed('mpq',$ccdomain)) ||
+ (&Apache::lonnet::allowed('mut',$ccdomain))) {
# Current user has quota modification privileges
$user_quota_text = &portfolio_quota($ccuname,$ccdomain);
- } elsif (&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) {
- # Get the user's portfolio information
- my %portq = &Apache::lonnet::get('environment',['portfolioquota'],
- $ccdomain,$ccuname);
-
- my %lt=&Apache::lonlocal::texthash(
- 'dska' => "Disk space allocated to user's portfolio files",
- 'youd' => "You do not have privileges to modify the portfolio quota for this user.",
- 'ichr' => "If a change is required, contact a domain coordinator for the domain",
- );
- $user_quota_text = < "Disk space allocated to user's portfolio files",
+ 'youd' => "You do not have privileges to modify the portfolio quota for this user.",
+ 'ichr' => "If a change is required, contact a domain coordinator for the domain",
+ );
+ $user_quota_text = <$lt{'dska'}
$lt{'youd'} $lt{'ichr'}: $ccdomain
ENDNOPORTPRIV
+ }
+ }
+ if (!&Apache::lonnet::allowed('mut',$ccdomain)) {
+ if (&Apache::lonnet::allowed('mut',$env{'request.role.domain'})) {
+ my %lt=&Apache::lonlocal::texthash(
+ 'utav' => "User Tools Availability",
+ 'yodo' => "You do not have privileges to modify Portfolio, Blog or Personal Information Page settings for this user.",
+ 'ifch' => "If a change is required, contact a domain coordinator for the domain",
+ );
+ $user_tools_text = <$lt{'utav'}
+$lt{'yodo'} $lt{'ifch'}: $ccdomain
+ENDNOTOOLSPRIV
+ }
}
if ($user_auth_text ne '') {
$r->print('
'.$user_auth_text);
if ($user_quota_text ne '') {
$r->print($user_quota_text);
}
+ if ($user_tools_text ne '') {
+ $r->print($user_tools_text);
+ }
if ($env{'form.action'} eq 'singlestudent') {
$r->print(&date_sections_select($context,$newuser,$formname));
}
} elsif ($user_quota_text ne '') {
$r->print('
'.$user_quota_text);
+ if ($user_tools_text ne '') {
+ $r->print($user_tools_text);
+ }
+ if ($env{'form.action'} eq 'singlestudent') {
+ $r->print(&date_sections_select($context,$newuser,$formname));
+ }
+ } elsif ($user_tools_text ne '') {
+ $r->print('
'.$user_tools_text);
if ($env{'form.action'} eq 'singlestudent') {
$r->print(&date_sections_select($context,$newuser,$formname));
}
@@ -820,7 +1155,7 @@ ENDNOPORTPRIV
} ## End of new user/old user logic
if ($env{'form.action'} eq 'singlestudent') {
- $r->print(' '."\n");
+ $r->print(' '."\n");
} else {
$r->print('
';
+ }
+ return $output;
+}
+
sub selfcreate_canmodify {
my ($context,$dom,$userinfo,$inst_results,$rolesarray) = @_;
if (ref($inst_results) eq 'HASH') {
@@ -1546,7 +1972,10 @@ sub update_user_data {
my $newuser = 0;
my ($jsback,$elements) = &crumb_utilities();
my $jscript = ''."\n";
+ '// '."\n".
+ ''."\n";
my %breadcrumb_text = &singleuser_breadcrumb();
my $args;
if ($env{'form.popup'}) {
@@ -1586,8 +2015,8 @@ sub update_user_data {
}
if ( $env{'form.ccuname'} ne
&LONCAPA::clean_username($env{'form.ccuname'}) ) {
- $r->print($error.&mt('Invalid login name').'. '.
- &mt('Only letters, numbers, periods, dashes, @, and underscores are valid').'.'.
+ $r->print($error.&mt('Invalid login name.').' '.
+ &mt('Only letters, numbers, periods, dashes, @, and underscores are valid.').
$end.$rtnlink);
return;
}
@@ -1597,8 +2026,8 @@ sub update_user_data {
}
if ( $env{'form.ccdomain'} ne
&LONCAPA::clean_domain($env{'form.ccdomain'}) ) {
- $r->print($error.&mt ('Invalid domain name').'. '.
- &mt('Only letters, numbers, periods, dashes, and underscores are valid').'.'.
+ $r->print($error.&mt('Invalid domain name.').' '.
+ &mt('Only letters, numbers, periods, dashes, and underscores are valid.').
$end.$rtnlink);
return;
}
@@ -1645,6 +2074,10 @@ sub update_user_data {
$r->print('
'.&mt('User [_1] in domain [_2]',
$env{'form.ccuname'}, $env{'form.ccdomain'}).'
');
my (%alerts,%rulematch,%inst_results,%curr_rules);
+ my @usertools = ('aboutme','blog','portfolio');
+ my @requestcourses = ('official','unofficial');
+ my ($othertitle,$usertypes,$types) =
+ &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});
if ($env{'form.makeuser'}) {
$r->print('
'.&mt('Creating new account.').'
');
# Check for the authentication mode and password
@@ -1704,26 +2137,53 @@ sub update_user_data {
$r->print(&mt('Generating user').': '.$result);
$uhome = &Apache::lonnet::homeserver($env{'form.ccuname'},
$env{'form.ccdomain'});
- if (($uhome ne 'no_host') && ($env{'form.customquota'} == 1)) {
- my (%changeHash,$newportfolioquota);
- if ($env{'form.portfolioquota'} eq '') {
- $newportfolioquota = 0;
- } else {
- $newportfolioquota = $env{'form.portfolioquota'};
- $newportfolioquota =~ s/[^\d\.]//g;
+ my (%changeHash,%newcustom,%changed);
+ if ($uhome ne 'no_host') {
+ if ($env{'form.customquota'} == 1) {
+ if ($env{'form.portfolioquota'} eq '') {
+ $newcustom{'quota'} = 0;
+ } else {
+ $newcustom{'quota'} = $env{'form.portfolioquota'};
+ $newcustom{'quota'} =~ s/[^\d\.]//g;
+ }
+ $changed{'quota'} = "a_admin($newcustom{'quota'},\%changeHash);
+ }
+ foreach my $item (@usertools) {
+ if ($env{'form.custom'.$item} == 1) {
+ $newcustom{$item} = $env{'form.tools_'.$item};
+ $changed{$item} = &tool_admin($item,$newcustom{$item},
+ \%changeHash,'tools');
+ }
}
- my $quotachanged = "a_admin($newportfolioquota,\%changeHash);
- if ($quotachanged) {
+ foreach my $item (@requestcourses) {
+ $newcustom{$item} = $env{'form.crsreq_'.$item};
+ if ($env{'form.crsreq_'.$item} eq 'autolimit') {
+ $newcustom{$item} .= '=';
+ unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) {
+ $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'};
+ }
+ }
+ $changed{$item} = &tool_admin($item,$newcustom{$item},
+ \%changeHash,'requestcourses');
+ }
+ if (exists($env{'form.inststatus'})) {
+ my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
+ if (@inststatuses > 0) {
+ $changeHash{'inststatus'} = join(',',@inststatuses);
+ $changed{'inststatus'} = $changeHash{'inststatus'};
+ }
+ }
+ if (keys(%changed)) {
$changeHash{'firstname'} = $env{'form.cfirstname'};
$changeHash{'middlename'} = $env{'form.cmiddlename'};
$changeHash{'lastname'} = $env{'form.clastname'};
$changeHash{'generation'} = $env{'form.cgeneration'};
$changeHash{'id'} = $env{'form.cid'};
$changeHash{'permanentemail'} = $env{'form.cpermanentemail'};
- my $quotachgresult =
- &Apache::lonnet::put('environment',\%changeHash,
- $env{'form.ccdomain'},$env{'form.ccuname'});
- }
+ my $chgresult =
+ &Apache::lonnet::put('environment',\%changeHash,
+ $env{'form.ccdomain'},$env{'form.ccuname'});
+ }
}
$r->print(' '.&mt('Home server').': '.$uhome.' '.
&Apache::lonnet::hostname($uhome));
@@ -1756,7 +2216,11 @@ sub update_user_data {
# Check for need to change
my %userenv = &Apache::lonnet::get
('environment',['firstname','middlename','lastname','generation',
- 'id','permanentemail','portfolioquota','inststatus'],
+ 'id','permanentemail','portfolioquota','inststatus','tools.aboutme',
+ 'tools.blog','tools.portfolio','requestcourses.official',
+ 'requestcourses.unofficial','requestcourses.community',
+ 'reqcrsotherdom.official','reqcrsotherdom.unofficial',
+ 'reqcrsotherdom.community'],
$env{'form.ccdomain'},$env{'form.ccuname'});
my ($tmp) = keys(%userenv);
if ($tmp =~ /^(con_lost|error)/i) {
@@ -1858,10 +2322,10 @@ sub update_user_data {
(!$forceid)) {
if ($env{'form.cid'} ne $uidhash{$env{'form.ccuname'}}) {
$env{'form.cid'} = $userenv{'id'};
- $no_forceid_alert = &mt('New Student/Employee ID does not match existing ID for this user.')
- .' '
- .&mt("Change is not permitted without checking the 'Force ID change' checkbox on the previous page.")
- .' '."\n";
+ $no_forceid_alert = &mt('New student/employee ID does not match existing ID for this user.')
+ .' '
+ .&mt("Change is not permitted without checking the 'Force ID change' checkbox on the previous page.")
+ .' '."\n";
}
}
if ($env{'form.cid'} ne $userenv{'id'}) {
@@ -1879,16 +2343,64 @@ sub update_user_data {
}
}
}
- my ($quotachanged,$oldportfolioquota,$newportfolioquota,
- $inststatus,$oldisdefault,$newisdefault,$olddefquotatext,
- $newdefquotatext);
+ my ($quotachanged,$oldportfolioquota,$newportfolioquota,$oldinststatus,
+ $inststatus,$newinststatus,$oldisdefault,$newisdefault,$olddefquotatext,
+ $newdefquotatext,%oldaccess,%oldaccesstext,%newaccess,%newaccesstext,
+ $oldinststatuses,$newinststatuses);
my ($defquota,$settingstatus) =
&Apache::loncommon::default_quota($env{'form.ccdomain'},$inststatus);
- my $showquota;
+ my ($showquota,$showtools,$showrequestcourses,$showinststatus,$showreqotherdom);
if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
$showquota = 1;
}
- my %changeHash;
+ if (&Apache::lonnet::allowed('mut',$env{'form.ccdomain'})) {
+ $showtools = 1;
+ }
+ if (&Apache::lonnet::allowed('ccc',$env{'form.ccdomain'})) {
+ $showrequestcourses = 1;
+ } elsif (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
+ $showreqotherdom = 1;
+ }
+ if (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'})) {
+ $showinststatus = 1;
+ }
+ my (%changeHash,%changed);
+ $oldinststatus = $userenv{'inststatus'};
+ if ($oldinststatus eq '') {
+ $oldinststatuses = $othertitle;
+ } else {
+ if (ref($usertypes) eq 'HASH') {
+ $oldinststatuses = join(', ',map{ $usertypes->{ &unescape($_) }; } (split(/:/,$userenv{'inststatus'})));
+ } else {
+ $oldinststatuses = join(', ',map{ &unescape($_); } (split(/:/,$userenv{'inststatus'})));
+ }
+ }
+ $changeHash{'inststatus'} = $userenv{'inststatus'};
+ my %canmodify_inststatus = &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},['inststatus'],\@userroles);
+ if ($canmodify_inststatus{'inststatus'}) {
+ if (exists($env{'form.inststatus'})) {
+ my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
+ if (@inststatuses > 0) {
+ $newinststatus = join(':',map { &escape($_); } @inststatuses);
+ $changeHash{'inststatus'} = $newinststatus;
+ if ($newinststatus ne $oldinststatus) {
+ $changed{'inststatus'} = $newinststatus;
+ }
+ if (ref($usertypes) eq 'HASH') {
+ $newinststatuses = join(', ',map{ $usertypes->{$_}; } (@inststatuses));
+ } else {
+ $newinststatuses = join(', ',map{ $usertypes->{$_}; } (@inststatuses));
+ }
+ } else {
+ $newinststatus = '';
+ $changeHash{'inststatus'} = $newinststatus;
+ $newinststatuses = $othertitle;
+ if ($newinststatus ne $oldinststatus) {
+ $changed{'inststatus'} = $changeHash{'inststatus'};
+ }
+ }
+ }
+ }
$changeHash{'portfolioquota'} = $userenv{'portfolioquota'};
if ($userenv{'portfolioquota'} ne '') {
$oldportfolioquota = $userenv{'portfolioquota'};
@@ -1900,12 +2412,12 @@ sub update_user_data {
$newportfolioquota =~ s/[^\d\.]//g;
}
if ($newportfolioquota != $oldportfolioquota) {
- $quotachanged = "a_admin($newportfolioquota,\%changeHash);
+ $changed{'quota'} = "a_admin($newportfolioquota,\%changeHash);
}
} else {
- $quotachanged = "a_admin('',\%changeHash);
+ $changed{'quota'} = "a_admin('',\%changeHash);
$newportfolioquota = $defquota;
- $newisdefault = 1;
+ $newisdefault = 1;
}
} else {
$oldisdefault = 1;
@@ -1917,7 +2429,7 @@ sub update_user_data {
$newportfolioquota = $env{'form.portfolioquota'};
$newportfolioquota =~ s/[^\d\.]//g;
}
- $quotachanged = "a_admin($newportfolioquota,\%changeHash);
+ $changed{'quota'} = "a_admin($newportfolioquota,\%changeHash);
} else {
$newportfolioquota = $defquota;
$newisdefault = 1;
@@ -1929,6 +2441,16 @@ sub update_user_data {
if ($newisdefault) {
$newdefquotatext = &get_defaultquota_text($settingstatus);
}
+ &tool_changes('tools',\@usertools,\%oldaccess,\%oldaccesstext,\%userenv,
+ \%changeHash,\%changed,\%newaccess,\%newaccesstext);
+
+ if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) {
+ &tool_changes('requestcourses',\@requestcourses,\%oldaccess,\%oldaccesstext,
+ \%userenv,\%changeHash,\%changed,\%newaccess,\%newaccesstext);
+ } else {
+ &tool_changes('reqcrsotherdom',\@requestcourses,\%oldaccess,\%oldaccesstext,
+ \%userenv,\%changeHash,\%changed,\%newaccess,\%newaccesstext);
+ }
if ($env{'form.cfirstname'} ne $userenv{'firstname'} ||
$env{'form.cmiddlename'} ne $userenv{'middlename'} ||
$env{'form.clastname'} ne $userenv{'lastname'} ||
@@ -1937,18 +2459,51 @@ sub update_user_data {
$env{'form.cpermanentemail'} ne $userenv{'permanentemail'} ) {
$namechanged = 1;
}
- if ($namechanged || $quotachanged) {
+ if (($namechanged) || (keys(%changed) > 0)) {
$changeHash{'firstname'} = $env{'form.cfirstname'};
$changeHash{'middlename'} = $env{'form.cmiddlename'};
$changeHash{'lastname'} = $env{'form.clastname'};
$changeHash{'generation'} = $env{'form.cgeneration'};
$changeHash{'id'} = $env{'form.cid'};
$changeHash{'permanentemail'} = $env{'form.cpermanentemail'};
- my ($quotachgresult,$namechgresult);
- if ($quotachanged) {
- $quotachgresult =
+ my ($chgresult,$namechgresult);
+ if (keys(%changed) > 0) {
+ $chgresult =
&Apache::lonnet::put('environment',\%changeHash,
$env{'form.ccdomain'},$env{'form.ccuname'});
+ if ($chgresult eq 'ok') {
+ if (($env{'user.name'} eq $env{'form.ccuname'}) &&
+ ($env{'user.domain'} eq $env{'form.ccdomain'})) {
+ my %newenvhash;
+ foreach my $key (keys(%changed)) {
+ if (($key eq 'official') || ($key eq 'unofficial')) {
+ $newenvhash{'environment.requestcourses.'.$key} =
+ $changeHash{'requestcourses.'.$key};
+ if ($changeHash{'requestcourses.'.$key} ne '') {
+ $newenvhash{'environment.canrequest.'.$key} =
+ $changeHash{'requestcourses.'.$key};
+ } else {
+ $newenvhash{'environment.canrequest.'.$key} =
+ &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
+ $key,'reload','requestcourses');
+ }
+ } elsif ($key ne 'quota') {
+ $newenvhash{'environment.tools.'.$key} =
+ $changeHash{'tools.'.$key};
+ if ($changeHash{'tools.'.$key} ne '') {
+ $newenvhash{'environment.availabletools.'.$key} =
+ $changeHash{'tools.'.$key};
+ } else {
+ $newenvhash{'environment.availabletools.'.$key} =
+ &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'}, $key,'reload','tools');
+ }
+ }
+ }
+ if (keys(%newenvhash)) {
+ &Apache::lonnet::appenv(\%newenvhash);
+ }
+ }
+ }
}
if ($namechanged) {
# Make the change
@@ -1967,19 +2522,25 @@ sub update_user_data {
);
}
if (($namechanged && $namechgresult eq 'ok') ||
- ($quotachanged && $quotachgresult eq 'ok')) {
+ ((keys(%changed) > 0) && $chgresult eq 'ok')) {
# Tell the user we changed the name
my %lt=&Apache::lonlocal::texthash(
- 'uic' => "User Information Changed",
- 'frst' => "first",
- 'mddl' => "middle",
- 'lst' => "last",
- 'gen' => "generation",
- 'id' => "Student/Employee ID",
- 'mail' => "permanent e-mail",
- 'disk' => "disk space allocated to portfolio files",
- 'prvs' => "Previous",
- 'chto' => "Changed To"
+ 'uic' => 'User Information Changed',
+ 'frst' => 'First Name',
+ 'mddl' => 'Middle Name',
+ 'lst' => 'Last Name',
+ 'gen' => 'Generation',
+ 'id' => 'Student/Employee ID',
+ 'mail' => 'Permanent e-mail address',
+ 'disk' => 'Disk space allocated to portfolio files',
+ 'blog' => 'Blog Availability',
+ 'aboutme' => 'Personal Information Page Availability',
+ 'portfolio' => 'Portfolio Availability',
+ 'official' => 'Can Request Official Courses',
+ 'unofficial' => 'Can Request Unofficial Courses',
+ 'inststatus' => "Affiliation",
+ 'prvs' => 'Previous Value:',
+ 'chto' => 'Changed To:'
);
$r->print('
'.$lt{'uic'}.'
'.
&Apache::loncommon::start_data_table().
@@ -1993,10 +2554,31 @@ sub update_user_data {
$lt{'id'}
$lt{'mail'}
END
+ if ($showinststatus) {
+ $r->print("
+
$lt{'inststatus'}
\n");
+ }
+ if ($showrequestcourses) {
+ foreach my $item (@requestcourses) {
+ $r->print("
+
\n");
}
+ if ($showtools) {
+ foreach my $item (@usertools) {
+ $r->print("
+
$newaccess{$item} $newaccesstext{$item}
\n");
+ }
+ }
$r->print(&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().' ');
if ($env{'form.cid'} ne $userenv{'id'}) {
@@ -2055,12 +2679,19 @@ END
$env{'form.ccdomain'}.' ');
}
} else { # End of if ($env ... ) logic
- # They did not want to change the users name or quota but we can
- # still tell them what the name and quota are
+ # They did not want to change the users name, quota, tool availability,
+ # or ability to request creation of courses,
+ # but we can still tell them what the name and quota and availabilities are
my %lt=&Apache::lonlocal::texthash(
- 'id' => "Student/Employee ID",
- 'mail' => "Permanent e-mail",
- 'disk' => "Disk space allocated to user's portfolio files",
+ 'id' => "Student/Employee ID",
+ 'mail' => "Permanent e-mail address",
+ 'disk' => "Disk space allocated to user's portfolio files",
+ 'blog' => "Blog Availability",
+ 'aboutme' => "Personal Information Page Availability",
+ 'portfolio' => "Portfolio Availability",
+ 'official' => "Can Request Official Courses",
+ 'unofficial' => "Can Request Unofficial Course",
+ 'inststatus' => "Affiliation",
);
$r->print(<<"END");
'.&mt('[_1] may not be used as the name for a section, as it is a reserved word.',$key));
+ $r->print(&mt('[_1] may not be used as the name for a section, as it is a reserved word.',''.$key.''));
} else {
- $r->print('
'.&mt('[_1] may not be used as the name for a section, as it is the name of a course group.',$key));
+ $r->print(&mt('[_1] may not be used as the name for a section, as it is the name of a course group.',''.$key.''));
}
- $r->print(' '.&mt('Please go back and choose a different section name.').'
';
}
$output .= &Apache::lonhtmlcommon::row_closure(1);
}
}
$output .= &Apache::lonhtmlcommon::end_pick_box().
' '
+ .&mt('Save').'" onclick="validate_types(this.form);" />'
.'';
$r->print($output);
return;
@@ -3599,7 +4594,7 @@ sub visible_in_cat {
miss => 'Your course does not currently appear in the Course Catalog for this domain.',
yous => 'You should remedy this if you plan to allow self-enrollment, otherwise students will have difficulty finding your course.',
coca => 'Courses can be absent from the Catalog, because they do not have an institutional code, have no assigned category, or have been specifically excluded.',
- make => 'Make any changes to self-enrollment settings below, click "Save changes", then take action to include the course in the Catalog:',
+ make => 'Make any changes to self-enrollment settings below, click "Save", then take action to include the course in the Catalog:',
take => 'Take the following action to ensure the course appears in the Catalog:',
dc_unhide => 'Ask a domain coordinator to change the "Exclude from course catalog" setting.',
dc_addinst => 'Ask a domain coordinator to enable display the catalog of "Official courses (with institutional codes)".',
@@ -3622,15 +4617,15 @@ sub visible_in_cat {
$cathash = $domconf{'coursecategories'}{'cats'};
}
if ($settable{'togglecats'} && $settable{'categorize'}) {
- $cansetvis = &mt('You are able to both assign a course category and choose to exclude this course from the catalog.');
+ $cansetvis = &mt('You are able to both assign a course category and choose to exclude this course from the catalog.');
} elsif ($settable{'togglecats'}) {
- $cansetvis = &mt('You are able to choose to exclude this course from the catalog, but only a Domain Coordinator may assign a course category.');
+ $cansetvis = &mt('You are able to choose to exclude this course from the catalog, but only a Domain Coordinator may assign a course category.');
} elsif ($settable{'categorize'}) {
- $cansetvis = &mt('You may assign a course category, but only a Domain Coordinator may choose to exclude this course from the catalog.');
+ $cansetvis = &mt('You may assign a course category, but only a Domain Coordinator may choose to exclude this course from the catalog.');
} else {
- $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.');
+ $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.');
}
-
+
my %currsettings =
&Apache::lonnet::get('environment',['hidefromcat','categories','internal.coursecode'],
$cdom,$cnum);
@@ -3640,7 +4635,7 @@ sub visible_in_cat {
$cathash = $domconf{'coursecategories'}{'cats'};
if (ref($cathash) eq 'HASH') {
if ($cathash->{'instcode::0'} eq '') {
- push(@vismsgs,'dc_addinst');
+ push(@vismsgs,'dc_addinst');
} else {
$visible = 1;
}
@@ -3679,7 +4674,7 @@ sub visible_in_cat {
}
}
if (!$matched) {
- if ($settable{'categorize'}) {
+ if ($settable{'categorize'}) {
push(@vismsgs,'chgcat');
} else {
push(@vismsgs,'dc_chgcat');
@@ -3690,7 +4685,7 @@ sub visible_in_cat {
}
} else {
if (ref($cathash) eq 'HASH') {
- if ((keys(%{$cathash}) > 1) ||
+ if ((keys(%{$cathash}) > 1) ||
(keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} eq '')) {
if ($settable{'categorize'}) {
push(@vismsgs,'addcat');
@@ -3945,6 +4940,7 @@ sub print_userchangelogs_display {
$r->print('');
$r->print(<<"ENDSCRIPT");
ENDSCRIPT
}
} else {
- $r->print(&mt('There are no records to display'));
+ $r->print('
'.
+ &mt('There are no records to display').
+ '
');
}
$r->print(''.
'');
@@ -3971,7 +4970,7 @@ sub role_display_filter {
my $context = 'course';
my $nolink = 1;
my $output = '
';
@@ -4012,20 +5011,29 @@ sub role_display_filter {
foreach my $chgtype ('any','auto','updatenow','createcourse','course','domain','selfenroll') {
my $selstr = '';
if ($curr->{'chgcontext'} eq $chgtype) {
- $output .= $selstr = ' selected="selected"';
+ $selstr = ' selected="selected"';
}
if (($chgtype eq 'auto') || ($chgtype eq 'updatenow')) {
next if (!&Apache::lonnet::auto_run($cnum,$cdom));
}
$output .= ''."\n";
}
- $output .= '
'.
- ''.
- &mt('[_1]Note:[_2] Only changes made from servers running LON-CAPA 2.6.99.0 or later are displayed.');
+ $output .= ''
+ .'';
+
+ # Update Display button
+ $output .= '
'
+ .''
+ .'
';
+
+ # Server version info
+ $output .= '
'
+ .&mt('Only changes made from servers running LON-CAPA [_1] or later are displayed.'
+ ,'2.6.99.0');
if ($version) {
- $output .= ' '.&mt('This server is version [_3].','','',$version); }
- $output .= '
';
+ $output .= ' '.&mt('This LON-CAPA server is version [_1]',$version);
+ }
+ $output .= ' ';
return $output;
}
@@ -4122,6 +5130,15 @@ sub user_search_result {
&build_search_response($context,$srch,%srch_results);
} else {
$currstate = 'modify';
+ my $uname = $srch->{'srchterm'};
+ my $udom = $srch->{'srchdomain'};
+ $srch_results{$uname.':'.$udom} =
+ { &Apache::lonnet::get('environment',
+ ['firstname',
+ 'lastname',
+ 'permanentemail'],
+ $udom,$uname)
+ };
}
} else {
%srch_results = &Apache::lonnet::usersearch($srch);
@@ -4413,15 +5430,48 @@ sub build_search_response {
$response .= ' '.&mt('You may want to broaden your search to the selected LON-CAPA domain.');
}
}
- if (!($srch->{'srchby'} eq 'uname' && $srch->{'srchin'} eq 'dom' && $srch->{'srchtype'} eq 'exact' && $srch->{'srchdomain'} eq $env{'request.role.domain'})) {
+ my $createdom = $env{'request.role.domain'};
+ if ($context eq 'requestcrs') {
+ if ($env{'form.coursedom'} ne '') {
+ $createdom = $env{'form.coursedom'};
+ }
+ }
+ if (!($srch->{'srchby'} eq 'uname' && $srch->{'srchin'} eq 'dom' && $srch->{'srchtype'} eq 'exact' && $srch->{'srchdomain'} eq $createdom)) {
my $cancreate =
- &Apache::lonuserutils::can_create_user($env{'request.role.domain'},$context);
+ &Apache::lonuserutils::can_create_user($createdom,$context);
+ my $targetdom = ''.$createdom.'';
if ($cancreate) {
- my $showdom = &display_domain_info($env{'request.role.domain'});
- $response .= '
'.&mt("To add a new user (you can only create new users in your current role's domain - [_1]):",$env{'request.role.domain'}).'
'.&mt("Set 'Domain/institution to search' to: [_1]",$showdom).'
'.&mt("Set 'Search criteria' to: 'username is ...... in selected LON-CAPA domain'").'
'.&mt('Provide the proposed username').'
'.&mt('Search').'
';
+ my $showdom = &display_domain_info($createdom);
+ $response .= '
'
+ .''.&mt('To add a new user:').''
+ .' ';
+ if ($context eq 'requestcrs') {
+ $response .= &mt("(You can only define new users in the new course's domain - [_1])",$targetdom);
+ } else {
+ $response .= &mt("(You can only create new users in your current role's domain - [_1])",$targetdom);
+ }
+ $response .= '
'
+ .&mt("Set 'Domain/institution to search' to: [_1]",''.$showdom.'')
+ .'
'
+ .&mt("Set 'Search criteria' to: [_1]username is ..... in selected LON-CAPA domain[_2]",'','')
+ .'
'.&mt("You are not authorized to create new users in your current role's domain - [_1].",$env{'request.role.domain'}).' '.&mt('Contact the helpdesk if you need to create a new user.',$helplink).'
';
+ $response .= '
';
+ if ($context eq 'requestcrs') {
+ $response .= &mt("You are not authorized to define new users in the new course's domain - [_1].",$targetdom);
+ } else {
+ $response .= &mt("You are not authorized to create new users in your current role's domain - [_1].",$targetdom);
+ }
+ $response .= ' '
+ .&mt('Please contact the [_1]helpdesk[_2] if you need to create a new user.'
+ ,' '
+ ,'')
+ .'