version 1.406.2.5, 2016/10/22 17:57:54
|
version 1.416, 2016/10/10 03:02:48
|
Line 251 sub build_tools_display {
|
Line 251 sub build_tools_display {
|
'unofficial' => 'Can request creation of unofficial courses', |
'unofficial' => 'Can request creation of unofficial courses', |
'community' => 'Can request creation of communities', |
'community' => 'Can request creation of communities', |
'textbook' => 'Can request creation of textbook courses', |
'textbook' => 'Can request creation of textbook courses', |
|
'placement' => 'Can request creation of placement tests', |
'requestauthor' => 'Can request author space', |
'requestauthor' => 'Can request author space', |
); |
); |
if ($context eq 'requestcourses') { |
if ($context eq 'requestcourses') { |
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, |
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, |
'requestcourses.official','requestcourses.unofficial', |
'requestcourses.official','requestcourses.unofficial', |
'requestcourses.community','requestcourses.textbook'); |
'requestcourses.community','requestcourses.textbook', |
@usertools = ('official','unofficial','community','textbook'); |
'requestcourses.placement'); |
|
@usertools = ('official','unofficial','community','textbook','placement'); |
@options =('norequest','approval','autolimit','validate'); |
@options =('norequest','approval','autolimit','validate'); |
%validations = &Apache::lonnet::auto_courserequest_checks($ccdomain); |
%validations = &Apache::lonnet::auto_courserequest_checks($ccdomain); |
%reqtitles = &courserequest_titles(); |
%reqtitles = &courserequest_titles(); |
Line 447 sub coursereq_externaluser {
|
Line 449 sub coursereq_externaluser {
|
'unofficial' => 'Can request creation of unofficial courses', |
'unofficial' => 'Can request creation of unofficial courses', |
'community' => 'Can request creation of communities', |
'community' => 'Can request creation of communities', |
'textbook' => 'Can request creation of textbook courses', |
'textbook' => 'Can request creation of textbook courses', |
|
'placement' => 'Can request creation of placement tests', |
); |
); |
|
|
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, |
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, |
'reqcrsotherdom.official','reqcrsotherdom.unofficial', |
'reqcrsotherdom.official','reqcrsotherdom.unofficial', |
'reqcrsotherdom.community','reqcrsotherdom.textbook'); |
'reqcrsotherdom.community','reqcrsotherdom.textbook', |
@usertools = ('official','unofficial','community','textbook'); |
'reqcrsotherdom.placement'); |
|
@usertools = ('official','unofficial','community','textbook','placement'); |
@options = ('approval','validate','autolimit'); |
@options = ('approval','validate','autolimit'); |
%validations = &Apache::lonnet::auto_courserequest_checks($cdom); |
%validations = &Apache::lonnet::auto_courserequest_checks($cdom); |
my $optregex = join('|',@options); |
my $optregex = join('|',@options); |
Line 529 sub domainrole_req {
|
Line 533 sub domainrole_req {
|
|
|
sub domadhocroles { |
sub domadhocroles { |
my ($ccuname,$ccdomain) = @_; |
my ($ccuname,$ccdomain) = @_; |
my $confname = &Apache::lonnet::get_domainconfiguser($env{'request.role.domain'}); |
my $confname = &Apache::lonnet::get_domainconfiguser($env{'request.role.domain'}); |
my %existing=&Apache::lonnet::dump('roles',$env{'request.role.domain'}, |
my %existing=&Apache::lonnet::dump('roles',$env{'request.role.domain'}, |
$confname,'rolesdef_'); |
$confname,'rolesdef_'); |
my $output; |
my $output; |
if (keys(%existing) > 0) { |
if (keys(%existing) > 0) { |
my @current; |
my @current; |
my $curradhoc = 'adhocroles.'.$env{'request.role.domain'}; |
my $curradhoc = 'adhocroles.'.$env{'request.role.domain'}; |
my %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,$curradhoc); |
my %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,$curradhoc); |
if ($userenv{$curradhoc}) { |
if ($userenv{$curradhoc}) { |
@current = split(/,/,$userenv{$curradhoc}); |
@current = split(/,/,$userenv{$curradhoc}); |
Line 556 sub domadhocroles {
|
Line 560 sub domadhocroles {
|
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Action').'</th><th>'.&mt('Role').'</th>'. |
'<th>'.&mt('Action').'</th><th>'.&mt('Role').'</th>'. |
'<th>'.&mt('Privileges in Course').'<th>'. |
'<th>'.&mt('Privileges in Course').'<th>'. |
&Apache::loncommon::end_data_table_header_row(); |
&Apache::loncommon::end_data_table_header_row(); |
foreach my $key (sort(keys(%customroles))) { |
foreach my $key (sort(keys(%customroles))) { |
$output .= &Apache::loncommon::start_data_table_row(); |
$output .= &Apache::loncommon::start_data_table_row(); |
if (grep(/^\Q$key\E$/,@current)) { |
if (grep(/^\Q$key\E$/,@current)) { |
Line 579 sub domadhocroles {
|
Line 583 sub domadhocroles {
|
} |
} |
my @privs = split(/:/,$customroles{$key}{$level}); |
my @privs = split(/:/,$customroles{$key}{$level}); |
foreach my $item (@privs) { |
foreach my $item (@privs) { |
next if ($item eq ''); |
next if ($item eq ''); |
my ($priv,$cond) = split(/\&/,$item); |
my ($priv,$cond) = split(/\&/,$item); |
$output .= &Apache::lonnet::plaintext($priv,'Course').$suffix.'<br />'; |
$output .= &Apache::lonnet::plaintext($priv,'Course').$suffix.'<br />'; |
} |
} |
Line 599 sub courserequest_titles {
|
Line 603 sub courserequest_titles {
|
unofficial => 'Unofficial', |
unofficial => 'Unofficial', |
community => 'Communities', |
community => 'Communities', |
textbook => 'Textbook', |
textbook => 'Textbook', |
|
placement => 'Placement Tests', |
norequest => 'Not allowed', |
norequest => 'Not allowed', |
approval => 'Approval by Dom. Coord.', |
approval => 'Approval by Dom. Coord.', |
validate => 'With validation', |
validate => 'With validation', |
Line 817 sub print_username_entry_form {
|
Line 822 sub print_username_entry_form {
|
$actiontext = $lt{'srst'}; |
$actiontext = $lt{'srst'}; |
} |
} |
} elsif ($env{'form.action'} eq 'accesslogs') { |
} elsif ($env{'form.action'} eq 'accesslogs') { |
$actiontext = $lt{'srva'}; |
$actiontext = $lt{'srva'}; |
} |
} |
$r->print("<h3>$actiontext</h3>"); |
$r->print("<h3>$actiontext</h3>"); |
if ($env{'form.origform'} ne 'crtusername') { |
if ($env{'form.origform'} ne 'crtusername') { |
Line 2679 sub update_user_data {
|
Line 2684 sub update_user_data {
|
my (%alerts,%rulematch,%inst_results,%curr_rules); |
my (%alerts,%rulematch,%inst_results,%curr_rules); |
my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id'); |
my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id'); |
my @usertools = ('aboutme','blog','webdav','portfolio'); |
my @usertools = ('aboutme','blog','webdav','portfolio'); |
my @requestcourses = ('official','unofficial','community','textbook'); |
my @requestcourses = ('official','unofficial','community','textbook','placement'); |
my @requestauthor = ('requestauthor'); |
my @requestauthor = ('requestauthor'); |
my ($othertitle,$usertypes,$types) = |
my ($othertitle,$usertypes,$types) = |
&Apache::loncommon::sorted_inst_types($env{'form.ccdomain'}); |
&Apache::loncommon::sorted_inst_types($env{'form.ccdomain'}); |
Line 2793 sub update_user_data {
|
Line 2798 sub update_user_data {
|
my @adds = &Apache::loncommon::get_env_multiple('form.adhocroleadd'); |
my @adds = &Apache::loncommon::get_env_multiple('form.adhocroleadd'); |
if (&adhocrole_changes(\%changeHash)) { |
if (&adhocrole_changes(\%changeHash)) { |
$changed{'adhocroles.'.$env{'request.role.domain'}} = $changeHash{'adhocroles.'.$env{'request.role.domain'}}; |
$changed{'adhocroles.'.$env{'request.role.domain'}} = $changeHash{'adhocroles.'.$env{'request.role.domain'}}; |
} |
} |
} |
} |
} |
} |
if ($canmodify_status{'inststatus'}) { |
if ($canmodify_status{'inststatus'}) { |
Line 2858 sub update_user_data {
|
Line 2863 sub update_user_data {
|
'requestcourses.community','requestcourses.textbook', |
'requestcourses.community','requestcourses.textbook', |
'reqcrsotherdom.official','reqcrsotherdom.unofficial', |
'reqcrsotherdom.official','reqcrsotherdom.unofficial', |
'reqcrsotherdom.community','reqcrsotherdom.textbook', |
'reqcrsotherdom.community','reqcrsotherdom.textbook', |
'requestauthor','adhocroles.'.$env{'request.role.domain'}], |
'reqcrsotherdom.placement','requestauthor', |
|
'adhocroles.'.$env{'request.role.domain'}], |
$env{'form.ccdomain'},$env{'form.ccuname'}); |
$env{'form.ccdomain'},$env{'form.ccuname'}); |
my ($tmp) = keys(%userenv); |
my ($tmp) = keys(%userenv); |
if ($tmp =~ /^(con_lost|error)/i) { |
if ($tmp =~ /^(con_lost|error)/i) { |
Line 3138 sub update_user_data {
|
Line 3144 sub update_user_data {
|
if (&adhocrole_changes(\%changeHash,\%userenv)) { |
if (&adhocrole_changes(\%changeHash,\%userenv)) { |
$changed{'adhocroles'} = 1; |
$changed{'adhocroles'} = 1; |
$oldsettings{'adhocroles'} = $userenv{'adhocroles.'.$env{'request.role.domain'}}; |
$oldsettings{'adhocroles'} = $userenv{'adhocroles.'.$env{'request.role.domain'}}; |
$newsettings{'adhocroles'} = $changeHash{'adhocroles.'.$env{'request.role.domain'}}; |
$newsettings{'adhocroles'} = $changeHash{'adhocroles.'.$env{'request.role.domain'}}; |
} |
} |
} |
} |
foreach my $item (@userinfo) { |
foreach my $item (@userinfo) { |
Line 3161 sub update_user_data {
|
Line 3167 sub update_user_data {
|
($env{'user.domain'} eq $env{'form.ccdomain'})) { |
($env{'user.domain'} eq $env{'form.ccdomain'})) { |
my %newenvhash; |
my %newenvhash; |
foreach my $key (keys(%changed)) { |
foreach my $key (keys(%changed)) { |
if (($key eq 'official') || ($key eq 'unofficial') |
if (($key eq 'official') || ($key eq 'unofficial') || |
|| ($key eq 'community') || ($key eq 'textbook')) { |
($key eq 'community') || ($key eq 'textbook') || |
|
($key eq 'placement')) { |
$newenvhash{'environment.requestcourses.'.$key} = |
$newenvhash{'environment.requestcourses.'.$key} = |
$changeHash{'requestcourses.'.$key}; |
$changeHash{'requestcourses.'.$key}; |
if ($changeHash{'requestcourses.'.$key}) { |
if ($changeHash{'requestcourses.'.$key}) { |
Line 3231 sub update_user_data {
|
Line 3238 sub update_user_data {
|
\%newsettingstext); |
\%newsettingstext); |
if ($env{'form.cid'} ne $userenv{'id'}) { |
if ($env{'form.cid'} ne $userenv{'id'}) { |
&Apache::lonnet::idput($env{'form.ccdomain'}, |
&Apache::lonnet::idput($env{'form.ccdomain'}, |
{$env{'form.ccuname'} => $env{'form.cid'}}); |
{$env{'form.ccuname'} => $env{'form.cid'}},$uhome,'ids'); |
if (($recurseid) && |
if (($recurseid) && |
(&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) { |
(&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) { |
my $idresult = |
my $idresult = |
Line 3374 sub display_userinfo {
|
Line 3381 sub display_userinfo {
|
'unofficial' => 'Can Request Unofficial Courses', |
'unofficial' => 'Can Request Unofficial Courses', |
'community' => 'Can Request Communities', |
'community' => 'Can Request Communities', |
'textbook' => 'Can Request Textbook Courses', |
'textbook' => 'Can Request Textbook Courses', |
|
'placement' => 'Can Request Placement Tests', |
'requestauthor' => 'Can Request Author Role', |
'requestauthor' => 'Can Request Author Role', |
'adhocroles' => 'Ad Hoc Roles Selectable via Helpdesk Role', |
'adhocroles' => 'Ad Hoc Roles Selectable via Helpdesk Role', |
'inststatus' => "Affiliation", |
'inststatus' => "Affiliation", |
Line 3754 sub adhocrole_changes {
|
Line 3762 sub adhocrole_changes {
|
@current = split(/,/,$userenv->{$adhoc_key}); |
@current = split(/,/,$userenv->{$adhoc_key}); |
if (@dels) { |
if (@dels) { |
foreach my $curr (@current) { |
foreach my $curr (@current) { |
next if ($curr eq ''); |
next if ($curr eq ''); |
unless (grep(/\Q$curr\E$/,@dels)) { |
unless (grep(/\Q$curr\E$/,@dels)) { |
push(@saved,$curr); |
push(@saved,$curr); |
} |
} |
Line 3792 sub adhocrole_changes {
|
Line 3800 sub adhocrole_changes {
|
push(@alladhoc,@saved); |
push(@alladhoc,@saved); |
} |
} |
if (@alladhoc) { |
if (@alladhoc) { |
my $adhocstr = join(',',sort(@alladhoc)); |
my $adhocstr = join(',',sort(@alladhoc)); |
$changehashref->{$adhoc_key} = $adhocstr; |
$changehashref->{$adhoc_key} = $adhocstr; |
} elsif (@dels) { |
} elsif (@dels) { |
&Apache::lonnet::del('environment',[$adhoc_key],$env{'form.ccdomain'},$env{'form.ccuname'}); |
&Apache::lonnet::del('environment',[$adhoc_key],$env{'form.ccdomain'},$env{'form.ccuname'}); |
Line 4371 sub custom_role_editor {
|
Line 4379 sub custom_role_editor {
|
($privs{'system'},$privs{'domain'},$privs{'course'})=split(/\_/,$roledef); |
($privs{'system'},$privs{'domain'},$privs{'course'})=split(/\_/,$roledef); |
if ($privs{'system'} =~ /bre\&S/) { |
if ($privs{'system'} =~ /bre\&S/) { |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$crstype = 'Course'; |
$crstype = 'Course'; |
} elsif ($crstype eq 'Community') { |
} elsif ($crstype eq 'Community') { |
$privs{'system'} =~ s/bre\&S//; |
$privs{'system'} =~ s/bre\&S//; |
} |
} |
Line 4386 sub custom_role_editor {
|
Line 4394 sub custom_role_editor {
|
|
|
# ------------------------------------------------------- What can be assigned? |
# ------------------------------------------------------- What can be assigned? |
my %full=(); |
my %full=(); |
my %levels=( |
my %levels=( |
course => {}, |
course => {}, |
domain => {}, |
domain => {}, |
system => {}, |
system => {}, |
Line 4399 sub custom_role_editor {
|
Line 4407 sub custom_role_editor {
|
&Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent); |
&Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent); |
my ($jsback,$elements) = &crumb_utilities(); |
my ($jsback,$elements) = &crumb_utilities(); |
my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype); |
my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype); |
my $head_script = |
my $head_script = |
&Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname, |
&Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname, |
\%full,\@templateroles,$jsback); |
\%full,\@templateroles,$jsback); |
push (@{$brcrum}, |
push (@{$brcrum}, |
Line 4414 sub custom_role_editor {
|
Line 4422 sub custom_role_editor {
|
); |
); |
my $args = { bread_crumbs => $brcrum, |
my $args = { bread_crumbs => $brcrum, |
bread_crumbs_component => 'User Management'}; |
bread_crumbs_component => 'User Management'}; |
|
|
$r->print(&Apache::loncommon::start_page('Custom Role Editor', |
$r->print(&Apache::loncommon::start_page('Custom Role Editor', |
$head_script,$args). |
$head_script,$args). |
$body_top); |
$body_top); |
Line 4431 ENDCCF
|
Line 4439 ENDCCF
|
$r->print(&Apache::loncommon::end_data_table(). |
$r->print(&Apache::loncommon::end_data_table(). |
'<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'. |
'<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'. |
'<input type="hidden" name="startrolename" value="'.$env{'form.rolename'}. |
'<input type="hidden" name="startrolename" value="'.$env{'form.rolename'}. |
'" />'."\n".'<input type="hidden" name="currstate" value="" />'."\n". |
'" />'."\n".'<input type="hidden" name="currstate" value="" />'."\n". |
'<input type="reset" value="'.&mt("Reset").'" />'."\n". |
'<input type="reset" value="'.&mt("Reset").'" />'."\n". |
'<input type="submit" value="'.&mt('Save').'" /></form>'); |
'<input type="submit" value="'.&mt('Save').'" /></form>'); |
} |
} |
Line 5351 sub print_main_menu {
|
Line 5359 sub print_main_menu {
|
push(@{ $menu[0]->{items} }, # Single Users |
push(@{ $menu[0]->{items} }, # Single Users |
{ |
{ |
linktext => 'User Access Log', |
linktext => 'User Access Log', |
icon => 'document-properties.png', |
icon => 'document-properties.png', |
#help => 'User_Access_Logs', |
#help => 'User_Access_Logs', |
url => '/adm/createuser?action=accesslogs', |
url => '/adm/createuser?action=accesslogs', |
permission => $permission->{'activity'}, |
permission => $permission->{'activity'}, |
Line 5409 sub print_main_menu {
|
Line 5417 sub print_main_menu {
|
groups => 'Community Groups', |
groups => 'Community Groups', |
}, |
}, |
); |
); |
|
$linktext{'Placement'} = $linktext{'Course'}; |
|
|
my %linktitle = ( |
my %linktitle = ( |
'Course' => { |
'Course' => { |
Line 5423 sub print_main_menu {
|
Line 5432 sub print_main_menu {
|
}, |
}, |
); |
); |
|
|
|
$linktitle{'Placement'} = $linktitle{'Course'}; |
|
|
push(@{ $menu[0]->{items} }, #Category: Single Users |
push(@{ $menu[0]->{items} }, #Category: Single Users |
{ |
{ |
linktext => $linktext{$crstype}{'single'}, |
linktext => $linktext{$crstype}{'single'}, |
Line 6667 sub print_useraccesslogs_display {
|
Line 6678 sub print_useraccesslogs_display {
|
my $args = { bread_crumbs => $brcrum, |
my $args = { bread_crumbs => $brcrum, |
bread_crumbs_component => 'User Management'}; |
bread_crumbs_component => 'User Management'}; |
|
|
# set javascript |
# set javascript |
my ($jsback,$elements) = &crumb_utilities(); |
my ($jsback,$elements) = &crumb_utilities(); |
my $jsnav = &userlogdisplay_js($formname); |
my $jsnav = &userlogdisplay_js($formname); |
|
|
Line 6683 $jsnav
|
Line 6694 $jsnav
|
|
|
ENDSCRIPT |
ENDSCRIPT |
|
|
# print page header |
# print page header |
$r->print(&header($jscript,$args)); |
$r->print(&header($jscript,$args)); |
|
|
# early out unless log data can be displayed. |
# early out unless log data can be displayed. |
Line 6700 ENDSCRIPT
|
Line 6711 ENDSCRIPT
|
.&mt("User's domain must match role's domain") |
.&mt("User's domain must match role's domain") |
.'</p>' |
.'</p>' |
.&earlyout_accesslog_form($formname,$prevphasestr,$udom)); |
.&earlyout_accesslog_form($formname,$prevphasestr,$udom)); |
return; |
return; |
} |
} |
|
|
if (($uname eq '') || ($udom eq '')) { |
if (($uname eq '') || ($udom eq '')) { |
Line 6825 ENDSCRIPT
|
Line 6836 ENDSCRIPT
|
if ($rolecode eq 'au') { |
if ($rolecode eq 'au') { |
$extra = ''; |
$extra = ''; |
} elsif ($rolecode =~ /^(ca|aa)$/) { |
} elsif ($rolecode =~ /^(ca|aa)$/) { |
$extra = &mt('Authoring Space: [_1]',$name.':'.$dom); |
$extra = &mt('Authoring Space: [_1]',$name.':'.$dom); |
} elsif ($rolecode =~ /^(li|dg|dh|dc|sc)$/) { |
} elsif ($rolecode =~ /^(li|dg|dh|dc|sc)$/) { |
$extra = &mt('Domain: [_1]',$dom); |
$extra = &mt('Domain: [_1]',$dom); |
} |
} |
Line 6833 ENDSCRIPT
|
Line 6844 ENDSCRIPT
|
my $rolename; |
my $rolename; |
if ($rolecode =~ m{^cr/($match_domain)/($match_username)/(\w+)}) { |
if ($rolecode =~ m{^cr/($match_domain)/($match_username)/(\w+)}) { |
my $role = $3; |
my $role = $3; |
my $owner = "($2:$1)"; |
my $owner = "($2:$1)"; |
if ($2 eq $1.'-domainconfig') { |
if ($2 eq $1.'-domainconfig') { |
$owner = '(ad hoc)'; |
$owner = '(ad hoc)'; |
} |
} |
$rolename = &mt('Custom role: [_1]',$role.' '.$owner); |
$rolename = &mt('Custom role: [_1]',$role.' '.$owner); |
} else { |
} else { |
$rolename = &Apache::lonnet::plaintext($rolecode,$crstype); |
$rolename = &Apache::lonnet::plaintext($rolecode,$crstype); |
Line 7184 sub user_search_result {
|
Line 7195 sub user_search_result {
|
$response .= '<br />'; |
$response .= '<br />'; |
} |
} |
} else { |
} else { |
unless (($context eq 'requestcrs') && ($srch->{'srchtype'} eq 'exact')) { |
unless (($context eq 'requestcrs') && ($srch->{'srchtype'} eq 'exact')) { |
my $domd_chk = &domdirectorysrch_check($srch); |
my $domd_chk = &domdirectorysrch_check($srch); |
if ($domd_chk ne 'ok') { |
if ($domd_chk ne 'ok') { |
my $instd_chk = &instdirectorysrch_check($srch); |
my $instd_chk = &instdirectorysrch_check($srch); |