--- loncom/interface/domainprefs.pm 2024/02/25 05:54:21 1.160.6.118.2.18 +++ loncom/interface/domainprefs.pm 2019/04/26 20:22:18 1.356 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.160.6.118.2.18 2024/02/25 05:54:21 raeburn Exp $ +# $Id: domainprefs.pm,v 1.356 2019/04/26 20:22:18 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -104,8 +104,8 @@ $datatable - HTML containing form eleme In the case of course requests, radio buttons are displayed for each institutional affiliate type (and also default, and _LC_adv) for each of the course types -(official, unofficial, community, textbook, and lti). -In each case the radio buttons allow the selection of one of four values: +(official, unofficial, community, textbook, placement, and lti). +In each case the radio buttons allow the selection of one of four values: 0, approval, validate, autolimit=N (where N is blank, or a positive integer). which have the following effects: @@ -167,17 +167,15 @@ use Apache::lonmsg(); use Apache::lonconfigsettings; use Apache::lonuserutils(); use Apache::loncoursequeueadmin(); -use Apache::courseprefs(); use LONCAPA qw(:DEFAULT :match); use LONCAPA::Enrollment; use LONCAPA::lonauthcgi(); +use LONCAPA::SSL; use File::Copy; use Locale::Language; use DateTime::TimeZone; use DateTime::Locale; use Time::HiRes qw( sleep ); -use Net::CIDR; -use Crypt::CBC; my $registered_cleanup; my $modified_urls; @@ -221,27 +219,16 @@ sub handler { 'serverstatuses','requestcourses','helpsettings', 'coursedefaults','usersessions','loadbalancing', 'requestauthor','selfenrollment','inststatus', - 'passwords','ltitools','toolsec','lti','ltisec', - 'wafproxy','ipaccess'],$dom); + 'ltitools','ssl','trust','lti','passwords'],$dom); my %encconfig = - &Apache::lonnet::get_dom('encconfig',['ltitools','lti','linkprot'],$dom,undef,1); - my ($checked_is_home,$is_home); + &Apache::lonnet::get_dom('encconfig',['ltitools','lti'],$dom); if (ref($domconfig{'ltitools'}) eq 'HASH') { if (ref($encconfig{'ltitools'}) eq 'HASH') { - my $home = &Apache::lonnet::domain($dom,'primary'); - unless (($home eq 'no_host') || ($home eq '')) { - my @ids=&Apache::lonnet::current_machine_ids(); - if (grep(/^\Q$home\E$/,@ids)) { - $is_home = 1; - } - } - $checked_is_home = 1; foreach my $id (keys(%{$domconfig{'ltitools'}})) { if ((ref($domconfig{'ltitools'}{$id}) eq 'HASH') && (ref($encconfig{'ltitools'}{$id}) eq 'HASH')) { - $domconfig{'ltitools'}{$id}{'key'} = $encconfig{'ltitools'}{$id}{'key'}; - if (($is_home) && ($phase eq 'process')) { - $domconfig{'ltitools'}{$id}{'secret'} = $encconfig{'ltitools'}{$id}{'secret'}; + foreach my $item ('key','secret') { + $domconfig{'ltitools'}{$id}{$item} = $encconfig{'ltitools'}{$id}{$item}; } } } @@ -249,50 +236,22 @@ sub handler { } if (ref($domconfig{'lti'}) eq 'HASH') { if (ref($encconfig{'lti'}) eq 'HASH') { - unless ($checked_is_home) { - my $home = &Apache::lonnet::domain($dom,'primary'); - unless (($home eq 'no_host') || ($home eq '')) { - my @ids=&Apache::lonnet::current_machine_ids(); - if (grep(/^\Q$home\E$/,@ids)) { - $is_home = 1; - } - } - $checked_is_home = 1; - } foreach my $id (keys(%{$domconfig{'lti'}})) { if ((ref($domconfig{'lti'}{$id}) eq 'HASH') && (ref($encconfig{'lti'}{$id}) eq 'HASH')) { - $domconfig{'lti'}{$id}{'key'} = $encconfig{'lti'}{$id}{'key'}; - if (($is_home) && ($phase eq 'process')) { - $domconfig{'lti'}{$id}{'secret'} = $encconfig{'lti'}{$id}{'secret'}; + foreach my $item ('key','secret') { + $domconfig{'lti'}{$id}{$item} = $encconfig{'lti'}{$id}{$item}; } } } } } - if (ref($domconfig{'ltisec'}) eq 'HASH') { - if (ref($domconfig{'ltisec'}{'linkprot'}) eq 'HASH') { - if (ref($encconfig{'linkprot'}) eq 'HASH') { - foreach my $id (keys(%{$domconfig{'ltisec'}{'linkprot'}})) { - unless ($id =~ /^\d+$/) { - delete($domconfig{'ltisec'}{'linkprot'}{$id}); - } - if ((ref($domconfig{'ltisec'}{'linkprot'}{$id}) eq 'HASH') && - (ref($encconfig{'linkprot'}{$id}) eq 'HASH')) { - foreach my $item ('key','secret') { - $domconfig{'ltisec'}{'linkprot'}{$id}{$item} = $encconfig{'linkprot'}{$id}{$item}; - } - } - } - } - } - } - my @prefs_order = ('rolecolors','login','ipaccess','defaults','wafproxy','passwords', - 'quotas','autoenroll','autoupdate','autocreate','directorysrch', - 'contacts','usercreation','selfcreation','usermodification', - 'scantron','requestcourses','requestauthor','coursecategories', + my @prefs_order = ('rolecolors','login','defaults','passwords','quotas','autoenroll', + 'autoupdate','autocreate','directorysrch','contacts', + 'usercreation','selfcreation','usermodification','scantron', + 'requestcourses','requestauthor','coursecategories', 'serverstatuses','helpsettings','coursedefaults', - 'ltitools','selfenrollment','usersessions','lti'); + 'ltitools','selfenrollment','usersessions','ssl','trust','lti'); my %existing; if (ref($domconfig{'loadbalancing'}) eq 'HASH') { %existing = %{$domconfig{'loadbalancing'}}; @@ -323,10 +282,7 @@ sub handler { {col1 => 'Log-in Help', col2 => 'Value'}, {col1 => 'Custom HTML in document head', - col2 => 'Value'}, - {col1 => 'SSO', - col2 => 'Dual login: SSO and non-SSO options'}, - ], + col2 => 'Value'}], print => \&print_login, modify => \&modify_login, }, @@ -336,23 +292,10 @@ sub handler { header => [{col1 => 'Setting', col2 => 'Value'}, {col1 => 'Institutional user types', - col2 => 'Name displayed'}, - {col1 => 'Mapping for missing usernames via standard log-in', - col2 => 'Rules in use'}], + col2 => 'Name displayed'}], print => \&print_defaults, modify => \&modify_defaults, }, - 'wafproxy' => - { text => 'Web Application Firewall/Reverse Proxy', - help => 'Domain_Configuration_WAF_Proxy', - header => [{col1 => 'Domain(s)', - col2 => 'Servers and WAF/Reverse Proxy alias(es)', - }, - {col1 => 'Domain(s)', - col2 => 'WAF Configuration',}], - print => \&print_wafproxy, - modify => \&modify_wafproxy, - }, 'passwords' => { text => 'Passwords (Internal authentication)', help => 'Domain_Configuration_Passwords', @@ -368,7 +311,7 @@ sub handler { modify => \&modify_passwords, }, 'quotas' => - { text => 'Blogs, personal pages/timezones, webDAV/quotas, portfolio', + { text => 'Blogs, personal web pages, webDAV/quotas, portfolios', help => 'Domain_Configuration_Quotas', header => [{col1 => 'User affiliation', col2 => 'Available tools', @@ -553,6 +496,14 @@ sub handler { print => \&print_selfenrollment, modify => \&modify_selfenrollment, }, + 'privacy' => + {text => 'User Privacy', + help => 'Domain_Configuration_User_Privacy', + header => [{col1 => 'Setting', + col2 => 'Value',}], + print => \&print_privacy, + modify => \&modify_privacy, + }, 'usersessions' => {text => 'User session hosting/offloading', help => 'Domain_Configuration_User_Sessions', @@ -576,42 +527,60 @@ sub handler { print => \&print_loadbalancing, modify => \&modify_loadbalancing, }, - 'ltitools' => + 'ltitools' => {text => 'External Tools (LTI)', help => 'Domain_Configuration_LTI_Tools', - header => [{col1 => 'Encryption of shared secrets', - col2 => 'Settings'}, - {col1 => 'Rules for shared secrets', - col2 => 'Settings'}, - {col1 => 'Providers', - col2 => 'Settings',}], + header => [{col1 => 'Setting', + col2 => 'Value',}], print => \&print_ltitools, modify => \&modify_ltitools, }, - 'lti' => - {text => 'LTI Link Protection and LTI Consumers', + 'ssl' => + {text => 'LON-CAPA Network (SSL)', + help => 'Domain_Configuration_Network_SSL', + header => [{col1 => 'Server', + col2 => 'Certificate Status'}, + {col1 => 'Connections to other servers', + col2 => 'Rules'}, + {col1 => 'Connections from other servers', + col2 => 'Rules'}, + {col1 => "Replicating domain's published content", + col2 => 'Rules'}], + print => \&print_ssl, + modify => \&modify_ssl, + }, + 'trust' => + {text => 'Trust Settings', + help => 'Domain_Configuration_Trust', + header => [{col1 => "Access to this domain's content by others", + col2 => 'Rules'}, + {col1 => "Access to other domain's content by this domain", + col2 => 'Rules'}, + {col1 => "Enrollment in this domain's courses by others", + col2 => 'Rules',}, + {col1 => "Co-author roles in this domain for others", + col2 => 'Rules',}, + {col1 => "Co-author roles for this domain's users elsewhere", + col2 => 'Rules',}, + {col1 => "Domain roles in this domain assignable to others", + col2 => 'Rules'}, + {col1 => "Course catalog for this domain displayed elsewhere", + col2 => 'Rules'}, + {col1 => "Requests for creation of courses in this domain by others", + col2 => 'Rules'}, + {col1 => "Users in other domains can send messages to this domain", + col2 => 'Rules'},], + print => \&print_trust, + modify => \&modify_trust, + }, + 'lti' => + {text => 'LTI Provider', help => 'Domain_Configuration_LTI_Provider', - header => [{col1 => 'Encryption of shared secrets', - col2 => 'Settings'}, - {col1 => 'Rules for shared secrets', - col2 => 'Settings'}, - {col1 => 'Link Protectors in Courses', - col2 => 'Values'}, - {col1 => 'Link Protectors', - col2 => 'Settings'}, - {col1 => 'Consumers', - col2 => 'Settings'},], + header => [{col1 => 'Setting', + col2 => 'Value',}], print => \&print_lti, modify => \&modify_lti, }, - 'ipaccess' => - {text => 'IP-based access control', - help => 'Domain_Configuration_IP_Access', - header => [{col1 => 'Setting', - col2 => 'Value'},], - print => \&print_ipaccess, - modify => \&modify_ipaccess, - }, ); if (keys(%servers) > 1) { $prefs{'login'} = { text => 'Log-in page options', @@ -619,14 +588,11 @@ sub handler { header => [{col1 => 'Log-in Service', col2 => 'Server Setting',}, {col1 => 'Log-in Page Items', - col2 => 'Settings'}, + col2 => ''}, {col1 => 'Log-in Help', col2 => 'Value'}, {col1 => 'Custom HTML in document head', - col2 => 'Value'}, - {col1 => 'SSO', - col2 => 'Dual login: SSO and non-SSO options'}, - ], + col2 => 'Value'}], print => \&print_login, modify => \&modify_login, }; @@ -667,8 +633,6 @@ $javascript_validations $coursebrowserjs END - } elsif (grep(/^ipaccess$/,@actions)) { - $js .= &Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'}); } if (grep(/^selfcreation$/,@actions)) { $js .= &selfcreate_javascript(); @@ -801,14 +765,14 @@ sub process_changes { $output = &modify_loadbalancing($dom,%domconfig); } elsif ($action eq 'ltitools') { $output = &modify_ltitools($r,$dom,$action,$lastactref,%domconfig); + } elsif ($action eq 'ssl') { + $output = &modify_ssl($dom,$lastactref,%domconfig); + } elsif ($action eq 'trust') { + $output = &modify_trust($dom,$lastactref,%domconfig); } elsif ($action eq 'lti') { $output = &modify_lti($r,$dom,$action,$lastactref,%domconfig); } elsif ($action eq 'passwords') { $output = &modify_passwords($r,$dom,$confname,$lastactref,%domconfig); - } elsif ($action eq 'wafproxy') { - $output = &modify_wafproxy($dom,$action,$lastactref,%domconfig); - } elsif ($action eq 'ipaccess') { - $output = &modify_ipaccess($dom,$lastactref,%domconfig); } return $output; } @@ -822,7 +786,7 @@ sub print_config_box { } elsif ($action eq 'defaults') { $output = &defaults_javascript($settings); } elsif ($action eq 'passwords') { - $output = &passwords_javascript($action); + $output = &passwords_javascript(); } elsif ($action eq 'helpsettings') { my (%privs,%levelscurrent); my %full=(); @@ -837,23 +801,12 @@ sub print_config_box { &Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent); my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype); $output = - &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full, + &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full, \@templateroles); } elsif ($action eq 'ltitools') { - $output .= &Apache::lonconfigsettings::ltitools_javascript($settings); + $output .= <itools_javascript($settings); } elsif ($action eq 'lti') { - $output .= &passwords_javascript('ltisecrets')."\n". - <i_javascript($dom,$settings); - } elsif ($action eq 'wafproxy') { - $output .= &wafproxy_javascript($dom); - } elsif ($action eq 'autoupdate') { - $output .= &autoupdate_javascript(); - } elsif ($action eq 'autoenroll') { - $output .= &autoenroll_javascript(); - } elsif ($action eq 'login') { - $output .= &saml_javascript(); - } elsif ($action eq 'ipaccess') { - $output .= &ipaccess_javascript($settings); + $output .= <i_javascript($settings); } $output .= ' @@ -870,32 +823,28 @@ sub print_config_box { if ($numheaders > 1) { my $colspan = ''; my $rightcolspan = ''; - my $leftnobr = ''; if (($action eq 'rolecolors') || ($action eq 'defaults') || ($action eq 'directorysrch') || - (($action eq 'login') && ($numheaders < 5))) { + (($action eq 'login') && ($numheaders < 4))) { $colspan = ' colspan="2"'; } if ($action eq 'usersessions') { $rightcolspan = ' colspan="3"'; } - if ($action eq 'passwords') { - $leftnobr = ' LC_nobreak'; - } $output .= ' - - - + '; + my @trusthdrs = qw(2 3 4 5 6 7); + my @prefixes = qw(enroll othcoau coaurem domroles catalog reqcrs); + for (my $i=0; $i<@trusthdrs; $i++) { + $output .= ' + + + '; + } + $output .= ' + + @@ -966,19 +927,18 @@ sub print_config_box { @@ -987,30 +947,53 @@ sub print_config_box { '; - } else { - $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); + } else { + $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); + } } $rowtotal ++; } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || - ($action eq 'directorysrch') || ($action eq 'helpsettings') || - ($action eq 'wafproxy')) { + ($action eq 'defaults') || ($action eq 'directorysrch') || + ($action eq 'helpsettings')) { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } elsif ($action eq 'scantron') { $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal); + } elsif ($action eq 'ssl') { + $output .= $item->{'print'}->('connto',$dom,$settings,\$rowtotal).' +
- + '; $rowtotal ++; if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') || ($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') || - ($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'directorysrch') || - ($action eq 'helpsettings') || ($action eq 'contacts') || ($action eq 'wafproxy') || - ($action eq 'lti') || ($action eq 'ltitools')) { + ($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'ssl') || + ($action eq 'directorysrch') || ($action eq 'trust') || ($action eq 'helpsettings') || + ($action eq 'contacts')) { $output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); } elsif ($action eq 'passwords') { $output .= $item->{'print'}->('top',$dom,$confname,$settings,\$rowtotal); @@ -904,7 +853,7 @@ sub print_config_box { } elsif ($action eq 'scantron') { $output .= $item->{'print'}->($r,'top',$dom,$confname,$settings,\$rowtotal); } elsif ($action eq 'login') { - if ($numheaders == 5) { + if ($numheaders == 4) { $colspan = ' colspan="2"'; $output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal); } else { @@ -929,36 +878,48 @@ sub print_config_box { $rowtotal ++; if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') || ($action eq 'selfenrollment') || - ($action eq 'usersessions') || ($action eq 'coursecategories') || - ($action eq 'contacts') || ($action eq 'passwords') || - ($action eq 'defaults') || ($action eq 'lti') || - ($action eq 'ltitools')) { + ($action eq 'usersessions') || ($action eq 'coursecategories') || + ($action eq 'trust') || ($action eq 'contacts') || ($action eq 'passwords')) { if ($action eq 'coursecategories') { $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); $colspan = ' colspan="2"'; + } elsif ($action eq 'trust') { + $output .= $item->{'print'}->('shared',$dom,$settings,\$rowtotal); } elsif ($action eq 'passwords') { $output .= $item->{'print'}->('middle',$dom,$confname,$settings,\$rowtotal); - } elsif ($action eq 'lti') { - $output .= $item->{'print'}->('upper',$dom,$settings,\$rowtotal).' -
'.&mt($item->{'header'}->[0]->{'col1'}).''.&mt($item->{'header'}->[0]->{'col1'}).' '.&mt($item->{'header'}->[0]->{'col2'}).'
-
- - - - - '."\n". - $item->{'print'}->('middle',$dom,$settings,\$rowtotal); } else { $output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal); } - my $hdridx = 2; - if ($action eq 'lti') { - $hdridx = 3; - } - $output .= ' + if ($action eq 'trust') { + $output .= ' +
'.&mt($item->{'header'}->[2]->{'col1'}).''.&mt($item->{'header'}->[2]->{'col2'}).'
+
+ + + + '. + $item->{'print'}->($prefixes[$i],$dom,$settings,\$rowtotal).' +
'.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col1'}).''.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col2'}).'
+
+ + + + '. + $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); + } else { + $output .= '
'.&mt($item->{'header'}->[8]->{'col1'}).''.&mt($item->{'header'}->[8]->{'col2'}).'
- - + + '."\n"; - if ($action eq 'coursecategories') { - $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); - } elsif (($action eq 'contacts') || ($action eq 'passwords')) { - if ($action eq 'passwords') { - $output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal); - } else { - $output .= $item->{'print'}->('lower',$dom,$settings,\$rowtotal); - } - $hdridx ++; - $output .= ' + if ($action eq 'coursecategories') { + $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); + } elsif (($action eq 'contacts') || ($action eq 'passwords')) { + if ($action eq 'passwords') { + $output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal); + } else { + $output .= $item->{'print'}->('lower',$dom,$settings,\$rowtotal); + } + $output .= '
'.&mt($item->{'header'}->[$hdridx]->{'col1'}).''.&mt($item->{'header'}->[$hdridx]->{'col2'}).''.&mt($item->{'header'}->[2]->{'col1'}).''.&mt($item->{'header'}->[2]->{'col2'}).'
- - '."\n"; - if ($action eq 'passwords') { - $output .= $item->{'print'}->('bottom',$dom,$confname,$settings,\$rowtotal); - } else { - $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); - } - $output .= ' + + '."\n"; + if ($action eq 'passwords') { + $output .= $item->{'print'}->('bottom',$dom,$confname,$settings,\$rowtotal); + } else { + $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); + } + $output .= '
'.&mt($item->{'header'}->[$hdridx]->{'col1'}).''.&mt($item->{'header'}->[$hdridx]->{'col2'}).'
'.&mt($item->{'header'}->[3]->{'col1'}).''.&mt($item->{'header'}->[3]->{'col2'}).'
+ + + + + + + + '. + $item->{'print'}->('connfrom',$dom,$settings,\$rowtotal).' +
'.&mt($item->{'header'}->[2]->{'col1'}).''.&mt($item->{'header'}->[2]->{'col2'}).'
+ + + + + + + + '. + $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } elsif ($action eq 'login') { - if ($numheaders == 5) { + if ($numheaders == 4) { $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
'.&mt($item->{'header'}->[3]->{'col1'}).''.&mt($item->{'header'}->[3]->{'col2'}).'
@@ -1034,7 +1017,7 @@ sub print_config_box { '; - if ($numheaders == 5) { + if ($numheaders == 4) { $output .= ' @@ -1046,27 +1029,7 @@ sub print_config_box { '; } $rowtotal ++; - $output .= &print_login('headtag',$dom,$confname,$phase,$settings,\$rowtotal).' -
'.&mt($item->{'header'}->[3]->{'col1'}).' '.&mt($item->{'header'}->[3]->{'col2'}).'
- - - - - - '; - if ($numheaders == 5) { - $output .= ' - - - '; - } else { - $output .= ' - - - '; - } - $rowtotal ++; - $output .= &print_login('saml',$dom,$confname,$phase,$settings,\$rowtotal); + $output .= &print_login('headtag',$dom,$confname,$phase,$settings,\$rowtotal); } elsif ($action eq 'requestcourses') { $output .= &print_requestmail($dom,$action,$settings,\$rowtotal); $rowtotal ++; @@ -1099,8 +1062,8 @@ sub print_config_box { '; } return $output; } @@ -9224,34 +8233,18 @@ sub print_defaults { } elsif ($item eq 'lang_def') { my $includeempty = 1; $datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty); - } elsif ($item eq 'portal_def') { - $datatable .= ''; - my $portalsty = 'none'; - if ($defaults{$item}) { - $portalsty = 'block'; - } - foreach my $field ('email','web') { - my $checkedoff = ' checked="checked"'; - my $checkedon; - if ($defaults{$item.'_'.$field}) { - $checkedon = $checkedoff; - $checkedoff = ''; - } - $datatable .= '
'. - ''.$titles->{$field}.' '. - ''. - (' 'x2). - ''. - '
'; - } } else { - $datatable .= ''; + my $size; + if ($item eq 'portal_def') { + $size = ' size="25"'; + } + $datatable .= ''; } $datatable .= ''; $rownum ++; } - } elsif ($position eq 'middle') { + } else { my %defaults; if (ref($settings) eq 'HASH') { if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { @@ -9275,7 +8268,7 @@ sub print_defaults { $datatable .= ' '.&mt('Internal ID:').' '.$item.' '. ''. &mt('delete').''. - ''; } @@ -9294,29 +8287,13 @@ sub print_defaults { $datatable .= ' '.&mt('Internal ID:'). ''. ' '.&mt('(new)'). - ''. ''."\n"; $rownum ++; } } - } else { - my ($unamemaprules,$ruleorder) = - &Apache::lonnet::inst_userrules($dom,'unamemap'); - $css_class = $rownum%2?' class="LC_odd_row"':''; - if ((ref($unamemaprules) eq 'HASH') && (ref($ruleorder) eq 'ARRAY')) { - my $numinrow = 2; - $datatable .= ''; - } - if ($datatable eq '') { - $datatable .= ''; - } } $$rowtotal += $rownum; return $datatable; @@ -9342,8 +8319,6 @@ sub defaults_titles { 'timezone_def' => 'Default timezone', 'datelocale_def' => 'Default locale for dates', 'portal_def' => 'Portal/Default URL', - 'email' => 'Email links use portal URL', - 'web' => 'Public web links use portal URL', 'intauth_cost' => 'Encryption cost for bcrypt (positive integer)', 'intauth_check' => 'Check bcrypt cost if authenticated', 'intauth_switch' => 'Existing crypt-based switched to bcrypt on authentication', @@ -9529,7 +8504,7 @@ sub print_scantronformat { } $datatable .= ''; if (keys(%error) == 0) { - $datatable .= ''. ''. @@ -9825,8 +8812,22 @@ sub print_coursecategories { $can_catcomm_dom.' value="dom" />'.$level{'dom'}.' '. ''. + ''. + ''. + ''. + ''. + ''. + ''. ''; - $$rowtotal += 4; + $$rowtotal += 6; } else { my $css_class; my $itemcount = 1; @@ -9851,12 +8852,15 @@ sub print_coursecategories { my %default_names = ( instcode => &mt('Official courses'), communities => &mt('Communities'), + placement => &mt('Placement Tests'), ); if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '') || (!grep(/^communities$/,@{$cats[0]})) || - ($cathash->{'communities::0'} eq '')) { + ($cathash->{'communities::0'} eq '') || + (!grep(/^placement$/,@{$cats[0]})) || + ($cathash->{'placement::0'} eq '')) { $maxnum ++; } my $lastidx; @@ -9877,7 +8881,7 @@ sub print_coursecategories { $datatable .= ''; } $datatable .= '
'.&mt($item->{'header'}->[4]->{'col1'}).''.&mt($item->{'header'}->[4]->{'col2'}).'
'.&mt($item->{'header'}->[3]->{'col1'}).''.&mt($item->{'header'}->[3]->{'col2'}).'
- - + + '. &print_validation_rows('requestcourses',$dom,$settings,\$rowtotal); } elsif ($action eq 'requestauthor') { @@ -1115,9 +1078,9 @@ sub print_config_box { '; + $itemcount ++; + } + } else { + my $prefix = 'replication'; + my @types = ('certreq','nocertreq'); + if (keys(%by_location) == 0) { + $datatable .= ''; $itemcount ++; + } else { + ($datatable,$itemcount) = + &rules_by_location($settings,$prefix,\%by_location,\%by_ip,\@types,\%titles); } } } @@ -7514,10 +6479,60 @@ sub print_usersessions { return $datatable; } +sub ssl_titles { + return &Apache::lonlocal::texthash ( + dom => 'LON-CAPA servers/VMs from same domain', + intdom => 'LON-CAPA servers/VMs from same "internet" domain', + other => 'External LON-CAPA servers/VMs', + connto => 'Connections to other servers', + connfrom => 'Connections from other servers', + replication => 'Replicating content to other institutions', + certreq => 'Client certificate required, but specific domains exempt', + nocertreq => 'No client certificate required, except for specific domains', + no => 'SSL not used', + yes => 'SSL Optional (used if available)', + req => 'SSL Required', + ); +} + +sub print_trust { + my ($prefix,$dom,$settings,$rowtotal) = @_; + my ($css_class,$datatable,%checked,%choices); + my (%by_ip,%by_location,@intdoms,@instdoms); + &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms); + my $itemcount = 1; + my %titles = &trust_titles(); + my @types = ('exc','inc'); + if ($prefix eq 'top') { + $prefix = 'content'; + } elsif ($prefix eq 'bottom') { + $prefix = 'msg'; + } + ($datatable,$itemcount) = &rules_by_location($settings,$prefix,\%by_location,\%by_ip,\@types,\%titles); + $$rowtotal += $itemcount; + return $datatable; +} + +sub trust_titles { + return &Apache::lonlocal::texthash( + content => "Access to this domain's content by others", + shared => "Access to other domain's content by this domain", + enroll => "Enrollment in this domain's courses by others", + othcoau => "Co-author roles in this domain for others", + coaurem => "Co-author roles for this domain's users elsewhere", + domroles => "Domain roles in this domain assignable to others", + catalog => "Course Catalog for this domain displayed elsewhere", + reqcrs => "Requests for creation of courses in this domain by others", + msg => "Users in other domains can send messages to this domain", + exc => "Allow all, but exclude specific domains", + inc => "Deny all, but include specific domains", + ); +} + sub build_location_hashes { - my ($intdoms,$by_ip,$by_location) = @_; + my ($intdoms,$by_ip,$by_location,$instdoms) = @_; return unless((ref($intdoms) eq 'ARRAY') && (ref($by_ip) eq 'HASH') && - (ref($by_location) eq 'HASH')); + (ref($by_location) eq 'HASH') && (ref($instdoms) eq 'ARRAY')); my %iphost = &Apache::lonnet::get_iphost(); my $primary_id = &Apache::lonnet::domain($env{'request.role.domain'},'primary'); my $primary_ip = &Apache::lonnet::get_host_ip($primary_id); @@ -7534,7 +6549,13 @@ sub build_location_hashes { foreach my $id (@{$iphost{$ip}}) { my $location = &Apache::lonnet::internet_dom($id); if ($location) { - next if (grep(/^\Q$location\E$/,@{$intdoms})); + if (grep(/^\Q$location\E$/,@{$intdoms})) { + my $dom = &Apache::lonnet::host_domain($id); + unless (grep(/^\Q$dom\E/,@{$instdoms})) { + push(@{$instdoms},$dom); + } + next; + } if (ref($by_ip->{$ip}) eq 'ARRAY') { unless(grep(/^\Q$location\E$/,@{$by_ip->{$ip}})) { push(@{$by_ip->{$ip}},$location); @@ -7642,8 +6663,7 @@ sub current_offloads_to { } sub spares_row { - my ($dom,$servers,$spareid,$serverhomes,$altids,$other_insts, - $curroffloadnow,$curroffloadoth,$rowtotal) = @_; + my ($dom,$servers,$spareid,$serverhomes,$altids,$curroffloadnow,$rowtotal) = @_; my $css_class; my $numinrow = 4; my $itemcount = 1; @@ -7663,17 +6683,12 @@ sub spares_row { } } next unless (ref($spareid->{$server}) eq 'HASH'); - my ($checkednow,$checkedoth); + my $checkednow; if (ref($curroffloadnow) eq 'HASH') { if ($curroffloadnow->{$server}) { $checkednow = ' checked="checked"'; } } - if (ref($curroffloadoth) eq 'HASH') { - if ($curroffloadoth->{$server}) { - $checkedoth = ' checked="checked"'; - } - } $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; $datatable .= ' '. - ''."\n". '\n". + "\n". ''; + $output .= '
'.&mt($item->{'header'}->[4]->{'col1'}).''.&mt($item->{'header'}->[4]->{'col2'}).''.&mt($item->{'header'}->[4]->{'col1'}).''.&mt($item->{'header'}->[4]->{'col2'}).'
- - '. &print_rolecolors($phase,'author',$dom,$confname,$settings,\$rowtotal).' @@ -1145,30 +1108,30 @@ sub print_config_box { '; } elsif ($action eq 'serverstatuses') { $output .= ' - '; } else { $output .= ' - '; + '; } if (defined($item->{'header'}->[0]->{'col3'})) { - $output .= ''; if ($item->{'header'}->[0]->{'col3'}) { if (defined($item->{'header'}->[0]->{'col4'})) { - $output .= ''; } if ($item->{'header'}->[0]->{'col4'}) { - $output .= ''; @@ -1185,8 +1148,8 @@ sub print_config_box { if ($action eq 'quotas') { $output .= &print_quotas($dom,$settings,\$rowtotal,$action); } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || - ($action eq 'serverstatuses') || ($action eq 'loadbalancing') || - ($action eq 'ipaccess')) { + ($action eq 'serverstatuses') || ($action eq 'loadbalancing') || + ($action eq 'ltitools') || ($action eq 'lti')) { $output .= $item->{'print'}->($dom,$settings,\$rowtotal); } } @@ -1200,18 +1163,15 @@ sub print_config_box { sub print_login { my ($caller,$dom,$confname,$phase,$settings,$rowtotal) = @_; - my ($css_class,$datatable,$switchserver,%lt); + my ($css_class,$datatable); my %choices = &login_choices(); - if (($caller eq 'help') || ($caller eq 'headtag') || ($caller eq 'saml')) { - %lt = &login_file_options(); - $switchserver = &check_switchserver($dom,$confname); - } + if ($caller eq 'service') { my %servers = &Apache::lonnet::internet_dom_servers($dom); my $choice = $choices{'disallowlogin'}; $css_class = ' class="LC_odd_row"'; $datatable .= ''. - ''."\n"; - $$itemcount ++; - } - } - $css_class = $$itemcount%2?' class="LC_odd_row"':''; - $datatable .= ''."\n". - ''."\n"; - return $datatable; -} - sub print_coursedefaults { my ($position,$dom,$settings,$rowtotal) = @_; my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles); my $itemcount = 1; my %choices = &Apache::lonlocal::texthash ( + canuse_pdfforms => 'Course/Community users can create/upload PDF forms', uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)', - coursequota => 'Default cumulative quota for all group portfolio spaces in course', anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys', coursecredits => 'Credits can be specified for courses', uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)', usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)', - inline_chem => 'Use inline previewer for chemical reaction response in place of pop-up', texengine => 'Default method to display mathematics', postsubmit => 'Disable submit button/keypress following student submission', canclone => "People who may clone a course (besides course's owner and coordinators)", mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver', - ltiauth => 'Student username in LTI launch of deep-linked URL can be accepted without re-authentication', - domexttool => 'External Tools defined in the domain may be used in courses/communities (by type)', - exttool => 'External Tools can be defined and configured in courses/communities (by type)', ); my %staticdefaults = ( anonsurvey_threshold => 10, uploadquota => 500, - coursequota => 20, postsubmit => 60, mysqltables => 172800, - domexttool => 1, - exttool => 0, ); if ($position eq 'top') { %defaultchecked = ( + 'canuse_pdfforms' => 'off', 'uselcmath' => 'on', 'usejsme' => 'on', - 'inline_chem' => 'on', 'canclone' => 'none', ); - @toggles = ('uselcmath','usejsme','inline_chem'); + @toggles = ('canuse_pdfforms','uselcmath','usejsme'); my $deftex = $Apache::lonnet::deftex; if (ref($settings) eq 'HASH') { if ($settings->{'texengine'}) { @@ -6061,13 +5348,13 @@ sub print_coursedefaults { $datatable = $mathdisp.$datatable; $css_class = $itemcount%2?' class="LC_odd_row"':''; $datatable .= - ''. - ''."\n"; - $itemcount ++; - $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable .= ''. ''."\n"; $itemcount ++; @@ -6282,7 +5518,7 @@ sub print_coursedefaults { ''.&mt('Default credits').'
'. + '. &mt($item->{'header'}->[2]->{'col1'}).''. + '. &mt($item->{'header'}->[2]->{'col2'}).'
'.&mt($item->{'header'}->[0]->{'col1'}).''.&mt($item->{'header'}->[0]->{'col1'}). + '.&mt($item->{'header'}->[0]->{'col1'}). '
('.&mt('Automatic access for Dom. Coords.').')
'.&mt($item->{'header'}->[0]->{'col1'}).''.&mt($item->{'header'}->[0]->{'col1'}).''. + $output .= ''. &mt($item->{'header'}->[0]->{'col2'}); if ($action eq 'serverstatuses') { $output .= '
('.&mt('user1:domain1,user2:domain2 etc.').')'; } } else { - $output .= '
'. + $output .= ''. &mt($item->{'header'}->[0]->{'col2'}); } $output .= ''. + $output .= ''. &mt($item->{'header'}->[0]->{'col3'}); } else { - $output .= ''. + $output .= ''. &mt($item->{'header'}->[0]->{'col3'}); } if ($action eq 'serverstatuses') { @@ -1177,7 +1140,7 @@ sub print_config_box { $output .= ''. + $output .= ''. &mt($item->{'header'}->[0]->{'col4'}); } $output .= '
'.$choice.''. + ''; } elsif ($caller eq 'help') { - my ($defaulturl,$defaulttype,%url,%type,%langchoices); + my ($defaulturl,$defaulttype,%url,%type,%lt,%langchoices); + my $switchserver = &check_switchserver($dom,$confname); my $itemcount = 1; $defaulturl = '/adm/loginproblems.html'; $defaulttype = 'default'; + %lt = &Apache::lonlocal::texthash ( + del => 'Delete?', + rep => 'Replace:', + upl => 'Upload:', + default => 'Default', + custom => 'Custom', + ); %langchoices = &Apache::lonlocal::texthash(&get_languages_hash()); my @currlangs; if (ref($settings) eq 'HASH') { @@ -1492,7 +1452,7 @@ sub print_login { my $choice = $choices{'headtag'}; $css_class = ' class="LC_odd_row"'; $datatable .= ''. - ''; @@ -2115,11 +1788,6 @@ sub display_color_options { $datatable .=' '; } } - if (($role eq 'login') && ($img ne 'login')) { - $datatable .= (' ' x2).' '; - } $datatable .= ''; } $itemcount ++; @@ -2141,7 +1809,7 @@ sub display_color_options { '
'.$choices{'hostid'}.''. ''. ''. ''. @@ -1292,7 +1252,6 @@ sub print_login { } } my @images = ('img','logo','domlogo','login'); - my @alttext = ('img','logo','domlogo'); my @logintext = ('textcol','bgcol'); my @bgs = ('pgbg','mainbg','sidebg'); my @links = ('link','alink','vlink'); @@ -1334,13 +1293,6 @@ sub print_login { $designs{'showlogo'}{$item} = $settings->{'showlogo'}{$item}; } } - foreach my $item (@alttext) { - if (ref($settings->{'alttext'}) eq 'HASH') { - if ($settings->{'alttext'}->{$item} ne '') { - $designs{'alttext'}{$item} = $settings->{'alttext'}{$item}; - } - } - } foreach my $item (@logintext) { if ($settings->{$item} ne '') { $designs{'logintext'}{$item} = $settings->{$item}; @@ -1407,10 +1359,18 @@ sub print_login { $datatable .= &display_color_options($dom,$confname,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal,\@logintext); $datatable .= '
'.$choices{'hostid'}.''.$choices{'server'}.''.$choices{'serverpath'}.''.$choices{'custompath'}.'
'.$choice.''. + ''; - } elsif ($caller eq 'saml') { - my %domservers = &Apache::lonnet::get_servers($dom); - $datatable .= ''; } return $datatable; } @@ -1661,205 +1534,10 @@ sub login_choices { headtag => "Custom markup", action => "Action", current => "Current", - samllanding => "Dual login?", - samloptions => "Options", - alttext => "Alt text", ); return %choices; } -sub login_file_options { - return &Apache::lonlocal::texthash( - del => 'Delete?', - rep => 'Replace:', - upl => 'Upload:', - curr => 'View contents', - default => 'Default', - custom => 'Custom', - none => 'None', - ); -} - -sub print_ipaccess { - my ($dom,$settings,$rowtotal) = @_; - my $css_class; - my $itemcount = 0; - my $datatable; - my %ordered; - if (ref($settings) eq 'HASH') { - foreach my $item (keys(%{$settings})) { - if (ref($settings->{$item}) eq 'HASH') { - my $num = $settings->{$item}{'order'}; - if ($num eq '') { - $num = scalar(keys(%{$settings})); - } - $ordered{$num} = $item; - } - } - } - my $maxnum = scalar(keys(%ordered)); - if (keys(%ordered)) { - my @items = sort { $a <=> $b } keys(%ordered); - for (my $i=0; $i<@items; $i++) { - $css_class = $itemcount%2?' class="LC_odd_row"':''; - my $item = $ordered{$items[$i]}; - my ($name,$ipranges,%commblocks,%courses); - if (ref($settings->{$item}) eq 'HASH') { - $name = $settings->{$item}->{'name'}; - $ipranges = $settings->{$item}->{'ip'}; - if (ref($settings->{$item}->{'commblocks'}) eq 'HASH') { - %commblocks = %{$settings->{$item}->{'commblocks'}}; - } - if (ref($settings->{$item}->{'courses'}) eq 'HASH') { - %courses = %{$settings->{$item}->{'courses'}}; - } - } - my $chgstr = ' onchange="javascript:reorderIPaccess(this.form,'."'ipaccess_pos_".$item."'".');"'; - $datatable .= ''. - ''; - $itemcount ++; - } - } - $css_class = $itemcount%2?' class="LC_odd_row"':''; - my $chgstr = ' onchange="javascript:reorderIPaccess(this.form,'."'ipaccess_pos_add'".');"'; - $datatable .= ''."\n". - ''."\n". - ''."\n"; - $$rowtotal ++; - return $datatable; -} - -sub ipaccess_options { - my ($num,$itemcount,$dom,$name,$ipranges,$blocksref,$coursesref) = @_; - my (%currblocks,%currcourses,$output); - if (ref($blocksref) eq 'HASH') { - %currblocks = %{$blocksref}; - } - if (ref($coursesref) eq 'HASH') { - %currcourses = %{$coursesref}; - } - $output = '
'.&mt('Location(s)').''. - ''.&mt('Name').': '. - ''. - '
'. - '
'.&mt('IP Range(s)').''. - &mt('Format for each IP range').': '.&mt('A.B.C.D/N or A.B.C.D-E.F.G.H').'
'. - &mt('Range(s) will be stored as IP netblock(s) in CIDR notation (comma separated)').'
'. - '
'. - '
'.&mt('Functionality Blocked?').''. - &blocker_checkboxes($num,$blocksref).'
'. - '
'.&mt('Courses/Communities allowed').''. - '
'.$choices{'hostid'}.''. ''. ''. ''."\n"; @@ -1507,6 +1467,14 @@ sub print_login { } } } + my %lt = &Apache::lonlocal::texthash( + del => 'Delete?', + rep => 'Replace:', + upl => 'Upload:', + curr => 'View contents', + none => 'None', + ); + my $switchserver = &check_switchserver($dom,$confname); foreach my $lonhost (sort(keys(%domservers))) { my $exempt = &check_exempt_addresses($currexempt{$lonhost}); $datatable .= ''; @@ -1530,101 +1498,6 @@ sub print_login { $datatable .= ''; } $datatable .= '
'.$choices{'hostid'}.''.$choices{'current'}.''.$choices{'action'}.''.$choices{'exempt'}.'
'.$domservers{$lonhost}.'
'. - ''. - ''. - ''."\n"; - my (%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlwindow,%samlnotsso,%styleon,%styleoff); - foreach my $lonhost (keys(%domservers)) { - $samlurl{$lonhost} = '/adm/sso'; - $styleon{$lonhost} = 'display:none'; - $styleoff{$lonhost} = ''; - } - if ((ref($settings) eq 'HASH') && (ref($settings->{'saml'}) eq 'HASH')) { - foreach my $lonhost (keys(%{$settings->{'saml'}})) { - if (ref($settings->{'saml'}{$lonhost}) eq 'HASH') { - $saml{$lonhost} = 1; - $samltext{$lonhost} = $settings->{'saml'}{$lonhost}{'text'}; - $samlimg{$lonhost} = $settings->{'saml'}{$lonhost}{'img'}; - $samlalt{$lonhost} = $settings->{'saml'}{$lonhost}{'alt'}; - $samlurl{$lonhost} = $settings->{'saml'}{$lonhost}{'url'}; - $samltitle{$lonhost} = $settings->{'saml'}{$lonhost}{'title'}; - $samlwindow{$lonhost} = $settings->{'saml'}{$lonhost}{'window'}; - $samlnotsso{$lonhost} = $settings->{'saml'}{$lonhost}{'notsso'}; - $styleon{$lonhost} = ''; - $styleoff{$lonhost} = 'display:none'; - } else { - $styleon{$lonhost} = 'display:none'; - $styleoff{$lonhost} = ''; - } - } - } - my $itemcount = 1; - foreach my $lonhost (sort(keys(%domservers))) { - my $samlon = ' '; - my $samloff = ' checked="checked" '; - if ($saml{$lonhost}) { - $samlon = $samloff; - $samloff = ' '; - } - my $samlwinon = ''; - my $samlwinoff = ' checked="checked"'; - if ($samlwindow{$lonhost}) { - $samlwinon = $samlwinoff; - $samlwinoff = ''; - } - my $css_class = $itemcount%2?' class="LC_odd_row"':''; - $datatable .= ''. - ''. - ''. - ''; - $itemcount ++; - } - $datatable .= '
'.$choices{'hostid'}.''.$choices{'samllanding'}.''.$choices{'samloptions'}.'
'.$domservers{$lonhost}.''.(' 'x2). - ''. - ''. - ''. - ''. - ''. - '
'.&mt('SSO').'
'.&mt('Text').''.&mt('Image').''.&mt('Alt Text').'
'; - if ($samlimg{$lonhost}) { - $datatable .= '
'. - ' '.$lt{'rep'}.''; - } else { - $datatable .= $lt{'upl'}; - } - $datatable .='
'; - if ($switchserver) { - $datatable .= &mt('Upload to library server: [_1]',$switchserver); - } else { - $datatable .= ''; - } - $datatable .= '

'. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - '
'.&mt('SSO').''. - ''.&mt('Non-SSO').'
'.&mt('URL').''.&mt('Tool Tip').''.&mt('Pop-up if iframe').''.&mt('Text').'
'.(' 'x2).'
 
' - .''.(' 'x2). - ''. - &ipaccess_options($i,$itemcount,$dom,$name,$ipranges,\%commblocks,\%courses). - '
'."\n". - ''."\n". - ' '."\n". - ''.&mt('Add').''. - &ipaccess_options('add',$itemcount,$dom). - '
'; - foreach my $cid (sort(keys(%currcourses))) { - my %courseinfo = &Apache::lonnet::coursedescription($cid,{'one_time' => 1}); - $output .= ''; - } - $output .= '
'. - ''. - ' ('.$cid.')
'.&mt('Add').': '. - ''. - &Apache::loncommon::selectcourse_link('display','ipaccess_cnum_'.$num,'ipaccess_cdom_'.$num,'ipaccess_cdesc_'.$num,$dom,undef,'Course/Community'). - ''. - ''. - '
'."\n". - ''; - return $output; -} - -sub blocker_checkboxes { - my ($num,$blocks) = @_; - my ($typeorder,$types) = &commblocktype_text(); - my $numinrow = 6; - my $output = ''; - for (my $i=0; $i<@{$typeorder}; $i++) { - my $block = $typeorder->[$i]; - my $blockstatus; - if (ref($blocks) eq 'HASH') { - if ($blocks->{$block} eq 'on') { - $blockstatus = 'checked="checked"'; - } - } - my $rem = $i%($numinrow); - if ($rem == 0) { - if ($i > 0) { - $output .= ''; - } - $output .= ''; - } - if ($i == scalar(@{$typeorder})-1) { - my $colsleft = $numinrow-$rem; - if ($colsleft > 1) { - $output .= ''; - } - $output .= '
'; - } else { - $output .= ''; - } - } else { - $output .= ''; - } - my $item = 'ipaccess_block_'.$num; - if ($blockstatus) { - $blockstatus = ' '.$blockstatus; - } - $output .= ''."\n". - '
'; - return $output; -} - -sub commblocktype_text { - my %types = &Apache::lonlocal::texthash( - 'com' => 'Messaging', - 'chat' => 'Chat Room', - 'boards' => 'Discussion', - 'port' => 'Portfolio', - 'groups' => 'Groups', - 'blogs' => 'Blogs', - 'about' => 'User Information', - 'printout' => 'Printouts', - 'passwd' => 'Change Password', - 'grades' => 'Gradebook', - 'search' => 'Course search', - 'wishlist' => 'Stored links', - 'annotate' => 'Annotations', - ); - my $typeorder = ['com','chat','boards','port','groups','blogs','about','wishlist','printout','grades','search','annotate','passwd']; - return ($typeorder,\%types); -} - sub print_rolecolors { my ($phase,$role,$dom,$confname,$settings,$rowtotal) = @_; my %choices = &color_font_choices(); @@ -2009,7 +1687,7 @@ sub display_color_options { $css_class = $itemcount%2?' class="LC_odd_row"':''; $datatable .= ''. '
'.$choices->{$img}; - my ($imgfile,$img_import,$login_hdr_pick,$logincolors,$alttext); + my ($imgfile,$img_import,$login_hdr_pick,$logincolors); if ($role eq 'login') { if ($img eq 'login') { $login_hdr_pick = @@ -2017,13 +1695,8 @@ sub display_color_options { $logincolors = &login_text_colors($img,$role,$logintext,$phase,$choices, $designs,$defaults); - } else { - if ($img ne 'domlogo') { - $datatable.= &logo_display_options($img,$defaults,$designs); - } - if (ref($designs->{'alttext'}) eq 'HASH') { - $alttext = $designs->{'alttext'}{$img}; - } + } elsif ($img ne 'domlogo') { + $datatable.= &logo_display_options($img,$defaults,$designs); } } $datatable .= '
'; foreach my $item (@{$bgs}) { - $datatable .= ''. '
'.$choices->{$item}; + $datatable .= ''.$choices->{$item}; my $color = $designs->{'bgs'}{$item} ? $designs->{'bgs'}{$item} : $defaults->{'bgs'}{$item}; if ($designs->{'bgs'}{$item}) { $datatable .= ' '; @@ -2169,7 +1837,7 @@ sub display_color_options { ''; foreach my $item (@{$links}) { my $color = $designs->{'links'}{$item} ? $designs->{'links'}{$item} : $defaults->{'links'}{$item}; - $datatable .= ''; $rownum ++; + $css_class = $rownum%2?' class="LC_odd_row"':''; + $datatable .= ''. + ''; + $rownum ++; } elsif ($position eq 'bottom') { my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); my (@posstypes,%usertypeshash); @@ -4479,7 +3746,7 @@ sub print_contacts { $includeloc{'override_'.$key} = ''; $includestr{'override_'.$key} = ''; if ($settings->{'overrides'}{$key}{'include'} ne '') { - ($includeloc{'override_'.$key},$includestr{'override_'.$key}) = + ($includeloc{'override_'.$key},$includestr{'override_'.$key}) = split(/:/,$settings->{'overrides'}{$key}{'include'},2); $includestr{'override_'.$key} = &unescape($includestr{'override_'.$key}); } @@ -4491,6 +3758,7 @@ sub print_contacts { my $optionsprefix = 'LC_options_helpdesk_'; my $onclicktypes = "toggleHelpdeskRow(this.form,'overrides','$customclass','$optionsprefix');"; + $datatable .= &insttypes_row($settings,$types,$usertypes,$dom, $numinrow,$othertitle,'overrides', \$rownum,$onclicktypes,$customclass); @@ -4557,7 +3825,7 @@ sub overridden_helpdesk { } my $title; if (ref($short_titles) eq 'HASH') { - $title = $short_titles->{$item}; + $title = $short_titles->{$item}; } $output .= ''; if ($align eq 'left') { @@ -5068,71 +4337,436 @@ sub radiobutton_prefs { } else { $datatable .= ''; + $datatable .= + ''. + ' '. + ''.$additional. + ''. + ''; $itemcount ++; } return ($datatable,$itemcount); } sub print_ltitools { - my ($position,$dom,$settings,$rowtotal) = @_; - my (%rules,%encrypt,%privkeys,%linkprot); + my ($dom,$settings,$rowtotal) = @_; + my $rownum = 0; + my $css_class; + my $itemcount = 1; + my $maxnum = 0; + my %ordered; if (ref($settings) eq 'HASH') { - if ($position eq 'top') { - if (exists($settings->{'encrypt'})) { - if (ref($settings->{'encrypt'}) eq 'HASH') { - foreach my $key (keys(%{$settings->{'encrypt'}})) { - $encrypt{'toolsec_'.$key} = $settings->{'encrypt'}{$key}; + foreach my $item (keys(%{$settings})) { + if (ref($settings->{$item}) eq 'HASH') { + my $num = $settings->{$item}{'order'}; + $ordered{$num} = $item; + } + } + } + my $confname = $dom.'-domainconfig'; + my $switchserver = &check_switchserver($dom,$confname); + my $maxnum = scalar(keys(%ordered)); + my $datatable; + my %lt = <itools_names(); + my @courseroles = ('cc','in','ta','ep','st'); + my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner); + my @fields = ('fullname','firstname','lastname','email','roles','user'); + if (keys(%ordered)) { + my @items = sort { $a <=> $b } keys(%ordered); + for (my $i=0; $i<@items; $i++) { + $css_class = $itemcount%2?' class="LC_odd_row"':''; + my $item = $ordered{$items[$i]}; + my ($title,$key,$secret,$url,$lifetime,$imgsrc,%sigsel); + if (ref($settings->{$item}) eq 'HASH') { + $title = $settings->{$item}->{'title'}; + $url = $settings->{$item}->{'url'}; + $key = $settings->{$item}->{'key'}; + $secret = $settings->{$item}->{'secret'}; + $lifetime = $settings->{$item}->{'lifetime'}; + my $image = $settings->{$item}->{'image'}; + if ($image ne '') { + $imgsrc = ''.&mt('Tool Provider icon').''; + } + if ($settings->{$item}->{'sigmethod'} eq 'HMAC-256') { + $sigsel{'HMAC-256'} = ' selected="selected"'; + } else { + $sigsel{'HMAC-SHA1'} = ' selected="selected"'; + } + } + my $chgstr = ' onchange="javascript:reorderLTITools(this.form,'."'ltitools_".$item."'".');"'; + $datatable .= ''. + ''."\n"; + $itemcount ++; } } - my $datatable; - my $itemcount = 1; - if ($position eq 'top') { - $datatable = &secrets_form($dom,'toolsec',\%encrypt,\%privkeys,$rowtotal); - } elsif ($position eq 'middle') { - $datatable = &password_rules('toolsecrets',\$itemcount,\%rules); - $$rowtotal += $itemcount; - } else { - $datatable = &Apache::courseprefs::print_ltitools($dom,'',$settings,\$rowtotal,'','','domain'); + $css_class = $itemcount%2?' class="LC_odd_row"':''; + my $chgstr = ' onchange="javascript:reorderLTITools(this.form,'."'ltitools_add_pos'".');"'; + $datatable .= ''."\n". + ''."\n". + ''."\n"; + $itemcount ++; return $datatable; } @@ -5146,7 +4780,7 @@ sub ltitools_names { 'key' => 'Key', 'lifetime' => 'Nonce lifetime (s)', 'secret' => 'Secret', - 'icon' => 'Icon', + 'icon' => 'Icon', 'user' => 'User', 'fullname' => 'Full Name', 'firstname' => 'First Name', @@ -5164,7 +4798,7 @@ sub ltitools_names { 'roster' => 'Tool can retrieve roster:', 'crstarget' => 'Display target', 'crslabel' => 'Course label', - 'crstitle' => 'Course title', + 'crstitle' => 'Course title', 'crslinktext' => 'Link Text', 'crsexplanation' => 'Explanation', 'crsappend' => 'Provider URL', @@ -5172,374 +4806,124 @@ sub ltitools_names { return %lt; } -sub secrets_form { - my ($dom,$context,$encrypt,$privkeys,$rowtotal) = @_; - my @ids=&Apache::lonnet::current_machine_ids(); - my %servers = &Apache::lonnet::get_servers($dom,'library'); - my $primary = &Apache::lonnet::domain($dom,'primary'); - my ($css_class,$extra,$numshown,$itemcount,$output); - $itemcount = 0; - foreach my $hostid (sort(keys(%servers))) { - my ($showextra,$divsty,$switch); - if ($hostid eq $primary) { - if ($context eq 'ltisec') { - if (($encrypt->{'ltisec_consumers'}) || ($encrypt->{'ltisec_domlinkprot'})) { - $showextra = 1; - } - if ($encrypt->{'ltisec_crslinkprot'}) { - $showextra = 1; - } - } else { - if (($encrypt->{'toolsec_crs'}) || ($encrypt->{'toolsec_dom'})) { - $showextra = 1; - } - } - unless (grep(/^\Q$hostid\E$/,@ids)) { - $switch = 1; - } - if ($showextra) { - $numshown ++; - $divsty = 'display:inline-block'; - } else { - $divsty = 'display:none'; - } - $extra .= '
'. - ''.$hostid.''; - if ($switch) { - my $switchserver = ''.&mt('Switch Server').''; - if (exists($privkeys->{$hostid})) { - $extra .= '
'. - ''. - &mt('Encryption Key').': ['.&mt('not shown').'] '.(' 'x2).'
'. - ''.&mt('Change?'). - ''. - (' 'x2). - '  '; - } else { - $extra .= ''. - &mt('Key required').' - '.&mt('submit from server ([_1]): [_2].',$hostid,$switchserver). - ''."\n"; - } - } elsif (exists($privkeys->{$hostid})) { - $extra .= '
'. - &mt('Encryption Key').': ['.&mt('not shown').'] '.(' 'x2).'
'. - ''.&mt('Change?'). - ''. - (' 'x2). - '  '; - } else { - $extra .= ''.&mt('Encryption Key').':'. - ''. - ''; - } - $extra .= '
'; - } - } - my (%choices,@toggles,%defaultchecked); - if ($context eq 'ltisec') { - %choices = &Apache::lonlocal::texthash ( - ltisec_crslinkprot => 'Encrypt stored link protection secrets defined in courses', - ltisec_domlinkprot => 'Encrypt stored link protection secrets defined in domain', - ltisec_consumers => 'Encrypt stored consumer secrets defined in domain', - ); - @toggles = qw(ltisec_crslinkprot ltisec_domlinkprot ltisec_consumers); - %defaultchecked = ( - 'ltisec_crslinkprot' => 'off', - 'ltisec_domlinkprot' => 'off', - 'ltisec_consumers' => 'off', - ); - } else { - %choices = &Apache::lonlocal::texthash ( - toolsec_crs => 'Encrypt stored external tool secrets defined in courses', - toolsec_dom => 'Encrypt stored external tool secrets defined in domain', - ); - @toggles = qw(toolsec_crs toolsec_dom); - %defaultchecked = ( - 'toolsec_crs' => 'off', - 'toolsec_dom' => 'off', - ); - } - my ($onclick,$itemcount); - $onclick = 'javascript:toggleLTIEncKey(this.form,'."'$context'".');'; - ($output,$itemcount) = &radiobutton_prefs($encrypt,\@toggles,\%defaultchecked, - \%choices,$itemcount,$onclick,'','left','no'); - - $css_class = $itemcount%2?' class="LC_odd_row"':''; - my $noprivkeysty = 'display:inline-block'; - if ($numshown) { - $noprivkeysty = 'display:none'; - } - $output .= ''. - ''; - $itemcount ++; - $$rowtotal += $itemcount; - return $output; -} - sub print_lti { - my ($position,$dom,$settings,$rowtotal) = @_; + my ($dom,$settings,$rowtotal) = @_; my $itemcount = 1; - my ($datatable,$css_class); - my (%rules,%encrypt,%privkeys,%linkprot,%suggestions); + my $maxnum = 0; + my $css_class; + my %ordered; if (ref($settings) eq 'HASH') { - if ($position eq 'top') { - if (exists($settings->{'encrypt'})) { - if (ref($settings->{'encrypt'}) eq 'HASH') { - foreach my $key (keys(%{$settings->{'encrypt'}})) { - if ($key eq 'consumers') { - $encrypt{'ltisec_'.$key} = $settings->{'encrypt'}{$key}; - } else { - $encrypt{'ltisec_'.$key.'linkprot'} = $settings->{'encrypt'}{$key}; - } - } - } - } - if (exists($settings->{'private'})) { - if (ref($settings->{'private'}) eq 'HASH') { - if (ref($settings->{'private'}) eq 'HASH') { - if (ref($settings->{'private'}{'keys'}) eq 'ARRAY') { - map { $privkeys{$_} = 1; } (@{$settings->{'private'}{'keys'}}); - } - } - } - } - } elsif ($position eq 'upper') { - if (exists($settings->{'rules'})) { - if (ref($settings->{'rules'}) eq 'HASH') { - %rules = %{$settings->{'rules'}}; - } - } - } elsif ($position eq 'middle') { - if (exists($settings->{'suggested'})) { - if (ref($settings->{'suggested'}) eq 'HASH') { - %suggestions = %{$settings->{'suggested'}}; - } - } - } elsif ($position eq 'lower') { - if (exists($settings->{'linkprot'})) { - if (ref($settings->{'linkprot'}) eq 'HASH') { - %linkprot = %{$settings->{'linkprot'}}; - if ($linkprot{'lock'}) { - delete($linkprot{'lock'}); - } - } - } - } else { - foreach my $key ('encrypt','private','rules','linkprot','suggestions') { - if (exists($settings->{$key})) { - delete($settings->{$key}); - } + foreach my $item (keys(%{$settings})) { + if (ref($settings->{$item}) eq 'HASH') { + my $num = $settings->{$item}{'order'}; + $ordered{$num} = $item; } } } - if ($position eq 'top') { - $datatable = &secrets_form($dom,'ltisec',\%encrypt,\%privkeys,$rowtotal); - } elsif ($position eq 'upper') { - $datatable = &password_rules('ltisecrets',\$itemcount,\%rules); - $$rowtotal += $itemcount; - } elsif ($position eq 'middle') { - $datatable = &linkprot_suggestions(\%suggestions,\$itemcount); - $$rowtotal += $itemcount; - } elsif ($position eq 'lower') { - $datatable .= &Apache::courseprefs::print_linkprotection($dom,'',$settings,$rowtotal,'','','domain'); - } else { - my ($switchserver,$switchmessage); - $switchserver = &check_switchserver($dom); - $switchmessage = &mt("submit from domain's primary library server: [_1].",$switchserver); - my $maxnum = 0; - my %ordered; - if (ref($settings) eq 'HASH') { - foreach my $item (keys(%{$settings})) { - if (ref($settings->{$item}) eq 'HASH') { - my $num = $settings->{$item}{'order'}; - if ($num eq '') { - $num = scalar(keys(%{$settings})); - } - $ordered{$num} = $item; - } + my $maxnum = scalar(keys(%ordered)); + my $datatable; + my %lt = <i_names(); + if (keys(%ordered)) { + my @items = sort { $a <=> $b } keys(%ordered); + for (my $i=0; $i<@items; $i++) { + $css_class = $itemcount%2?' class="LC_odd_row"':''; + my $item = $ordered{$items[$i]}; + my ($key,$secret,$lifetime,$consumer,$requser,$current); + if (ref($settings->{$item}) eq 'HASH') { + $key = $settings->{$item}->{'key'}; + $secret = $settings->{$item}->{'secret'}; + $lifetime = $settings->{$item}->{'lifetime'}; + $consumer = $settings->{$item}->{'consumer'}; + $requser = $settings->{$item}->{'requser'}; + $current = $settings->{$item}; + } + my $onclickrequser = ' onclick="toggleLTI(this.form,'."'requser','$i'".');"'; + my %checkedrequser = ( + yes => ' checked="checked"', + no => '', + ); + if (!$requser) { + $checkedrequser{'no'} = $checkedrequser{'yes'}; + $checkedrequser{'yes'} = ''; } - } - $maxnum = scalar(keys(%ordered)); - my %lt = <i_names(); - if (keys(%ordered)) { - my @items = sort { $a <=> $b } keys(%ordered); - for (my $i=0; $i<@items; $i++) { - $css_class = $itemcount%2?' class="LC_odd_row"':''; - my $item = $ordered{$items[$i]}; - my ($key,$secret,$usable,$lifetime,$consumer,$requser,$crsinc,$current); - if (ref($settings->{$item}) eq 'HASH') { - $key = $settings->{$item}->{'key'}; - $usable = $settings->{$item}->{'usable'}; - $lifetime = $settings->{$item}->{'lifetime'}; - $consumer = $settings->{$item}->{'consumer'}; - $requser = $settings->{$item}->{'requser'}; - $crsinc = $settings->{$item}->{'crsinc'}; - $current = $settings->{$item}; - } - my $onclickrequser = ' onclick="toggleLTI(this.form,'."'requser','$i'".');"'; - my %checkedrequser = ( - yes => ' checked="checked"', - no => '', - ); - if (!$requser) { - $checkedrequser{'no'} = $checkedrequser{'yes'}; - $checkedrequser{'yes'} = ''; - } - my $onclickcrsinc = ' onclick="toggleLTI(this.form,'."'crsinc','$i'".');"'; - my %checkedcrsinc = ( - yes => ' checked="checked"', - no => '', - ); - if (!$crsinc) { - $checkedcrsinc{'no'} = $checkedcrsinc{'yes'}; - $checkedcrsinc{'yes'} = ''; - } - my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_".$item."'".');"'; - $datatable .= ''. - ''; - $itemcount ++; + $datatable .= ''; } + $datatable .= ''.(' 'x2). + ''. + ''; + $itemcount ++; } - $css_class = $itemcount%2?' class="LC_odd_row"':''; - my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_add'".');"'; - $datatable .= ''."\n". - ''."\n". - ''."\n"; - $itemcount ++; + $datatable .= ''; } - $$rowtotal += $itemcount; - return $datatable; + $datatable .= ' '."\n". + ''.&mt('Add').''."\n". + ''."\n". + ''."\n"; + $$rowtotal ++; + return $datatable;; } sub lti_names { @@ -5551,7 +4935,6 @@ sub lti_names { 'consumer' => 'Consumer', 'secret' => 'Secret', 'requser' => "User's identity sent", - 'crsinc' => "Course's identity sent", 'email' => 'Email address', 'sourcedid' => 'User ID', 'other' => 'Other', @@ -5565,11 +4948,10 @@ sub lti_names { sub lti_options { my ($num,$current,$itemcount,%lt) = @_; - my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield,$callback); + my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield); $checked{'mapuser'}{'sourcedid'} = ' checked="checked"'; $checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"'; - $checked{'storecrs'}{'Y'} = ' checked="checked"'; - $checked{'makecrs'}{'N'} = ' checked="checked"'; + $checked{'makecrs'}{'N'} = ' checked="checked"'; $checked{'mapcrstype'} = {}; $checked{'makeuser'} = {}; $checked{'selfenroll'} = {}; @@ -5584,10 +4966,8 @@ sub lti_options { my $crsfieldsty = 'none'; my $crssecfieldsty = 'none'; my $secsrcfieldsty = 'none'; - my $callbacksty = 'none'; my $passbacksty = 'none'; my $optionsty = 'block'; - my $crssty = 'block'; my $lcauthparm; my $lcauthparmstyle = 'display:none'; my $lcauthparmtext; @@ -5598,14 +4978,11 @@ sub lti_options { if (ref($current) eq 'HASH') { if (!$current->{'requser'}) { $optionsty = 'none'; - $crssty = 'none'; - } elsif (!$current->{'crsinc'}) { - $crssty = 'none'; } if (($current->{'mapuser'} ne '') && ($current->{'mapuser'} ne 'lis_person_sourcedid')) { $checked{'mapuser'}{'sourcedid'} = ''; if ($current->{'mapuser'} eq 'lis_person_contact_email_primary') { - $checked{'mapuser'}{'email'} = ' checked="checked"'; + $checked{'mapuser'}{'email'} = ' checked="checked"'; } else { $checked{'mapuser'}{'other'} = ' checked="checked"'; $userfield = $current->{'mapuser'}; @@ -5615,7 +4992,7 @@ sub lti_options { if (($current->{'mapcrs'} ne '') && ($current->{'mapcrs'} ne 'course_offering_sourcedid')) { $checked{'mapcrs'}{'course_offering_sourcedid'} = ''; if ($current->{'mapcrs'} eq 'context_id') { - $checked{'mapcrs'}{'context_id'} = ' checked="checked"'; + $checked{'mapcrs'}{'context_id'} = ' checked="checked"'; } else { $checked{'mapcrs'}{'other'} = ' checked="checked"'; $cidfield = $current->{'mapcrs'}; @@ -5627,10 +5004,6 @@ sub lti_options { $checked{'mapcrstype'}{$type} = ' checked="checked"'; } } - if (!$current->{'storecrs'}) { - $checked{'storecrs'}{'N'} = $checked{'storecrs'}{'Y'}; - $checked{'storecrs'}{'Y'} = ''; - } if ($current->{'makecrs'}) { $checked{'makecrs'}{'Y'} = ' checked="checked"'; } @@ -5643,7 +5016,7 @@ sub lti_options { $checked{'lcauth'}{$1} = ' checked="checked"'; unless (($current->{'lcauth'} eq 'lti') || ($current->{'lcauth'} eq 'internal')) { $lcauthparm = $current->{'lcauthparm'}; - $lcauthparmstyle = 'display:table-row'; + $lcauthparmstyle = 'display:table-row'; if ($current->{'lcauth'} eq 'localauth') { $lcauthparmtext = &mt('Local auth argument'); } else { @@ -5660,7 +5033,7 @@ sub lti_options { %rolemaps = %{$current->{'maproles'}}; } if ($current->{'section'} ne '') { - $checked{'crssec'}{'Y'} = ' checked="checked"'; + $checked{'crssec'}{'Y'} = ' checked="checked"'; $crssecfieldsty = 'inline-block'; if ($current->{'section'} eq 'course_section_sourcedid') { $checked{'crssecsrc'}{'sourcedid'} = ' checked="checked"'; @@ -5672,13 +5045,6 @@ sub lti_options { } else { $checked{'crssec'}{'N'} = ' checked="checked"'; } - if ($current->{'callback'} ne '') { - $callback = $current->{'callback'}; - $checked{'callback'}{'Y'} = ' checked="checked"'; - $callbacksty = 'inline-block'; - } else { - $checked{'callback'}{'N'} = ' checked="checked"'; - } if ($current->{'topmenu'}) { $checked{'topmenu'}{'Y'} = ' checked="checked"'; } else { @@ -5704,18 +5070,18 @@ sub lti_options { } else { $checked{'makecrs'}{'N'} = ' checked="checked"'; $checked{'crssec'}{'N'} = ' checked="checked"'; - $checked{'callback'}{'N'} = ' checked="checked"'; $checked{'topmenu'}{'N'} = ' checked="checked"'; - $checked{'inlinemenu'}{'Y'} = ' checked="checked"'; + $checked{'inlinemenu'}{'Y'} = ' checked="checked"'; $checked{'menuitem'}{'grades'} = ' checked="checked"'; - $menusty = 'inline-block'; + $menusty = 'inline-block'; } - my @coursetypes = ('official','unofficial','community','textbook','lti'); + my @coursetypes = ('official','unofficial','community','textbook','placement','lti'); my %coursetypetitles = &Apache::lonlocal::texthash ( official => 'Official', unofficial => 'Unofficial', community => 'Community', textbook => 'Textbook', + placement => 'Placement Test', lti => 'LTI Provider', ); my @authtypes = ('internal','krb4','krb5','localauth'); @@ -5732,21 +5098,10 @@ sub lti_options { my $onclickuser = ' onclick="toggleLTI(this.form,'."'user','$num'".');"'; my $onclickcrs = ' onclick="toggleLTI(this.form,'."'crs','$num'".');"'; my $onclicksec = ' onclick="toggleLTI(this.form,'."'sec','$num'".');"'; - my $onclickcallback = ' onclick="toggleLTI(this.form,'."'callback','$num'".');"'; my $onclicksecsrc = ' onclick="toggleLTI(this.form,'."'secsrc','$num'".')"'; my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"'; my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"'; - my $output = '
'.&mt('Logout options').''. - '
'.&mt('Callback to logout LON-CAPA on log out from Consumer').': '. - ''.(' 'x2). - '
'. - '
'. - ''.&mt('Parameter').': '. - ''. - '
'. - '
'.&mt('Mapping users').''. + my $output = '
'.&mt('Mapping users').''. '
'.&mt('LON-CAPA username').': '; foreach my $option ('sourcedid','email','other') { $output .= '
'. - '
'.&mt('Roles which may create user accounts').''; + 'value="'.$userfield.'" />
'. + '
'.&mt('Mapping course roles').'
'.$choices->{$item}."\n"; + $datatable .= ''.$choices->{$item}."\n"; if ($designs->{'links'}{$item}) { $datatable.=' '; } @@ -2230,7 +1898,7 @@ sub login_text_colors { my ($img,$role,$logintext,$phase,$choices,$designs,$defaults) = @_; my $color_menu = ''; foreach my $item (@{$logintext}) { - $color_menu .= ''; @@ -2263,7 +1931,7 @@ sub image_changes { $role.'_del_'.$img.'" value="1" />'.&mt('Delete?'). ' '.&mt('Replace:').'
'; } else { - $output .= ''. ''. ''. - ''; + ''; $$rowtotal += 4; return $datatable; } sub print_autoupdate { my ($position,$dom,$settings,$rowtotal) = @_; - my ($enable,$datatable); + my $datatable; if ($position eq 'top') { - my %choices = &Apache::lonlocal::texthash ( - run => 'Auto-update active?', - classlists => 'Update information in classlists?', - unexpired => 'Skip updates for users without active or future roles?', - lastactive => 'Skip updates for inactive users?', - ); - my $itemcount = 0; my $updateon = ' '; my $updateoff = ' checked="checked" '; + my $classlistson = ' '; + my $classlistsoff = ' checked="checked" '; if (ref($settings) eq 'HASH') { if ($settings->{'run'} eq '1') { $updateon = $updateoff; $updateoff = ' '; } + if ($settings->{'classlists'} eq '1') { + $classlistson = $classlistsoff; + $classlistsoff = ' '; + } } - $enable = ''. - ''. - ''. + ''. + ''. + $updateoff.'value="0" />'.&mt('No').''. + ''. + ''. + ''. ''; - my @toggles = ('classlists','unexpired'); - my %defaultchecked = ('classlists' => 'off', - 'unexpired' => 'off' - ); - $$rowtotal ++; - ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, - \%choices,$itemcount,'','','left','no'); - $datatable = $enable.$datatable; - $$rowtotal += $itemcount; - my $lastactiveon = ' '; - my $lastactiveoff = ' checked="checked" '; - my $lastactivestyle = 'none'; - my $lastactivedays; - my $onclick = ' onclick="javascript:toggleLastActiveDays(this.form);"'; - if (ref($settings) eq 'HASH') { - if ($settings->{'lastactive'} =~ /^\d+$/) { - $lastactiveon = $lastactiveoff; - $lastactiveoff = ' '; - $lastactivestyle = 'inline-block'; - $lastactivedays = $settings->{'lastactive'}; - } - } - my $css_class = $itemcount%2?' class="LC_odd_row"':''; - $datatable .= ''. - ''. - ''. - ''; - $$rowtotal ++; + $$rowtotal += 2; } elsif ($position eq 'middle') { my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); my $numinrow = 3; @@ -4367,17 +3628,18 @@ sub print_contacts { \%choices,$rownum); $datatable .= $reports; } elsif ($position eq 'lower') { - my (%current,%excluded,%weights); + $css_class = $rownum%2?' class="LC_odd_row"':''; + my ($threshold,$sysmail,%excluded,%weights); my ($defaults,$names) = &Apache::loncommon::lon_status_items(); if ($lonstatus{'threshold'} =~ /^\d+$/) { - $current{'errorthreshold'} = $lonstatus{'threshold'}; + $threshold = $lonstatus{'threshold'}; } else { - $current{'errorthreshold'} = $defaults->{'threshold'}; + $threshold = $defaults->{'threshold'}; } if ($lonstatus{'sysmail'} =~ /^\d+$/) { - $current{'errorsysmail'} = $lonstatus{'sysmail'}; + $sysmail = $lonstatus{'sysmail'}; } else { - $current{'errorsysmail'} = $defaults->{'sysmail'}; + $sysmail = $defaults->{'sysmail'}; } if (ref($lonstatus{'weights'}) eq 'HASH') { foreach my $type ('E','W','N','U') { @@ -4397,16 +3659,13 @@ sub print_contacts { map {$excluded{$_} = 1; } @{$lonstatus{'excluded'}}; } } - foreach my $item ('errorthreshold','errorsysmail') { - $css_class = $rownum%2?' class="LC_odd_row"':''; - $datatable .= ''. - ''; - $rownum ++; - } + $datatable .= ''. + ''; + $rownum ++; $css_class = $rownum%2?' class="LC_odd_row"':''; $datatable .= ''. '
'.$choices->{$item}; + $color_menu .= ''.$choices->{$item}; my $color = $designs->{'logintext'}{$item} ? $designs->{'logintext'}{$item} : $defaults->{'logintext'}{$item}; $color_menu .= '
'.$logincolors.&mt('Upload:').'
'; + $output .= '
'.$logincolors.&mt('Upload:').'
'; } } return $output; @@ -2282,7 +1950,7 @@ sub print_quotas { my $typecount = 0; my ($css_class,%titles); if ($context eq 'requestcourses') { - @usertools = ('official','unofficial','community','textbook','lti'); + @usertools = ('official','unofficial','community','textbook','placement','lti'); @options =('norequest','approval','validate','autolimit'); %validations = &Apache::lonnet::auto_courserequest_checks($dom); %titles = &courserequest_titles(); @@ -2291,7 +1959,7 @@ sub print_quotas { @options = ('norequest','approval','automatic'); %titles = &authorrequest_titles(); } else { - @usertools = ('aboutme','blog','webdav','portfolio','timezone'); + @usertools = ('aboutme','blog','webdav','portfolio'); %titles = &tool_titles(); } if (ref($types) eq 'ARRAY') { @@ -2395,12 +2063,9 @@ sub print_quotas { } } else { my $checked = 'checked="checked" '; - if ($item eq 'timezone') { - $checked = ''; - } if (ref($settings) eq 'HASH') { if (ref($settings->{$item}) eq 'HASH') { - if (!$settings->{$item}->{$type}) { + if ($settings->{$item}->{$type} == 0) { $checked = ''; } elsif ($settings->{$item}->{$type} == 1) { $checked = 'checked="checked" '; @@ -2749,7 +2414,7 @@ sub print_studentcode { my ($settings,$rowtotal) = @_; my $rownum = 0; my ($output,%current); - my @crstypes = ('official','unofficial','community','textbook','lti'); + my @crstypes = ('official','unofficial','community','textbook','placement','lti'); if (ref($settings) eq 'HASH') { if (ref($settings->{'uniquecode'}) eq 'HASH') { foreach my $type (@crstypes) { @@ -3125,147 +2790,21 @@ function toggleLTITools(form,setting,ite ENDSCRIPT } -sub wafproxy_javascript { - my ($dom) = @_; - return <<"ENDSCRIPT"; - - -ENDSCRIPT -} - sub lti_javascript { - my ($dom,$settings) = @_; - my $togglejs = <i_toggle_js($dom); - my $linkprot_js = &Apache::courseprefs::linkprot_javascript(); + my ($settings) = @_; + my $togglejs = <i_toggle_js(); unless (ref($settings) eq 'HASH') { - return $togglejs.' - -'; + return $togglejs; } my (%ordered,$total,%jstext); - $total = scalar(keys(%{$settings})); + $total = 0; foreach my $item (keys(%{$settings})) { if (ref($settings->{$item}) eq 'HASH') { my $num = $settings->{$item}{'order'}; - if ($num eq '') { - $num = $total - 1; - } $ordered{$num} = $item; } } + $total = scalar(keys(%{$settings})); my @jsarray = (); foreach my $item (sort {$a <=> $b } (keys(%ordered))) { push(@jsarray,$ordered{$item}); @@ -3315,9 +2854,6 @@ $jstext } return; } - -$linkprot_js - // ]]> @@ -3327,77 +2863,40 @@ ENDSCRIPT } sub lti_toggle_js { - my ($dom) = @_; my %lcauthparmtext = &Apache::lonlocal::texthash ( localauth => 'Local auth argument', krb => 'Kerberos domain', ); - my $crsincalert = &mt('"User\'s identity sent" needs to be set to "Yes" first,[_1] before setting "Course\'s identity sent" to "Yes"',"\n"); - &js_escape(\$crsincalert); - my %servers = &Apache::lonnet::get_servers($dom,'library'); - my $primary = &Apache::lonnet::domain($dom,'primary'); - my $course_servers = "'".join("','",keys(%servers))."'"; return <<"ENDSCRIPT"; - -ENDSCRIPT -} - -sub autoupdate_javascript { - return <<"ENDSCRIPT"; - - -ENDSCRIPT -} - -sub autoenroll_javascript { - return <<"ENDSCRIPT"; - - -ENDSCRIPT -} - -sub saml_javascript { - return <<"ENDSCRIPT"; - - -ENDSCRIPT -} - -sub ipaccess_javascript { - my ($settings) = @_; - my (%ordered,$total,%jstext); - $total = 0; - if (ref($settings) eq 'HASH') { - foreach my $item (keys(%{$settings})) { - if (ref($settings->{$item}) eq 'HASH') { - my $num = $settings->{$item}{'order'}; - $ordered{$num} = $item; - } - } - $total = scalar(keys(%{$settings})); - } - my @jsarray = (); - foreach my $item (sort {$a <=> $b } (keys(%ordered))) { - push(@jsarray,$ordered{$item}); - } - my $jstext = ' var ipaccess = Array('."'".join("','",@jsarray)."'".');'."\n"; - return <<"ENDSCRIPT"; - @@ -3729,12 +3044,7 @@ ENDSCRIPT sub print_autoenroll { my ($dom,$settings,$rowtotal) = @_; my $autorun = &Apache::lonnet::auto_run(undef,$dom), - my ($defdom,$runon,$runoff,$coownerson,$coownersoff, - $failsafe,$autofailsafe,$failsafesty,%failsafechecked); - $failsafesty = 'none'; - %failsafechecked = ( - off => ' checked="checked"', - ); + my ($defdom,$runon,$runoff,$coownerson,$coownersoff,$failsafe); if (ref($settings) eq 'HASH') { if (exists($settings->{'run'})) { if ($settings->{'run'} eq '0') { @@ -3768,24 +3078,8 @@ sub print_autoenroll { if (exists($settings->{'sender_domain'})) { $defdom = $settings->{'sender_domain'}; } - if (exists($settings->{'failsafe'})) { - $failsafe = $settings->{'failsafe'}; - if ($failsafe eq 'zero') { - $failsafechecked{'zero'} = ' checked="checked"'; - $failsafechecked{'off'} = ''; - $failsafesty = 'inline-block'; - } elsif ($failsafe eq 'any') { - $failsafechecked{'any'} = ' checked="checked"'; - $failsafechecked{'off'} = ''; - } - $autofailsafe = $settings->{'autofailsafe'}; - } elsif (exists($settings->{'autofailsafe'})) { - $autofailsafe = $settings->{'autofailsafe'}; - if ($autofailsafe ne '') { - $failsafechecked{'zero'} = ' checked="checked"'; - $failsafe = 'zero'; - $failsafechecked{'off'} = ''; - } + if (exists($settings->{'autofailsafe'})) { + $failsafe = $settings->{'autofailsafe'}; } } else { if ($autorun) { @@ -3824,84 +3118,51 @@ sub print_autoenroll { $coownersoff.' value="0" />'.&mt('No').'
'.&mt('Failsafe for no drops when institutional data missing').''. - '    '. - '
'. - ''. - '
'. - ''. - &mt('Threshold for number of students in section to drop: [_1]', - ''). - '
'. + '
'.$choices{'run'}.'
'.&mt($title{'run'}).' '. + $updateon.' value="1" />'.&mt('Yes').' '. '
'.&mt($title{'classlists'}).''. + ' '. + '
'.$choices{'lastactive'}.''. - ' '. - '
'. - ': '.&mt('inactive = no activity in last [_1] days', - ''). - '
'. - $titles->{$item}. - ''. - '
'. + $titles->{'errorthreshold'}. + ''. + '
'. @@ -4452,6 +3711,14 @@ sub print_contacts { } $datatable .= '
'. + $titles->{'errorsysmail'}. + ''. + '
'.$role.'
'. + $datatable .= '
'.$role.'
'. '
'. + ''. ''.$choices->{$item}. ''; } - $datatable .= ''; - if ($firstval eq 'no') { - $datatable .= - ' '; - } else { - $datatable .= - ' '; - } - $datatable .= ''.$additional.'
' + .''.(' 'x2). + ''. + '
'.&mt('Required settings').''. + ''.$lt{'title'}.': '. + (' 'x2). + ''.$lt{'version'}.': '. + (' 'x2). + ''.$lt{'msgtype'}.': '. + (' 'x2). + ''.$lt{'sigmethod'}.':'. + '

'. + ''.$lt{'url'}.':'. + (' 'x2). + ''.$lt{'key'}.':'. + ' '. + (' 'x2). + ''.$lt{'lifetime'}.':'. + ' '. + (' 'x2). + ''.$lt{'secret'}.':'. + ''. + ''. + ''. + '
'. + '
'.&mt('Optional settings').''. + ''.&mt('Display target:'); + my %currdisp; + if (ref($settings->{$item}->{'display'}) eq 'HASH') { + if ($settings->{$item}->{'display'}->{'target'} eq 'window') { + $currdisp{'window'} = ' checked="checked"'; + } elsif ($settings->{$item}->{'display'}->{'target'} eq 'tab') { + $currdisp{'tab'} = ' checked="checked"'; + } else { + $currdisp{'iframe'} = ' checked="checked"'; + } + if ($settings->{$item}->{'display'}->{'width'} =~ /^(\d+)$/) { + $currdisp{'width'} = $1; + } + if ($settings->{$item}->{'display'}->{'height'} =~ /^(\d+)$/) { + $currdisp{'height'} = $1; + } + $currdisp{'linktext'} = $settings->{$item}->{'display'}->{'linktext'}; + $currdisp{'explanation'} = $settings->{$item}->{'display'}->{'explanation'}; + } else { + $currdisp{'iframe'} = ' checked="checked"'; + } + foreach my $disp ('iframe','tab','window') { + $datatable .= ''.(' 'x2); + } + $datatable .= (' 'x4); + foreach my $dimen ('width','height') { + $datatable .= ''. + (' 'x2); + } + $datatable .= '
'. + '
'.$lt{'linktext'}.'
'. + '
'. + '
'.$lt{'explanation'}.'
'. + '

'; + my %units = ( + 'passback' => 'days', + 'roster' => 'seconds', + ); + foreach my $extra ('passback','roster') { + my $validsty = 'none'; + my $currvalid; + my $checkedon = ''; + my $checkedoff = ' checked="checked"'; + if ($settings->{$item}->{$extra}) { + $checkedon = $checkedoff; + $checkedoff = ''; + $validsty = 'inline-block'; + if ($settings->{$item}->{$extra.'valid'} =~ /^\d+\.?\d*$/) { + $currvalid = $settings->{$item}->{$extra.'valid'}; + } + } + my $onclick = ' onclick="toggleLTITools(this.form,'."'$extra','$i'".');"'; + $datatable .= '
'.$lt{$extra}.' '. + ''.(' 'x2). + '
'. + '
'. + ''. + &mt("at least [_1] $units{$extra} after launch", + ''). + '
'; + } + $datatable .= ''.$lt{'icon'}.': '; + if ($imgsrc) { + $datatable .= $imgsrc. + ' '. + ' '.&mt('Replace:').' '; + } else { + $datatable .= '('.&mt('if larger than 21x21 pixels, image will be scaled').') '; + } + if ($switchserver) { + $datatable .= &mt('Upload to library server: [_1]',$switchserver); + } else { + $datatable .= ''; + } + $datatable .= '
'; + my (%checkedfields,%rolemaps,$userincdom); + if (ref($settings->{$item}) eq 'HASH') { + if (ref($settings->{$item}->{'fields'}) eq 'HASH') { + %checkedfields = %{$settings->{$item}->{'fields'}}; + } + $userincdom = $settings->{$item}->{'incdom'}; + if (ref($settings->{$item}->{'roles'}) eq 'HASH') { + %rolemaps = %{$settings->{$item}->{'roles'}}; + $checkedfields{'roles'} = 1; + } + } + $datatable .= '
'.&mt('User data sent on launch').''. + ''; + my $userfieldstyle = 'display:none;'; + my $seluserdom = ''; + my $unseluserdom = ' selected="selected"'; + foreach my $field (@fields) { + my ($checked,$onclick,$id,$spacer); + if ($checkedfields{$field}) { + $checked = ' checked="checked"'; + } + if ($field eq 'user') { + $id = ' id="ltitools_user_field_'.$i.'"'; + $onclick = ' onclick="toggleLTITools(this.form,'."'$field','$i'".')"'; + if ($checked) { + $userfieldstyle = 'display:inline-block'; + if ($userincdom) { + $seluserdom = $unseluserdom; + $unseluserdom = ''; + } } + } else { + $spacer = (' ' x2); } + $datatable .= ''.$spacer; } - if (exists($settings->{'private'})) { - if (ref($settings->{'private'}) eq 'HASH') { - if (ref($settings->{'private'}) eq 'HASH') { - if (ref($settings->{'private'}{'keys'}) eq 'ARRAY') { - map { $privkeys{$_} = 1; } (@{$settings->{'private'}{'keys'}}); + $datatable .= ''; + $datatable .= '
'. + ' : '. + '
'; + $datatable .= '
'. + '
'.&mt('Role mapping').''; + foreach my $role (@courseroles) { + my ($selected,$selectnone); + if (!$rolemaps{$role}) { + $selectnone = ' selected="selected"'; + } + $datatable .= ''; } - } elsif ($position eq 'middle') { - if (exists($settings->{'rules'})) { - if (ref($settings->{'rules'}) eq 'HASH') { - %rules = %{$settings->{'rules'}}; + $datatable .= '
'. + &Apache::lonnet::plaintext($role,'Course').'
'. + '
'; + my %courseconfig; + if (ref($settings->{$item}) eq 'HASH') { + if (ref($settings->{$item}->{'crsconf'}) eq 'HASH') { + %courseconfig = %{$settings->{$item}->{'crsconf'}}; } } - } else { - foreach my $key ('encrypt','private','rules') { - if (exists($settings->{$key})) { - delete($settings->{$key}); + $datatable .= '
'.&mt('Configurable in course').''; + foreach my $item ('label','title','target','linktext','explanation','append') { + my $checked; + if ($courseconfig{$item}) { + $checked = ' checked="checked"'; + } + $datatable .= ''.(' ' x2)."\n"; + } + $datatable .= '
'. + '
'.&mt('Custom items sent on launch').''. + ''; + if (ref($settings->{$item}->{'custom'}) eq 'HASH') { + my %custom = %{$settings->{$item}->{'custom'}}; + if (keys(%custom) > 0) { + foreach my $key (sort(keys(%custom))) { + $datatable .= ''. + ''; + } } } + $datatable .= ''; + $datatable .= '
'.&mt('Action').''.&mt('Name').''.&mt('Value').'
'. + ''.$key.'
'. + ''. + '
'."\n". + ''."\n". + ' '."\n". + ''.&mt('Add').''. + '
'.&mt('Required settings').''. + ''.$lt{'title'}.': '."\n". + (' 'x2). + ''.$lt{'version'}.': '."\n". + (' 'x2). + ''.$lt{'msgtype'}.': '. + ''.$lt{'sigmethod'}.':'. + '
'. + ''.$lt{'url'}.': '."\n". + (' 'x2). + ''.$lt{'key'}.': '."\n". + (' 'x2). + ''.$lt{'lifetime'}.': '."\n". + (' 'x2). + ''.$lt{'secret'}.':'. + ' '."\n". + '
'. + '
'.&mt('Optional settings').''. + ''.&mt('Display target:'); + my %defaultdisp; + $defaultdisp{'iframe'} = ' checked="checked"'; + foreach my $disp ('iframe','tab','window') { + $datatable .= ''.(' 'x2); + } + $datatable .= (' 'x4); + foreach my $dimen ('width','height') { + $datatable .= ''. + (' 'x2); + } + $datatable .= '
'. + '
'.$lt{'linktext'}.'
'. + '
'. + '
'.$lt{'explanation'}.'
'. + ''. + '

'; + my %units = ( + 'passback' => 'days', + 'roster' => 'seconds', + ); + my %defaulttimes = ( + 'passback' => '7', + 'roster' => '300', + ); + foreach my $extra ('passback','roster') { + my $onclick = ' onclick="toggleLTITools(this.form,'."'$extra','add'".');"'; + $datatable .= '
'.$lt{$extra}.' '. + ''.(' 'x2).''. + '
'. + '
'; + } + $datatable .= ''.$lt{'icon'}.': '. + '('.&mt('if larger than 21x21 pixels, image will be scaled').') '; + if ($switchserver) { + $datatable .= &mt('Upload to library server: [_1]',$switchserver); + } else { + $datatable .= ''; + } + $datatable .= '
'. + '
'.&mt('User data sent on launch').''. + ''; + foreach my $field (@fields) { + my ($id,$onclick,$spacer); + if ($field eq 'user') { + $id = ' id="ltitools_user_field_add"'; + $onclick = ' onclick="toggleLTITools(this.form,'."'$field','add'".')"'; + } else { + $spacer = (' ' x2); + } + $datatable .= ''.$spacer; + } + $datatable .= ''. + '
'; + $datatable .= '
'.&mt('Role mapping').''; + foreach my $role (@courseroles) { + my ($checked,$checkednone); + $datatable .= ''; + } + $datatable .= '
'. + &Apache::lonnet::plaintext($role,'Course').'
'. + '
'. + '
'.&mt('Configurable in course').''; + foreach my $item ('label','title','target','linktext','explanation','append') { + $datatable .= ''.(' ' x2)."\n"; + } + $datatable .= '
'. + '
'.&mt('Custom items sent on launch').''. + ''. + ''. + '
'.&mt('Action').''.&mt('Name').''.&mt('Value').'
'. + ''. + '
'."\n". + '
'.&mt('Encryption Key(s)').'
'. - ''.&mt('Not in use').'
'. - $extra. - '
' - .''.(' 'x2). - ''. - '
'.&mt('Required settings').''. - ''.$lt{'consumer'}. - ': '. - (' 'x2). - ''.$lt{'version'}.': '. - (' 'x2). - ''.$lt{'lifetime'}.':

'; - if ($key ne '') { - $datatable .= ''.$lt{'key'}; - if ($switchserver) { - $datatable .= ': ['.&mt('[_1] to view/edit',$switchserver).']'; - } else { - $datatable .= ':'; - } - $datatable .= ' '.(' 'x2); - } elsif (!$switchserver) { - $datatable .= ''.$lt{'key'}.':'. - ''. - ' '.(' 'x2); + my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_".$item."'".');"'; + $datatable .= '
' + .''.&mt('No').''. - (' 'x2). - ''.(' 'x2). - ''; - } elsif ($key eq '') { - $datatable .= ''.&mt('Key and Secret are required').' - '.$switchmessage.''."\n"; - } else { - $datatable .= ''.&mt('Secret required').' - '.$switchmessage.''."\n"; - } - } else { - if ($usable ne '') { - $datatable .= '
'. - $lt{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).'
'. - ''.&mt('Change?'). - ''. - (' 'x2). - '  '; - } else { - $datatable .= - ''.$lt{'secret'}.':'. - ''. - ''; - } - } - $datatable .= '

'. - ''.$lt{'requser'}.':'. - ' '."\n". - ''."\n". - '

'. - ''.$lt{'crsinc'}.':'. - ' '."\n". - ''."\n". - (' 'x4). - '
'. - ''.<i_options($i,$current,$itemcount,%lt).'
'. + '
'.&mt('Required settings').''. + ''.$lt{'consumer'}. + ': '. + (' 'x2). + ''.$lt{'version'}.': '. + (' 'x2). + ''.$lt{'lifetime'}.':'. + (' 'x2). + ''.$lt{'requser'}.':'. + ' '."\n". + ''."\n". + '

'. + ''.$lt{'key'}. + ': '. + (' 'x2). + ''.$lt{'secret'}.':'. + ''. + ''. + ''. + '
'.<i_options($i,$current,$itemcount,%lt).'
'."\n". - ''."\n". - '
'."\n". + ''."\n". + ' '."\n". - ''.&mt('Add').''. - '
'.&mt('Required settings').''. - ''.$lt{'consumer'}. - ': '."\n". - (' 'x2). - ''.$lt{'version'}.': '."\n". - (' 'x2). - ''.$lt{'lifetime'}.':

'."\n"; - if ($switchserver) { - $datatable .= ''.&mt('Key and Secret are required').' - '.$switchmessage.''."\n"; - } else { - $datatable .= ''.$lt{'key'}.': '."\n". - (' 'x2). - ''.$lt{'secret'}.':'. - ' '."\n"; - } - $datatable .= '

'. - ''.$lt{'requser'}.':'. - ' '."\n". - ''."\n". - '

'. - ''.$lt{'crsinc'}.':'. - ' '."\n". - ''."\n". - '
'.<i_options('add',undef,$itemcount,%lt). - '
'. + '
'.&mt('Required settings').''. + ''.$lt{'consumer'}. + ': '."\n". + (' 'x2). + ''.$lt{'version'}.': '."\n". + (' 'x2). + ''.$lt{'lifetime'}.': '."\n". + (' 'x2). + ''.$lt{'requser'}.':'. + ' '."\n". + ''."\n". + '

'. + ''.$lt{'key'}.': '."\n". + (' 'x2). + ''.$lt{'secret'}.':'. + ' '."\n". + '
'.<i_options('add',undef,$itemcount,%lt). + '
'; + foreach my $ltirole (@lticourseroles) { + my ($selected,$selectnone); + if ($rolemaps{$ltirole} eq '') { + $selectnone = ' selected="selected"'; + } + $output .= ''; + } + $output .= '
'.$ltirole.'
'. + '
'. + '
'.&mt('Roles which may create user accounts').''; foreach my $ltirole (@ltiroles) { $output .= '  '; + $checked{'makeuser'}{$ltirole}.' />'.$ltirole.'  '; } $output .= '
'. - '
'.&mt('New user accounts created for LTI users').''. + '
'.&mt('New user accounts created for LTI users').''. ''. &modifiable_userdata_row('lti','instdata_'.$num,$current,$numinrow,$itemcount). '
'. @@ -5786,29 +5165,7 @@ sub lti_options { ''.$lcauthparmtext.''. '
'. - '
'. - &mt('LON-CAPA menu items (Course Coordinator can override)').''. - '
'.$lt{'topmenu'}.': '. - ''.(' 'x2). - '
'. - '
'. - '
'.$lt{'inlinemenu'}.': '. - ''.(' 'x2). - '
'; - $output .='
'. - '
'. - ''.&mt('Menu items').': '; - foreach my $type ('fullname','coursetitle','role','logout','grades') { - $output .= ''. - (' 'x2); - } - $output .= '
'. - '
'.&mt('Mapping courses').''. + '
'.&mt('Mapping courses').''. '
'. &mt('Unique course identifier').': '; foreach my $option ('course_offering_sourcedid','context_id','other') { @@ -5825,51 +5182,21 @@ sub lti_options { $checked{'mapcrstype'}{$type}.' />'.$coursetypetitles{$type}.''. (' 'x2); } - $output .= '

'. - ''.&mt('Store mapping of course identifier to LON-CAPA CourseID').': '. - ''.(' 'x2). - ''. - '
'. - '
'.&mt('Mapping course roles').''; - foreach my $ltirole (@lticourseroles) { - my ($selected,$selectnone); - if ($rolemaps{$ltirole} eq '') { - $selectnone = ' selected="selected"'; - } - $output .= ''; - } - $output .= '
'.$ltirole.'
'. - '
'. - '
'.&mt('Creating courses').''. + $output .= '
'. + '
'.&mt('Creating courses').''. ''.&mt('Course created (if absent) on Instructor access').': '. ''.(' 'x2). ''. '
'. - '
'.&mt('Roles which may self-enroll').''; + '
'.&mt('Roles which may self-enroll').''; foreach my $lticrsrole (@lticourseroles) { $output .= '  '; } $output .= '
'. - '
'.&mt('Course options').''. + '
'.&mt('Course options').''. '
'.&mt('Assign users to sections').': '. ''.(' 'x2). @@ -5892,9 +5219,9 @@ sub lti_options { if ($extra eq 'passback') { $pb1p1chk = ' checked="checked"'; $pb1p0chk = ''; - $onclickpb = ' onclick="toggleLTI(this.form,'."'passback','$num'".');"'; + $onclickpb = ' onclick="toggleLTI(this.form,'."'passback','$num'".');"'; } else { - $onclickpb = ''; + $onclickpb = ''; } if (ref($current) eq 'HASH') { if (($current->{$extra})) { @@ -5920,8 +5247,27 @@ sub lti_options { ''.(' 'x2). '
'. - '
'; + &mt('Outcomes Extension (1.0)').'
'. + '
'.&mt('Course defaults (Course Coordinator can override)').''. + '
'.$lt{'topmenu'}.': '. + ''.(' 'x2). + '
'. + '
'. + '
'.$lt{'inlinemenu'}.': '. + ''.(' 'x2). + '
'; + $output .='
'. + '
'. + ''.&mt('Menu items').': '; + foreach my $type ('fullname','coursetitle','role','logout','grades') { + $output .= ''. + (' 'x2); + } $output .= '
'; # '
'.&mt('Assigning author roles').''; # @@ -5940,95 +5286,36 @@ sub ltimenu_titles { ); } -sub linkprot_suggestions { - my ($suggested,$itemcount) = @_; - my $count = 0; - my $next = 1; - my %lt = &Apache::lonlocal::texthash( - 'name' => 'Suggested Launcher', - 'info' => 'Recommendations', - ); - my ($datatable,$css_class,$dest); - if (ref($suggested) eq 'HASH') { - my @current = sort { $a <=> $b } keys(%{$suggested}); - $next += $current[-1]; - for (my $i=0; $i<@current; $i++) { - my $num = $current[$i]; - my %values; - if (ref($suggested->{$num}) eq 'HASH') { - %values = %{$suggested->{$num}}; - } else { - next; - } - $css_class = $$itemcount%2?' class="LC_odd_row"':''; - $datatable .= - '
'."\n". - ''."\n". - '
'.$lt{'name'}.''."\n". - ''."\n". - '
'. - '
'.$lt{'info'}.''."\n". - ''. - '
'. - '
'."\n". - '
'."\n". - ''."\n". - ''.&mt('Add').''."\n". - '
'.$lt{'name'}.''."\n". - ''."\n". - '
'. - '
'.$lt{'info'}.''."\n". - ''. - '
'. - '
'."\n". - '
'. + ''. ''.$choices{'canclone'}. ''; my $currcanclone = 'none'; my $onclick; my @cloneoptions = ('none','domain'); - my %clonetitles = &Apache::lonlocal::texthash ( + my %clonetitles = ( none => 'No additional course requesters', domain => "Any course requester in course's domain", instcode => 'Course requests for official courses ...', @@ -6132,49 +5419,17 @@ sub print_coursedefaults { $itemcount ++; } else { $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - my ($currdefresponder,%defcredits,%curruploadquota,%currcoursequota, - %deftimeout,%currmysql); + my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql); my $currusecredits = 0; my $postsubmitclient = 1; - my $ltiauth = 0; - my %domexttool; - my %exttool; - my @types = ('official','unofficial','community','textbook'); + my @types = ('official','unofficial','community','textbook','placement'); if (ref($settings) eq 'HASH') { - if ($settings->{'ltiauth'}) { - $ltiauth = 1; - } - if (ref($settings->{'domexttool'}) eq 'HASH') { - foreach my $type (@types) { - if ($settings->{'domexttool'}->{$type}) { - $domexttool{$type} = ' checked="checked"'; - } - } - } else { - foreach my $type (@types) { - if ($staticdefaults{'domexttool'}) { - $domexttool{$type} = ' checked="checked"'; - } - } - } - if (ref($settings->{'exttool'}) eq 'HASH') { - foreach my $type (@types) { - if ($settings->{'exttool'}->{$type}) { - $exttool{$type} = ' checked="checked"'; - } - } - } $currdefresponder = $settings->{'anonsurvey_threshold'}; if (ref($settings->{'uploadquota'}) eq 'HASH') { foreach my $type (keys(%{$settings->{'uploadquota'}})) { $curruploadquota{$type} = $settings->{'uploadquota'}{$type}; } } - if (ref($settings->{'coursequota'}) eq 'HASH') { - foreach my $type (keys(%{$settings->{'coursequota'}})) { - $currcoursequota{$type} = $settings->{'coursequota'}{$type}; - } - } if (ref($settings->{'coursecredits'}) eq 'HASH') { foreach my $type (@types) { next if ($type eq 'community'); @@ -6220,9 +5475,6 @@ sub print_coursedefaults { } else { foreach my $type (@types) { $deftimeout{$type} = $staticdefaults{'postsubmit'}; - if ($staticdefaults{'domexttool'}) { - $domexttool{$type} = ' checked="checked"'; - } } } if (!$currdefresponder) { @@ -6234,9 +5486,6 @@ sub print_coursedefaults { if ($curruploadquota{$type} eq '') { $curruploadquota{$type} = $staticdefaults{'uploadquota'}; } - if ($currcoursequota{$type} eq '') { - $currcoursequota{$type} = $staticdefaults{'coursequota'}; - } } $datatable .= ''. @@ -6251,25 +5500,12 @@ sub print_coursedefaults { $datatable .= ''. $choices{'uploadquota'}. ''. - ''; - foreach my $type (@types) { - $datatable .= ''; - } - $datatable .= '
'.&mt($type).'
'. - '
'. - $choices{'coursequota'}. - ''. ''; foreach my $type (@types) { $datatable .= ''; + ''; } $datatable .= '
'.&mt($type).'
'. - '
'; foreach my $type (@types) { next if ($type eq 'community'); - $additional .= ''; } @@ -6306,7 +5542,7 @@ sub print_coursedefaults { ''.&mt('Enter 0 to remain disabled until page reload.').'
'. '
'.&mt($type).'
'. + $additional .= '
'.&mt($type).'
'. '
'; foreach my $type (@types) { - $additional .= ''; } @@ -6324,53 +5560,16 @@ sub print_coursedefaults { $datatable .= ''. - ''."\n"; $itemcount ++; - %defaultchecked = ('ltiauth' => 'off'); - @toggles = ('ltiauth'); - $current = { - 'ltiauth' => $ltiauth, - }; - ($table,$itemcount) = - &radiobutton_prefs($current,\@toggles,\%defaultchecked, - \%choices,$itemcount,undef,undef,'left'); - $datatable .= $table; - $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable .= ''. - ''."\n"; - $itemcount ++; - $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable .= ''. - ''."\n"; + } $$rowtotal += $itemcount; return $datatable; @@ -6380,7 +5579,7 @@ sub print_selfenrollment { my ($position,$dom,$settings,$rowtotal) = @_; my ($css_class,$datatable); my $itemcount = 1; - my @types = ('official','unofficial','community','textbook'); + my @types = ('official','unofficial','community','textbook','placement'); if (($position eq 'top') || ($position eq 'middle')) { my ($rowsref,$titlesref) = &Apache::lonuserutils::get_selfenroll_titles(); my %descs = &Apache::lonuserutils::selfenroll_default_descs(); @@ -6622,6 +5821,7 @@ sub print_passwords { min => 'Minimum password length', max => 'Maximum password length', chars => 'Required characters', + expire => 'Password expiration (days)', numsaved => 'Number of previous passwords to save and disallow reuse', ); if ($position eq 'top') { @@ -6687,7 +5887,7 @@ sub print_passwords { $datatable .= ''. - '   '; + '   '; } } my $checkedcase; @@ -6791,7 +5991,7 @@ sub print_passwords { &mt('(If you use the same account ... reset a password from this page.)').'

'. &mt('Include custom text:'); if ($customurl) { - my $link = &Apache::loncommon::modal_link($customurl,&mt('custom text'),600,500, + my $link = &Apache::loncommon::modal_link($customurl,&mt('Custom text file'),600,500, undef,undef,undef,undef,'background-color:#ffffff'); $datatable .= ' '.$link. ''. - ''. - ''; - } - return $datatable; -} - -sub password_rules { - my ($prefix,$itemcountref,$settings) = @_; - my ($min,$max,%chars,$numsaved,$numinrow); - my %titles; - if ($prefix eq 'passwords') { - %titles = &Apache::lonlocal::texthash ( - min => 'Minimum password length', - max => 'Maximum password length', - chars => 'Required characters', - ); - } elsif (($prefix eq 'ltisecrets') || ($prefix eq 'toolsecrets')) { - %titles = &Apache::lonlocal::texthash ( - min => 'Minimum secret length', - max => 'Maximum secret length', - chars => 'Required characters', - ); - } - $min = $Apache::lonnet::passwdmin; - my $datatable; - my $itemcount; - if (ref($itemcountref)) { - $itemcount = $$itemcountref; - } - if (ref($settings) eq 'HASH') { - if ($settings->{min}) { - $min = $settings->{min}; - } - if ($settings->{max}) { - $max = $settings->{max}; - } - if (ref($settings->{chars}) eq 'ARRAY') { - map { $chars{$_} = 1; } (@{$settings->{chars}}); - } - if ($prefix eq 'passwords') { - if ($settings->{numsaved}) { - $numsaved = $settings->{numsaved}; + if ($settings->{expire}) { + $expire = $settings->{expire}; } - } - } - my %rulenames = &Apache::lonlocal::texthash( - uc => 'At least one upper case letter', - lc => 'At least one lower case letter', - num => 'At least one number', - spec => 'At least one non-alphanumeric', - ); - my $css_class = $itemcount%2?' class="LC_odd_row"':''; - $datatable .= ''. - ''; - $itemcount ++; - $css_class = $itemcount%2?' class="LC_odd_row"':''; - $datatable .= ''. - ''; - $itemcount ++; - $css_class = $itemcount%2?' class="LC_odd_row"':''; - $datatable .= ''; - my $numinrow = 2; - my @possrules = ('uc','lc','num','spec'); - $datatable .= ''; - $itemcount ++; - if ($prefix eq 'passwords') { - $titles{'numsaved'} = &mt('Number of previous passwords to save and disallow reuse'); + my %rulenames = &Apache::lonlocal::texthash( + uc => 'At least one upper case letter', + lc => 'At least one lower case letter', + num => 'At least one number', + spec => 'At least one non-alphanumeric', + ); $css_class = $itemcount%2?' class="LC_odd_row"':''; - $datatable .= ''. + $datatable .= ''. ''; $itemcount ++; - } - if (ref($itemcountref)) { - $$itemcountref += $itemcount; - } - return $datatable; -} - -sub print_wafproxy { - my ($position,$dom,$settings,$rowtotal) = @_; - my $css_class; - my $itemcount = 0; - my $datatable; - my %servers = &Apache::lonnet::internet_dom_servers($dom); - my (%othercontrol,%otherdoms,%aliases,%saml,%values,$setdom,$showdom); - my %lt = &wafproxy_titles(); - foreach my $server (sort(keys(%servers))) { - my $serverhome = &Apache::lonnet::get_server_homeID($servers{$server}); - next if ($serverhome eq ''); - my $serverdom; - if ($serverhome ne $server) { - $serverdom = &Apache::lonnet::host_domain($serverhome); - if (($serverdom ne '') && (&Apache::lonnet::domain($serverdom) ne '')) { - $othercontrol{$server} = $serverdom; - } - } else { - $serverdom = &Apache::lonnet::host_domain($server); - next if (($serverdom eq '') || (&Apache::lonnet::domain($serverdom) eq '')); - if ($serverdom ne $dom) { - $othercontrol{$server} = $serverdom; - } else { - $setdom = 1; - if (ref($settings) eq 'HASH') { - if (ref($settings->{'alias'}) eq 'HASH') { - $aliases{$dom} = $settings->{'alias'}; - if ($aliases{$dom} ne '') { - $showdom = 1; - } - } - if (ref($settings->{'saml'}) eq 'HASH') { - $saml{$dom} = $settings->{'saml'}; - } - } - } - } - } - if ($setdom) { - %{$values{$dom}} = (); - if (ref($settings) eq 'HASH') { - foreach my $item ('remoteip','ipheader','trusted','vpnint','vpnext') { - $values{$dom}{$item} = $settings->{$item}; + $css_class = $itemcount%2?' class="LC_odd_row"':''; + $datatable .= ''. + ''; + $itemcount ++; + $css_class = $itemcount%2?' class="LC_odd_row"':''; + $datatable .= ''; + my $numinrow = 2; + my @possrules = ('uc','lc','num','spec'); + $datatable .= ''; + $itemcount ++; + $css_class = $itemcount%2?' class="LC_odd_row"':''; + $datatable .= ''. + ''; + $itemcount ++; + $css_class = $itemcount%2?' class="LC_odd_row"':''; + $datatable .= ''. + ''; } else { - my %ip_methods = &remoteip_methods(); - if ($setdom) { - $itemcount ++; - $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - my ($nowafstyle,$wafstyle,$curr_remotip,$currwafdisplay,$vpndircheck,$vpnaliascheck, - $currwafvpn,$wafrangestyle,$alltossl,$ssltossl); - $wafstyle = ' style="display:none;"'; - $nowafstyle = ' style="display:table-row;"'; - $currwafdisplay = ' style="display: none"'; - $wafrangestyle = ' style="display: none"'; - $curr_remotip = 'n'; - $ssltossl = ' checked="checked"'; - if ($showdom) { - $wafstyle = ' style="display:table-row;"'; - $nowafstyle = ' style="display:none;"'; - if (keys(%{$values{$dom}})) { - if ($values{$dom}{remoteip} =~ /^[nmh]$/) { - $curr_remotip = $values{$dom}{remoteip}; - } - if ($curr_remotip eq 'h') { - $currwafdisplay = ' style="display:table-row"'; - $wafrangestyle = ' style="display:inline-block;"'; - } - if ($values{$dom}{'sslopt'}) { - $alltossl = ' checked="checked"'; - $ssltossl = ''; - } - } - if (($values{$dom}{'vpnint'} ne '') || ($values{$dom}{'vpnext'} ne '')) { - $vpndircheck = ' checked="checked"'; - $currwafvpn = ' style="display:table-row;"'; - $wafrangestyle = ' style="display:inline-block;"'; - } else { - $vpnaliascheck = ' checked="checked"'; - $currwafvpn = ' style="display:none;"'; - } - } - $datatable .= ''. - ''. - ''. - ''. - ''. - ''. - ''; - } - if (keys(%otherdoms)) { - foreach my $domain (sort(keys(%otherdoms))) { - $itemcount ++; - $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable .= ''. - ''. - ''; + my $checkedon; + my $checkedoff = ' checked="checked"'; + if (ref($settings) eq 'HASH') { + if ($settings->{crsownerchg}) { + $checkedon = $checkedoff; + $checkedoff = ''; } } + $css_class = $itemcount%2?' class="LC_odd_row"':''; + $datatable .= ''. + ''. + ''; + } - $$rowtotal += $itemcount; return $datatable; } -sub wafproxy_titles { - return &Apache::lonlocal::texthash( - remoteip => "Method for determining user's IP", - ipheader => 'Request header containing remote IP', - trusted => 'Trusted IP range(s)', - vpnaccess => 'Access from institutional VPN', - vpndirect => 'via regular hostname (no WAF)', - vpnaliased => 'via aliased hostname (WAF)', - vpnint => 'Internal IP Range(s) for VPN sessions', - vpnext => 'IP Range(s) for backend WAF connections', - sslopt => 'Forwarding http/https', - alltossl => 'WAF forwards both http and https requests to https', - ssltossl => 'WAF forwards http requests to http and https to https', - ); -} - -sub remoteip_methods { - return &Apache::lonlocal::texthash( - m => 'Use Apache mod_remoteip', - h => 'Use headers parsed by LON-CAPA', - n => 'Not in use', - ); -} - sub print_usersessions { my ($position,$dom,$settings,$rowtotal) = @_; - my ($css_class,$datatable,%checked,%choices); - my (%by_ip,%by_location,@intdoms); - &build_location_hashes(\@intdoms,\%by_ip,\%by_location); + my ($css_class,$datatable,$itemcount,%checked,%choices); + my (%by_ip,%by_location,@intdoms,@instdoms); + &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms); my @alldoms = &Apache::lonnet::all_domains(); my %serverhomes = %Apache::lonnet::serverhomeIDs; my %servers = &Apache::lonnet::internet_dom_servers($dom); my %altids = &id_for_thisdom(%servers); - my $itemcount = 1; if ($position eq 'top') { if (keys(%serverhomes) > 1) { my %spareid = ¤t_offloads_to($dom,$settings,\%servers); - my ($curroffloadnow,$curroffloadoth); + my $curroffloadnow; if (ref($settings) eq 'HASH') { if (ref($settings->{'offloadnow'}) eq 'HASH') { $curroffloadnow = $settings->{'offloadnow'}; } - if (ref($settings->{'offloadoth'}) eq 'HASH') { - $curroffloadoth = $settings->{'offloadoth'}; - } } - my $other_insts = scalar(keys(%by_location)); - $datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids, - $other_insts,$curroffloadnow,$curroffloadoth,$rowtotal); + $datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,$curroffloadnow,$rowtotal); } else { $datatable .= ''; } } else { - if (keys(%by_location) == 0) { - $datatable .= ''; + my %titles = &usersession_titles(); + my ($prefix,@types); + if ($position eq 'bottom') { + $prefix = 'remote'; + @types = ('version','excludedomain','includedomain'); } else { - my %lt = &usersession_titles(); - my $numinrow = 5; - my $prefix; - my @types; - if ($position eq 'bottom') { - $prefix = 'remote'; - @types = ('version','excludedomain','includedomain'); - } else { - $prefix = 'hosted'; - @types = ('excludedomain','includedomain'); - } - my (%current,%checkedon,%checkedoff); - my @lcversions = &Apache::lonnet::all_loncaparevs(); - my @locations = sort(keys(%by_location)); - foreach my $type (@types) { - $checkedon{$type} = ''; - $checkedoff{$type} = ' checked="checked"'; - } - if (ref($settings) eq 'HASH') { - if (ref($settings->{$prefix}) eq 'HASH') { - foreach my $key (keys(%{$settings->{$prefix}})) { - $current{$key} = $settings->{$prefix}{$key}; - if ($key eq 'version') { - if ($current{$key} ne '') { - $checkedon{$key} = ' checked="checked"'; - $checkedoff{$key} = ''; - } - } elsif (ref($current{$key}) eq 'ARRAY') { + $prefix = 'hosted'; + @types = ('excludedomain','includedomain'); + } + ($datatable,$itemcount) = &rules_by_location($settings,$prefix,\%by_location,\%by_ip,\@types,\%titles); + } + $$rowtotal += $itemcount; + return $datatable; +} + +sub rules_by_location { + my ($settings,$prefix,$by_location,$by_ip,$types,$titles) = @_; + my ($datatable,$itemcount,$css_class); + if (keys(%{$by_location}) == 0) { + $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; + $datatable = ''; + $itemcount = 1; + } else { + $itemcount = 0; + my $numinrow = 5; + my (%current,%checkedon,%checkedoff); + my @locations = sort(keys(%{$by_location})); + foreach my $type (@{$types}) { + $checkedon{$type} = ''; + $checkedoff{$type} = ' checked="checked"'; + } + if (ref($settings) eq 'HASH') { + if (ref($settings->{$prefix}) eq 'HASH') { + foreach my $key (keys(%{$settings->{$prefix}})) { + $current{$key} = $settings->{$prefix}{$key}; + if ($key eq 'version') { + if ($current{$key} ne '') { $checkedon{$key} = ' checked="checked"'; $checkedoff{$key} = ''; } + } elsif (ref($current{$key}) eq 'ARRAY') { + $checkedon{$key} = ' checked="checked"'; + $checkedoff{$key} = ''; } } } - foreach my $type (@types) { - next if ($type ne 'version' && !@locations); - $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable .= ' - '; + $itemcount ++; + } + } + return ($datatable,$itemcount); +} + +sub print_ssl { + my ($position,$dom,$settings,$rowtotal) = @_; + my ($css_class,$datatable); + my $itemcount = 1; + if ($position eq 'top') { + my $primary_id = &Apache::lonnet::domain($dom,'primary'); + my $intdom = &Apache::lonnet::internet_dom($primary_id); + my $same_institution; + if ($intdom ne '') { + my $internet_names = &Apache::lonnet::get_internet_names($Apache::lonnet::perlvar{'lonHostID'}); + if (ref($internet_names) eq 'ARRAY') { + if (grep(/^\Q$intdom\E$/,@{$internet_names})) { + $same_institution = 1; + } + } + } + $css_class = $itemcount%2?' class="LC_odd_row"':''; + $datatable = ''; + $itemcount ++; + } else { + my %titles = &ssl_titles(); + my (%by_ip,%by_location,@intdoms,@instdoms); + &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms); + my @alldoms = &Apache::lonnet::all_domains(); + my %serverhomes = %Apache::lonnet::serverhomeIDs; + my @domservers = &Apache::lonnet::get_servers($dom); + my %servers = &Apache::lonnet::internet_dom_servers($dom); + my %altids = &id_for_thisdom(%servers); + if (($position eq 'connto') || ($position eq 'connfrom')) { + my $legacy; + unless (ref($settings) eq 'HASH') { + my $name; + if ($position eq 'connto') { + $name = 'loncAllowInsecure'; + } else { + $name = 'londAllowInsecure'; + } + my $primarylibserv = &Apache::lonnet::domain($dom,'primary'); + my @ids=&Apache::lonnet::current_machine_ids(); + if (($primarylibserv ne '') && (!grep(/^\Q$primarylibserv\E$/,@ids))) { + my %what = ( + $name => 1, + ); + my ($result,$returnhash) = + &Apache::lonnet::get_remote_globals($primarylibserv,\%what); + if ($result eq 'ok') { + if (ref($returnhash) eq 'HASH') { + $legacy = $returnhash->{$name}; + } + } + } else { + $legacy = $Apache::lonnet::perlvar{$name}; + } + } + foreach my $type ('dom','intdom','other') { + my %checked; + $css_class = $itemcount%2?' class="LC_odd_row"':''; + $datatable .= ''. + '
'.&mt($type).'
'. + $additional .= '
'.&mt($type).'
'. '
'. $choices{'mysqltables'}. ''. + ''. ''; foreach my $type (@types) { - $datatable .= ''; } $datatable .= '
'.&mt($type).'
'. + $datatable .= '
'.&mt($type).'
'. '
'. - $choices{'domexttool'}. - ''. - ''; - foreach my $type (@types) { - $datatable .= ''."\n"; - } - $datatable .= '
'. - ''. - ''. - &mt($type).'
'. - $choices{'exttool'}. - ''. - ''; - foreach my $type (@types) { - $datatable .= ''."\n"; - } - $datatable .= '
'. - ''. - ''. - &mt($type).'
'. - &mt('Requirements').'
    '. - '
  • '.&mt("Course 'type' is not a Community").'
  • '. - '
  • '.&mt('User is Course Coordinator and also course owner').'
  • '. - '
  • '.&mt("Student's only active roles are student role(s) in course(s) owned by this user").'
  • '. - '
  • '.&mt('User, course, and student share same domain').'
  • '. - '
'. - '
'; - foreach my $item ('by','for') { - $datatable .= '
'. - ''.$ownertitles{$item}.''; - if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) { - foreach my $type (@{$types}) { - my $checked; - if ($ownerchg{$item}{$type}) { - $checked = ' checked="checked"'; - } - $datatable .= ''. - '   '; - } + if ($settings->{max}) { + $max = $settings->{max}; } - my $checked; - if ($ownerchg{$item}{'default'}) { - $checked = ' checked="checked"'; + if (ref($settings->{chars}) eq 'ARRAY') { + map { $chars{$_} = 1; } (@{$settings->{chars}}); } - $datatable .= '
'; - } - $datatable .= '
'.$titles{'min'}.''. - ''. - ' '.&mt('(Enter an integer: 7 or larger)').''. - '
'.$titles{'max'}.''. - ''. - ' '.&mt('(Leave blank for no maximum)').''. - '
'.$titles{'chars'}.'
'. - ''.&mt('(Leave unchecked if not required)'). - '
'; - for (my $i=0; $i<@possrules; $i++) { - my ($rem,$checked); - if ($chars{$possrules[$i]}) { - $checked = ' checked="checked"'; - } - $rem = $i%($numinrow); - if ($rem == 0) { - if ($i > 0) { - $datatable .= ''; + if ($settings->(numsaved}) { + $numsaved = $settings->(numsaved}; } - $datatable .= ''; + } else { + $min = '7'; } - $datatable .= ''; - } - my $rem = @possrules%($numinrow); - my $colsleft = $numinrow - $rem; - if ($colsleft > 1 ) { - $datatable .= ''; - } elsif ($colsleft == 1) { - $datatable .= ''; - } - $datatable .='
'. - '  
'.$titles{'numsaved'}.''.$titles{'min'}.''. - ''. - ' '.&mt('(Leave blank to not save previous passwords)').''. + ''. + ' '.&mt('(Leave blank for no minimum)').''. '
'.$titles{'max'}.''. + ''. + ' '.&mt('(Leave blank for no maximum)').''. + '
'.$titles{'chars'}.'
'. + ''.&mt('(Leave unchecked if not required)'). + '
'; + for (my $i=0; $i<@possrules; $i++) { + my ($rem,$checked); + if ($chars{$possrules[$i]}) { + $checked = ' checked="checked"'; } - } - } - if (keys(%othercontrol)) { - %otherdoms = reverse(%othercontrol); - foreach my $domain (keys(%otherdoms)) { - %{$values{$domain}} = (); - my %config = &Apache::lonnet::get_dom('configuration',['wafproxy'],$domain); - if (ref($config{'wafproxy'}) eq 'HASH') { - $aliases{$domain} = $config{'wafproxy'}{'alias'}; - if (exists($config{'wafproxy'}{'saml'})) { - $saml{$domain} = $config{'wafproxy'}{'saml'}; - } - foreach my $item ('remoteip','ipheader','trusted','vpnint','vpnext') { - $values{$domain}{$item} = $config{'wafproxy'}{$item}; + $rem = $i%($numinrow); + if ($rem == 0) { + if ($i > 0) { + $datatable .= ''; } + $datatable .= ''; } + $datatable .= ''; } - } - if ($position eq 'top') { - my %servers = &Apache::lonnet::internet_dom_servers($dom); - my %aliasinfo; - foreach my $server (sort(keys(%servers))) { - $itemcount ++; - my $dom_in_effect; - my $aliasrows = ''. - ''; - if ($othercontrol{$server}) { - $dom_in_effect = $othercontrol{$server}; - my ($current,$forsaml); - if (ref($aliases{$dom_in_effect}) eq 'HASH') { - $current = $aliases{$dom_in_effect}{$server}; - } - if (ref($saml{$dom_in_effect}) eq 'HASH') { - if ($saml{$dom_in_effect}{$server}) { - $forsaml = 1; - } - } - $aliasrows .= ''; - } else { - $dom_in_effect = $dom; - my ($current,$samlon,$samloff); - $samloff = ' checked="checked"'; - if (ref($aliases{$dom}) eq 'HASH') { - if ($aliases{$dom}{$server}) { - $current = $aliases{$dom}{$server}; - } - } - if (ref($saml{$dom}) eq 'HASH') { - if ($saml{$dom}{$server}) { - $samlon = $samloff; - undef($samloff); - } - } - $aliasrows .= ''; - } - $aliasrows .= ''; - $aliasinfo{$dom_in_effect} .= $aliasrows; - } - if ($aliasinfo{$dom}) { - my ($onclick,$wafon,$wafoff,$showtable); - $onclick = ' onclick="javascript:toggleWAF();"'; - $wafoff = ' checked="checked"'; - $showtable = ' style="display:none";'; - if ($showdom) { - $wafon = $wafoff; - $wafoff = ''; - $showtable = ' style="display:inline;"'; - } - $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable = ''. - ''. - ''; - $itemcount++; - } - if (keys(%otherdoms)) { - foreach my $key (sort(keys(%otherdoms))) { - $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - $datatable .= ''. - ''. - ''; - $itemcount++; - } + my $rem = @possrules%($numinrow); + my $colsleft = $numinrow - $rem; + if ($colsleft > 1 ) { + $datatable .= ''; + } elsif ($colsleft == 1) { + $datatable .= ''; } + $datatable .='
'. - &mt('Hostname').': '. - ''. - &Apache::lonnet::hostname($server).' '. - &mt('Alias').': '; - if ($current) { - $aliasrows .= $current; - if ($forsaml) { - $aliasrows .= ' ('.&mt('also for SSO Auth').')'; - } - } else { - $aliasrows .= &mt('None'); - } - $aliasrows .= ' ('. - &mt('controlled by domain: [_1]', - ''.$dom_in_effect.'').')'. - &mt('Alias').': '. - ''. - (' 'x2).''. - &mt('Alias used for SSO Auth').':  '. - '
'.&mt('Domain: [_1]',''.$dom.'').'
'. - ''.&mt('WAF in use?').' '.(' 'x2).'
'. - ''.$aliasinfo{$dom}. - '
'.&mt('Domain: [_1]',''.$key.'').''.$aliasinfo{$key}. - '
'. + '  
'.$titles{'expire'}.''. + ''. + ' '.&mt('(Leave blank for no expiration)').''. + '
'.$titles{'numsaved'}.''. + ''. + ' '.&mt('(Leave blank to not save previous passwords)').''. + '
'.&mt('Domain: [_1]',''.$dom.'').''.&mt('WAF not in use, nothing to set').'
'.&mt('Domain: [_1]',''.$dom.'').'

'. - '
'.&mt('Format for comma separated IP ranges').':
'. - &mt('A.B.C.D/N or A.B.C.D-E.F.G.H').'
'. - &mt('Range(s) stored in CIDR notation').'
'. - ''. - ''."\n". - ''."\n". - ''."\n". - ''."\n". - ''. - ''; - foreach my $item ('vpnint','vpnext') { - $datatable .= ''. - ''."\n"; - } - $datatable .= ''."\n". - ''. - ''."\n". - '
'.$lt{'remoteip'}.': '. - '
'. - $lt{'ipheader'}.': '. - ''. - '
'. - $lt{'trusted'}.':
'. - ''. - '

'.$lt{'vpnaccess'}.':
'. - ''.(' 'x2). - '
'.$lt{$item}.':
'. - ''. - '

'.$lt{'sslopt'}.':
'. - ''.(' 'x2). - '
'.&mt('Domain: [_1]',''.$domain.'').''; - foreach my $item ('remoteip','ipheader','trusted','vpnint','vpnext','sslopt') { - my $showval = &mt('None'); - if ($item eq 'ssl') { - $showval = $lt{'ssltossl'}; - } - if ($values{$domain}{$item}) { - $showval = $values{$domain}{$item}; - if ($item eq 'ssl') { - $showval = $lt{'alltossl'}; - } elsif ($item eq 'remoteip') { - $showval = $ip_methods{$values{$domain}{$item}}; - } - } - $datatable .= ''. - ''; - } - $datatable .= '
'.$lt{$item}.': '.$showval.'
'. + &mt('Requirements').'
    '. + '
  • '.&mt("Course 'type' is not a Community").'
  • '. + '
  • '.&mt('User is Course Coordinator and also course owner').'
  • '. + '
  • '.&mt("Student's only active roles are student role(s) in course(s) owned by this user").'
  • '. + '
'. + '
'. + '   '. + ''. + '
'. &mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.'). '
'. - &mt('Nothing to set here, as the cluster to which this domain belongs only contains one institution.'). - '
'. + &mt('Nothing to set here, as the cluster to which this domain belongs only contains one institution.'). + '
'.$lt{$type}.'
-   -   -
'; - if ($type eq 'version') { - my $selector = ''.$titles->{$type}.'
+   +   +
'; + if ($type eq 'version') { + my @lcversions = &Apache::lonnet::all_loncaparevs(); + my $selector = ' '; - $datatable .= &mt('remote server must be version: [_1] or later',$selector); - } else { - $datatable.= '
'.(' 'x2). - ''. - "\n". - '
'; - my $rem; - for (my $i=0; $i<@locations; $i++) { - my ($showloc,$value,$checkedtype); - if (ref($by_location{$locations[$i]}) eq 'ARRAY') { - my $ip = $by_location{$locations[$i]}->[0]; - if (ref($by_ip{$ip}) eq 'ARRAY') { - $value = join(':',@{$by_ip{$ip}}); - $showloc = join(', ',@{$by_ip{$ip}}); - if (ref($current{$type}) eq 'ARRAY') { - foreach my $loc (@{$by_ip{$ip}}) { - if (grep(/^\Q$loc\E$/,@{$current{$type}})) { - $checkedtype = ' checked="checked"'; - last; - } + $selector .= ' '; + } + $selector .= ' '; + $datatable .= &mt('remote server must be version: [_1] or later',$selector); + } else { + $datatable.= '
'.(' 'x2). + ''. + "\n". + '
'; + my $rem; + for (my $i=0; $i<@locations; $i++) { + my ($showloc,$value,$checkedtype); + if (ref($by_location->{$locations[$i]}) eq 'ARRAY') { + my $ip = $by_location->{$locations[$i]}->[0]; + if (ref($by_ip->{$ip}) eq 'ARRAY') { + $value = join(':',@{$by_ip->{$ip}}); + $showloc = join(', ',@{$by_ip->{$ip}}); + if (ref($current{$type}) eq 'ARRAY') { + foreach my $loc (@{$by_ip->{$ip}}) { + if (grep(/^\Q$loc\E$/,@{$current{$type}})) { + $checkedtype = ' checked="checked"'; + last; } } } } - $rem = $i%($numinrow); - if ($rem == 0) { - if ($i > 0) { - $datatable .= ''; - } - $datatable .= ''; - } - $datatable .= ''; } - $rem = @locations%($numinrow); - my $colsleft = $numinrow - $rem; - if ($colsleft > 1 ) { - $datatable .= ''; - } elsif ($colsleft == 1) { - $datatable .= ''; + $rem = $i%($numinrow); + if ($rem == 0) { + if ($i > 0) { + $datatable .= ''; + } + $datatable .= ''; + } + $datatable .= ''; + } + $rem = @locations%($numinrow); + my $colsleft = $numinrow - $rem; + if ($colsleft > 1 ) { + $datatable .= ''; + } elsif ($colsleft == 1) { + $datatable .= ''; + } + $datatable .= '
'. - ''. - '  
'. + ''. + '  
'; + } + $datatable .= '
'; + if ($same_institution) { + my %domservers = &Apache::lonnet::get_servers($dom); + $datatable .= &LONCAPA::SSL::print_certstatus(\%domservers,'web','domprefs'); + } else { + $datatable .= &mt("You need to be logged into one of your own domain's servers to display information about the status of LON-CAPA SSL certificates."); + } + $datatable .= '
'.$titles{$type}.''; + my $skip; + if ($type eq 'dom') { + unless (keys(%servers) > 1) { + $datatable .= &mt('Nothing to set here, as there are no other servers/VMs'); + $skip = 1; + } + } + if ($type eq 'intdom') { + unless (@instdoms > 1) { + $datatable .= &mt('Nothing to set here, as there are no other domains for this institution'); + $skip = 1; + } + } elsif ($type eq 'other') { + if (keys(%by_location) == 0) { + $datatable .= &mt('Nothing to set here, as there are no other institutions'); + $skip = 1; + } + } + unless ($skip) { + $checked{'yes'} = ' checked="checked"'; + if (ref($settings) eq 'HASH') { + if (ref($settings->{$position}) eq 'HASH') { + if ($settings->{$position}->{$type} =~ /^(no|req)$/) { + $checked{$1} = $checked{'yes'}; + delete($checked{'yes'}); + } + } + } else { + if ($legacy == 0) { + $checked{'req'} = $checked{'yes'}; + delete($checked{'yes'}); + } + } + foreach my $option ('no','yes','req') { + $datatable .= ''.(' 'x2); } - $datatable .= '
'; } $datatable .= '
'. + &mt('Nothing to set here, as there are no other institutions'). + '
@@ -7682,15 +6697,8 @@ sub spares_row { ,''.$server.'').'
'. ''."\n". ''. - "\n"; - if ($other_insts) { - $datatable .= '
'. - ''."\n". - ''. + ' '.&mt('Switch active users on next access').''. "\n"; - } my (%current,%canselect); my @choices = &possible_newspares($server,$spareid->{$server},$serverhomes,$altids); @@ -7854,7 +6862,7 @@ sub print_loadbalancing { my $disabled_div_style = 'display: block'; my $homedom_div_style = 'display: none'; $datatable .= '
'. + ''. '

'; if ($lonhost eq '') { $datatable .= ''; @@ -7887,7 +6895,7 @@ sub print_loadbalancing { $homedom_div_style = 'display: block'; } } - $datatable .= '

'. + $datatable .= '

'. '
'.$disabledtext.'
'."\n". '
'.&mt('Offloads to:').'
'; @@ -7898,7 +6906,7 @@ sub print_loadbalancing { no => ' checked="checked"', ); my %balcookiechecked = ( - no => ' checked="checked"', + no => ' checked="checked"', ); foreach my $sparetype (@sparestypes) { my $targettable; @@ -8119,7 +7127,7 @@ sub loadbalance_rule_row { $space = '
 
'; } my $output = - '
'.$space. + '
'.$space. '
'.$title.'
'.$space. '
'."\n"; @@ -8209,8 +7217,8 @@ sub contact_titles { 'updatesmail' => 'E-mail from nightly check of LON-CAPA module integrity/updates', 'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID', 'hostipmail' => 'E-mail from nightly check of hostname/IP network changes', - 'errorthreshold' => 'Error count threshold for status e-mail to admin(s)', - 'errorsysmail' => 'Error count threshold for e-mail to developer group', + 'errorthreshold' => 'Error/warning threshold for status e-mail', + 'errorsysmail' => 'Error threshold for e-mail to core group', 'errorweights' => 'Weights used to compute error count', 'errorexcluded' => 'Servers with unsent updates excluded from count', ); @@ -8255,11 +7263,11 @@ sub tool_titles { blog => 'Blog', webdav => 'WebDAV', portfolio => 'Portfolio', - timezone => 'Can set time zone', official => 'Official courses (with institutional codes)', unofficial => 'Unofficial courses', community => 'Communities', textbook => 'Textbook courses', + placement => 'Placement tests', ); return %titles; } @@ -8270,9 +7278,10 @@ sub courserequest_titles { unofficial => 'Unofficial', community => 'Communities', textbook => 'Textbook', + placement => 'Placement tests', lti => 'LTI Provider', norequest => 'Not allowed', - approval => 'Approval by Dom. Coord.', + approval => 'Approval by DC', validate => 'With validation', autolimit => 'Numerical limit', unlimited => '(blank for unlimited)', @@ -8361,7 +7370,7 @@ sub print_usercreation { } $datatable .= ''. '
'.$lt{$item}. - ''; + ''; my @options = ('any'); if (ref($rules) eq 'HASH') { if (keys(%{$rules}) > 0) { @@ -8483,7 +7492,7 @@ sub print_selfcreation { ($datatable,$itemcount) = &radiobutton_prefs(\%radiohash,\@toggles,\%defaultchecked, \%choices,$itemcount,$onclick); $$rowtotal += $itemcount; - + if (ref($usertypes) eq 'HASH') { if (keys(%{$usertypes}) > 0) { $datatable .= &insttypes_row($createsettings,$types,$usertypes, @@ -8620,7 +7629,7 @@ sub print_selfcreation { my $currstyle = 'display:none'; if (grep(/^\Q$status\E$/,@ordered)) { $currstyle = $rowstyle; - $hidden = 0; + $hidden = 0; } $datatable .= &noninst_users($processing,$emailverified,$emailoptions,$emaildomain, $emailrules,$emailruleorder,$settings,$status,$rowid, @@ -8647,8 +7656,8 @@ sub print_selfcreation { foreach my $status (@posstypes) { my $rowid = $classprefix.$status; my $datarowstyle = 'display:none'; - if (grep(/^\Q$status\E$/,@ordered)) { - $datarowstyle = $rowstyle; + if (grep(/^\Q$status\E$/,@ordered)) { + $datarowstyle = $rowstyle; } $datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings, $numinrow,$$rowtotal,\%usertypeshash,$infofields, @@ -8750,7 +7759,7 @@ function toggleEmailOptions(form,radio,p document.getElementById(altprefix+'_inst_'+status).style.display = 'none'; document.getElementById(altprefix+'_noninst_'+status).style.display = 'none'; if (curr == 'custom') { - if (prefix) { + if (prefix) { document.getElementById(prefix+'_'+status).style.display = 'inline'; } } else if (curr == 'inst') { @@ -8773,10 +7782,10 @@ ENDSCRIPT sub noninst_users { my ($processing,$emailverified,$emailoptions,$emaildomain,$emailrules, - $emailruleorder,$settings,$type,$rowid,$typetitle,$css_class,$rowstyle,$intdom) = @_; + $emailruleorder,$settings,$type,$rowid,$typetitle,$css_class,$rowstyle,$intdom) = @_; my $class = 'LC_left_item'; if ($css_class) { - $css_class = ' class="'.$css_class.'"'; + $css_class = ' class="'.$css_class.'"'; } if ($rowid) { $rowid = ' id="'.$rowid.'"'; @@ -8791,10 +7800,10 @@ sub noninst_users { $description = &mt('Requests for: [_1] (status self-reported)',$typetitle); } $output = ''. - "$description$description'. ''; - my %headers = &Apache::lonlocal::texthash( + my %headers = &Apache::lonlocal::texthash( approve => 'Processing', email => 'E-mail', username => 'Username', @@ -8804,7 +7813,7 @@ sub noninst_users { } $output .= ''; foreach my $item ('approve','email','username') { - $output .= ''. ''; } - $output .= ''; - unless (($type eq 'email') || ($type eq 'unamemap')) { - $output .= '
'; + $output .= ''; my (%choices,@options,$hashref,$defoption,$name,$onclick,$hascustom); if ($item eq 'approve') { %choices = &Apache::lonlocal::texthash ( @@ -8919,7 +7928,7 @@ sub noninst_users { my $value; if (ref($emaildomain) eq 'HASH') { if (ref($emaildomain->{$type}) eq 'HASH') { - $value = $emaildomain->{$type}->{$option}; + $value = $emaildomain->{$type}->{$option}; } } if ($value eq '') { @@ -9035,7 +8044,7 @@ sub user_formats_row { 'username' => 'new usernames', 'id' => 'IDs', ); - unless (($type eq 'email') || ($type eq 'unamemap')) { + unless ($type eq 'email') { my $css_class = $rowcount%2?' class="LC_odd_row"':''; $output = '
'. @@ -9090,9 +8099,9 @@ sub user_formats_row { } elsif ($colsleft == 1) { $output .= ' 
'; + unless ($type eq 'email') { + $output .= '
'.&mt('Name displayed').':'. + ''.&mt('Name displayed:'). ''. '
'. - &mt('Name displayed').':'. + ''. + &mt('Name displayed:'). '
'.&mt('Available conversions').''. - &user_formats_row('unamemap',$settings,$unamemaprules, - $ruleorder,$numinrow). - '
'. - &mt('No rules set for domain in customized localenroll.pm'). - '
'; + $datatable .= ''; if (!$switchserver) { $datatable .= &mt('Upload:').'
'; } @@ -9576,13 +8551,10 @@ sub legacy_scantronformat { my ($url,$error); my @statinfo = &Apache::lonnet::stat_file($newurl); if ((!@statinfo) || ($statinfo[0] eq 'no_such_dir')) { - my $modified = []; (my $result,$url) = - &Apache::lonconfigsettings::publishlogo($r,'copy',$legacyfile,$dom,$confname, - 'scantron','','',$newfile,$modified); - if ($result eq 'ok') { - &update_modify_urls($r,$modified); - } else { + &publishlogo($r,'copy',$legacyfile,$dom,$confname,'scantron', + '','',$newfile); + if ($result ne 'ok') { $error = &mt("An error occurred publishing the [_1] bubblesheet format file in RES space. Error was: [_2].",$newfile,$result); } } @@ -9767,6 +8739,10 @@ sub print_coursecategories { my $toggle_catscomm_dom = ' checked="checked" '; my $can_catcomm_comm = ' '; my $can_catcomm_dom = ' checked="checked" '; + my $toggle_catsplace_place = ' '; + my $toggle_catsplace_dom = ' checked="checked" '; + my $can_catplace_place = ' '; + my $can_catplace_dom = ' checked="checked" '; if (ref($settings) eq 'HASH') { if ($settings->{'togglecats'} eq 'crs') { @@ -9785,17 +8761,28 @@ sub print_coursecategories { $can_catcomm_comm = $can_catcomm_dom; $can_catcomm_dom = ' '; } + if ($settings->{'togglecatsplace'} eq 'place') { + $toggle_catsplace_place = $toggle_catsplace_dom; + $toggle_catsplace_dom = ' '; + } + if ($settings->{'categorizeplace'} eq 'place') { + $can_catplace_place = $can_catplace_dom; + $can_catplace_dom = ' '; + } } my %title = &Apache::lonlocal::texthash ( - togglecats => 'Show/Hide a course in catalog', - togglecatscomm => 'Show/Hide a community in catalog', - categorize => 'Assign a category to a course', - categorizecomm => 'Assign a category to a community', + togglecats => 'Show/Hide a course in catalog', + togglecatscomm => 'Show/Hide a community in catalog', + togglecatsplace => 'Show/Hide a placement test in catalog', + categorize => 'Assign a category to a course', + categorizecomm => 'Assign a category to a community', + categorizeplace => 'Assign a category to a placement test', ); my %level = &Apache::lonlocal::texthash ( - dom => 'Set in Domain', - crs => 'Set in Course', - comm => 'Set in Community', + dom => 'Set in Domain', + crs => 'Set in Course', + comm => 'Set in Community', + place => 'Set in Placement Test', ); $datatable = '
'.$title{'togglecats'}.'
'.$title{'togglecatsplace'}.' '. + '
'.$title{'categorizeplace'}.''. + ' '. + '
'; - if ($parent eq 'instcode' || $parent eq 'communities') { + if ($parent eq 'instcode' || $parent eq 'communities' || $parent eq 'placement') { $datatable .= '' .$default_names{$parent}.''; if ($parent eq 'instcode') { @@ -9900,7 +8904,7 @@ sub print_coursecategories { $datatable .= ''; - if ($parent eq 'communities') { + if (($parent eq 'communities') || ($parent eq 'placement')) { $datatable .= '
'; } $datatable .= ''; @@ -9932,7 +8936,7 @@ sub print_coursecategories { .'' .''."\n"; $itemcount ++; - foreach my $default ('instcode','communities') { + foreach my $default ('instcode','communities','placement') { if ((!grep(/^\Q$default\E$/,@{$cats[0]})) || ($cathash->{$default.'::0'} eq '')) { $css_class = $itemcount%2?' class="LC_odd_row"':''; my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$default"."_pos','$lastidx'".');"'; @@ -10021,31 +9025,14 @@ sub print_serverstatuses { sub serverstatus_pages { return ('userstatus','lonstatus','loncron','server-status','codeversions', - 'checksums','clusterstatus','metadata_keywords','metadata_harvest', - 'takeoffline','takeonline','showenv','toggledebug','ping','domconf', - 'uniquecodes','diskusage','coursecatalog'); + 'checksums','clusterstatus','certstatus','metadata_keywords', + 'metadata_harvest','takeoffline','takeonline','showenv','toggledebug', + 'ping','domconf','uniquecodes','diskusage','coursecatalog'); } sub defaults_javascript { my ($settings) = @_; return unless (ref($settings) eq 'HASH'); - my $portal_js = <<"ENDPORTAL"; - -function portalExtras(caller) { - var x = caller.value; - var y = new Array('email','web'); - for (var i=0; i 0) { - z.style.display = 'block'; - } else { - z.style.display = 'none'; - } - } - } -} -ENDPORTAL if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { my $maxnum = scalar(@{$settings->{'inststatusorder'}}); if ($maxnum eq '') { @@ -10099,17 +9086,6 @@ $jstext return; } -$portal_js - -// ]]> - - -ENDSCRIPT - } else { -return <<"ENDSCRIPT"; - @@ -10119,31 +9095,16 @@ ENDSCRIPT } sub passwords_javascript { - my ($prefix) = @_; - my %intalert; - if ($prefix eq 'passwords') { - %intalert = &Apache::lonlocal::texthash ( - authcheck => 'Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.', - authcost => 'Warning: bcrypt encryption cost for internal authentication must be an integer.', - passmin => 'Warning: minimum password length must be a positive integer greater than 6.', - passmax => 'Warning: maximum password length must be a positive integer (or blank).', - passnum => 'Warning: number of previous passwords to save must be a positive integer (or blank).', - ); - } elsif (($prefix eq 'ltisecrets') || ($prefix eq 'toolsecrets')) { - %intalert = &Apache::lonlocal::texthash ( - passmin => 'Warning: minimum secret length must be a positive integer greater than 6.', - passmax => 'Warning: maximum secret length must be a positive integer (or blank).', - ); - } - &js_escape(\%intalert); - my $defmin = $Apache::lonnet::passwdmin; - my $intauthjs; - if ($prefix eq 'passwords') { $intauthjs = <<"ENDSCRIPT"; + my $intauthcheck = &mt('Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.'); + my $intauthcost = &mt('Warning: bcrypt encryption cost for internal authentication must be an integer.'); + &js_escape(\$intauthcheck); + &js_escape(\$intauthcost); + my $intauthjs = <<"ENDSCRIPT"; function warnIntAuth(field) { if (field.name == 'intauth_check') { if (field.value == '2') { - alert('$intalert{authcheck}'); + alert('$intauthcheck'); } } if (field.name == 'intauth_cost') { @@ -10151,52 +9112,7 @@ function warnIntAuth(field) { if (field.value != '') { var regexdigit=/^\\d+\$/; if (!regexdigit.test(field.value)) { - alert('$intalert{authcost}'); - } - } - } - return; -} - -ENDSCRIPT - - } - - $intauthjs .= <<"ENDSCRIPT"; - -function warnInt$prefix(field) { - field.value.replace(/^\s+/,''); - field.value.replace(/\s+\$/,''); - var regexdigit=/^\\d+\$/; - if (field.name == '${prefix}_min') { - if (field.value == '') { - alert('$intalert{passmin}'); - field.value = '$defmin'; - } else { - if (!regexdigit.test(field.value)) { - alert('$intalert{passmin}'); - field.value = '$defmin'; - } - var minval = parseInt(field.value,10); - if (minval < $defmin) { - alert('$intalert{passmin}'); - field.value = '$defmin'; - } - } - } else { - if (field.value == '0') { - field.value = ''; - } - if (field.value != '') { - if (!regexdigit.test(field.value)) { - if (field.name == '${prefix}_max') { - alert('$intalert{passmax}'); - } else { - if (field.name == '${prefix}_numsaved') { - alert('$intalert{passnum}'); - } - } - field.value = ''; + alert('$intauthcost'); } } } @@ -10231,9 +9147,11 @@ sub coursecategories_javascript { } my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"'); my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"'); + my $placement_reserved = &mt('The name: [_1] is a reserved category.','"placement"'); my $choose_again = "\n".&mt('Please use a different name for the new top level category.'); &js_escape(\$instcode_reserved); &js_escape(\$communities_reserved); + &js_escape(\$placement_reserved); &js_escape(\$choose_again); $output = <<"ENDSCRIPT";