--- loncom/interface/domainprefs.pm 2016/09/18 19:22:48 1.160.6.71
+++ loncom/interface/domainprefs.pm 2017/01/28 03:48:44 1.290
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.71 2016/09/18 19:22:48 raeburn Exp $
+# $Id: domainprefs.pm,v 1.290 2017/01/28 03:48:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -19,7 +19,8 @@
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA#
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
@@ -103,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, and textbook). In each case the radio buttons
-allow the selection of one of four values:
+(official, unofficial, community, textbook, and placement).
+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:
@@ -169,10 +170,12 @@ use Apache::loncoursequeueadmin();
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 );
my $registered_cleanup;
my $modified_urls;
@@ -213,15 +216,16 @@ sub handler {
'quotas','autoenroll','autoupdate','autocreate',
'directorysrch','usercreation','usermodification',
'contacts','defaults','scantron','coursecategories',
- 'serverstatuses','requestcourses','coursedefaults',
- 'usersessions','loadbalancing','requestauthor',
- 'selfenrollment','inststatus'],$dom);
+ 'serverstatuses','requestcourses','helpsettings',
+ 'coursedefaults','usersessions','loadbalancing',
+ 'requestauthor','selfenrollment','inststatus',
+ 'ltitools','ssl','trust'],$dom);
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','autocreate','directorysrch','contacts',
'usercreation','selfcreation','usermodification','scantron',
'requestcourses','requestauthor','coursecategories',
- 'serverstatuses','coursedefaults','selfenrollment',
- 'usersessions');
+ 'serverstatuses','helpsettings','coursedefaults',
+ 'ltitools','selfenrollment','usersessions','ssl','trust');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -304,18 +308,24 @@ sub handler {
modify => \&modify_autocreate,
},
'directorysrch' =>
- { text => 'Institutional directory searches',
+ { text => 'Directory searches',
help => 'Domain_Configuration_InstDirectory_Search',
- header => [{col1 => 'Setting',
+ header => [{col1 => 'Institutional Directory Setting',
+ col2 => 'Value',},
+ {col1 => 'LON-CAPA Directory Setting',
col2 => 'Value',}],
print => \&print_directorysrch,
modify => \&modify_directorysrch,
},
'contacts' =>
- { text => 'Contact Information',
+ { text => 'E-mail addresses and helpform',
help => 'Domain_Configuration_Contact_Info',
- header => [{col1 => 'Setting',
- col2 => 'Value',}],
+ header => [{col1 => 'Default e-mail addresses',
+ col2 => 'Value',},
+ {col1 => 'Recipient(s) for notifications',
+ col2 => 'Value',},
+ {col1 => 'Ask helpdesk form settings',
+ col2 => 'Value',},],
print => \&print_contacts,
modify => \&modify_contacts,
},
@@ -411,6 +421,16 @@ sub handler {
print => \&print_serverstatuses,
modify => \&modify_serverstatuses,
},
+ 'helpsettings' =>
+ {text => 'Support settings',
+ help => 'Domain_Configuration_Help_Settings',
+ header => [{col1 => 'Help Page Settings (logged-in users)',
+ col2 => 'Value'},
+ {col1 => 'Helpdesk Roles',
+ col2 => 'Settings'},],
+ print => \&print_helpsettings,
+ modify => \&modify_helpsettings,
+ },
'coursedefaults' =>
{text => 'Course/Community defaults',
help => 'Domain_Configuration_Course_Defaults',
@@ -433,6 +453,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',
@@ -445,7 +473,7 @@ sub handler {
print => \&print_usersessions,
modify => \&modify_usersessions,
},
- 'loadbalancing' =>
+ 'loadbalancing' =>
{text => 'Dedicated Load Balancer(s)',
help => 'Domain_Configuration_Load_Balancing',
header => [{col1 => 'Balancers',
@@ -456,6 +484,50 @@ sub handler {
print => \&print_loadbalancing,
modify => \&modify_loadbalancing,
},
+ 'ltitools' =>
+ {text => 'External Tools (LTI)',
+ help => 'Domain_configuration_LTI_Tools',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ print => \&print_ltitools,
+ modify => \&modify_ltitools,
+ },
+ '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 => "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,
+ },
);
if (keys(%servers) > 1) {
$prefs{'login'} = { text => 'Log-in page options',
@@ -509,6 +581,9 @@ $javascript_validations
$coursebrowserjs
END
}
+ if (grep(/^contacts$/,@actions)) {
+ $js .= &contacts_javascript();
+ }
&Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,$js);
} else {
# check if domconfig user exists for the domain.
@@ -619,6 +694,8 @@ sub process_changes {
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
} elsif ($action eq 'requestauthor') {
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
+ } elsif ($action eq 'helpsettings') {
+ $output = &modify_helpsettings($r,$dom,$confname,$lastactref,%domconfig);
} elsif ($action eq 'coursedefaults') {
$output = &modify_coursedefaults($dom,$lastactref,%domconfig);
} elsif ($action eq 'selfenrollment') {
@@ -627,6 +704,12 @@ sub process_changes {
$output = &modify_usersessions($dom,$lastactref,%domconfig);
} elsif ($action eq 'loadbalancing') {
$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);
}
return $output;
}
@@ -639,6 +722,22 @@ sub print_config_box {
$output = &coursecategories_javascript($settings);
} elsif ($action eq 'defaults') {
$output = &defaults_javascript($settings);
+ } elsif ($action eq 'helpsettings') {
+ my (%privs,%levelscurrent);
+ my %full=();
+ my %levels=(
+ course => {},
+ domain => {},
+ system => {},
+ );
+ my $context = 'domain';
+ my $crstype = 'Course';
+ my $formname = 'display';
+ &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,
+ \@templateroles);
}
$output .=
'
@@ -656,6 +755,7 @@ sub print_config_box {
my $colspan = '';
my $rightcolspan = '';
if (($action eq 'rolecolors') || ($action eq 'defaults') ||
+ ($action eq 'directorysrch') ||
(($action eq 'login') && ($numheaders < 4))) {
$colspan = ' colspan="2"';
}
@@ -673,7 +773,9 @@ sub print_config_box {
$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 '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 'coursecategories') {
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);
@@ -703,14 +805,46 @@ 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 'usersessions') || ($action eq 'coursecategories') ||
+ ($action eq 'ssl') || ($action eq 'trust') || ($action eq 'contacts')) {
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);
} else {
$output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal);
}
- $output .= '
+ if ($action eq 'trust') {
+ $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 .= '
+
+
+
+
+ '.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col1'}).'
+ '.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col2'}).' '.
+ $item->{'print'}->($prefixes[$i],$dom,$settings,\$rowtotal).'
+
+
+ ';
+ }
+ $output .= '
+
+
+
+
+ '.&mt($item->{'header'}->[8]->{'col1'}).'
+ '.&mt($item->{'header'}->[8]->{'col2'}).' '.
+ $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ } else {
+ $output .= '
@@ -721,14 +855,16 @@ sub print_config_box {
'.&mt($item->{'header'}->[2]->{'col1'}).'
'.&mt($item->{'header'}->[2]->{'col2'}).'
'."\n";
- if ($action eq 'coursecategories') {
- $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
- } else {
- $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ if ($action eq 'coursecategories') {
+ $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
+ } else {
+ $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ }
}
$rowtotal ++;
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
- ($action eq 'defaults')) {
+ ($action eq 'defaults') || ($action eq 'directorysrch') ||
+ ($action eq 'helpsettings')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 4) {
@@ -841,7 +977,7 @@ sub print_config_box {
';
- if (($action eq 'login') || ($action eq 'directorysrch')) {
+ if ($action eq 'login') {
$output .= '
'.&mt($item->{'header'}->[0]->{'col1'}).' ';
} elsif ($action eq 'serverstatuses') {
@@ -885,13 +1021,12 @@ sub print_config_box {
$rowtotal ++;
if ($action eq 'quotas') {
$output .= &print_quotas($dom,$settings,\$rowtotal,$action);
- } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || ($action eq 'directorysrch') ||
- ($action eq 'contacts') || ($action eq 'serverstatuses') || ($action eq 'loadbalancing')) {
+ } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') ||
+ ($action eq 'serverstatuses') || ($action eq 'loadbalancing') ||
+ ($action eq 'ltitools')) {
$output .= $item->{'print'}->($dom,$settings,\$rowtotal);
} elsif ($action eq 'scantron') {
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
- } elsif ($action eq 'helpsettings') {
- $output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal);
}
}
$output .= '
@@ -1692,7 +1827,7 @@ sub print_quotas {
my $typecount = 0;
my ($css_class,%titles);
if ($context eq 'requestcourses') {
- @usertools = ('official','unofficial','community','textbook');
+ @usertools = ('official','unofficial','community','textbook','placement');
@options =('norequest','approval','validate','autolimit');
%validations = &Apache::lonnet::auto_courserequest_checks($dom);
%titles = &courserequest_titles();
@@ -2144,7 +2279,7 @@ sub print_studentcode {
my ($settings,$rowtotal) = @_;
my $rownum = 0;
my ($output,%current);
- my @crstypes = ('official','unofficial','community','textbook');
+ my @crstypes = ('official','unofficial','community','textbook','placement');
if (ref($settings) eq 'HASH') {
if (ref($settings->{'uniquecode'}) eq 'HASH') {
foreach my $type (@crstypes) {
@@ -2240,8 +2375,7 @@ sub print_textbookcourses {
(' 'x2).
''.&mt('Thumbnail:');
if ($image) {
- $datatable .= ''.
- $imgsrc.
+ $datatable .= $imgsrc.
' '.&mt('Delete?').' '.
' '.&mt('Replace:').' ';
@@ -2395,6 +2529,74 @@ $jstext{'templates'};
ENDSCRIPT
}
+sub ltitools_javascript {
+ my ($settings) = @_;
+ return unless(ref($settings) eq 'HASH');
+ my (%ordered,$total,%jstext);
+ $total = 0;
+ 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 ltitools = Array('."'".join("','",@jsarray)."'".');'."\n";
+ return <<"ENDSCRIPT";
+
+
+ENDSCRIPT
+}
+
sub print_autoenroll {
my ($dom,$settings,$rowtotal) = @_;
my $autorun = &Apache::lonnet::auto_run(undef,$dom),
@@ -2604,233 +2806,781 @@ sub print_autocreate {
}
sub print_directorysrch {
- my ($dom,$settings,$rowtotal) = @_;
- my $srchon = ' ';
- my $srchoff = ' checked="checked" ';
- my ($exacton,$containson,$beginson);
- my $localon = ' ';
- my $localoff = ' checked="checked" ';
- if (ref($settings) eq 'HASH') {
- if ($settings->{'available'} eq '1') {
- $srchon = $srchoff;
- $srchoff = ' ';
- }
- if ($settings->{'localonly'} eq '1') {
- $localon = $localoff;
- $localoff = ' ';
- }
- if (ref($settings->{'searchtypes'}) eq 'ARRAY') {
- foreach my $type (@{$settings->{'searchtypes'}}) {
- if ($type eq 'exact') {
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my $datatable;
+ if ($position eq 'top') {
+ my $instsrchon = ' ';
+ my $instsrchoff = ' checked="checked" ';
+ my ($exacton,$containson,$beginson);
+ my $instlocalon = ' ';
+ my $instlocaloff = ' checked="checked" ';
+ if (ref($settings) eq 'HASH') {
+ if ($settings->{'available'} eq '1') {
+ $instsrchon = $instsrchoff;
+ $instsrchoff = ' ';
+ }
+ if ($settings->{'localonly'} eq '1') {
+ $instlocalon = $instlocaloff;
+ $instlocaloff = ' ';
+ }
+ if (ref($settings->{'searchtypes'}) eq 'ARRAY') {
+ foreach my $type (@{$settings->{'searchtypes'}}) {
+ if ($type eq 'exact') {
+ $exacton = ' checked="checked" ';
+ } elsif ($type eq 'contains') {
+ $containson = ' checked="checked" ';
+ } elsif ($type eq 'begins') {
+ $beginson = ' checked="checked" ';
+ }
+ }
+ } else {
+ if ($settings->{'searchtypes'} eq 'exact') {
+ $exacton = ' checked="checked" ';
+ } elsif ($settings->{'searchtypes'} eq 'contains') {
+ $containson = ' checked="checked" ';
+ } elsif ($settings->{'searchtypes'} eq 'specify') {
$exacton = ' checked="checked" ';
- } elsif ($type eq 'contains') {
$containson = ' checked="checked" ';
- } elsif ($type eq 'begins') {
- $beginson = ' checked="checked" ';
}
}
- } else {
- if ($settings->{'searchtypes'} eq 'exact') {
- $exacton = ' checked="checked" ';
- } elsif ($settings->{'searchtypes'} eq 'contains') {
- $containson = ' checked="checked" ';
- } elsif ($settings->{'searchtypes'} eq 'specify') {
- $exacton = ' checked="checked" ';
- $containson = ' checked="checked" ';
- }
}
- }
- my ($searchtitles,$titleorder) = &sorted_searchtitles();
- my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
+ my ($searchtitles,$titleorder) = &sorted_searchtitles();
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
- my $numinrow = 4;
- my $cansrchrow = 0;
- my $datatable=''.
- ''.&mt('Directory search available?').' '.
- ''.
- ' '.&mt('Yes').' '.
- ' '.&mt('No').' '.
- ' '.
- ''.&mt('Other domains can search?').' '.
- ''.
- ' '.&mt('Yes').' '.
- ' '.&mt('No').' '.
- ' ';
- $$rowtotal += 2;
- if (ref($usertypes) eq 'HASH') {
- if (keys(%{$usertypes}) > 0) {
- $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
- $numinrow,$othertitle,'cansearch');
- $cansrchrow = 1;
+ my $numinrow = 4;
+ my $cansrchrow = 0;
+ $datatable=''.
+ ''.&mt('Institutional directory search available?').' '.
+ ''.
+ ' '.&mt('Yes').' '.
+ ' '.&mt('No').' '.
+ ' '.
+ ''.&mt('Other domains can search institution?').' '.
+ ''.
+ ' '.&mt('Yes').' '.
+ ' '.&mt('No').' '.
+ ' ';
+ $$rowtotal += 2;
+ if (ref($usertypes) eq 'HASH') {
+ if (keys(%{$usertypes}) > 0) {
+ $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
+ $numinrow,$othertitle,'cansearch');
+ $cansrchrow = 1;
+ }
}
- }
- if ($cansrchrow) {
- $$rowtotal ++;
- $datatable .= '';
- } else {
- $datatable .= ' ';
- }
- $datatable .= ''.&mt('Supported search methods').
- ' ';
- foreach my $title (@{$titleorder}) {
- if (defined($searchtitles->{$title})) {
- my $check = ' ';
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{'searchby'}) eq 'ARRAY') {
- if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) {
- $check = ' checked="checked" ';
+ if ($cansrchrow) {
+ $$rowtotal ++;
+ $datatable .= ' ';
+ } else {
+ $datatable .= ' ';
+ }
+ $datatable .= ''.&mt('Supported search methods').
+ ' ';
- $$rowtotal ++;
- if ($cansrchrow) {
- $datatable .= '';
+ $datatable .= '
';
+ $$rowtotal ++;
+ if ($cansrchrow) {
+ $datatable .= '';
+ } else {
+ $datatable .= ' ';
+ }
+ $datatable .= ''.&mt('Search latitude').' '.
+ ''.
+ ''.
+ ' '.&mt('Exact match').
+ ' '.
+ ' '.&mt('Begins with').
+ ' '.
+ ' '.&mt('Contains').
+ ' ';
+ $$rowtotal ++;
} else {
- $datatable .= '';
+ my $domsrchon = ' checked="checked" ';
+ my $domsrchoff = ' ';
+ my $domlocalon = ' ';
+ my $domlocaloff = ' checked="checked" ';
+ if (ref($settings) eq 'HASH') {
+ if ($settings->{'lclocalonly'} eq '1') {
+ $domlocalon = $domlocaloff;
+ $domlocaloff = ' ';
+ }
+ if ($settings->{'lcavailable'} eq '0') {
+ $domsrchoff = $domsrchon;
+ $domsrchon = ' ';
+ }
+ }
+ $datatable=' '.
+ ''.&mt('LON-CAPA directory search available?').' '.
+ ''.
+ ' '.&mt('Yes').' '.
+ ' '.&mt('No').' '.
+ ' '.
+ ''.&mt('Other domains can search LON-CAPA domain?').' '.
+ ''.
+ ' '.&mt('Yes').' '.
+ ' '.&mt('No').' '.
+ ' ';
+ $$rowtotal += 2;
}
- $datatable .= ' '.&mt('Search latitude').' '.
- ''.
- ''.
- ' '.&mt('Exact match').
- ' '.
- ' '.&mt('Begins with').
- ' '.
- ' '.&mt('Contains').
- ' ';
- $$rowtotal ++;
return $datatable;
}
sub print_contacts {
- my ($dom,$settings,$rowtotal) = @_;
+ my ($position,$dom,$settings,$rowtotal) = @_;
my $datatable;
my @contacts = ('adminemail','supportemail');
- my (%checked,%to,%otheremails,%bccemails);
- my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail',
- 'requestsmail','updatesmail','idconflictsmail');
- foreach my $type (@mailings) {
- $otheremails{$type} = '';
- }
- $bccemails{'helpdeskmail'} = '';
- if (ref($settings) eq 'HASH') {
- foreach my $item (@contacts) {
- if (exists($settings->{$item})) {
- $to{$item} = $settings->{$item};
+ my (%checked,%to,%otheremails,%bccemails,%includestr,%includeloc,%currfield,
+ $maxsize,$fields,$fieldtitles,$fieldoptions,$possoptions,@mailings);
+ if ($position eq 'top') {
+ if (ref($settings) eq 'HASH') {
+ foreach my $item (@contacts) {
+ if (exists($settings->{$item})) {
+ $to{$item} = $settings->{$item};
+ }
}
}
+ } elsif ($position eq 'middle') {
+ @mailings = ('errormail','packagesmail','lonstatusmail','requestsmail',
+ 'updatesmail','idconflictsmail');
foreach my $type (@mailings) {
- if (exists($settings->{$type})) {
- if (ref($settings->{$type}) eq 'HASH') {
- foreach my $item (@contacts) {
- if ($settings->{$type}{$item}) {
- $checked{$type}{$item} = ' checked="checked" ';
+ $otheremails{$type} = '';
+ }
+ } else {
+ @mailings = ('helpdeskmail','otherdomsmail');
+ foreach my $type (@mailings) {
+ $otheremails{$type} = '';
+ }
+ $bccemails{'helpdeskmail'} = '';
+ $bccemails{'otherdomsmail'} = '';
+ $includestr{'helpdeskmail'} = '';
+ $includestr{'otherdomsmail'} = '';
+ ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields();
+ }
+ if (ref($settings) eq 'HASH') {
+ unless ($position eq 'top') {
+ foreach my $type (@mailings) {
+ if (exists($settings->{$type})) {
+ if (ref($settings->{$type}) eq 'HASH') {
+ foreach my $item (@contacts) {
+ if ($settings->{$type}{$item}) {
+ $checked{$type}{$item} = ' checked="checked" ';
+ }
+ }
+ $otheremails{$type} = $settings->{$type}{'others'};
+ if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) {
+ $bccemails{$type} = $settings->{$type}{'bcc'};
+ if ($settings->{$type}{'include'} ne '') {
+ ($includeloc{$type},$includestr{$type}) = split(/:/,$settings->{$type}{'include'},2);
+ $includestr{$type} = &unescape($includestr{$type});
+ }
}
}
- $otheremails{$type} = $settings->{$type}{'others'};
- if ($type eq 'helpdeskmail') {
- $bccemails{$type} = $settings->{$type}{'bcc'};
+ } elsif ($type eq 'lonstatusmail') {
+ $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
+ }
+ }
+ }
+ if ($position eq 'bottom') {
+ foreach my $type (@mailings) {
+ $bccemails{$type} = $settings->{$type}{'bcc'};
+ if ($settings->{$type}{'include'} ne '') {
+ ($includeloc{$type},$includestr{$type}) = split(/:/,$settings->{$type}{'include'},2);
+ $includestr{$type} = &unescape($includestr{$type});
+ }
+ }
+ if (ref($settings->{'helpform'}) eq 'HASH') {
+ if (ref($fields) eq 'ARRAY') {
+ foreach my $field (@{$fields}) {
+ $currfield{$field} = $settings->{'helpform'}{$field};
+ }
+ }
+ if (exists($settings->{'helpform'}{'maxsize'})) {
+ $maxsize = $settings->{'helpform'}{'maxsize'};
+ } else {
+ $maxsize = '1.0';
+ }
+ } else {
+ if (ref($fields) eq 'ARRAY') {
+ foreach my $field (@{$fields}) {
+ $currfield{$field} = 'yes';
}
}
- } elsif ($type eq 'lonstatusmail') {
- $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
+ $maxsize = '1.0';
}
}
} else {
- $to{'supportemail'} = $Apache::lonnet::perlvar{'lonSupportEMail'};
- $to{'adminemail'} = $Apache::lonnet::perlvar{'lonAdmEMail'};
- $checked{'errormail'}{'adminemail'} = ' checked="checked" ';
- $checked{'packagesmail'}{'adminemail'} = ' checked="checked" ';
- $checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" ';
- $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
- $checked{'requestsmail'}{'adminemail'} = ' checked="checked" ';
- $checked{'updatesmail'}{'adminemail'} = ' checked="checked" ';
- $checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" ';
+ if ($position eq 'top') {
+ $to{'supportemail'} = $Apache::lonnet::perlvar{'lonSupportEMail'};
+ $to{'adminemail'} = $Apache::lonnet::perlvar{'lonAdmEMail'};
+ $checked{'errormail'}{'adminemail'} = ' checked="checked" ';
+ $checked{'packagesmail'}{'adminemail'} = ' checked="checked" ';
+ $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
+ $checked{'requestsmail'}{'adminemail'} = ' checked="checked" ';
+ $checked{'updatesmail'}{'adminemail'} = ' checked="checked" ';
+ $checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" ';
+ } elsif ($position eq 'bottom') {
+ $checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" ';
+ $checked{'otherdomsmail'}{'supportemail'} = ' checked="checked" ';
+ if (ref($fields) eq 'ARRAY') {
+ foreach my $field (@{$fields}) {
+ $currfield{$field} = 'yes';
+ }
+ }
+ $maxsize = '1.0';
+ }
}
my ($titles,$short_titles) = &contact_titles();
my $rownum = 0;
my $css_class;
- foreach my $item (@contacts) {
- $css_class = $rownum%2?' class="LC_odd_row"':'';
- $datatable .= ''.
- ''.$titles->{$item}.
- ' '.
- ' ';
- $rownum ++;
+ if ($position eq 'top') {
+ foreach my $item (@contacts) {
+ $css_class = $rownum%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.$titles->{$item}.
+ ' '.
+ ' ';
+ $rownum ++;
+ }
+ } else {
+ foreach my $type (@mailings) {
+ $css_class = $rownum%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.
+ $titles->{$type}.': '.
+ '';
+ if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) {
+ $datatable .= ''.&mt('E-mail recipient(s)').' ';
+ }
+ $datatable .= '';
+ foreach my $item (@contacts) {
+ $datatable .= ''.
+ ' '.$short_titles->{$item}.
+ ' ';
+ }
+ $datatable .= ' '.&mt('Others').': '.
+ ' ';
+ my %locchecked;
+ if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) {
+ foreach my $loc ('s','b') {
+ if ($includeloc{$type} eq $loc) {
+ $locchecked{$loc} = ' checked="checked"';
+ last;
+ }
+ }
+ $datatable .= ' '.&mt('Bcc:').(' 'x6).
+ ' '.
+ ''.&mt('Optional added text').' '.
+ &mt('Text automatically added to e-mail:').' '.
+ ' '.
+ ''.&mt('Location:').' '.
+ ' '.&mt('in subject').' '.
+ (' 'x2).
+ ' '.&mt('in body').' '.
+ ' ';
+ }
+ $datatable .= ' '."\n";
+ $rownum ++;
+ }
}
- foreach my $type (@mailings) {
+ if ($position eq 'middle') {
+ my %choices;
+ $choices{'reporterrors'} = &mt('E-mail error reports to [_1]',
+ &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+ &mt('LON-CAPA core group - MSU'),600,500));
+ $choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]',
+ &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+ &mt('LON-CAPA core group - MSU'),600,500));
+ my @toggles = ('reporterrors','reportupdates');
+ my %defaultchecked = ('reporterrors' => 'on',
+ 'reportupdates' => 'on');
+ (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+ \%choices,$rownum);
+ $datatable .= $reports;
+ } elsif ($position eq 'bottom') {
$css_class = $rownum%2?' class="LC_odd_row"':'';
$datatable .= ''.
- ''.
- $titles->{$type}.': '.
- ''.
- '';
- foreach my $item (@contacts) {
- $datatable .= ''.
- ' '.$short_titles->{$item}.
- ' ';
- }
- $datatable .= ' '.&mt('Others').': '.
- ' ';
- if ($type eq 'helpdeskmail') {
- $datatable .= ' '.&mt('Bcc:').(' 'x6).
- ' ';
+ ' '.&mt('Extra helpdesk form fields:').' '.
+ &mt('(e-mail, subject, and description always shown)').
+ ' ';
+ if ((ref($fields) eq 'ARRAY') && (ref($fieldtitles) eq 'HASH') &&
+ (ref($fieldoptions) eq 'HASH') && (ref($possoptions) eq 'HASH')) {
+ $datatable .= '';
}
$datatable .= ' '."\n";
$rownum ++;
}
- my %choices;
- $choices{'reporterrors'} = &mt('E-mail error reports to [_1]',
- &Apache::loncommon::modal_link('http://loncapa.org/core.html',
- &mt('LON-CAPA core group - MSU'),600,500));
- $choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]',
- &Apache::loncommon::modal_link('http://loncapa.org/core.html',
- &mt('LON-CAPA core group - MSU'),600,500));
- my @toggles = ('reporterrors','reportupdates');
- my %defaultchecked = ('reporterrors' => 'on',
- 'reportupdates' => 'on');
- (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
- \%choices,$rownum);
- $datatable .= $reports;
$$rowtotal += $rownum;
return $datatable;
}
+sub contacts_javascript {
+ return <<"ENDSCRIPT";
+
+
+
+ENDSCRIPT
+}
+
sub print_helpsettings {
- my ($dom,$confname,$settings,$rowtotal) = @_;
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my $confname = $dom.'-domainconfig';
+ my $formname = 'display';
my ($datatable,$itemcount);
- $itemcount = 1;
- my (%choices,%defaultchecked,@toggles);
- $choices{'submitbugs'} = &mt('Display link to: [_1]?',
- &Apache::loncommon::modal_link('http://bugs.loncapa.org',
- &mt('LON-CAPA bug tracker'),600,500));
- %defaultchecked = ('submitbugs' => 'on');
- @toggles = ('submitbugs',);
-
- ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
- \%choices,$itemcount);
+ if ($position eq 'top') {
+ $itemcount = 1;
+ my (%choices,%defaultchecked,@toggles);
+ $choices{'submitbugs'} = &mt('Display link to: [_1]?',
+ &Apache::loncommon::modal_link('http://bugs.loncapa.org',
+ &mt('LON-CAPA bug tracker'),600,500));
+ %defaultchecked = ('submitbugs' => 'on');
+ @toggles = ('submitbugs');
+ ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+ \%choices,$itemcount);
+ $$rowtotal ++;
+ } else {
+ my $css_class;
+ my %existing=&Apache::lonnet::dump('roles',$dom,$confname,'rolesdef_');
+ my (%customroles,%ordered,%current);
+ if (ref($settings->{'adhoc'}) eq 'HASH') {
+ %current = %{$settings->{'adhoc'}};
+ }
+ my $count = 0;
+ foreach my $key (sort(keys(%existing))) {
+ if ($key=~/^rolesdef\_(\w+)$/) {
+ my $rolename = $1;
+ my (%privs,$order);
+ ($privs{'system'},$privs{'domain'},$privs{'course'}) = split(/\_/,$existing{$key});
+ $customroles{$rolename} = \%privs;
+ if (ref($current{$rolename}) eq 'HASH') {
+ $order = $current{$rolename}{'order'};
+ }
+ if ($order eq '') {
+ $order = $count;
+ }
+ $ordered{$order} = $rolename;
+ $count++;
+ }
+ }
+ my $maxnum = scalar(keys(%ordered));
+ my @roles_by_num = ();
+ foreach my $item (sort {$a <=> $b } (keys(%ordered))) {
+ push(@roles_by_num,$item);
+ }
+ my $context = 'domprefs';
+ my $crstype = 'Course';
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
+ my @accesstypes = ('all','none');
+ my ($numstatustypes,@jsarray);
+ if (ref($types) eq 'ARRAY') {
+ if (@{$types} > 0) {
+ $numstatustypes = scalar(@{$types});
+ push(@accesstypes,'status');
+ @jsarray = ('bystatus');
+ }
+ }
+ my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh','da']);
+ if (keys(%domhelpdesk)) {
+ push(@accesstypes,('inc','exc'));
+ push(@jsarray,('notinc','notexc'));
+ }
+ my $hiddenstr = join("','",@jsarray);
+ $datatable .= &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname);
+ my $context = 'domprefs';
+ my $crstype = 'Course';
+ my $prefix = 'helproles_';
+ my $add_class = 'LC_hidden';
+ foreach my $num (@roles_by_num) {
+ my $role = $ordered{$num};
+ my ($desc,$access,@statuses);
+ if (ref($current{$role}) eq 'HASH') {
+ $desc = $current{$role}{'desc'};
+ $access = $current{$role}{'access'};
+ if (ref($current{$role}{'insttypes'}) eq 'ARRAY') {
+ @statuses = @{$current{$role}{'insttypes'}};
+ }
+ }
+ if ($desc eq '') {
+ $desc = $role;
+ }
+ my $identifier = 'custhelp'.$num;
+ my %full=();
+ my %levels= (
+ course => {},
+ domain => {},
+ system => {},
+ );
+ my %levelscurrent=(
+ course => {},
+ domain => {},
+ system => {},
+ );
+ &Apache::lonuserutils::custom_role_privs($customroles{$role},\%full,\%levels,\%levelscurrent);
+ my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $chgstr = ' onchange="javascript:reorderHelpRoles(this.form,'."'helproles_".$num."_pos'".');"';
+ $datatable .= ''.$role.' '.
+ '';
+ for (my $k=0; $k<=$maxnum; $k++) {
+ my $vpos = $k+1;
+ my $selstr;
+ if ($k == $num) {
+ $selstr = ' selected="selected" ';
+ }
+ $datatable .= ''.$vpos.' ';
+ }
+ $datatable .= ' '.(' 'x2).
+ ' '.
+ ' '.
+ ''.&mt('Role name').' '.
+ &mt('Name shown to users:').
+ ' '.
+ ' '.
+ &helpdeskroles_access($dom,$prefix,$num,$add_class,$current{$role},\@accesstypes,
+ $othertitle,$usertypes,$types,\%domhelpdesk).
+ ''.
+ ''.&mt('Role privileges').&adhocbutton($prefix,$num,'privs','show').' '.
+ &Apache::lonuserutils::custom_role_table($crstype,\%full,\%levels,
+ \%levelscurrent,$identifier,
+ 'LC_hidden',$prefix.$num.'_privs').
+ ' ';
+ $itemcount ++;
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $newcust = 'custhelp'.$count;
+ my (%privs,%levelscurrent);
+ my %full=();
+ my %levels= (
+ course => {},
+ domain => {},
+ system => {},
+ );
+ &Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent);
+ my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);
+ my $chgstr = ' onchange="javascript:reorderHelpRoles(this.form,'."'helproles_".$count."_pos'".');"';
+ $datatable .= ''.
+ ' '."\n".
+ '';
+ for (my $k=0; $k<$maxnum+1; $k++) {
+ my $vpos = $k+1;
+ my $selstr;
+ if ($k == $maxnum) {
+ $selstr = ' selected="selected" ';
+ }
+ $datatable .= ''.$vpos.' ';
+ }
+ $datatable .= ' '."\n".
+ ' '. &mt('Add').
+ ' '.
+ ''.&mt('Role name').' '.
+ ''.
+ &mt('Internal name:').
+ ' '.
+ ' '.(' 'x4).
+ ''.
+ &mt('Name shown to users:').
+ ' '.
+ ' '.
+ &helpdeskroles_access($dom,$prefix,$count,'',undef,\@accesstypes,$othertitle,
+ $usertypes,$types,\%domhelpdesk).
+ ''.&mt('Role privileges').' '.
+ &Apache::lonuserutils::custom_role_header($context,$crstype,
+ \@templateroles,$newcust).
+ &Apache::lonuserutils::custom_role_table('Course',\%full,\%levels,
+ \%levelscurrent,$newcust).
+ ' ';
+ $count ++;
+ $$rowtotal += $count;
+ }
return $datatable;
}
+sub adhocbutton {
+ my ($prefix,$num,$field,$visibility) = @_;
+ my %lt = &Apache::lonlocal::texthash(
+ show => 'Show details',
+ hide => 'Hide details',
+ );
+ return ''.(' 'x10).
+ ' '.(' 'x2).' '.(' 'x2);
+}
+
+sub helpsettings_javascript {
+ my ($roles_by_num,$total,$hiddenstr,$formname) = @_;
+ return unless(ref($roles_by_num) eq 'ARRAY');
+ my %html_js_lt = &Apache::lonlocal::texthash(
+ show => 'Show details',
+ hide => 'Hide details',
+ );
+ &html_escape(\%html_js_lt);
+ my $jstext = ' var helproles = Array('."'".join("','",@{$roles_by_num})."'".');'."\n";
+ return <<"ENDSCRIPT";
+
+
+ENDSCRIPT
+}
+
+sub helpdeskroles_access {
+ my ($dom,$prefix,$num,$add_class,$current,$accesstypes,$othertitle,
+ $usertypes,$types,$domhelpdesk) = @_;
+ return unless ((ref($accesstypes) eq 'ARRAY') && (ref($domhelpdesk) eq 'HASH'));
+ my %lt = &Apache::lonlocal::texthash(
+ 'rou' => 'Role usage',
+ 'whi' => 'Which helpdesk personnel may use this role?',
+ 'all' => 'All',
+ 'none' => 'None',
+ 'status' => 'Determined based on institutional status',
+ 'inc' => 'Include all, but exclude specific personnel',
+ 'exc' => 'Exclude all, but include specific personnel',
+ );
+ my %usecheck = (
+ all => ' checked="checked"',
+ );
+ my %displaydiv = (
+ status => 'none',
+ inc => 'none',
+ exc => 'none',
+ priv => 'block',
+ );
+ my $output;
+ if (ref($current) eq 'HASH') {
+ if (($current->{'access'} ne '') && ($current->{'access'} ne 'all')) {
+ if (grep(/^\Q$current->{access}\E$/,@{$accesstypes})) {
+ $usecheck{$current->{access}} = $usecheck{'all'};
+ delete($usecheck{'all'});
+ if ($current->{access} =~ /^(status|inc|exc)$/) {
+ my $access = $1;
+ $displaydiv{$access} = 'inline';
+ } elsif ($current->{access} eq 'none') {
+ $displaydiv{'priv'} = 'none';
+ }
+ }
+ }
+ }
+ $output = ''.$lt{'rou'}.' '.
+ ''.$lt{'whi'}.'
';
+ foreach my $access (@{$accesstypes}) {
+ $output .= ' '.
+ $lt{$access}.' ';
+ if ($access eq 'status') {
+ $output .= '
'.
+ &Apache::lonuserutils::adhoc_status_types($dom,$prefix,$num,$current->{$access},
+ $othertitle,$usertypes,$types).
+ '
';
+ } elsif (($access eq 'inc') && (keys(%{$domhelpdesk}) > 0)) {
+ $output .= ''.
+ &Apache::lonuserutils::adhoc_staff($access,$prefix,$num,$current->{$access},$domhelpdesk).
+ '
';
+ } elsif (($access eq 'exc') && (keys(%{$domhelpdesk}) > 0)) {
+ $output .= ''.
+ &Apache::lonuserutils::adhoc_staff($access,$prefix,$num,$current->{$access},$domhelpdesk).
+ '
';
+ }
+ $output .= '';
+ }
+ $output .= ' ';
+ return $output;
+}
+
sub radiobutton_prefs {
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick,
$additional,$align) = @_;
@@ -2887,11 +3637,358 @@ sub radiobutton_prefs {
return ($datatable,$itemcount);
}
+sub print_ltitools {
+ my ($dom,$settings,$rowtotal) = @_;
+ my $rownum = 0;
+ my $css_class;
+ my $itemcount = 1;
+ 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'};
+ $ordered{$num} = $item;
+ }
+ }
+ }
+ my $confname = $dom.'-domainconfig';
+ my $switchserver = &check_switchserver($dom,$confname);
+ my $maxnum = scalar(keys(%ordered));
+ my $datatable = <itools_javascript($settings);
+ my %lt = <itools_names();
+ my @courseroles = ('cc','in','ta','ep','st');
+ my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner);
+ my @fields = ('fullname','firstname','lastname','email','user','roles');
+ 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,$imgsrc,$version);
+ if (ref($settings->{$item}) eq 'HASH') {
+ $title = $settings->{$item}->{'title'};
+ $url = $settings->{$item}->{'url'};
+ $key = $settings->{$item}->{'key'};
+ $secret = $settings->{$item}->{'secret'};
+ my $image = $settings->{$item}->{'image'};
+ if ($image ne '') {
+ $imgsrc = ' ';
+ }
+ }
+ my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'ltitools_".$item."'".');"';
+ $datatable .= ''
+ .'';
+ for (my $k=0; $k<=$maxnum; $k++) {
+ my $vpos = $k+1;
+ my $selstr;
+ if ($k == $i) {
+ $selstr = ' selected="selected" ';
+ }
+ $datatable .= ''.$vpos.' ';
+ }
+ $datatable .= ' '.(' 'x2).
+ ' '.
+ &mt('Delete?').' '.
+ ''.
+ ''.&mt('Required settings').' '.
+ ''.$lt{'title'}.': '.
+ (' 'x2).
+ ''.$lt{'version'}.':'.
+ '1.1 '.
+ (' 'x2).
+ ''.$lt{'msgtype'}.':'.
+ 'Launch '.
+ ' '.
+ ''.$lt{'url'}.': '.
+ (' 'x2).
+ ''.$lt{'key'}.
+ ' '.
+ (' 'x2).
+ ''.$lt{'secret'}.':'.
+ ' '.
+ ' '.&mt('Visible input').' '.
+ ' '.
+ ' '.
+ ''.&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"';
+ } else {
+ $currdisp{'iframe'} = ' checked="checked"';
+ }
+ if ($settings->{$item}->{'display'}->{'width'} =~ /^(\d+)$/) {
+ $currdisp{'width'} = $1;
+ }
+ if ($settings->{$item}->{'display'}->{'height'} =~ /^(\d+)$/) {
+ $currdisp{'height'} = $1;
+ }
+ } else {
+ $currdisp{'iframe'} = ' checked="checked"';
+ }
+ foreach my $disp ('iframe','window') {
+ $datatable .= ' '.
+ $lt{$disp}.' '.(' 'x2);
+ }
+ $datatable .= (' 'x4);
+ foreach my $dimen ('width','height') {
+ $datatable .= ''.$lt{$dimen}.' '.
+ ' '.
+ (' 'x2);
+ }
+ $datatable .= ' ';
+ foreach my $extra ('passback','roster') {
+ my $checkedon = '';
+ my $checkedoff = ' checked="checked"';
+ if ($settings->{$item}->{$extra}) {
+ $checkedon = $checkedoff;
+ $checkedoff = '';
+ }
+ $datatable .= $lt{$extra}.' '.
+ ' '.
+ &mt('Yes').' '.(' 'x2).
+ ' '.
+ &mt('No').' '.(' 'x4);
+ }
+ $datatable .= ''.$lt{'icon'}.': ';
+ if ($imgsrc) {
+ $datatable .= $imgsrc.
+ ' '.&mt('Delete?').' '.
+ ' '.&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);
+ if (ref($settings->{$item}) eq 'HASH') {
+ if (ref($settings->{$item}->{'fields'}) eq 'HASH') {
+ %checkedfields = %{$settings->{$item}->{'fields'}};
+ }
+ if (ref($settings->{$item}->{'roles'}) eq 'HASH') {
+ %rolemaps = %{$settings->{$item}->{'roles'}};
+ $checkedfields{'roles'} = 1;
+ }
+ }
+ $datatable .= ''.&mt('User data sent on launch').' '.
+ '';
+ foreach my $field (@fields) {
+ my $checked;
+ if ($checkedfields{$field}) {
+ $checked = ' checked="checked"';
+ }
+ $datatable .= ''.
+ ' '.
+ $lt{$field}.' '.(' ' x2);
+ }
+ $datatable .= ' '.
+ ''.&mt('Role mapping').' ';
+ foreach my $role (@courseroles) {
+ my ($selected,$selectnone);
+ if (!$rolemaps{$role}) {
+ $selectnone = ' selected="selected"';
+ }
+ $datatable .= ''.
+ &Apache::lonnet::plaintext($role,'Course').' '.
+ ''.
+ ''.&mt('Select').' ';
+ foreach my $ltirole (@ltiroles) {
+ unless ($selectnone) {
+ if ($rolemaps{$role} eq $ltirole) {
+ $selected = ' selected="selected"';
+ } else {
+ $selected = '';
+ }
+ }
+ $datatable .= ''.$ltirole.' ';
+ }
+ $datatable .= ' ';
+ }
+ $datatable .= '
';
+ my %courseconfig;
+ if (ref($settings->{$item}) eq 'HASH') {
+ if (ref($settings->{$item}->{'crsconf'}) eq 'HASH') {
+ %courseconfig = %{$settings->{$item}->{'crsconf'}};
+ }
+ }
+ $datatable .= ''.&mt('Configurable in course').' ';
+ foreach my $item ('label','title','target') {
+ my $checked;
+ if ($courseconfig{$item}) {
+ $checked = ' checked="checked"';
+ }
+ $datatable .= ''.
+ ' '.
+ $lt{'crs'.$item}.' '.(' ' x2)."\n";
+ }
+ $datatable .= ' '.
+ ''.&mt('Custom items sent on launch').' '.
+ ' '."\n";
+ $itemcount ++;
+ }
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'ltitools_add_pos'".');"';
+ $datatable .= ''."\n".
+ ' '."\n".
+ '';
+ for (my $k=0; $k<$maxnum+1; $k++) {
+ my $vpos = $k+1;
+ my $selstr;
+ if ($k == $maxnum) {
+ $selstr = ' selected="selected" ';
+ }
+ $datatable .= ''.$vpos.' ';
+ }
+ $datatable .= ' '."\n".
+ ' '.&mt('Add').' '."\n".
+ ''.
+ ''.&mt('Required settings').' '.
+ ''.$lt{'title'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'version'}.':'.
+ '1.1 '."\n".
+ (' 'x2).
+ ''.$lt{'msgtype'}.':'.
+ 'Launch '.
+ ' '.
+ ''.$lt{'url'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'key'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'secret'}.': '.
+ ' '.&mt('Visible input').' '."\n".
+ ' '.
+ ''.&mt('Optional settings').' '.
+ ''.&mt('Display target:');
+ my %defaultdisp;
+ $defaultdisp{'iframe'} = ' checked="checked"';
+ foreach my $disp ('iframe','window') {
+ $datatable .= ' '.
+ $lt{$disp}.' '.(' 'x2);
+ }
+ $datatable .= (' 'x4);
+ foreach my $dimen ('width','height') {
+ $datatable .= ''.$lt{$dimen}.' '.
+ ' '.
+ (' 'x2);
+ }
+ $datatable .= ' ';
+ foreach my $extra ('passback','roster') {
+ $datatable .= $lt{$extra}.' '.
+ ' '.
+ &mt('Yes').' '.(' 'x2).
+ ' '.
+ &mt('No').' '.(' 'x4);
+ }
+ $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) {
+ $datatable .= ''.
+ ' '.
+ $lt{$field}.' '.(' ' x2);
+ }
+ $datatable .= ' '.
+ ''.&mt('Role mapping').' ';
+ foreach my $role (@courseroles) {
+ my ($checked,$checkednone);
+ $datatable .= ''.
+ &Apache::lonnet::plaintext($role,'Course').' '.
+ ''.
+ ''.&mt('Select').' ';
+ foreach my $ltirole (@ltiroles) {
+ $datatable .= ''.$ltirole.' ';
+ }
+ $datatable .= ' ';
+ }
+ $datatable .= '
'.
+ ''.&mt('Configurable in course').' ';
+ foreach my $item ('label','title','target') {
+ $datatable .= ''.
+ ' '.
+ $lt{'crs'.$item}.' '.(' ' x2)."\n";
+ }
+ $datatable .= ' '.
+ ''.&mt('Custom items sent on launch').' '.
+ ' '."\n".
+ ''."\n".
+ ''."\n";
+ $itemcount ++;
+ return $datatable;
+}
+
+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',
+ '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;
+}
+
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)',
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
coursecredits => 'Credits can be specified for courses',
@@ -2909,11 +4006,12 @@ sub print_coursedefaults {
);
if ($position eq 'top') {
%defaultchecked = (
+ 'canuse_pdfforms' => 'off',
'uselcmath' => 'on',
'usejsme' => 'on',
'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"':'';
@@ -2992,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') {
@@ -3149,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();
@@ -3372,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);
@@ -3393,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);
}
}
}
@@ -3512,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);
@@ -3532,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);
@@ -3879,6 +5139,9 @@ sub print_loadbalancing {
my ($numspares,@spares) = &count_servers($lonhost,%servers);
my @sparestypes = ('primary','default');
my %typetitles = &sparestype_titles();
+ my %hostherechecked = (
+ no => ' checked="checked"',
+ );
foreach my $sparetype (@sparestypes) {
my $targettable;
for (my $i=0; $i<$numspares; $i++) {
@@ -3924,6 +5187,23 @@ sub print_loadbalancing {
$datatable .= ''.$typetitles{$sparetype}.' '.
' ';
}
+ $hostherechecked{$sparetype} = '';
+ if (ref($currtargets{$lonhost}) eq 'HASH') {
+ if (ref($currtargets{$lonhost}{$sparetype}) eq 'ARRAY') {
+ if (grep(/^\Q$lonhost\E$/,@{$currtargets{$lonhost}{$sparetype}})) {
+ $hostherechecked{$sparetype} = ' checked="checked"';
+ $hostherechecked{'no'} = '';
+ }
+ }
+ }
+ }
+ $datatable .= &mt('Hosting on balancer itself').' '.
+ ' '.&mt('No').' ';
+ foreach my $sparetype (@sparestypes) {
+ $datatable .= ''.$typetitles{$sparetype}.
+ ' ';
}
$datatable .= ' '.
&loadbalancing_rules($dom,$intdom,$currrules{$lonhost},
@@ -4141,14 +5421,15 @@ sub sparestype_titles {
sub contact_titles {
my %titles = &Apache::lonlocal::texthash (
- 'supportemail' => 'Support E-mail address',
- '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 to be e-mailed to',
- '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',
+ 'supportemail' => 'Support E-mail address',
+ '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 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',
'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID',
);
my %short_titles = &Apache::lonlocal::texthash (
@@ -4158,6 +5439,34 @@ sub contact_titles {
return (\%titles,\%short_titles);
}
+sub helpform_fields {
+ my %titles = &Apache::lonlocal::texthash (
+ 'username' => 'Name',
+ 'user' => 'Username/domain',
+ 'phone' => 'Phone',
+ 'cc' => 'Cc e-mail',
+ 'course' => 'Course Details',
+ 'section' => 'Sections',
+ 'screenshot' => 'File upload',
+ );
+ my @fields = ('username','phone','user','course','section','cc','screenshot');
+ my %possoptions = (
+ username => ['yes','no','req'],
+ phone => ['yes','no','req'],
+ user => ['yes','no'],
+ cc => ['yes','no'],
+ course => ['yes','no'],
+ section => ['yes','no'],
+ screenshot => ['yes','no'],
+ );
+ my %fieldoptions = &Apache::lonlocal::texthash (
+ 'yes' => 'Optional',
+ 'req' => 'Required',
+ 'no' => "Not shown",
+ );
+ return (\@fields,\%titles,\%fieldoptions,\%possoptions);
+}
+
sub tool_titles {
my %titles = &Apache::lonlocal::texthash (
aboutme => 'Personal web page',
@@ -4168,6 +5477,7 @@ sub tool_titles {
unofficial => 'Unofficial courses',
community => 'Communities',
textbook => 'Textbook courses',
+ placement => 'Placement tests',
);
return %titles;
}
@@ -4178,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',
@@ -4568,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') {
@@ -5162,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') {
@@ -5180,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'}.' '.
@@ -5220,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;
@@ -5246,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;
@@ -5272,7 +6615,7 @@ sub print_coursecategories {
$datatable .= ''.$vpos.' ';
}
$datatable .= '';
- 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') {
@@ -5295,7 +6638,7 @@ sub print_coursecategories {
$datatable .= ' '
.&mt('Do not display').' ';
- if ($parent eq 'communities') {
+ if (($parent eq 'communities') || ($parent eq 'placement')) {
$datatable .= '
';
}
$datatable .= ' ';
@@ -5327,7 +6670,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'".');"';
@@ -5416,9 +6759,9 @@ 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 {
@@ -5508,9 +6851,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";