');
$r->print(&personal_data_display($ccuname,$ccdomain,$newuser,$context,
- $inst_results{$ccuname.':'.$ccdomain}));
+ $inst_results{$ccuname.':'.$ccdomain},$readonly));
# Option to disable student/employee ID conflict checking not offerred for new users.
my ($home_server_pick,$numlib) =
&Apache::loncommon::home_server_form_item($ccdomain,'hserver',
@@ -1369,7 +1670,7 @@ $lt{'hs'}: $home_server_pick
}
if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
$r->print('
'.
- &mt('User Can Request Creation of Courses/Communities in this Domain?').'
'.
+ &mt('Can Request Creation of Courses/Communities in this Domain?').''.
&Apache::loncommon::start_data_table().
&build_tools_display($ccuname,$ccdomain,
'requestcourses').
@@ -1465,39 +1766,61 @@ ENDAUTH
$inst_results{$ccuname.':'.$ccdomain}));
if ((&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) ||
(&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) {
- $r->print('
'.&mt('User Can Request Creation of Courses/Communities in this Domain?').'
'.&mt('Can Request Creation of Courses/Communities in this Domain?').'
'."\n");
+ if (($env{'request.role.domain'} eq $ccdomain) ||
+ (&Apache::lonnet::will_trust('reqcrs',$ccdomain,$env{'request.role.domain'}))) {
+ $r->print(&Apache::loncommon::start_data_table());
+ if ($env{'request.role.domain'} eq $ccdomain) {
+ $r->print(&build_tools_display($ccuname,$ccdomain,'requestcourses'));
+ } else {
+ $r->print(&coursereq_externaluser($ccuname,$ccdomain,
+ $env{'request.role.domain'}));
+ }
+ $r->print(&Apache::loncommon::end_data_table());
} else {
- $r->print(&coursereq_externaluser($ccuname,$ccdomain,
- $env{'request.role.domain'}));
+ $r->print(&mt('Domain configuration for this domain prohibits course creation by users from domain: "[_1]"',
+ &Apache::lonnet::domain($ccdomain,'description')));
}
- $r->print(&Apache::loncommon::end_data_table());
}
$r->print('
');
- my @order = ('auth','quota','tools','requestauthor');
+ my @order = ('auth','quota','tools','requestauthor','authordefaults');
my %user_text;
my ($isadv,$isauthor) =
&Apache::lonnet::is_advanced_user($ccdomain,$ccuname);
- if ((!$isauthor) &&
- ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) ||
+ if (((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) ||
(&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) &&
- ($env{'request.role.domain'} eq $ccdomain)) {
- $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain);
+ ($env{'request.role.domain'} eq $ccdomain)) {
+ if (!$isauthor) {
+ $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain);
+ }
+ $user_text{'authordefaults'} = &authoring_defaults($ccuname,$ccdomain);
+ if (&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) {
+ $need_quota_js = 1;
+ }
}
$user_text{'auth'} = &user_authentication($ccuname,$ccdomain,$formname,$crstype,$permission);
if ((&Apache::lonnet::allowed('mpq',$ccdomain)) ||
(&Apache::lonnet::allowed('mut',$ccdomain)) ||
(&Apache::lonnet::allowed('udp',$ccdomain))) {
+ $user_text{'quota'} = '
'.&mt('User Tools').'
'."\n".
+ &Apache::loncommon::start_data_table();
+ if ((&Apache::lonnet::allowed('mut',$ccdomain)) ||
+ (&Apache::lonnet::allowed('udp',$ccdomain))) {
+ $user_text{'quota'} .= &build_tools_display($ccuname,$ccdomain,'tools');
+ }
# Current user has quota modification privileges
- $user_text{'quota'} = &user_quotas($ccuname,$ccdomain);
+ if ((&Apache::lonnet::allowed('mpq',$ccdomain)) ||
+ (&Apache::lonnet::allowed('udp',$ccdomain))) {
+ $user_text{'quota'} .= &user_quotas($ccuname,$ccdomain,'portfolio');
+ $need_quota_js = 1;
+ }
+ $user_text{'quota'} .= &Apache::loncommon::end_data_table();
}
if (!&Apache::lonnet::allowed('mpq',$ccdomain)) {
if (&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) {
my %lt=&Apache::lonlocal::texthash(
- 'dska' => "Disk quotas for user's portfolio and Authoring Space",
- 'youd' => "You do not have privileges to modify the portfolio and/or Authoring Space quotas for this user.",
+ 'dska' => "Disk quotas for user's portfolio",
+ '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_text{'quota'} = < "User Tools Availability",
- 'yodo' => "You do not have privileges to modify Portfolio, Blog, WebDAV, or Personal Information Page settings for this user.",
+ 'yodo' => "You do not have privileges to modify Portfolio, Blog, Personal Information Page, or Time Zone settings for this user.",
'ifch' => "If a change is required, contact a domain coordinator for the domain",
);
$user_text{'tools'} = <print(' onclick="auth_check()" \>'."\n");
} else {
- $r->print('onclick="this.form.submit()" \>'."\n");
+ $r->print(' onclick="this.form.submit()" \>'."\n");
}
} else {
$r->print(''.
@@ -1608,6 +1931,9 @@ ENDNOTOOLSPRIV
$r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain']));
$r->print('');
$r->print('
');
+ if ($need_quota_js) {
+ $r->print(&user_quota_js());
+ }
return;
}
@@ -1666,14 +1992,16 @@ sub date_sections_select {
sub validation_javascript {
my ($context,$ccdomain,$pjump_def,$crstype,$groupslist,$newuser,$formname,
- $loaditem) = @_;
+ $loaditem,$permission) = @_;
my $dc_setcourse_code = '';
my $nondc_setsection_code = '';
if ($context eq 'domain') {
- my $dcdom = $env{'request.role.domain'};
- $loaditem->{'onload'} = "document.cu.coursedesc.value='';";
- $dc_setcourse_code =
- &Apache::lonuserutils::dc_setcourse_js('cu','singleuser',$context);
+ if ((ref($permission) eq 'HASH') && ($permission->{'cusr'})) {
+ my $dcdom = $env{'request.role.domain'};
+ $loaditem->{'onload'} = "document.cu.coursedesc.value='';";
+ $dc_setcourse_code =
+ &Apache::lonuserutils::dc_setcourse_js('cu','singleuser',$context);
+ }
} else {
my $checkauth;
if (($newuser) || (&Apache::lonnet::allowed('mau',$ccdomain))) {
@@ -1745,7 +2073,12 @@ sub display_existing_roles {
next unless (($rnum eq $env{'course.'.$env{'request.course.id'}.'.num'})
&& ($rdom eq $env{'course.'.$env{'request.course.id'}.'.domain'}));
} elsif ($context eq 'author') {
- next unless (($rnum eq $env{'user.name'}) && ($rdom eq $env{'request.role.domain'}));
+ if ($env{'request.role'} =~ m{^ca\./($match_domain)/($match_username)$}) {
+ my ($audom,$auname) = ($1,$2);
+ next unless (($rnum eq $auname) && ($rdom eq $audom));
+ } else {
+ next unless (($rnum eq $env{'user.name'}) && ($rdom eq $env{'request.role.domain'}));
+ }
}
my ($newkey,$newvalue,$newrole);
$newkey = '/'.$rdom.'/'.$rnum;
@@ -1905,6 +2238,8 @@ sub display_existing_roles {
$area=~m{/($match_domain)/($match_username)};
if (&Apache::lonuserutils::authorpriv($2,$1)) {
$allowed=1;
+ } elsif (&Apache::lonuserutils::coauthorpriv($2,$1)) {
+ $allowed=1;
} else {
$allowed=0;
}
@@ -2007,6 +2342,9 @@ sub display_existing_roles {
}
} elsif ($env{'request.role'} =~ /^au\./) {
$contextrole = &mt('Existing Co-Author Roles in your Authoring Space');
+ } elsif ($env{'request.role'} =~ m{^ca\./($match_domain)/($match_username)/$}) {
+ $contextrole = &mt('Existing Co-Author Roles in [_1] Authoring Space',
+ ''.$1.'_'.$2.'');
} else {
if ($showall) {
$contextrole = &mt('Existing Roles in this Domain');
@@ -2048,13 +2386,25 @@ sub new_coauthor_roles {
#
# Co-Author
#
- if (&Apache::lonuserutils::authorpriv($env{'user.name'},
- $env{'request.role.domain'}) &&
- ($env{'user.name'} ne $ccuname || $env{'user.domain'} ne $ccdomain)) {
+ my ($cuname,$cudom);
+ if (($env{'request.role'} eq "au./$env{'user.domain'}/") ||
+ ($env{'request.role'} eq "dc./$env{'user.domain'}/")) {
+ $cuname=$env{'user.name'};
+ $cudom=$env{'request.role.domain'};
# No sense in assigning co-author role to yourself
- $addrolesdisplay = 1;
- my $cuname=$env{'user.name'};
- my $cudom=$env{'request.role.domain'};
+ if ((&Apache::lonuserutils::authorpriv($cuname,$cudom)) &&
+ ($env{'user.name'} ne $ccuname || $env{'user.domain'} ne $ccdomain)) {
+ $addrolesdisplay = 1;
+ }
+ } elsif ($env{'request.role'} =~ m{^ca\./($match_domain)/($match_username)$}) {
+ ($cudom,$cuname) = ($1,$2);
+ if ((&Apache::lonuserutils::coauthorpriv($cuname,$cudom)) &&
+ ($env{'user.name'} ne $ccuname || $env{'user.domain'} ne $ccdomain) &&
+ ($cudom ne $ccdomain || $cuname ne $ccuname)) {
+ $addrolesdisplay = 1;
+ }
+ }
+ if ($addrolesdisplay) {
my %lt=&Apache::lonlocal::texthash(
'cs' => "Authoring Space",
'act' => "Activate",
@@ -2109,6 +2459,17 @@ sub new_coauthor_roles {
($env{'user.domain'} eq $ccdomain)) {
$r->print(&mt('Assigning yourself a co-author or assistant co-author role in your own author area in Authoring Space is not permitted'));
}
+ } elsif ($env{'request.role'} =~ m{^ca\./($match_domain)/($match_username)$}) {
+ if (!(&Apache::lonuserutils::coauthorpriv($2,$1))) {
+ $r->print(''.
+ &mt('You do not have privileges to assign co-author roles.').
+ '');
+ } elsif (($env{'user.name'} eq $ccuname) &&
+ ($env{'user.domain'} eq $ccdomain)) {
+ $r->print(&mt('Assigning yourself a co-author or assistant co-author role in an author area in Authoring Space in which you already have a co-author role is not permitted'));
+ } elsif (($cudom eq $ccdomain) && ($cuname eq $ccuname)) {
+ $r->print(&mt("Assigning a co-author or assistant co-author role to an Authoring Space's author is not permitted"));
+ }
}
return $addrolesdisplay;;
}
@@ -2129,11 +2490,20 @@ sub new_domain_roles {
'
'.&mt('Start').'
'.&mt('End').'
'.
&Apache::loncommon::end_data_table_header_row();
my @allroles = &Apache::lonuserutils::roles_by_context('domain');
+ my $uprimary = &Apache::lonnet::domain($env{'request.role.domain'},'primary');
+ my $uintdom = &Apache::lonnet::internet_dom($uprimary);
foreach my $thisdomain (sort(&Apache::lonnet::all_domains())) {
foreach my $role (@allroles) {
next if ($role eq 'ad');
next if (($role eq 'au') && ($ccdomain ne $thisdomain));
if (&Apache::lonnet::allowed('c'.$role,$thisdomain)) {
+ if ($role eq 'dc') {
+ unless ($thisdomain eq $env{'request.role.domain'}) {
+ my $domprim = &Apache::lonnet::domain($thisdomain,'primary');
+ my $intdom = &Apache::lonnet::internet_dom($domprim);
+ next unless ($uintdom eq $intdom);
+ }
+ }
my $plrole=&Apache::lonnet::plaintext($role);
my %lt=&Apache::lonlocal::texthash(
'ssd' => "Set Start Date",
@@ -2175,7 +2545,7 @@ sub user_authentication {
'ld' => "Login Data"
);
# Check for a bad authentication type
- if ($currentauth !~ /^(krb4|krb5|unix|internal|localauth):/) {
+ if ($currentauth !~ /^(krb4|krb5|unix|internal|localauth|lti):/) {
# bad authentication scheme
if (&Apache::lonnet::allowed('mau',$ccdomain)) {
&initialize_authen_forms($ccdomain,$formname);
@@ -2202,6 +2572,7 @@ $lt{'uuas'} ($currentauth). $lt{'adcs'}.
ENDBADAUTH
}
} else { # Authentication type is valid
+
&initialize_authen_forms($ccdomain,$formname,$currentauth,'modifyuser');
my ($authformcurrent,$can_modify,@authform_others) =
&modify_login_block($ccdomain,$currentauth);
@@ -2290,6 +2661,8 @@ ENDJS
$result = &mt('Currently using local (institutional) authentication.');
} elsif ($currentauth =~ /^unix:/) {
$result = &mt('Currently Filesystem Authenticated.');
+ } elsif ($currentauth =~ /^lti:/) {
+ $result = &mt('Currently LTI authenticated.');
}
$outcome = '
'.$lt{'ld'}.'
'.
&Apache::loncommon::start_data_table().
@@ -2328,6 +2701,9 @@ sub modify_login_block {
if ($can_assign{'loc'}) {
push(@authform_others,$authformloc);
}
+ if ($can_assign{'lti'}) {
+ push(@authform_others,$authformlti);
+ }
if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) {
$show_override_msg = 1;
}
@@ -2339,6 +2715,9 @@ sub modify_login_block {
if ($can_assign{'loc'}) {
push(@authform_others,$authformloc);
}
+ if ($can_assign{'lti'}) {
+ push(@authform_others,$authformlti);
+ }
if ($can_assign{'int'}) {
$show_override_msg = 1;
}
@@ -2353,6 +2732,9 @@ sub modify_login_block {
if ($can_assign{'loc'}) {
push(@authform_others,$authformloc);
}
+ if ($can_assign{'lti'}) {
+ push(@authform_others,$authformlti);
+ }
if ($can_assign{'fsys'}) {
$show_override_msg = 1;
}
@@ -2364,9 +2746,23 @@ sub modify_login_block {
if ($can_assign{'int'}) {
push(@authform_others,$authformint);
}
+ if ($can_assign{'lti'}) {
+ push(@authform_others,$authformlti);
+ }
if ($can_assign{'loc'}) {
$show_override_msg = 1;
}
+ } elsif ($currentauth=~/^lti:/) {
+ $authformcurrent=$authformlti;
+ if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) {
+ push(@authform_others,$authformkrb);
+ }
+ if ($can_assign{'int'}) {
+ push(@authform_others,$authformint);
+ }
+ if ($can_assign{'loc'}) {
+ push(@authform_others,$authformloc);
+ }
}
if ($show_override_msg) {
$authformcurrent = '
'.$authformcurrent.
@@ -2381,9 +2777,9 @@ sub modify_login_block {
}
sub personal_data_display {
- my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray,
- $now,$captchaform,$emailusername,$usertype,$usernameset,$condition,$excluded) = @_;
- my ($output,%userenv,%canmodify,%canmodify_status);
+ my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$readonly,$rolesarray,$now,
+ $captchaform,$emailusername,$usertype,$usernameset,$condition,$excluded,$showsubmit) = @_;
+ my ($output,%userenv,%canmodify,%canmodify_status,$disabled);
my @userinfo = ('firstname','middlename','lastname','generation',
'permanentemail','id');
my $rowcount = 0;
@@ -2452,6 +2848,8 @@ sub personal_data_display {
%canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo,
$inst_results,$rolesarray);
}
+ } elsif ($readonly) {
+ $disabled = ' disabled="disabled"';
}
my $genhelp=&Apache::loncommon::help_open_topic('Generation');
@@ -2465,7 +2863,7 @@ sub personal_data_display {
} else {
undef($condition);
}
- }
+ }
if ($excluded) {
unless ($excluded =~ /^\@[^\@]+$/) {
undef($condition);
@@ -2492,8 +2890,8 @@ sub personal_data_display {
}
$rowcount ++;
$output .= &Apache::lonhtmlcommon::row_closure(1);
- my $upassone = '';
- my $upasstwo = '';
+ my $upassone = '';
+ my $upasstwo = '';
$output .= &Apache::lonhtmlcommon::row_title(&mt('Password').'*',
'LC_pick_box_title',
'LC_oddrow_value')."\n".
@@ -2505,12 +2903,13 @@ sub personal_data_display {
$upasstwo.
&Apache::lonhtmlcommon::row_closure()."\n";
if ($usernameset eq 'free') {
- my $onclick = "toggleUsernameDisp(this,'selfcreateusername');";
+ my $onclick = "toggleUsernameDisp(this,'selfcreateusername');";
$output .= &Apache::lonhtmlcommon::row_title($lt{'username'},undef,'LC_oddrow_value')."\n".
- &mt('Use e-mail address: ').
- ''."\n".
- (' 'x2).
- ''."\n".
+ ''.&mt('Use e-mail address: ').
+ ''.(' 'x2).
+ ''."\n".
'
'.
' '.&mt('Preferred username').
' '.
@@ -2518,6 +2917,24 @@ sub personal_data_display {
$rowcount ++;
}
}
+ my %shownfields;
+ if ($env{'request.role.domain'} ne $ccdomain) {
+ my %shownfields_by_type =
+ &Apache::lonuserutils::get_othdom_shownfields($ccdomain,\@userinfo);
+ my @types = split(/:/,$userenv{'inststatus'});
+ if (@types == 0) {
+ @types = ('default');
+ }
+ foreach my $type (@types) {
+ if (ref($shownfields_by_type{$type}) eq 'HASH') {
+ foreach my $field (keys(%{$shownfields_by_type{$type}})) {
+ if ($shownfields_by_type{$type}{$field}) {
+ $shownfields{$field} = 1;
+ }
+ }
+ }
+ }
+ }
foreach my $item (@userinfo) {
my $rowtitle = $lt{$item};
my $hiderow = 0;
@@ -2538,7 +2955,7 @@ sub personal_data_display {
$hiderow = 1;
}
} else {
- $row .= '';
+ $row .= '';
}
}
} else {
@@ -2554,7 +2971,7 @@ sub personal_data_display {
$hiderow = 1;
}
} else {
- $row .= '';
+ $row .= '';
}
}
} else {
@@ -2564,7 +2981,15 @@ sub personal_data_display {
$row .= ' '.&Apache::lonuserutils::forceid_change($context);
}
} else {
- $row .= $userenv{$item};
+ if ($env{'request.role.domain'} ne $ccdomain) {
+ if ($shownfields{$item}) {
+ $row .= $userenv{$item};
+ } else {
+ $row .= &mt('not shown');
+ }
+ } else {
+ $row .= $userenv{$item};
+ }
}
}
$row .= &Apache::lonhtmlcommon::row_closure(1);
@@ -2618,12 +3043,17 @@ sub personal_data_display {
&Apache::lonhtmlcommon::row_closure(1);
$rowcount ++;
}
- my $submit_text = &mt('Create account');
- $output .= &Apache::lonhtmlcommon::row_title()."\n".
- ' '.
- ''.
- &Apache::lonhtmlcommon::row_closure(1);
+ if ($showsubmit) {
+ my $submit_text = &mt('Create account');
+ $output .= &Apache::lonhtmlcommon::row_title()."\n".
+ ' ';
+ if ($usertype ne '') {
+ $output .= '';
+ }
+ $output .= &Apache::lonhtmlcommon::row_closure(1);
+ }
}
$output .= &Apache::lonhtmlcommon::end_pick_box();
if (wantarray) {
@@ -2825,6 +3255,9 @@ sub update_user_data {
$amode='localauth';
$genpwd=$env{'form.locarg'};
$genpwd=" " if (!$genpwd);
+ } elsif ($env{'form.login'} eq 'lti') {
+ $amode='lti';
+ $genpwd=" ";
} elsif (($env{'form.login'} eq 'nochange') ||
($env{'form.login'} eq '' )) {
# There is no need to tell the user we did not change what they
@@ -2843,9 +3276,10 @@ sub update_user_data {
my (%alerts,%rulematch,%inst_results,%curr_rules);
my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
- my @usertools = ('aboutme','blog','webdav','portfolio');
- my @requestcourses = ('official','unofficial','community','textbook');
+ my @usertools = ('aboutme','blog','portfolio','portaccess','timezone');
+ my @requestcourses = ('official','unofficial','community','textbook','placement','lti');
my @requestauthor = ('requestauthor');
+ my @authordefaults = ('webdav','editors','archive');
my ($othertitle,$usertypes,$types) =
&Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});
my %canmodify_status =
@@ -2954,6 +3388,35 @@ sub update_user_data {
$newcustom{'requestauthor'},
\%changeHash,'requestauthor');
}
+ if ($env{'form.customeditors'} == 1) {
+ my @editors;
+ my @posseditors = &Apache::loncommon::get_env_multiple('form.custom_editor');
+ if (@posseditors) {
+ foreach my $editor (@posseditors) {
+ if (grep(/^\Q$editor\E$/,@posseditors)) {
+ unless (grep(/^\Q$editor\E$/,@editors)) {
+ push(@editors,$editor);
+ }
+ }
+ }
+ }
+ if (@editors) {
+ @editors = sort(@editors);
+ $changed{'editors'} = &tool_admin('editors',join(',',@editors),
+ \%changeHash,'authordefaults');
+ }
+ }
+ if ($env{'form.customwebdav'} == 1) {
+ $newcustom{'webdav'} = $env{'form.authordefaults_webdav'};
+ $changed{'webdav'} = &tool_admin('webdav',$newcustom{'webdav'},
+ \%changeHash,'authordefaults');
+ }
+ if ($env{'form.customarchive'} == 1) {
+ $newcustom{'archive'} = $env{'form.authordefaults_archive'};
+ $changed{'archive'} = &tool_admin('archive',$newcustom{'archive'},
+ \%changeHash,'authordefaults');
+
+ }
}
if ($canmodify_status{'inststatus'}) {
if (exists($env{'form.inststatus'})) {
@@ -2971,9 +3434,9 @@ sub update_user_data {
my $chgresult =
&Apache::lonnet::put('environment',\%changeHash,
$env{'form.ccdomain'},$env{'form.ccuname'});
- }
+ }
}
- $r->print(' '.&mt('Home server').': '.$uhome.' '.
+ $r->print(' '.&mt('Home Server').': '.$uhome.' '.
&Apache::lonnet::hostname($uhome));
} elsif (($env{'form.login'} ne 'nochange') &&
($env{'form.login'} ne '' )) {
@@ -2988,11 +3451,11 @@ sub update_user_data {
&Apache::lonnet::modifyuserauth(
$env{'form.ccdomain'},$env{'form.ccuname'},
$amode,$genpwd));
- $r->print(' '.&mt('Home server').': '.&Apache::lonnet::homeserver
+ $r->print(' '.&mt('Home Server').': '.&Apache::lonnet::homeserver
($env{'form.ccuname'},$env{'form.ccdomain'}));
} else {
# Okay, this is a non-fatal error.
- $r->print($error.&mt('You do not have privileges to modify the authentication configuration for this user.').$end);
+ $r->print($error.&mt('You do not have privileges to modify the authentication configuration for this user.').$end);
}
} elsif (($env{'form.intarg'} ne '') &&
(&Apache::lonnet::queryauthenticate($env{'form.ccuname'},$env{'form.ccdomain'}) =~ /^internal:/) &&
@@ -3019,17 +3482,25 @@ sub update_user_data {
my %userenv = &Apache::lonnet::get
('environment',['firstname','middlename','lastname','generation',
'id','permanentemail','portfolioquota','authorquota','inststatus',
- 'tools.aboutme','tools.blog','tools.webdav','tools.portfolio',
+ 'tools.aboutme','tools.blog','tools.webdav',
+ 'tools.portfolio','tools.timezone','tools.portaccess',
+ 'authormanagers','authoreditors','authorarchive','requestauthor',
'requestcourses.official','requestcourses.unofficial',
'requestcourses.community','requestcourses.textbook',
+ 'requestcourses.placement','requestcourses.lti',
'reqcrsotherdom.official','reqcrsotherdom.unofficial',
'reqcrsotherdom.community','reqcrsotherdom.textbook',
- 'requestauthor'],
+ 'reqcrsotherdom.placement','domcoord.author'],
$env{'form.ccdomain'},$env{'form.ccuname'});
my ($tmp) = keys(%userenv);
if ($tmp =~ /^(con_lost|error)/i) {
%userenv = ();
}
+ unless (($userenv{'domcoord.author'} eq 'blocked') &&
+ (($env{'user.name'} ne $env{'form.ccuname'}) ||
+ ($env{'user.domain'} ne $env{'form.ccdomain'}))) {
+ push(@authordefaults,'managers');
+ }
my $no_forceid_alert;
# Check to see if user information can be changed
my %domconfig =
@@ -3054,7 +3525,7 @@ sub update_user_data {
}
} elsif ($context eq 'author') {
if ($rolenum eq $auname && $roledom eq $audom) {
- if (!grep(/^\Q$role\E$/,@userroles)) {
+ if (!grep(/^\Q$role\E$/,@userroles)) {
push(@userroles,$role);
}
}
@@ -3152,7 +3623,7 @@ sub update_user_data {
%oldsettingstatus,%newsettingstatus);
@disporder = ('inststatus');
if ($env{'request.role.domain'} eq $env{'form.ccdomain'}) {
- push(@disporder,'requestcourses','requestauthor');
+ push(@disporder,('requestcourses','requestauthor','authordefaults'));
} else {
push(@disporder,'reqcrsotherdom');
}
@@ -3180,6 +3651,7 @@ sub update_user_data {
}
if (&Apache::lonnet::allowed('cau',$env{'form.ccdomain'})) {
$canshow{'requestauthor'} = 1;
+ $canshow{'authordefaults'} = 1;
}
my (%changeHash,%changed);
if ($oldinststatus eq '') {
@@ -3288,8 +3760,14 @@ sub update_user_data {
if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) {
&tool_changes('requestcourses',\@requestcourses,\%oldsettings,\%oldsettingstext,
\%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
- &tool_changes('requestauthor',\@requestauthor,\%oldsettings,\%oldsettingstext,
- \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
+ my ($isadv,$isauthor) =
+ &Apache::lonnet::is_advanced_user($env{'form.ccdomain'},$env{'form.ccuname'});
+ unless ($isauthor) {
+ &tool_changes('requestauthor',\@requestauthor,\%oldsettings,\%oldsettingstext,
+ \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
+ }
+ &tool_changes('authordefaults',\@authordefaults,\%oldsettings,\%oldsettingstext,
+ \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
} else {
&tool_changes('reqcrsotherdom',\@requestcourses,\%oldsettings,\%oldsettingstext,
\%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
@@ -3307,33 +3785,135 @@ sub update_user_data {
if ((keys(%namechanged) > 0) || (keys(%changed) > 0)) {
my ($chgresult,$namechgresult);
if (keys(%changed) > 0) {
- $chgresult =
+ $chgresult =
&Apache::lonnet::put('environment',\%changeHash,
$env{'form.ccdomain'},$env{'form.ccuname'});
if ($chgresult eq 'ok') {
+ my ($ca_mgr_del,%ca_mgr_add);
+ if ($changed{'managers'}) {
+ my (@adds,@dels);
+ if ($changeHash{'authormanagers'} eq '') {
+ @dels = split(/,/,$userenv{'authormanagers'});
+ } elsif ($userenv{'authormanagers'} eq '') {
+ @adds = split(/,/,$changeHash{'authormanagers'});
+ } else {
+ my @old = split(/,/,$userenv{'authormanagers'});
+ my @new = split(/,/,$changeHash{'authormanagers'});
+ my @diffs = &Apache::loncommon::compare_arrays(\@old,\@new);
+ if (@diffs) {
+ foreach my $user (@diffs) {
+ if (grep(/^\Q$user\E$/,@old)) {
+ push(@dels,$user);
+ } elsif (grep(/^\Q$user\E$/,@new)) {
+ push(@adds,$user);
+ }
+ }
+ }
+ }
+ my $key = "internal.manager./$env{'form.ccdomain'}/$env{'form.ccuname'}";
+ if (@dels) {
+ foreach my $user (@dels) {
+ if ($user =~ /^($match_username):($match_domain)$/) {
+ &Apache::lonnet::del('environment',[$key],$2,$1);
+ }
+ }
+ my $curruser = $env{'user.name'}.':'.$env{'user.domain'};
+ if (grep(/^\Q$curruser\E$/,@dels)) {
+ $ca_mgr_del = $key;
+ }
+ }
+ if (@adds) {
+ foreach my $user (@adds) {
+ if ($user =~ /^($match_username):($match_domain)$/) {
+ &Apache::lonnet::put('environment',{$key => 1},$2,$1);
+ }
+ }
+ my $curruser = $env{'user.name'}.':'.$env{'user.domain'};
+ if (grep(/^\Q$curruser\E$/,@adds)) {
+ $ca_mgr_add{$key} = 1;
+ }
+ }
+ }
if (($env{'user.name'} eq $env{'form.ccuname'}) &&
($env{'user.domain'} eq $env{'form.ccdomain'})) {
- my %newenvhash;
+ my (%newenvhash,$got_domdefs,%domdefaults,$got_userenv,
+ %userenv);
+ my @fromenv = keys(%changed);
+ push(@fromenv,'inststatus');
foreach my $key (keys(%changed)) {
- if (($key eq 'official') || ($key eq 'unofficial')
- || ($key eq 'community') || ($key eq 'textbook')) {
+ if (($key eq 'official') || ($key eq 'unofficial') ||
+ ($key eq 'community') || ($key eq 'textbook') ||
+ ($key eq 'placement') || ($key eq 'lti')) {
$newenvhash{'environment.requestcourses.'.$key} =
$changeHash{'requestcourses.'.$key};
if ($changeHash{'requestcourses.'.$key}) {
$newenvhash{'environment.canrequest.'.$key} = 1;
} else {
+ unless ($got_domdefs) {
+ %domdefaults =
+ &Apache::lonnet::get_domain_defaults($env{'user.domain'});
+ $got_domdefs = 1;
+ }
+ unless ($got_userenv) {
+ %userenv =
+ &Apache::lonnet::userenvironment($env{'user.domain'},
+ $env{'user.name'},@fromenv);
+ $got_userenv = 1;
+ }
$newenvhash{'environment.canrequest.'.$key} =
&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
- $key,'reload','requestcourses');
+ $key,'reload','requestcourses',\%userenv,\%domdefaults);
}
} elsif ($key eq 'requestauthor') {
$newenvhash{'environment.'.$key} = $changeHash{$key};
if ($changeHash{$key}) {
$newenvhash{'environment.canrequest.author'} = 1;
} else {
+ unless ($got_domdefs) {
+ %domdefaults =
+ &Apache::lonnet::get_domain_defaults($env{'user.domain'});
+ $got_domdefs = 1;
+ }
+ unless ($got_userenv) {
+ %userenv =
+ &Apache::lonnet::userenvironment($env{'user.domain'},
+ $env{'user.name'},@fromenv);
+ $got_userenv = 1;
+ }
$newenvhash{'environment.canrequest.author'} =
&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
- $key,'reload','requestauthor');
+ $key,'reload','requestauthor',\%userenv,\%domdefaults);
+ }
+ } elsif ($key eq 'editors') {
+ $newenvhash{'environment.author'.$key} = $changeHash{'author'.$key};
+ if ($env{'form.customeditors'}) {
+ $newenvhash{'environment.editors'} = $changeHash{'author'.$key};
+ } else {
+ unless ($got_domdefs) {
+ %domdefaults =
+ &Apache::lonnet::get_domain_defaults($env{'user.domain'});
+ $got_domdefs = 1;
+ }
+ if ($domdefaults{'editors'} ne '') {
+ $newenvhash{'environment.editors'} = $domdefaults{'editors'};
+ } else {
+ $newenvhash{'environment.editors'} = 'edit,xml';
+ }
+ }
+ } elsif ($key eq 'archive') {
+ $newenvhash{'environment.author.'.$key} =
+ $changeHash{'author.'.$key};
+ if ($changeHash{'author.'.$key} ne '') {
+ $newenvhash{'environment.canarchive'} =
+ $changeHash{'author.'.$key};
+ } else {
+ unless ($got_domdefs) {
+ %domdefaults =
+ &Apache::lonnet::get_domain_defaults($env{'user.domain'});
+ $got_domdefs = 1;
+ }
+ $newenvhash{'environment.canarchive'} =
+ $domdefaults{'archive'};
}
} elsif ($key ne 'quota') {
$newenvhash{'environment.tools.'.$key} =
@@ -3342,15 +3922,37 @@ sub update_user_data {
$newenvhash{'environment.availabletools.'.$key} =
$changeHash{'tools.'.$key};
} else {
+ unless ($got_domdefs) {
+ %domdefaults =
+ &Apache::lonnet::get_domain_defaults($env{'user.domain'});
+ $got_domdefs = 1;
+ }
+ unless ($got_userenv) {
+ %userenv =
+ &Apache::lonnet::userenvironment($env{'user.domain'},
+ $env{'user.name'},@fromenv);
+ $got_userenv = 1;
+ }
$newenvhash{'environment.availabletools.'.$key} =
&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
- $key,'reload','tools');
+ $key,'reload','tools',\%userenv,\%domdefaults);
}
}
}
if (keys(%newenvhash)) {
&Apache::lonnet::appenv(\%newenvhash);
}
+ } else {
+ if ($ca_mgr_del) {
+ &Apache::lonnet::delenv($ca_mgr_del);
+ }
+ if (keys(%ca_mgr_add)) {
+ &Apache::lonnet::appenv(\%ca_mgr_add);
+ }
+ }
+ if ($changed{'aboutme'}) {
+ &Apache::loncommon::devalidate_aboutme_cache($env{'form.ccuname'},
+ $env{'form.ccdomain'});
}
}
}
@@ -3382,7 +3984,7 @@ sub update_user_data {
\%newsettingstext);
if ($env{'form.cid'} ne $userenv{'id'}) {
&Apache::lonnet::idput($env{'form.ccdomain'},
- {$env{'form.ccuname'} => $env{'form.cid'}});
+ {$env{'form.ccuname'} => $env{'form.cid'}},$uhome,'ids');
if (($recurseid) &&
(&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) {
my $idresult =
@@ -3521,14 +4123,24 @@ sub display_userinfo {
'webdav' => 'WebDAV Availability',
'aboutme' => 'Personal Information Page Availability',
'portfolio' => 'Portfolio Availability',
+ 'portaccess' => 'Portfolio Shareable',
+ 'timezone' => 'Can set own Time Zone',
'official' => 'Can Request Official Courses',
'unofficial' => 'Can Request Unofficial Courses',
'community' => 'Can Request Communities',
'textbook' => 'Can Request Textbook Courses',
+ 'placement' => 'Can Request Placement Tests',
+ 'lti' => 'Can Request LTI Courses',
'requestauthor' => 'Can Request Author Role',
'inststatus' => "Affiliation",
'prvs' => 'Previous Value:',
- 'chto' => 'Changed To:'
+ 'chto' => 'Changed To:',
+ 'editors' => "Available Editors in Authoring Space",
+ 'managers' => "Co-authors who can add/revoke roles",
+ 'archive' => "Managers can download tar.gz file of Authoring Space",
+ 'edit' => 'Standard editor (Edit)',
+ 'xml' => 'Text editor (EditXML)',
+ 'daxe' => 'Daxe editor (Daxe)',
);
if ($changed) {
$r->print('
'.$lt{'uic'}.'
'.
@@ -3553,10 +4165,13 @@ sub display_userinfo {
}
foreach my $entry (@{$order}) {
if ($canshow->{$entry}) {
- if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom') || ($entry eq 'requestauthor')) {
+ if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom') ||
+ ($entry eq 'requestauthor') || ($entry eq 'authordefaults')) {
my @items;
if ($entry eq 'requestauthor') {
@items = ($entry);
+ } elsif ($entry eq 'authordefaults') {
+ @items = ('webdav','managers','editors','archive');
} else {
@items = @{$requestcourses};
}
@@ -3564,19 +4179,27 @@ sub display_userinfo {
if (($newsetting->{$item} ne $oldsetting->{$item}) ||
($newsettingtext->{$item} ne $oldsettingtext->{$item})) {
$r->print(&Apache::loncommon::start_data_table_row()."\n");
- $r->print("
'.&Apache::loncommon::end_data_table_row()
.&Apache::loncommon::end_data_table();
@@ -6460,7 +7784,7 @@ sub get_noedit_fields {
}
}
return %noedit;
-}
+}
sub visible_in_stdcat {
my ($cdom,$cnum,$domconf) = @_;
@@ -6568,6 +7892,7 @@ sub visible_in_stdcat {
}
sub cat_visibility {
+ my ($cdom) = @_;
my %visactions = &Apache::lonlocal::texthash(
vis => 'This course/community currently appears in the Course/Community Catalog for this domain.',
gen => 'Courses can be both self-cataloging, based on an institutional code (e.g., fs08phy231), or can be assigned categories from a hierarchy defined for the domain.',
@@ -6580,13 +7905,24 @@ sub cat_visibility {
dc_chgconf => 'Ask a domain coordinator to change the Catalog type for this domain.',
dc_setcode => 'Ask a domain coordinator to assign a six character code to the course',
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)".',
+ dc_addinst => 'Ask a domain coordinator to enable catalog display of "Official courses (with institutional codes)".',
dc_instcode => 'Ask a domain coordinator to assign an institutional code (if this is an official course).',
dc_catalog => 'Ask a domain coordinator to enable or create at least one course category in the domain.',
dc_categories => 'Ask a domain coordinator to create a hierarchy of categories and sub categories for courses in the domain.',
dc_chgcat => 'Ask a domain coordinator to change the category assigned to the course, as the one currently assigned is no longer used in the domain',
dc_addcat => 'Ask a domain coordinator to assign a category to the course.',
);
+ if ($env{'request.role'} eq "dc./$cdom/") {
+ $visactions{'dc_chgconf'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to change the Catalog type for this domain.','»');
+ $visactions{'dc_setcode'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to assign a six character code to the course.','»');
+ $visactions{'dc_unhide'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to change the "Exclude from course catalog" setting.','»');
+ $visactions{'dc_addinst'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to enable catalog display of "Official courses (with institutional codes)".','»');
+ $visactions{'dc_instcode'} = &mt('Use: "Main menu" [_1] "View or modify a course or community" [_1] "View/Modify course owner, institutional code ... " to assign an institutional code (if this is an official course).','»');
+ $visactions{'dc_catalog'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to enable or create at least one course category in the domain.','»');
+ $visactions{'dc_categories'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to create a hierarchy of categories and sub categories for courses in the domain.','»');
+ $visactions{'dc_chgcat'} = &mt('Use: "Main menu" [_1] "View or modify a course or community" [_1] "View/Modify catalog settings for course" to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','»');
+ $visactions{'dc_addcat'} = &mt('Use: "Main menu" [_1] "View or modify a course or community" [_1] "View/Modify catalog settings for course" to assign a category to the course.','»');
+ }
$visactions{'unhide'} = &mt('Use [_1]Categorize course[_2] to change the "Exclude from course catalog" setting.','','"');
$visactions{'chgcat'} = &mt('Use [_1]Categorize course[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','"','"');
$visactions{'addcat'} = &mt('Use [_1]Categorize course[_2] to assign a category to the course.','"','"');
@@ -6712,9 +8048,11 @@ sub print_userchangelogs_display {
&Apache::loncommon::restore_course_settings('roles_log',
\%saveable_parameters);
} elsif ($context eq 'author') {
- $domain = $env{'user.domain'};
+ $domain = $env{'user.domain'};
if ($env{'request.role'} =~ m{^au\./\Q$domain\E/$}) {
$username = $env{'user.name'};
+ } elsif ($env{'request.role'} =~ m{^ca\./($match_domain)/($match_username)$}) {
+ ($domain,$username) = ($1,$2);
} else {
undef($domain);
}
@@ -6765,12 +8103,13 @@ ENDSCRIPT
chgcontext => 'any',
rolelog_start_date => $defstart,
rolelog_end_date => $now,
+ approvals => 'any',
);
my $more_records = 0;
# set current
my %curr;
- foreach my $item ('show','page','role','chgcontext') {
+ foreach my $item ('show','page','role','chgcontext','approvals') {
$curr{$item} = $env{'form.'.$item};
}
my ($startdate,$enddate) =
@@ -6844,6 +8183,11 @@ ENDSCRIPT
if (($context eq 'course') && ($viewablesec ne '')) {
next if ($roleslog{$id}{'logentry'}{'section'} ne $viewablesec);
}
+ if ($curr{'approvals'} eq 'none') {
+ next if ($roleslog{$id}{'logentry'}{'approval'});
+ } elsif ($curr{'approvals'} ne 'any') {
+ next if ($roleslog{$id}{'logentry'}{'approval'} ne $curr{'approvals'});
+ }
$count ++;
next if ($count < $minshown);
unless ($showntableheader) {
@@ -6890,11 +8234,30 @@ ENDSCRIPT
if ($chgcontext ne '' && $lt{$chgcontext} ne '') {
$chgcontext = $lt{$chgcontext};
}
+ my ($showreqby,%reqby);
+ if (($roleslog{$id}{'logentry'}{'approval'}) &&
+ ($roleslog{$id}{'logentry'}{'requester'})) {
+ if ($reqby{$roleslog{$id}{'logentry'}{'requester'}} eq '') {
+ my ($requname,$requdom) = split(/:/,$roleslog{$id}{'logentry'}{'requester'});
+ $reqby{$roleslog{$id}{'logentry'}{'requester'}} =
+ &Apache::loncommon::plainname($requname,$requdom);
+ }
+ $showreqby = &mt('Requester').': '.$reqby{$roleslog{$id}{'logentry'}{'requester'}}.' ';
+ if ($roleslog{$id}{'logentry'}{'approval'} eq 'domain') {
+ $showreqby .= &mt('Adjudicator').': '.
+ $whodunit{$roleslog{$id}{'exe_uname'}.':'.$roleslog{$id}{'exe_udom'}}.
+ '';
+ } else {
+ $showreqby .= ''.&mt('User approved').'';
+ }
+ } else {
+ $showreqby = $whodunit{$roleslog{$id}{'exe_uname'}.':'.$roleslog{$id}{'exe_udom'}};
+ }
$r->print(
&Apache::loncommon::start_data_table_row()
.'