');
$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',
@@ -1389,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').
@@ -1485,7 +1766,7 @@ 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?').'
'."\n");
+ $r->print('
'.&mt('Can Request Creation of Courses/Communities in this Domain?').'
');
- 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(''.
@@ -1634,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;
}
@@ -1692,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))) {
@@ -1771,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;
@@ -1931,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;
}
@@ -2033,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');
@@ -2074,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",
@@ -2135,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;;
}
@@ -2442,9 +2777,9 @@ sub modify_login_block {
}
sub personal_data_display {
- my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray,$now,
+ my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$readonly,$rolesarray,$now,
$captchaform,$emailusername,$usertype,$usernameset,$condition,$excluded,$showsubmit) = @_;
- my ($output,%userenv,%canmodify,%canmodify_status);
+ my ($output,%userenv,%canmodify,%canmodify_status,$disabled);
my @userinfo = ('firstname','middlename','lastname','generation',
'permanentemail','id');
my $rowcount = 0;
@@ -2513,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');
@@ -2553,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".
@@ -2580,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;
@@ -2600,7 +2955,7 @@ sub personal_data_display {
$hiderow = 1;
}
} else {
- $row .= '';
+ $row .= '';
}
}
} else {
@@ -2616,7 +2971,7 @@ sub personal_data_display {
$hiderow = 1;
}
} else {
- $row .= '';
+ $row .= '';
}
}
} else {
@@ -2626,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);
@@ -2913,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 @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 =
@@ -3024,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'})) {
@@ -3041,7 +3434,7 @@ sub update_user_data {
my $chgresult =
&Apache::lonnet::put('environment',\%changeHash,
$env{'form.ccdomain'},$env{'form.ccuname'});
- }
+ }
}
$r->print(' '.&mt('Home Server').': '.$uhome.' '.
&Apache::lonnet::hostname($uhome));
@@ -3089,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',
- 'reqcrsotherdom.placement','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 =
@@ -3124,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);
}
}
@@ -3222,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');
}
@@ -3250,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 '') {
@@ -3358,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);
@@ -3377,13 +3785,61 @@ 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') ||
@@ -3393,18 +3849,71 @@ sub update_user_data {
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} =
@@ -3413,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'});
}
}
}
@@ -3592,6 +4123,8 @@ 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',
@@ -3601,7 +4134,13 @@ sub display_userinfo {
'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'}.'
'.
@@ -3626,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};
}
@@ -3637,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("
'."\n";
-
- my $visactions = &cat_visibility();
+ my $visactions = &cat_visibility($cdom);
my ($cathash,%cattype);
my %domconfig = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom);
if (ref($domconfig{'coursecategories'}) eq 'HASH') {
@@ -6537,7 +7784,7 @@ sub get_noedit_fields {
}
}
return %noedit;
-}
+}
sub visible_in_stdcat {
my ($cdom,$cnum,$domconf) = @_;
@@ -6645,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.',
@@ -6657,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.','"','"');
@@ -6789,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);
}
@@ -6842,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) =
@@ -6921,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) {
@@ -6967,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()
.'