@@ -3317,10 +3222,8 @@ sub print_helpsettings {
my $css_class;
my %existing=&Apache::lonnet::dump('roles',$dom,$confname,'rolesdef_');
my (%customroles,%ordered,%current);
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{'adhoc'}) eq 'HASH') {
- %current = %{$settings->{'adhoc'}};
- }
+ if (ref($settings->{'adhoc'}) eq 'HASH') {
+ %current = %{$settings->{'adhoc'}};
}
my $count = 0;
foreach my $key (sort(keys(%existing))) {
@@ -3347,7 +3250,7 @@ sub print_helpsettings {
my $context = 'domprefs';
my $crstype = 'Course';
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
- my @accesstypes = ('all','dh','da','none');
+ my @accesstypes = ('all','none');
my ($numstatustypes,@jsarray);
if (ref($types) eq 'ARRAY') {
if (@{$types} > 0) {
@@ -3356,7 +3259,7 @@ sub print_helpsettings {
@jsarray = ('bystatus');
}
}
- my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh','da']);
+ my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh']);
if (keys(%domhelpdesk)) {
push(@accesstypes,('inc','exc'));
push(@jsarray,('notinc','notexc'));
@@ -3565,7 +3468,7 @@ function helpdeskAccess(num) {
shown = Array('notinc');
hidden = Array('notexc','bystatus');
}
- if ((curraccess == 'all') || (curraccess == 'dh') || (curraccess == 'da')) {
+ if (curraccess == 'all') {
hidden = Array('notinc','notexc','bystatus');
}
}
@@ -3594,7 +3497,7 @@ function helpdeskAccess(num) {
function toggleHelpdeskItem(num,field) {
if (document.getElementById('helproles_'+num+'_'+field)) {
if (document.getElementById('helproles_'+num+'_'+field).className.match(/(?:^|\\s)LC_hidden(?!\\S)/)) {
- document.getElementById('helproles_'+num+'_'+field).className =
+ document.getElementById('helproles_'+num+'_'+field).className =
document.getElementById('helproles_'+num+'_'+field).className.replace(/(?:^|\\s)LC_hidden(?!\\S)/g ,'');
if (document.getElementById('helproles_'+num+'_'+field+'_vis')) {
document.getElementById('helproles_'+num+'_'+field+'_vis').value = '$html_js_lt{hide}';
@@ -3622,9 +3525,7 @@ sub helpdeskroles_access {
my %lt = &Apache::lonlocal::texthash(
'rou' => 'Role usage',
'whi' => 'Which helpdesk personnel may use this role?',
- 'all' => 'All with domain helpdesk or helpdesk assistant role',
- 'dh' => 'All with domain helpdesk role',
- 'da' => 'All with domain helpdesk assistant role',
+ 'all' => 'All',
'none' => 'None',
'status' => 'Determined based on institutional status',
'inc' => 'Include all, but exclude specific personnel',
@@ -3722,7 +3623,7 @@ sub radiobutton_prefs {
} else {
$datatable .= '';
}
- $datatable .=
+ $datatable .=
''.
' '.&mt('Yes').
@@ -3816,8 +3717,6 @@ sub print_ltitools {
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"';
}
@@ -3827,12 +3726,10 @@ sub print_ltitools {
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') {
+ foreach my $disp ('iframe','window') {
$datatable .= ' '.
$lt{$disp}.' '.(' 'x2);
}
@@ -3842,12 +3739,6 @@ sub print_ltitools {
' '.
(' 'x2);
}
- $datatable .= ' '.
- ''.$lt{'linktext'}.' '.
- '
'.
- ''.$lt{'explanation'}.' '.
- '
';
$datatable .= ' ';
foreach my $extra ('passback','roster') {
my $checkedon = '';
@@ -3905,7 +3796,7 @@ sub print_ltitools {
if (!$rolemaps{$role}) {
$selectnone = ' selected="selected"';
}
- $datatable .= ' '.
+ $datatable .= ' '.
&Apache::lonnet::plaintext($role,'Course').' '.
''.
''.&mt('Select').' ';
@@ -3929,7 +3820,7 @@ sub print_ltitools {
}
}
$datatable .= ''.&mt('Configurable in course').' ';
- foreach my $item ('label','title','target','linktext','explanation') {
+ foreach my $item ('label','title','target') {
my $checked;
if ($courseconfig{$item}) {
$checked = ' checked="checked"';
@@ -3997,7 +3888,7 @@ sub print_ltitools {
''.&mt('Display target:');
my %defaultdisp;
$defaultdisp{'iframe'} = ' checked="checked"';
- foreach my $disp ('iframe','tab','window') {
+ foreach my $disp ('iframe','window') {
$datatable .= ' '.
$lt{$disp}.' '.(' 'x2);
}
@@ -4007,12 +3898,7 @@ sub print_ltitools {
' '.
(' 'x2);
}
- $datatable .= ' '.
- ''.$lt{'linktext'}.' '.
- '
'.
- ''.$lt{'explanation'}.' '.
- ''.
- '
';
+ $datatable .= ' ';
foreach my $extra ('passback','roster') {
$datatable .= $lt{$extra}.' '.
' '.
@@ -4050,10 +3936,10 @@ sub print_ltitools {
}
$datatable .= ' '.
''.&mt('Configurable in course').' ';
- foreach my $item ('label','title','target','linktext','explanation') {
- $datatable .= ''.
- ' '.
- $lt{'crs'.$item}.' '.(' ' x2)."\n";
+ foreach my $item ('label','title','target') {
+ $datatable .= ''.
+ ' '.
+ $lt{'crs'.$item}.' '.(' ' x2)."\n";
}
$datatable .= ' '.
''.&mt('Custom items sent on launch').' '.
@@ -4071,35 +3957,29 @@ sub print_ltitools {
sub ltitools_names {
my %lt = &Apache::lonlocal::texthash(
- 'title' => 'Title',
- 'version' => 'Version',
- 'msgtype' => 'Message Type',
- 'url' => 'URL',
- 'key' => 'Key',
- 'secret' => 'Secret',
- 'icon' => 'Icon',
- 'user' => 'Username:domain',
- 'fullname' => 'Full Name',
- 'firstname' => 'First Name',
- 'lastname' => 'Last Name',
- 'email' => 'E-mail',
- 'roles' => 'Role',
- 'window' => 'Window',
- 'tab' => 'Tab',
- 'iframe' => 'iFrame',
- 'height' => 'Height',
- 'width' => 'Width',
- 'linktext' => 'Default Link Text',
- 'explanation' => 'Default Explanation',
- 'passback' => 'Tool can return grades:',
- 'roster' => 'Tool can retrieve roster:',
- 'crstarget' => 'Display target',
- 'crslabel' => 'Course label',
- 'crstitle' => 'Course title',
- 'crslinktext' => 'Link Text',
- 'crsexplanation' => 'Explanation',
+ 'title' => 'Title',
+ 'version' => 'Version',
+ 'msgtype' => 'Message Type',
+ 'url' => 'URL',
+ 'key' => 'Key',
+ 'secret' => 'Secret',
+ 'icon' => 'Icon',
+ 'user' => 'Username:domain',
+ 'fullname' => 'Full Name',
+ 'firstname' => 'First Name',
+ 'lastname' => 'Last Name',
+ 'email' => 'E-mail',
+ 'roles' => 'Role',
+ 'window' => 'Window/Tab',
+ 'iframe' => 'iFrame',
+ 'height' => 'Height',
+ 'width' => 'Width',
+ 'passback' => 'Tool can return grades:',
+ 'roster' => 'Tool can retrieve roster:',
+ 'crstarget' => 'Display target',
+ 'crslabel' => 'Course label',
+ 'crstitle' => 'Course title',
);
-
return %lt;
}
@@ -4108,6 +3988,7 @@ sub print_coursedefaults {
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)',
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
coursecredits => 'Credits can be specified for courses',
@@ -4125,11 +4006,12 @@ sub print_coursedefaults {
);
if ($position eq 'top') {
%defaultchecked = (
+ 'canuse_pdfforms' => 'off',
'uselcmath' => 'on',
'usejsme' => 'on',
- 'canclone' => 'none',
+ 'canclone' => 'none',
);
- @toggles = ('uselcmath','usejsme');
+ @toggles = ('canuse_pdfforms','uselcmath','usejsme');
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
\%choices,$itemcount);
$css_class = $itemcount%2?' class="LC_odd_row"':'';
@@ -4166,7 +4048,7 @@ sub print_coursedefaults {
$currcanclone = $settings->{'canclone'};
}
}
- }
+ }
foreach my $option (@cloneoptions) {
my ($checked,$additional);
if ($currcanclone eq $option) {
@@ -4208,7 +4090,7 @@ sub print_coursedefaults {
my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql);
my $currusecredits = 0;
my $postsubmitclient = 1;
- my @types = ('official','unofficial','community','textbook');
+ my @types = ('official','unofficial','community','textbook','placement');
if (ref($settings) eq 'HASH') {
$currdefresponder = $settings->{'anonsurvey_threshold'};
if (ref($settings->{'uploadquota'}) eq 'HASH') {
@@ -4235,7 +4117,7 @@ sub print_coursedefaults {
foreach my $type (@types) {
if (ref($settings->{'postsubmit'}->{'timeout'}) eq 'HASH') {
if ($settings->{'postsubmit'}->{'timeout'}->{$type} =~ /^\d+$/) {
- $deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type};
+ $deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type};
} else {
$deftimeout{$type} = $staticdefaults{'postsubmit'};
}
@@ -4351,7 +4233,7 @@ sub print_coursedefaults {
foreach my $type (@types) {
$datatable .= ''.&mt($type).' '.
' ';
+ ' value="'.$currmysql{$type}.'" size="5" /> ';
}
$datatable .= ''."\n";
$itemcount ++;
@@ -4365,7 +4247,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();
@@ -4588,15 +4470,14 @@ sub print_validation_rows {
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);
@@ -4609,118 +4490,226 @@ sub print_usersessions {
$datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,$curroffloadnow,$rowtotal);
} else {
$datatable .= ''.
- &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 server.').
+ ' ';
}
} else {
- if (keys(%by_location) == 0) {
- $datatable .= ''.
- &mt('Nothing to set here, as the cluster to which this domain belongs only contains one institution.');
+ 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 = ' '.
+ &mt('Nothing to set here, as the cluster to which this domain belongs only contains one institution.').
+ ' ';
+ $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 .= '
- '.$lt{$type}.'
-
- '.&mt('Not in use').'
- '.&mt('In use').' ';
- if ($type eq 'version') {
- my $selector = '';
- foreach my $version (@lcversions) {
- my $selected = '';
- if ($current{'version'} eq $version) {
- $selected = ' selected="selected"';
- }
- $selector .= ' '.$version.' ';
+ }
+ foreach my $type (@{$types}) {
+ next if ($type ne 'version' && !@locations);
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= '
+ '.$titles->{$type}.'
+
+ '.&mt('Not in use').'
+ '.&mt('In use').' ';
+ if ($type eq 'version') {
+ my @lcversions = &Apache::lonnet::all_loncaparevs();
+ my $selector = '';
+ foreach my $version (@lcversions) {
+ my $selected = '';
+ if ($current{'version'} eq $version) {
+ $selected = ' selected="selected"';
}
- $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 .= ' '.$version.' ';
+ }
+ $selector .= ' ';
+ $datatable .= &mt('remote server must be version: [_1] or later',$selector);
+ } else {
+ $datatable.= ' '.(' 'x2).
+ ' '.
+ "\n".
+ '
';
+ }
+ $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 = '
';
+ 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 .= ' ';
+ $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 'middle') {
+ foreach my $type ('dom','intdom','other') {
+ my %checked;
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $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->{'connect'}) eq 'HASH') {
+ if ($settings->{'connect'}->{$type} =~ /^(no|req)$/) {
+ $checked{$1} = $checked{'yes'};
+ delete($checked{'yes'});
+ }
+ }
+ }
+ foreach my $option ('no','yes','req') {
+ $datatable .= ''.
+ ' '.$titles{$option}.
+ ' '.(' 'x2);
}
- $datatable .= '
';
}
$datatable .= '
';
+ $itemcount ++;
+ }
+ } else {
+ my $prefix = 'replication';
+ my @types = ('certreq','nocertreq');
+ if (keys(%by_location) == 0) {
+ $datatable .= ''.
+ &mt('Nothing to set here, as there are no other institutions').
+ ' ';
$itemcount ++;
+ } else {
+ ($datatable,$itemcount) =
+ &rules_by_location($settings,$prefix,\%by_location,\%by_ip,\@types,\%titles);
}
}
}
@@ -4728,10 +4717,59 @@ 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',
+ connect => 'Connections to 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);
@@ -4748,7 +4786,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);
@@ -4888,7 +4932,7 @@ sub spares_row {
'.
&mt('[_1] when busy, offloads to:'
,''.$server.' ').' '.
- ''."\n".
+ ''."\n".
' '.
' '.&mt('Switch active users on next access').' '.
"\n";
@@ -5252,14 +5296,9 @@ sub loadbalancing_titles {
'_LC_ipchange' => &mt('Non-SSO users with IP mismatch'),
);
my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external','_LC_ipchangesso','_LC_ipchange');
- my @available;
if (ref($types) eq 'ARRAY') {
- @available = @{$types};
+ unshift(@alltypes,@{$types},'default');
}
- unless (grep(/^default$/,@available)) {
- push(@available,'default');
- }
- unshift(@alltypes,@available);
my %titles;
foreach my $type (@alltypes) {
if ($type =~ /^_LC_/) {
@@ -5386,8 +5425,8 @@ sub contact_titles {
'adminemail' => 'Default Server Admin E-mail address',
'errormail' => 'Error reports to be e-mailed to',
'packagesmail' => 'Package update alerts to be e-mailed to',
- 'helpdeskmail' => "Helpdesk requests from all users in this domain",
- 'otherdomsmail' => 'Helpdesk requests from users in other (unconfigured) domains',
+ 'helpdeskmail' => "Helpdesk requests for this domain's users",
+ 'otherdomsmail' => 'Helpdesk requests for other (unconfigured) domains',
'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)',
'requestsmail' => 'E-mail from course requests requiring approval',
'updatesmail' => 'E-mail from nightly check of LON-CAPA module integrity/updates',
@@ -5408,14 +5447,14 @@ sub helpform_fields {
'cc' => 'Cc e-mail',
'course' => 'Course Details',
'section' => 'Sections',
- 'screenshot' => 'File upload',
+ 'screenshot' => 'File upload',
);
my @fields = ('username','phone','user','course','section','cc','screenshot');
my %possoptions = (
username => ['yes','no','req'],
- phone => ['yes','no','req'],
+ phone => ['yes','no','req'],
user => ['yes','no'],
- cc => ['yes','no'],
+ cc => ['yes','no'],
course => ['yes','no'],
section => ['yes','no'],
screenshot => ['yes','no'],
@@ -5438,6 +5477,7 @@ sub tool_titles {
unofficial => 'Unofficial courses',
community => 'Communities',
textbook => 'Textbook courses',
+ placement => 'Placement tests',
);
return %titles;
}
@@ -5448,6 +5488,7 @@ sub courserequest_titles {
unofficial => 'Unofficial',
community => 'Communities',
textbook => 'Textbook',
+ placement => 'Placement tests',
norequest => 'Not allowed',
approval => 'Approval by Dom. Coord.',
validate => 'With validation',
@@ -5635,7 +5676,6 @@ sub print_selfcreation {
my %radiohash;
my $numinrow = 4;
map { $radiohash{'cancreate_'.$_} = 1; } @selfcreate;
- my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
if ($position eq 'top') {
my %choices = &Apache::lonlocal::texthash (
cancreate_login => 'Institutional Login',
@@ -5651,11 +5691,13 @@ sub print_selfcreation {
\%choices,$itemcount,$onclick);
$$rowtotal += $itemcount;
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
+
if (ref($usertypes) eq 'HASH') {
if (keys(%{$usertypes}) > 0) {
$datatable .= &insttypes_row($createsettings,$types,$usertypes,
$dom,$numinrow,$othertitle,
- 'statustocreate',$rowtotal);
+ 'statustocreate',$$rowtotal);
$$rowtotal ++;
}
}
@@ -5700,22 +5742,16 @@ sub print_selfcreation {
$$rowtotal ++;
} elsif ($position eq 'middle') {
my %domconf = &Apache::lonnet::get_dom('configuration',['usermodification'],$dom);
- my @posstypes;
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
+ $usertypes->{'default'} = $othertitle;
if (ref($types) eq 'ARRAY') {
- @posstypes = @{$types};
- }
- unless (grep(/^default$/,@posstypes)) {
- push(@posstypes,'default');
- }
- my %usertypeshash;
- if (ref($usertypes) eq 'HASH') {
- %usertypeshash = %{$usertypes};
- }
- $usertypeshash{'default'} = $othertitle;
- foreach my $status (@posstypes) {
- $datatable .= &modifiable_userdata_row('selfcreate',$status,$domconf{'usermodification'},
- $numinrow,$$rowtotal,\%usertypeshash);
- $$rowtotal ++;
+ push(@{$types},'default');
+ $usertypes->{'default'} = $othertitle;
+ foreach my $status (@{$types}) {
+ $datatable .= &modifiable_userdata_row('selfcreate',$status,$domconf{'usermodification'},
+ $numinrow,$$rowtotal,$usertypes);
+ $$rowtotal ++;
+ }
}
} else {
my %choices = &Apache::lonlocal::texthash (
@@ -5733,30 +5769,29 @@ sub print_selfcreation {
my $onclick = "toggleDisplay(this.form,'emailoptions');";
my $additional = '';
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
- my (@ordered,%usertypeshash);
- if (ref($domdefaults{'inststatusguest'}) eq 'ARRAY') {
- @ordered = @{$domdefaults{'inststatusguest'}};
- }
- if (@ordered) {
- unless (grep(/^default$/,@ordered)) {
- push(@ordered,'default');
- }
- if (ref($usertypes) eq 'HASH') {
- %usertypeshash = %{$usertypes};
- }
- $usertypeshash{'default'} = $othertitle;
- $additional .= '
';
- foreach my $status (@ordered) {
- $additional .= ''.$usertypeshash{$status}.' ';
- }
- $additional .= ' ';
- foreach my $status (@ordered) {
- $additional .= ''.&email_as_username($rowtotal,$processing,$status).' ';
+ my $usertypes = {};
+ my $order = [];
+ if ((ref($domdefaults{'inststatustypes'}) eq 'HASH') && (ref($domdefaults{'inststatusguest'}) eq 'ARRAY')) {
+ $usertypes = $domdefaults{'inststatustypes'};
+ $order = $domdefaults{'inststatusguest'};
+ }
+ if (ref($order) eq 'ARRAY') {
+ push(@{$order},'default');
+ if (@{$order} > 1) {
+ $usertypes->{'default'} = &mt('Other users');
+ $additional .= '';
+ foreach my $status (@{$order}) {
+ $additional .= ''.$usertypes->{$status}.' ';
+ }
+ $additional .= ' ';
+ foreach my $status (@{$order}) {
+ $additional .= ''.&email_as_username($rowtotal,$processing,$status).' ';
+ }
+ $additional .= '
';
+ } else {
+ $usertypes->{'default'} = &mt('All users');
+ $additional .= &email_as_username($rowtotal,$processing);
}
- $additional .= '
';
- } else {
- $usertypeshash{'default'} = $othertitle;
- $additional .= &email_as_username($rowtotal,$processing);
}
$additional .= '
'."\n";
@@ -5767,10 +5802,12 @@ sub print_selfcreation {
$$rowtotal ++;
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info();
$numinrow = 1;
- foreach my $status (@ordered) {
- $datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings,
- $numinrow,$$rowtotal,\%usertypeshash,$infofields,$infotitles);
- $$rowtotal ++;
+ if (ref($order) eq 'ARRAY') {
+ foreach my $status (@{$order}) {
+ $datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings,
+ $numinrow,$$rowtotal,$usertypes,$infofields,$infotitles);
+ $$rowtotal ++;
+ }
}
my ($emailrules,$emailruleorder) =
&Apache::lonnet::inst_userrules($dom,'email');
@@ -5842,7 +5879,7 @@ sub email_as_username {
sub captcha_choice {
my ($context,$settings,$itemcount) = @_;
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext,
- $vertext,$currver);
+ $vertext,$currver);
my %lt = &captcha_phrases();
$keyentry = 'hidden';
if ($context eq 'cancreate') {
@@ -6037,10 +6074,7 @@ sub print_usermodification {
sub print_defaults {
my ($position,$dom,$settings,$rowtotal) = @_;
my $rownum = 0;
- my ($datatable,$css_class,$titles);
- unless ($position eq 'bottom') {
- $titles = &defaults_titles($dom);
- }
+ my ($datatable,$css_class);
if ($position eq 'top') {
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def',
'datelocale_def','portal_def');
@@ -6053,6 +6087,7 @@ sub print_defaults {
$defaults{$item} = $domdefaults{$item};
}
}
+ my $titles = &defaults_titles($dom);
foreach my $item (@items) {
if ($rownum%2) {
$css_class = '';
@@ -6100,87 +6135,8 @@ sub print_defaults {
$datatable .= ' ';
$rownum ++;
}
- } elsif ($position eq 'middle') {
- my @items = ('intauth_cost','intauth_check','intauth_switch');
- my %defaults;
- if (ref($settings) eq 'HASH') {
- %defaults = %{$settings};
- if ($defaults{'intauth_cost'} !~ /^\d+$/) {
- $defaults{'intauth_cost'} = 10;
- }
- if ($defaults{'intauth_check'} !~ /^(0|1|2)$/) {
- $defaults{'intauth_check'} = 0;
- }
- if ($defaults{'intauth_switch'} !~ /^(0|1|2)$/) {
- $defaults{'intauth_switch'} = 0;
- }
- } else {
- %defaults = (
- 'intauth_cost' => 10,
- 'intauth_check' => 0,
- 'intauth_switch' => 0,
- );
- }
- foreach my $item (@items) {
- if ($rownum%2) {
- $css_class = '';
- } else {
- $css_class = ' class="LC_odd_row" ';
- }
- $datatable .= ''.
- ''.$titles->{$item}.
- ' ';
- if ($item eq 'intauth_switch') {
- my @options = (0,1,2);
- my %optiondesc = &Apache::lonlocal::texthash (
- 0 => 'No',
- 1 => 'Yes',
- 2 => 'Yes, and copy existing passwd file to passwd.bak file',
- );
- $datatable .= '';
- } elsif ($item eq 'intauth_check') {
- my @options = (0,1,2);
- my %optiondesc = &Apache::lonlocal::texthash (
- 0 => 'No',
- 1 => 'Yes, allow login then update passwd file using default cost (if higher)',
- 2 => 'Yes, disallow login if stored cost is less than domain default',
- );
- $datatable .= '';
- } else {
- $datatable .= ' ';
- }
- $datatable .= ' ';
- $rownum ++;
- }
} else {
- my %defaults;
+ my (%defaults);
if (ref($settings) eq 'HASH') {
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH') &&
(ref($settings->{'inststatusguest'}) eq 'ARRAY')) {
@@ -6275,9 +6231,6 @@ sub defaults_titles {
'timezone_def' => 'Default timezone',
'datelocale_def' => 'Default locale for dates',
'portal_def' => 'Portal/Default 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',
);
if ($dom) {
my $uprimary_id = &Apache::lonnet::domain($dom,'primary');
@@ -6520,6 +6473,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') {
@@ -6538,17 +6495,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'}.' '.
@@ -6578,8 +6546,22 @@ sub print_coursecategories {
$can_catcomm_dom.' value="dom" />'.$level{'dom'}.' '.
' '.$level{'comm'}.' '.
+ ' '.
+ ''.$title{'togglecatsplace'}.' '.
+ ''.
+ ' '.$level{'dom'}.' '.
+ ' '.$level{'place'}.' '.
+ ' '.
+ ''.$title{'categorizeplace'}.' '.
+ ''.
+ ' '.$level{'dom'}.' '.
+ ' '.$level{'place'}.' '.
' ';
- $$rowtotal += 4;
+ $$rowtotal += 6;
} else {
my $css_class;
my $itemcount = 1;
@@ -6604,12 +6586,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;
@@ -6630,7 +6615,7 @@ sub print_coursecategories {
$datatable .= ''.$vpos.' ';
}
$datatable .= '