--- loncom/interface/loncreateuser.pm 2024/02/29 21:43:33 1.406.2.20.2.5 +++ loncom/interface/loncreateuser.pm 2019/04/29 22:19:24 1.451 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.406.2.20.2.5 2024/02/29 21:43:33 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.451 2019/04/29 22:19:24 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -71,7 +71,6 @@ use Apache::longroup; use Apache::lonuserutils; use Apache::loncoursequeueadmin; use LONCAPA qw(:DEFAULT :match); -use HTML::Entities; my $loginscript; # piece of javascript used in two separate instances my $authformnop; @@ -79,9 +78,10 @@ my $authformkrb; my $authformint; my $authformfsys; my $authformloc; +my $authformlti; sub initialize_authen_forms { - my ($dom,$formname,$curr_authtype,$mode,$readonly) = @_; + my ($dom,$formname,$curr_authtype,$mode) = @_; my ($krbdef,$krbdefdom) = &Apache::loncommon::get_kerberos_defaults($dom); my %param = ( formname => $formname, kerb_def_dom => $krbdefdom, @@ -89,7 +89,7 @@ sub initialize_authen_forms { domain => $dom, ); my %abv_auth = &auth_abbrev(); - if ($curr_authtype =~ /^(krb4|krb5|internal|localauth|unix):(.*)$/) { + if ($curr_authtype =~ /^(krb4|krb5|internal|localauth|unix|lti):(.*)$/) { my $long_auth = $1; my $curr_autharg = $2; my %abv_auth = &auth_abbrev(); @@ -102,15 +102,13 @@ sub initialize_authen_forms { $param{'mode'} = $mode; } } - if ($readonly) { - $param{'readonly'} = 1; - } $loginscript = &Apache::loncommon::authform_header(%param); $authformkrb = &Apache::loncommon::authform_kerberos(%param); $authformnop = &Apache::loncommon::authform_nochange(%param); $authformint = &Apache::loncommon::authform_internal(%param); $authformfsys = &Apache::loncommon::authform_filesystem(%param); $authformloc = &Apache::loncommon::authform_local(%param); + $authformlti = &Apache::loncommon::authform_lti(%param); } sub auth_abbrev { @@ -120,6 +118,7 @@ sub auth_abbrev { internal => 'int', localauth => 'loc', unix => 'fsys', + lti => 'lti', ); return %abv_auth; } @@ -127,82 +126,14 @@ sub auth_abbrev { # ==================================================== sub user_quotas { - my ($ccuname,$ccdomain,$name) = @_; + my ($ccuname,$ccdomain) = @_; my %lt = &Apache::lonlocal::texthash( + 'usrt' => "User Tools", 'cust' => "Custom quota", 'chqu' => "Change quota", ); - my ($output,$longinsttype); - my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($ccdomain); - my %titles = &Apache::lonlocal::texthash ( - portfolio => "Disk space allocated to user's portfolio files", - author => "Disk space allocated to user's Authoring Space", - ); - my ($currquota,$quotatype,$inststatus,$defquota) = - &Apache::loncommon::get_user_quota($ccuname,$ccdomain,$name); - if ($longinsttype eq '') { - if ($inststatus ne '') { - if ($usertypes->{$inststatus} ne '') { - $longinsttype = $usertypes->{$inststatus}; - } - } - } - my ($showquota,$custom_on,$custom_off,$defaultinfo,$colspan); - $custom_on = ' '; - $custom_off = ' checked="checked" '; - $colspan = ' colspan="2"'; - if ($quotatype eq 'custom') { - $custom_on = $custom_off; - $custom_off = ' '; - $showquota = $currquota; - if ($longinsttype eq '') { - $defaultinfo = &mt('For this user, the default quota would be [_1]' - .' MB.',$defquota); - } else { - $defaultinfo = &mt("For this user, the default quota would be [_1]". - " MB,[_2]as determined by the user's institutional". - " affiliation ([_3]).",$defquota,'
',$longinsttype); - } - } else { - if ($longinsttype eq '') { - $defaultinfo = &mt('For this user, the default quota is [_1]' - .' MB.',$defquota); - } else { - $defaultinfo = &mt("For this user, the default quota of [_1]". - " MB,[_2]is determined by the user's institutional". - " affiliation ([_3]).",$defquota,'
',$longinsttype); - } - } - - if (&Apache::lonnet::allowed('mpq',$ccdomain)) { - $output .= ''."\n". - ' '.$titles{$name}.''."\n". - ' '."\n". - &Apache::loncommon::start_data_table_row()."\n". - ' '. - &mt('Current quota: [_1] MB',$currquota).'  '. - $defaultinfo.''."\n". - &Apache::loncommon::end_data_table_row()."\n". - &Apache::loncommon::start_data_table_row()."\n". - ''.$lt{'chqu'}. - ':  '. - '  '. - ' '.&mt('MB').''."\n". - &Apache::loncommon::end_data_table_row()."\n"; - } - return $output; -} - -sub user_quota_js { - return <<"END_SCRIPT"; + + my $quota_javascript = <<"END_SCRIPT"; END_SCRIPT + my $longinsttype; + my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($ccdomain); + my $output = $quota_javascript."\n". + '

'.$lt{'usrt'}.'

'."\n". + &Apache::loncommon::start_data_table(); + + if ((&Apache::lonnet::allowed('mut',$ccdomain)) || + (&Apache::lonnet::allowed('udp',$ccdomain))) { + $output .= &build_tools_display($ccuname,$ccdomain,'tools'); + } -} - -sub set_custom_js { - return <<"END_SCRIPT"; - - - -END_SCRIPT + my ($showquota,$custom_on,$custom_off,$defaultinfo); + $custom_on = ' '; + $custom_off = ' checked="checked" '; + if ($quotatype eq 'custom') { + $custom_on = $custom_off; + $custom_off = ' '; + $showquota = $currquota; + if ($longinsttype eq '') { + $defaultinfo = &mt('For this user, the default quota would be [_1]' + .' MB.',$defquota); + } else { + $defaultinfo = &mt("For this user, the default quota would be [_1]". + " MB, as determined by the user's institutional". + " affiliation ([_2]).",$defquota,$longinsttype); + } + } else { + if ($longinsttype eq '') { + $defaultinfo = &mt('For this user, the default quota is [_1]' + .' MB.',$defquota); + } else { + $defaultinfo = &mt("For this user, the default quota of [_1]". + " MB, is determined by the user's institutional". + " affiliation ([_2]).",$defquota,$longinsttype); + } + } + if (&Apache::lonnet::allowed('mpq',$ccdomain)) { + $output .= ''."\n". + ' '.$titles{$name}.''."\n". + ' '."\n". + &Apache::loncommon::start_data_table_row()."\n". + ' '. + &mt('Current quota: [_1] MB',$currquota).'  '. + $defaultinfo.''."\n". + &Apache::loncommon::end_data_table_row()."\n". + &Apache::loncommon::start_data_table_row()."\n". + ' '.$lt{'chqu'}. + ':  '. + '  '. + ' '.&mt('MB').''."\n". + &Apache::loncommon::end_data_table_row()."\n"; + } + } + $output .= &Apache::loncommon::end_data_table(); + return $output; } sub build_tools_display { my ($ccuname,$ccdomain,$context) = @_; my (@usertools,%userenv,$output,@options,%validations,%reqtitles,%reqdisplay, - $colspan,$isadv,%domconfig,@defaulteditors,@customeditors); + $colspan,$isadv,%domconfig); my %lt = &Apache::lonlocal::texthash ( 'blog' => "Personal User Blog", 'aboutme' => "Personal Information Page", - 'webdav' => "WebDAV access to Authoring Spaces (https)", - 'editors' => "Available Editors", + 'webdav' => "WebDAV access to Authoring Spaces (if SSL and author/co-author)", 'portfolio' => "Personal User Portfolio", - 'timezone' => "Can set Time Zone", 'avai' => "Available", 'cusa' => "availability", 'chse' => "Change setting", @@ -290,73 +255,53 @@ sub build_tools_display { 'unofficial' => 'Can request creation of unofficial courses', 'community' => 'Can request creation of communities', 'textbook' => 'Can request creation of textbook courses', + 'placement' => 'Can request creation of placement tests', + 'lti' => 'Can request creation of LTI courses', 'requestauthor' => 'Can request author space', - 'edit' => 'Standard editor (Edit)', - 'xml' => 'Text editor (EditXML)', - 'daxe' => 'Daxe editor (Daxe)', ); - $isadv = &Apache::lonnet::is_advanced_user($ccdomain,$ccuname); if ($context eq 'requestcourses') { %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, 'requestcourses.official','requestcourses.unofficial', - 'requestcourses.community','requestcourses.textbook'); - @usertools = ('official','unofficial','community','textbook'); + 'requestcourses.community','requestcourses.textbook', + 'requestcourses.placement','requestcourses.lti'); + @usertools = ('official','unofficial','community','textbook','placement','lti'); @options =('norequest','approval','autolimit','validate'); %validations = &Apache::lonnet::auto_courserequest_checks($ccdomain); %reqtitles = &courserequest_titles(); %reqdisplay = &courserequest_display(); + $colspan = ' colspan="2"'; %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$ccdomain); + $isadv = &Apache::lonnet::is_advanced_user($ccdomain,$ccuname); } elsif ($context eq 'requestauthor') { - %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,'requestauthor'); + %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, + 'requestauthor'); @usertools = ('requestauthor'); @options =('norequest','approval','automatic'); %reqtitles = &requestauthor_titles(); %reqdisplay = &requestauthor_display(); + $colspan = ' colspan="2"'; %domconfig = &Apache::lonnet::get_dom('configuration',['requestauthor'],$ccdomain); - } elsif ($context eq 'authordefaults') { - %domconfig = - &Apache::lonnet::get_dom('configuration',['quotas','authordefaults'],$ccdomain); - %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,'tools.webdav', - 'authoreditors'); - @usertools = ('webdav','editors'); - $colspan = ' colspan="2"'; } else { %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, 'tools.aboutme','tools.portfolio','tools.blog', - 'tools.timezone'); - @usertools = ('aboutme','blog','portfolio','timezone'); - $colspan = ' colspan="2"'; + 'tools.webdav'); + @usertools = ('aboutme','blog','webdav','portfolio'); } foreach my $item (@usertools) { my ($custom_access,$curr_access,$cust_on,$cust_off,$tool_on,$tool_off, - $currdisp,$custdisp,$custradio,$onclick,$customsty,$editorsty); + $currdisp,$custdisp,$custradio); $cust_off = 'checked="checked" '; $tool_on = 'checked="checked" '; - unless (($context eq 'authordefaults') && ($item ne 'webdav')) { - $curr_access = - &Apache::lonnet::usertools_access($ccuname,$ccdomain,$item,undef, - $context,\%userenv,'', - {'is_adv' => $isadv}); - } + $curr_access = + &Apache::lonnet::usertools_access($ccuname,$ccdomain,$item,undef, + $context); if ($context eq 'requestauthor') { if ($userenv{$context} ne '') { $cust_on = ' checked="checked" '; $cust_off = ''; - } - } elsif ($context eq 'authordefaults') { - if ($item eq 'editors') { - if ($userenv{'author'.$item} ne '') { - $cust_on = ' checked="checked" '; - $cust_off = ''; - } - } elsif ($item eq 'webdav') { - if ($userenv{'tools.'.$item} ne '') { - $cust_on = ' checked="checked" '; - $cust_off = ''; - } - } + } } elsif ($userenv{$context.'.'.$item} ne '') { $cust_on = ' checked="checked" '; $cust_off = ''; @@ -364,77 +309,37 @@ sub build_tools_display { if ($context eq 'requestcourses') { if ($userenv{$context.'.'.$item} eq '') { $custom_access = &mt('Currently from default setting.'); - $customsty = ' style="display:none;"'; } else { $custom_access = &mt('Currently from custom setting.'); - $customsty = ' style="display:block;"'; } } elsif ($context eq 'requestauthor') { if ($userenv{$context} eq '') { $custom_access = &mt('Currently from default setting.'); - $customsty = ' style="display:none;"'; - } else { - $custom_access = &mt('Currently from custom setting.'); - $customsty = ' style="display:block;"'; - } - } elsif ($item eq 'editors') { - if ($userenv{'author'.$item} eq '') { - if (ref($domconfig{'authordefaults'}{'editors'}) eq 'ARRAY') { - @defaulteditors = @{$domconfig{'authordefaults'}{'editors'}}; - } else { - @defaulteditors = ('edit','xml'); - } - $custom_access = &mt('Can use: [_1]', - join(', ', map { $lt{$_} } @defaulteditors)); - $editorsty = ' style="display:none;"'; } else { $custom_access = &mt('Currently from custom setting.'); - foreach my $editor (split(/,/,$userenv{'author'.$item})) { - if ($editor =~ /^(edit|daxe|xml)$/) { - push(@customeditors,$editor); - } - } - if (@customeditors) { - if (@customeditors > 1) { - $custom_access .= '
'; - } else { - $custom_access .= ' '; - } - $custom_access .= &mt('Can use: [_1]', - join(', ', map { $lt{$_} } @customeditors)). - ''; - } else { - $custom_access .= ' '.&mt('No available editors'); - } - $editorsty = ' style="display:block;"'; } } else { - my $current = $userenv{$context.'.'.$item}; - if ($item eq 'webdav') { - $current = $userenv{'tools.webdav'}; - } - if ($current eq '') { + if ($userenv{$context.'.'.$item} eq '') { $custom_access = &mt('Availability determined currently from default setting.'); if (!$curr_access) { $tool_off = 'checked="checked" '; $tool_on = ''; } - $customsty = ' style="display:none;"'; } else { $custom_access = &mt('Availability determined currently from custom setting.'); - if ($current == 0) { + if ($userenv{$context.'.'.$item} == 0) { $tool_off = 'checked="checked" '; $tool_on = ''; } - $customsty = ' style="display:inline;"'; } } $output .= ' '."\n". ' '.$lt{$item}.''."\n". ' '."\n". &Apache::loncommon::start_data_table_row()."\n"; + if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { my ($curroption,$currlimit); my $envkey = $context.'.'.$item; @@ -460,11 +365,6 @@ sub build_tools_display { if (!$curroption) { $curroption = 'norequest'; } - my $name = 'crsreq_'.$item; - if ($context eq 'requestauthor') { - $name = $item; - } - $onclick = ' onclick="javascript:toggleCustom(this.form,'."'customtext_$item','custom$item'".');"'; if ($curroption =~ /^autolimit=(\d*)$/) { $currlimit = $1; if ($currlimit eq '') { @@ -475,7 +375,7 @@ sub build_tools_display { } else { $currdisp = $reqdisplay{$curroption}; } - $custdisp = '
'; + $custdisp = ''; foreach my $option (@options) { my $val = $option; if ($option eq 'norequest') { @@ -498,87 +398,53 @@ sub build_tools_display { $checked = ' checked="checked"'; } } - if ($option eq 'autolimit') { - $custdisp .= '
'; + my $name = 'crsreq_'.$item; + if ($context eq 'requestauthor') { + $name = $item; } - $custdisp .= ''."\n". - &Apache::loncommon::end_data_table_row()."\n"; - unless (&Apache::lonnet::allowed('udp',$ccdomain)) { - $output .= &Apache::loncommon::start_data_table_row()."\n". - ''. - $lt{'chse'}.': '.(' ' x3). - '
'. - '
'; - foreach my $editor ('edit','xml','daxe') { - my $checked; - if ($userenv{'author'.$item} eq '') { - if (grep(/^\Q$editor\E$/,@defaulteditors)) { - $checked = ' checked="checked"'; - } - } elsif (grep(/^\Q$editor\E$/,@customeditors)) { - $checked = ' checked="checked"'; - } - $output .= ' '; - } - $output .= '
'. - &Apache::loncommon::end_data_table_row()."\n"; + $custdisp .= '
'; } + $custdisp .= '
 '; if ($option eq 'autolimit') { $custdisp .= ' '. - $reqtitles{'unlimited'}.''; + 'value="'.$currlimit.'" />
'. + $reqtitles{'unlimited'}; } else { $custdisp .= ''; } - $custdisp .= ' '; - } - $custdisp .= ''; - $custradio = '
'.$custdisp; - } elsif ($item eq 'editors') { - $output .= ''.$custom_access.'
'; + $custradio = ''.&mt('Custom setting').'
'.$custdisp; } else { $currdisp = ($curr_access?&mt('Yes'):&mt('No')); my $name = $context.'_'.$item; - $onclick = 'onclick="javascript:toggleCustom(this.form,'."'customtext_$item','custom$item'".');" '; + if ($context eq 'requestauthor') { + $name = $context; + } $custdisp = '  '; - $custradio = ''. - '--'.$lt{'cusa'}.': '.$custdisp.''; - } - unless ($item eq 'editors') { - $output .= ' '.$custom_access.(' 'x4). - $lt{'avai'}.': '.$currdisp.''."\n". - &Apache::loncommon::end_data_table_row()."\n"; - unless (&Apache::lonnet::allowed('udp',$ccdomain)) { - $output .= + $tool_off.'/>'.&mt('Off').''; + $custradio = (' 'x2).'--'.$lt{'cusa'}.': '.$custdisp. + ''; + } + $output .= ' '.$custom_access.(' 'x4). + $lt{'avai'}.': '.$currdisp.''."\n". + &Apache::loncommon::end_data_table_row()."\n"; + unless (&Apache::lonnet::allowed('udp',$ccdomain)) { + $output .= &Apache::loncommon::start_data_table_row()."\n". - ''. + ' '. $lt{'chse'}.': '.(' ' x3). + $cust_off.'/>'.$lt{'usde'}.''.(' ' x3). ''; - if ($colspan) { - $output .= ''; - } - $output .= $custradio.''. - &Apache::loncommon::end_data_table_row()."\n"; - } + $cust_on.'/>'.$lt{'uscu'}.''.$custradio.''. + &Apache::loncommon::end_data_table_row()."\n"; } } return $output; @@ -592,12 +458,14 @@ sub coursereq_externaluser { 'unofficial' => 'Can request creation of unofficial courses', 'community' => 'Can request creation of communities', 'textbook' => 'Can request creation of textbook courses', + 'placement' => 'Can request creation of placement tests', ); %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, 'reqcrsotherdom.official','reqcrsotherdom.unofficial', - 'reqcrsotherdom.community','reqcrsotherdom.textbook'); - @usertools = ('official','unofficial','community','textbook'); + 'reqcrsotherdom.community','reqcrsotherdom.textbook', + 'reqcrsotherdom.placement'); + @usertools = ('official','unofficial','community','textbook','placement'); @options = ('approval','validate','autolimit'); %validations = &Apache::lonnet::auto_courserequest_checks($cdom); my $optregex = join('|',@options); @@ -664,7 +532,7 @@ sub coursereq_externaluser { sub domainrole_req { my ($ccuname,$ccdomain) = @_; return '

'. - &mt('Can Request Assignment of Domain Roles?'). + &mt('User Can Request Assignment of Domain Roles?'). '

'."\n". &Apache::loncommon::start_data_table(). &build_tools_display($ccuname,$ccdomain, @@ -672,24 +540,14 @@ sub domainrole_req { &Apache::loncommon::end_data_table(); } -sub authoring_defaults { - my ($ccuname,$ccdomain) = @_; - return '

'. - &mt('Authoring Space defaults (if role assigned)'). - '

'."\n". - &Apache::loncommon::start_data_table(). - &build_tools_display($ccuname,$ccdomain, - 'authordefaults'). - &user_quotas($ccuname,$ccdomain,'author'). - &Apache::loncommon::end_data_table(); -} - sub courserequest_titles { my %titles = &Apache::lonlocal::texthash ( official => 'Official', unofficial => 'Unofficial', community => 'Communities', textbook => 'Textbook', + placement => 'Placement Tests', + lti => 'LTI Provider', norequest => 'Not allowed', approval => 'Approval by Dom. Coord.', validate => 'With validation', @@ -1033,7 +891,15 @@ ENDBLOCK (!(($env{'form.action'} eq 'singleuser') && ($context eq 'domain') && (!&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))))) { my $defdom=$env{'request.role.domain'}; - my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain'); + my ($trusted,$untrusted); + if ($context eq 'course') { + ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('enroll',$defdom); + } elsif ($context eq 'author') { + ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('othcoau',$defdom); + } elsif ($context eq 'domain') { + ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('domroles',$defdom); + } + my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain',undef,undef,undef,$trusted,$untrusted); my %lt=&Apache::lonlocal::texthash( 'enro' => 'Enroll one student', 'enrm' => 'Enroll one member', @@ -1394,9 +1260,8 @@ sub print_user_modification_page { my $groupslist = &Apache::lonuserutils::get_groupslist(); - my $js = &validation_javascript($context,$ccdomain,$pjump_def, - $crstype,$groupslist,$newuser, - $formname,\%loaditem,$permission); + my $js = &validation_javascript($context,$ccdomain,$pjump_def,$crstype, + $groupslist,$newuser,$formname,\%loaditem); my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$ccdomain); my $helpitem = 'Course_Change_Privileges'; if ($env{'form.action'} eq 'singlestudent') { @@ -1405,7 +1270,6 @@ sub print_user_modification_page { $helpitem = 'Author_Change_Privileges'; } elsif ($context eq 'domain') { $helpitem = 'Domain_Change_Privileges'; - $js .= &set_custom_js(); } push (@{$brcrum}, {href => "javascript:backPage($form)", @@ -1431,32 +1295,6 @@ sub print_user_modification_page { if ($env{'form.popup'}) { $args->{'no_nav_bar'} = 1; } - if (($context eq 'domain') && ($env{'request.role.domain'} eq $ccdomain)) { - my @toggles; - if (&Apache::lonnet::allowed('cau',$ccdomain)) { - my ($isadv,$isauthor) = - &Apache::lonnet::is_advanced_user($ccdomain,$ccuname); - unless ($isauthor) { - push(@toggles,'requestauthor'); - } - push(@toggles,('webdav','editors')); - } - if (&Apache::lonnet::allowed('mut',$ccdomain)) { - push(@toggles,('aboutme','blog','portfolio','timezone')); - } - if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) { - push(@toggles,('official','unofficial','community','textbook')); - } - if (@toggles) { - my $onload; - foreach my $item (@toggles) { - $onload .= "toggleCustom(document.cu,'customtext_$item','custom$item');"; - } - $args->{'add_entries'} = { - 'onload' => $onload, - }; - } - } my $start_page = &Apache::loncommon::start_page('User Management',$js,$args); @@ -1493,36 +1331,18 @@ ENDFORMINFO } } my $title = ''; - my $need_quota_js; if ($newuser) { my ($portfolioform,$domroleform); 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 = '

'. - &mt('User Tools'). - '

'."\n". - &Apache::loncommon::start_data_table(); - if (&Apache::lonnet::allowed('mut',$ccdomain)) { - $portfolioform .= &build_tools_display($ccuname,$ccdomain,'tools'); - } - if (&Apache::lonnet::allowed('mpq',$ccdomain)) { - $portfolioform .= &user_quotas($ccuname,$ccdomain,'portfolio'); - $need_quota_js = 1; - } - $portfolioform .= &Apache::loncommon::end_data_table(); + $portfolioform = '
'.&user_quotas($ccuname,$ccdomain); } if ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) && ($ccdomain eq $env{'request.role.domain'})) { - $domroleform = &domainrole_req($ccuname,$ccdomain). - &authoring_defaults($ccuname,$ccdomain); - $need_quota_js = 1; - } - my $readonly; - unless ($permission->{'cusr'}) { - $readonly = 1; + $domroleform = '
'.&domainrole_req($ccuname,$ccdomain); } - &initialize_authen_forms($ccdomain,$formname,'','',$readonly); + &initialize_authen_forms($ccdomain,$formname); my %lt=&Apache::lonlocal::texthash( 'lg' => 'Login Data', 'hs' => "Home Server", @@ -1553,7 +1373,7 @@ ENDTITLE $r->print('

'.$title.'

'."\n"); $r->print('
'); $r->print(&personal_data_display($ccuname,$ccdomain,$newuser,$context, - $inst_results{$ccuname.':'.$ccdomain},$readonly)); + $inst_results{$ccuname.':'.$ccdomain})); # 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', @@ -1568,7 +1388,7 @@ $lt{'hs'}: $home_server_pick } if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) { $r->print('

'. - &mt('Can Request Creation of Courses/Communities in this Domain?').'

'. + &mt('User Can Request Creation of Courses/Communities in this Domain?').''. &Apache::loncommon::start_data_table(). &build_tools_display($ccuname,$ccdomain, 'requestcourses'). @@ -1664,55 +1484,45 @@ 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('Can Request Creation of Courses/Communities in this Domain?').'

'."\n". - &Apache::loncommon::start_data_table()); - if ($env{'request.role.domain'} eq $ccdomain) { - $r->print(&build_tools_display($ccuname,$ccdomain,'requestcourses')); + $r->print('

'.&mt('User 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','authordefaults'); + my @order = ('auth','quota','tools','requestauthor'); my %user_text; my ($isadv,$isauthor) = &Apache::lonnet::is_advanced_user($ccdomain,$ccuname); - if (((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) || + if ((!$isauthor) && + ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) || (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) && - ($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; - } + ($env{'request.role.domain'} eq $ccdomain)) { + $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain); } $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 - 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(); + $user_text{'quota'} = &user_quotas($ccuname,$ccdomain); } 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", - 'youd' => "You do not have privileges to modify the portfolio quota for this user.", + '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.", '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, Personal Information Page, or Time Zone settings for this user.", + 'yodo' => "You do not have privileges to modify Portfolio, Blog, WebDAV, or Personal Information Page 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('
'. @@ -1823,9 +1633,6 @@ 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; } @@ -1884,16 +1691,14 @@ sub date_sections_select { sub validation_javascript { my ($context,$ccdomain,$pjump_def,$crstype,$groupslist,$newuser,$formname, - $loaditem,$permission) = @_; + $loaditem) = @_; my $dc_setcourse_code = ''; my $nondc_setsection_code = ''; if ($context eq 'domain') { - 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); - } + 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))) { @@ -2349,11 +2154,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", @@ -2395,7 +2209,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); @@ -2422,6 +2236,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); @@ -2510,6 +2325,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(). @@ -2548,6 +2365,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; } @@ -2559,6 +2379,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; } @@ -2573,6 +2396,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; } @@ -2584,9 +2410,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 = ''.&Apache::loncommon::end_data_table_row() .&Apache::loncommon::end_data_table(); @@ -6995,7 +6638,6 @@ 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.', @@ -7008,24 +6650,13 @@ 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 catalog display of "Official courses (with institutional codes)".', + dc_addinst => 'Ask a domain coordinator to enable display the catalog 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.','"','"'); @@ -7516,10 +7147,9 @@ ENDSCRIPT my ($nav_script,$nav_links); # table header - my $heading = '

'. + my $tableheader = '

'. &mt('User access logs for: [_1]', - &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$udom),$uname,$udom)).'

'; - my $tableheader = $heading + &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$udom),$uname,$udom)).'' .&Apache::loncommon::start_data_table_header_row() .'' .'' @@ -7637,7 +7267,7 @@ ENDSCRIPT $r->print(&Apache::loncommon::end_data_table(). &userlogdisplay_navlinks(\%curr,$more_records)); } else { # No content displayed above - $r->print($heading.'

' + $r->print('

' .&mt('There are no records to display.') .'

'); } @@ -7826,12 +7456,12 @@ sub role_display_filter { &mt('Context:').'
'.$authformcurrent. @@ -2601,8 +2441,8 @@ sub modify_login_block { } sub personal_data_display { - my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray,$now, - $captchaform,$emailusername,$usertype,$usernameset,$condition,$excluded,$showsubmit) = @_; + my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray, + $now,$captchaform,$emailusername,$usertype,$usernameset,$condition,$excluded) = @_; my ($output,%userenv,%canmodify,%canmodify_status); my @userinfo = ('firstname','middlename','lastname','generation', 'permanentemail','id'); @@ -2685,7 +2525,7 @@ sub personal_data_display { } else { undef($condition); } - } + } if ($excluded) { unless ($excluded =~ /^\@[^\@]+$/) { undef($condition); @@ -2712,8 +2552,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". @@ -2725,13 +2565,12 @@ 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: '). - ''.(' 'x2). - ''."\n". + &mt('Use e-mail address: '). + ''."\n". + (' 'x2). + ''."\n". ''); } else { $r->print('
'.&mt('No information to display for this account request.').'
'); @@ -5617,9 +5270,8 @@ sub handler { ''.&mt('You do not have permission to modify dates or sections for users').''); } } elsif ($env{'form.action'} eq 'selfenroll') { - my %currsettings; - if ($permission->{selfenrolladmin} || $permission->{selfenrollview}) { - %currsettings = ( + if ($permission->{selfenrolladmin}) { + my %currsettings = ( selfenroll_types => $env{'course.'.$cid.'.internal.selfenroll_types'}, selfenroll_registered => $env{'course.'.$cid.'.internal.selfenroll_registered'}, selfenroll_section => $env{'course.'.$cid.'.internal.selfenroll_section'}, @@ -5635,8 +5287,6 @@ sub handler { default_enrollment_end_date => $env{'course.'.$cid.'.default_enrollment_end_date'}, uniquecode => $env{'course.'.$cid.'.internal.uniquecode'}, ); - } - if ($permission->{selfenrolladmin}) { push(@{$brcrum}, {href => '/adm/createuser?action=selfenroll', text => "Configure Self-enrollment", @@ -5657,16 +5307,6 @@ sub handler { $r->print('

'.&mt('Self-enrollment with a student role').'

'."\n"); &update_selfenroll_config($r,$cid,$cdom,$cnum,$context,$crstype,\%currsettings); } - } elsif ($permission->{selfenrollview}) { - push(@{$brcrum}, - {href => '/adm/createuser?action=selfenroll', - text => "View Self-enrollment configuration", - help => 'Course_Self_Enrollment'}); - $args = { bread_crumbs => $brcrum, - bread_crumbs_component => 'Self-enrollment Settings'}; - $r->print(&header(undef,$args)); - $r->print('

'.&mt('Self-enrollment with a student role').'

'."\n"); - &print_selfenroll_menu($r,'course',$cid,$cdom,$cnum,\%currsettings,'',1); } else { $r->print(&header(undef,{'no_nav_bar' => 1}). ''.&mt('You do not have permission to configure self-enrollment').''); @@ -5710,8 +5350,7 @@ sub handler { ''.&mt('You do not have permission to view change logs').''); } } elsif ($env{'form.action'} eq 'helpdesk') { - if (($permission->{'owner'} || $permission->{'co-owner'}) && - ($permission->{'cusr'} || $permission->{'view'})) { + if (($permission->{'owner'}) || ($permission->{'co-owner'})) { if ($env{'form.state'} eq 'process') { if ($permission->{'owner'}) { &update_helpdeskaccess($r,$permission,$brcrum); @@ -6097,6 +5736,7 @@ sub print_main_menu { groups => 'Community Groups', }, ); + $linktext{'Placement'} = $linktext{'Course'}; my %linktitle = ( 'Course' => { @@ -6111,6 +5751,8 @@ sub print_main_menu { }, ); + $linktitle{'Placement'} = $linktitle{'Course'}; + push(@{ $menu[0]->{items} }, #Category: Single Users { linktext => $linktext{$crstype}{'single'}, @@ -6138,8 +5780,7 @@ sub print_main_menu { icon => 'helpdesk-access.png', #help => 'Course_Helpdesk_Access', url => '/adm/createuser?action=helpdesk', - permission => (($permission->{'owner'} || $permission->{'co-owner'}) && - ($permission->{'view'} || $permission->{'cusr'})), + permission => ($permission->{'owner'} || $permission->{'co-owner'}), linktitle => 'Helpdesk access options', }, { @@ -6174,7 +5815,7 @@ sub print_main_menu { icon => 'selfenrl-queue.png', #help => 'Course_Approve_Selfenroll', url => '/adm/createuser?action=selfenrollqueue', - permission => $permission->{'selfenrolladmin'} || $permission->{'selfenrollview'}, + permission => $permission->{'selfenrolladmin'}, linktitle =>'Approve or reject enrollment requests.', }, ); @@ -6201,7 +5842,7 @@ sub print_main_menu { icon => 'self_enroll.png', #help => 'Course_Self_Enrollment', url => '/adm/createuser?action=selfenroll', - permission => $permission->{'selfenrolladmin'} || $permission->{'selfenrollview'}, + permission => $permission->{'selfenrolladmin'}, linktitle => 'Configure user self-enrollment.', }, ); @@ -6450,7 +6091,8 @@ ENDSCRIPT '// ]]>'."\n". ''."\n". '

'.$lt->{'selfenroll'}.'

'."\n"; - my $visactions = &cat_visibility($cdom); + + my $visactions = &cat_visibility(); my ($cathash,%cattype); my %domconfig = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); if (ref($domconfig{'coursecategories'}) eq 'HASH') { @@ -6613,10 +6255,11 @@ ENDSCRIPT } elsif ($curr_types eq '') { $add_domtitle = &mt('Users in other domain:'); } + my ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('enroll',$cdom); $output .= &Apache::loncommon::start_data_table_row() .'
'.$add_domtitle.'
' .&Apache::loncommon::select_dom_form('','selfenroll_newdom', - $includeempty,$showdomdesc,'','','',$readonly) + $includeempty,$showdomdesc,'',$trusted,$untrusted,$readonly) .'' .'
 '.&mt('When').'