--- loncom/interface/domainprefs.pm 2020/01/15 16:55:18 1.160.6.102.2.1
+++ loncom/interface/domainprefs.pm 2017/01/02 19:44:06 1.285
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.102.2.1 2020/01/15 16:55:18 raeburn Exp $
+# $Id: domainprefs.pm,v 1.285 2017/01/02 19:44:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -19,8 +19,7 @@
#
# 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/
@@ -104,8 +103,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:
@@ -170,10 +169,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;
@@ -217,26 +218,13 @@ sub handler {
'serverstatuses','requestcourses','helpsettings',
'coursedefaults','usersessions','loadbalancing',
'requestauthor','selfenrollment','inststatus',
- 'passwords','ltitools'],$dom);
- if (ref($domconfig{'ltitools'}) eq 'HASH') {
- my %encconfig =
- &Apache::lonnet::get_dom('encconfig',['ltitools'],$dom);
- if (ref($encconfig{'ltitools'}) eq 'HASH') {
- foreach my $id (keys(%{$domconfig{'ltitools'}})) {
- if (ref($domconfig{'ltitools'}{$id}) eq 'HASH') {
- foreach my $item ('key','secret') {
- $domconfig{'ltitools'}{$id}{$item} = $encconfig{'ltitools'}{$id}{$item};
- }
- }
- }
- }
- }
- my @prefs_order = ('rolecolors','login','defaults','passwords','quotas','autoenroll',
+ 'ltitools','ssl','trust'],$dom);
+ my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','autocreate','directorysrch','contacts',
'usercreation','selfcreation','usermodification','scantron',
'requestcourses','requestauthor','coursecategories',
'serverstatuses','helpsettings','coursedefaults',
- 'ltitools','selfenrollment','usersessions');
+ 'ltitools','selfenrollment','usersessions','ssl','trust');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -277,24 +265,10 @@ sub handler {
header => [{col1 => 'Setting',
col2 => 'Value'},
{col1 => 'Institutional user types',
- col2 => 'Name displayed'}],
+ col2 => 'Assignable to e-mail usernames'}],
print => \&print_defaults,
modify => \&modify_defaults,
},
- 'passwords' =>
- { text => 'Passwords (Internal authentication)',
- help => 'Domain_Configuration_Passwords',
- header => [{col1 => 'Resetting Forgotten Password',
- col2 => 'Settings'},
- {col1 => 'Encryption of Stored Passwords (Internal Auth)',
- col2 => 'Settings'},
- {col1 => 'Rules for LON-CAPA Passwords',
- col2 => 'Settings'},
- {col1 => 'Course Owner Changing Student Passwords',
- col2 => 'Settings'}],
- print => \&print_passwords,
- modify => \&modify_passwords,
- },
'quotas' =>
{ text => 'Blogs, personal web pages, webDAV/quotas, portfolios',
help => 'Domain_Configuration_Quotas',
@@ -343,14 +317,10 @@ sub handler {
modify => \&modify_directorysrch,
},
'contacts' =>
- { text => 'E-mail addresses and helpform',
+ { text => 'Contact Information',
help => 'Domain_Configuration_Contact_Info',
- header => [{col1 => 'Default e-mail addresses',
- col2 => 'Value',},
- {col1 => 'Recipient(s) for notifications',
- col2 => 'Value',},
- {col1 => 'Ask helpdesk form settings',
- col2 => 'Value',},],
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
print => \&print_contacts,
modify => \&modify_contacts,
},
@@ -373,7 +343,7 @@ sub handler {
col2 => 'Enabled?'},
{col1 => 'Institutional user type (login/SSO self-creation)',
col2 => 'Information user can enter'},
- {col1 => 'Self-creation with e-mail verification',
+ {col1 => 'Self-creation with e-mail as username',
col2 => 'Settings'}],
print => \&print_selfcreation,
modify => \&modify_selfcreation,
@@ -389,12 +359,11 @@ sub handler {
modify => \&modify_usermodification,
},
'scantron' =>
- { text => 'Bubblesheet format',
+ { text => 'Bubblesheet format file',
help => 'Domain_Configuration_Scantron_Format',
- header => [ {col1 => 'Bubblesheet format file',
- col2 => ''},
- {col1 => 'Bubblesheet data upload formats',
- col2 => 'Settings'}],
+ header => [ {col1 => 'Item',
+ col2 => '',
+ }],
print => \&print_scantron,
modify => \&modify_scantron,
},
@@ -479,6 +448,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',
@@ -502,14 +479,50 @@ sub handler {
print => \&print_loadbalancing,
modify => \&modify_loadbalancing,
},
- 'ltitools' =>
+ 'ltitools' =>
{text => 'External Tools (LTI)',
- help => 'Domain_Configuration_LTI_Tools',
+ 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',
@@ -563,15 +576,6 @@ $javascript_validations
$coursebrowserjs
END
}
- if (grep(/^selfcreation$/,@actions)) {
- $js .= &selfcreate_javascript();
- }
- if (grep(/^contacts$/,@actions)) {
- $js .= &contacts_javascript();
- }
- if (grep(/^scantron$/,@actions)) {
- $js .= &scantron_javascript();
- }
&Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,$js);
} else {
# check if domconfig user exists for the domain.
@@ -661,11 +665,11 @@ sub process_changes {
} elsif ($action eq 'autocreate') {
$output = &modify_autocreate($dom,%domconfig);
} elsif ($action eq 'directorysrch') {
- $output = &modify_directorysrch($dom,$lastactref,%domconfig);
+ $output = &modify_directorysrch($dom,%domconfig);
} elsif ($action eq 'usercreation') {
$output = &modify_usercreation($dom,%domconfig);
} elsif ($action eq 'selfcreation') {
- $output = &modify_selfcreation($dom,$lastactref,%domconfig);
+ $output = &modify_selfcreation($dom,%domconfig);
} elsif ($action eq 'usermodification') {
$output = &modify_usermodification($dom,%domconfig);
} elsif ($action eq 'contacts') {
@@ -692,10 +696,12 @@ sub process_changes {
$output = &modify_usersessions($dom,$lastactref,%domconfig);
} elsif ($action eq 'loadbalancing') {
$output = &modify_loadbalancing($dom,%domconfig);
- } elsif ($action eq 'passwords') {
- $output = &modify_passwords($r,$dom,$confname,$lastactref,%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;
}
@@ -708,8 +714,6 @@ sub print_config_box {
$output = &coursecategories_javascript($settings);
} elsif ($action eq 'defaults') {
$output = &defaults_javascript($settings);
- } elsif ($action eq 'passwords') {
- $output = &passwords_javascript();
} elsif ($action eq 'helpsettings') {
my (%privs,%levelscurrent);
my %full=();
@@ -724,7 +728,7 @@ sub print_config_box {
&Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent);
my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);
$output =
- &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full,
+ &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full,
\@templateroles);
}
$output .=
@@ -761,15 +765,11 @@ 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 'directorysrch') ||
- ($action eq 'helpsettings') || ($action eq 'contacts')) {
+ ($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'ssl') ||
+ ($action eq 'directorysrch') || ($action eq 'trust') || ($action eq 'helpsettings')) {
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal);
- } elsif ($action eq 'passwords') {
- $output .= $item->{'print'}->('top',$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'coursecategories') {
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);
- } elsif ($action eq 'scantron') {
- $output .= $item->{'print'}->($r,'top',$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 4) {
$colspan = ' colspan="2"';
@@ -796,56 +796,67 @@ sub print_config_box {
$rowtotal ++;
if (($action eq 'autoupdate') || ($action eq 'usercreation') ||
($action eq 'selfcreation') || ($action eq 'selfenrollment') ||
- ($action eq 'usersessions') || ($action eq 'coursecategories') ||
- ($action eq 'contacts') || ($action eq 'passwords')) {
+ ($action eq 'usersessions') || ($action eq 'coursecategories') ||
+ ($action eq 'ssl') || ($action eq 'trust')) {
if ($action eq 'coursecategories') {
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
$colspan = ' colspan="2"';
- } elsif ($action eq 'passwords') {
- $output .= $item->{'print'}->('middle',$dom,$confname,$settings,\$rowtotal);
+ } 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'}->[2]->{'col1'}).' |
- '.&mt($item->{'header'}->[2]->{'col2'}).' |
- '."\n";
- if ($action eq 'coursecategories') {
- $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
- } elsif ($action eq 'passwords') {
- $output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal).'
-
+ '.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col1'}).' |
+ '.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col2'}).' | '.
+ $item->{'print'}->($prefixes[$i],$dom,$settings,\$rowtotal).'
- |
-
-
+
+
';
+ }
+ $output .= '
+
- '.&mt($item->{'header'}->[3]->{'col1'}).' |
- '.&mt($item->{'header'}->[3]->{'col2'}).' | '."\n".
- $item->{'print'}->('bottom',$dom,$confname,$settings,\$rowtotal).'
-
+ | '.&mt($item->{'header'}->[8]->{'col1'}).' |
+ '.&mt($item->{'header'}->[8]->{'col2'}).' |
'.
+ $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ } else {
+ $output .= '
+
- ';
- } else {
- $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+
+
+
+
+ '.&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);
+ }
}
$rowtotal ++;
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
($action eq 'defaults') || ($action eq 'directorysrch') ||
($action eq 'helpsettings')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
- } elsif ($action eq 'scantron') {
- $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 4) {
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -1002,9 +1013,11 @@ sub print_config_box {
if ($action eq 'quotas') {
$output .= &print_quotas($dom,$settings,\$rowtotal,$action);
} elsif (($action eq 'autoenroll') || ($action eq 'autocreate') ||
- ($action eq 'serverstatuses') || ($action eq 'loadbalancing') ||
- ($action eq 'ltitools')) {
+ ($action eq 'contacts') || ($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);
}
}
$output .= '
@@ -1349,7 +1362,7 @@ sub print_login {
} else {
$datatable .= '';
}
- $datatable .= ' | ';
+ $datatable .= ' | ';
}
$datatable .= ' |
';
}
@@ -1509,7 +1522,7 @@ sub display_color_options {
my $datatable = ''.
''.$choices->{'font'}.' | ';
if (!$is_custom->{'font'}) {
- $datatable .= ''.&mt('Default in use:').' '.$defaults->{'font'}.' | ';
+ $datatable .= ''.&mt('Default in use:').' '.$defaults->{'font'}.' | ';
} else {
$datatable .= ' | ';
}
@@ -1518,12 +1531,12 @@ sub display_color_options {
$datatable .= ''.
' '.
- ' |
';
+ ' ';
unless ($role eq 'login') {
$datatable .= ''.
''.$choices->{'fontmenu'}.' | ';
if (!$is_custom->{'fontmenu'}) {
- $datatable .= ''.&mt('Default in use:').' '.$defaults->{'fontmenu'}.' | ';
+ $datatable .= ''.&mt('Default in use:').' '.$defaults->{'fontmenu'}.' | ';
} else {
$datatable .= ' | ';
}
@@ -1533,7 +1546,7 @@ sub display_color_options {
' '.
- '
';
+ ' ';
}
my $switchserver = &check_switchserver($dom,$confname);
foreach my $img (@{$images}) {
@@ -1592,8 +1605,7 @@ sub display_color_options {
if ($fullwidth ne '' && $fullheight ne '') {
if ($fullwidth > $width && $fullheight > $height) {
my $size = $width.'x'.$height;
- my @args = ('convert','-sample',$size,$input,$output);
- system({$args[0]} @args);
+ system("convert -sample $size $input $output");
$showfile = "/$imgdir/tn-".$filename;
}
}
@@ -1651,7 +1663,7 @@ sub display_color_options {
my $bgs_def;
foreach my $item (@{$bgs}) {
if (!$is_custom->{$item}) {
- $bgs_def .= ''.$choices->{$item}.' '.$defaults->{'bgs'}{$item}.' | ';
+ $bgs_def .= ''.$choices->{$item}.' '.$defaults->{'bgs'}{$item}.' | ';
}
}
if ($bgs_def) {
@@ -1679,7 +1691,7 @@ sub display_color_options {
my $links_def;
foreach my $item (@{$links}) {
if (!$is_custom->{$item}) {
- $links_def .= ''.$choices->{$item}.' '.$defaults->{'links'}{$item}.' | ';
+ $links_def .= ''.$choices->{$item}.' '.$defaults->{'links'}{$item}.' | ';
}
}
if ($links_def) {
@@ -1765,15 +1777,17 @@ sub image_changes {
my ($is_custom,$alt_text,$img_import,$showfile,$fullsize,$role,$img,$imgfile,$logincolors) = @_;
my $output;
if ($img eq 'login') {
- $output = ''.$logincolors; # suppress image for Log-in header
+ # suppress image for Log-in header
} elsif (!$is_custom) {
if ($img ne 'domlogo') {
- $output = &mt('Default image:').' ';
+ $output .= &mt('Default image:').' ';
} else {
- $output = &mt('Default in use:').' ';
+ $output .= &mt('Default in use:').' ';
}
}
- if ($img ne 'login') {
+ if ($img eq 'login') { # suppress image for Log-in header
+ $output .= ' | '.$logincolors;
+ } else {
if ($img_import) {
$output .= '';
}
@@ -1804,7 +1818,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();
@@ -2217,7 +2231,7 @@ sub print_quotas {
}
sub print_requestmail {
- my ($dom,$action,$settings,$rowtotal,$customcss,$rowstyle) = @_;
+ my ($dom,$action,$settings,$rowtotal) = @_;
my ($now,$datatable,%currapp);
$now = time;
if (ref($settings) eq 'HASH') {
@@ -2229,19 +2243,7 @@ sub print_requestmail {
}
my $numinrow = 2;
my $css_class;
- if ($$rowtotal%2) {
- $css_class = 'LC_odd_row';
- }
- if ($customcss) {
- $css_class .= " $customcss";
- }
- $css_class =~ s/^\s+//;
- if ($css_class) {
- $css_class = ' class="'.$css_class.'"';
- }
- if ($rowstyle) {
- $css_class .= ' style="'.$rowstyle.'"';
- }
+ $css_class = ($$rowtotal%2? ' class="LC_odd_row"':'');
my $text;
if ($action eq 'requestcourses') {
$text = &mt('Receive notification of course requests requiring approval');
@@ -2268,7 +2270,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) {
@@ -2364,8 +2366,7 @@ sub print_textbookcourses {
(' 'x2).
''.&mt('Thumbnail:');
if ($image) {
- $datatable .= ''.
- $imgsrc.
+ $datatable .= $imgsrc.
' '.
' '.&mt('Replace:').' ';
@@ -2396,7 +2397,7 @@ sub print_textbookcourses {
$datatable .= '';
}
$datatable .= ' '."\n".
- ''.&mt('Add').' | '."\n".
+ ''.&mt('Add').''."\n".
''.
''.&mt('Subject:').' '."\n".
(' 'x2).
@@ -2413,13 +2414,13 @@ sub print_textbookcourses {
} else {
$datatable .= '';
}
- $datatable .= ''."\n";
}
- $datatable .= ''.&mt('LON-CAPA course:').' '.
+ $datatable .= ''."\n".
+ ''.&mt('LON-CAPA course:').' '.
&Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom').
''.
&Apache::loncommon::selectcourse_link
- ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course').
+ ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course');
' | '."\n".
''."\n";
$itemcount ++;
@@ -2666,7 +2667,7 @@ sub print_autoenroll {
''.&mt('Failsafe for no drops when institutional data missing').' | '.
''.
' | ';
+ ' value="'.$failsafe.'" size="4" />';
$$rowtotal += 4;
return $datatable;
}
@@ -2715,7 +2716,7 @@ sub print_autoupdate {
my $locknamesettings;
$datatable .= &insttypes_row($settings,$types,$usertypes,
$dom,$numinrow,$othertitle,
- 'lockablenames',$rowtotal);
+ 'lockablenames');
$$rowtotal ++;
} else {
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
@@ -2858,8 +2859,7 @@ sub print_directorysrch {
if (ref($usertypes) eq 'HASH') {
if (keys(%{$usertypes}) > 0) {
$datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
- $numinrow,$othertitle,'cansearch',
- $rowtotal);
+ $numinrow,$othertitle,'cansearch');
$cansrchrow = 1;
}
}
@@ -2944,415 +2944,104 @@ sub print_directorysrch {
}
sub print_contacts {
- my ($position,$dom,$settings,$rowtotal) = @_;
+ my ($dom,$settings,$rowtotal) = @_;
my $datatable;
my @contacts = ('adminemail','supportemail');
- 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','hostipmail');
- foreach my $type (@mailings) {
- $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();
+ 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') {
- 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});
- }
- }
- }
- } elsif ($type eq 'lonstatusmail') {
- $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
- }
+ foreach my $item (@contacts) {
+ if (exists($settings->{$item})) {
+ $to{$item} = $settings->{$item};
}
}
- 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};
+ 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" ';
+ }
}
- }
- 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';
+ $otheremails{$type} = $settings->{$type}{'others'};
+ if ($type eq 'helpdeskmail') {
+ $bccemails{$type} = $settings->{$type}{'bcc'};
}
}
- $maxsize = '1.0';
+ } elsif ($type eq 'lonstatusmail') {
+ $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
}
}
} else {
- 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" ';
- $checked{'hostipmail'}{'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';
- }
+ $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" ';
}
my ($titles,$short_titles) = &contact_titles();
my $rownum = 0;
my $css_class;
- if ($position eq 'top') {
- foreach my $item (@contacts) {
- $css_class = $rownum%2?' class="LC_odd_row"':'';
- $datatable .= ''.
- ''.$titles->{$item}.
- ' | '.
- ' |
';
- $rownum ++;
- }
- } elsif ($position eq 'bottom') {
+ foreach my $item (@contacts) {
+ $css_class = $rownum%2?' class="LC_odd_row"':'';
+ $datatable .= ''.
+ ''.$titles->{$item}.
+ ' | '.
+ ' |
';
+ $rownum ++;
+ }
+ foreach my $type (@mailings) {
$css_class = $rownum%2?' class="LC_odd_row"':'';
$datatable .= ''.
- ''.&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 .= '';
+ ' | '.
+ $titles->{$type}.': | '.
+ ''.
+ '';
+ foreach my $item (@contacts) {
+ $datatable .= ' ';
+ }
+ $datatable .= ' '.&mt('Others').': '.
+ '';
+ if ($type eq 'helpdeskmail') {
+ $datatable .= ' '.&mt('Bcc:').(' 'x6).
+ '';
}
$datatable .= ' |
'."\n";
$rownum ++;
}
- unless ($position eq 'top') {
- foreach my $type (@mailings) {
- $css_class = $rownum%2?' class="LC_odd_row"':'';
- $datatable .= ''.
- ''.
- $titles->{$type}.': | '.
- '';
- if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) {
- $datatable .= ''.
- '';
- }
- $datatable .= ' |
'."\n";
- $rownum ++;
- }
- }
- 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') {
- my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
- my (@posstypes,%usertypeshash);
- if (ref($types) eq 'ARRAY') {
- @posstypes = @{$types};
- }
- if (@posstypes) {
- if (ref($usertypes) eq 'HASH') {
- %usertypeshash = %{$usertypes};
- }
- my @overridden;
- my $numinrow = 4;
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{'overrides'}) eq 'HASH') {
- foreach my $key (sort(keys(%{$settings->{'overrides'}}))) {
- if (ref($settings->{'overrides'}{$key}) eq 'HASH') {
- push(@overridden,$key);
- foreach my $item (@contacts) {
- if ($settings->{'overrides'}{$key}{$item}) {
- $checked{'override_'.$key}{$item} = ' checked="checked" ';
- }
- }
- $otheremails{'override_'.$key} = $settings->{'overrides'}{$key}{'others'};
- $bccemails{'override_'.$key} = $settings->{'overrides'}{$key}{'bcc'};
- $includeloc{'override_'.$key} = '';
- $includestr{'override_'.$key} = '';
- if ($settings->{'overrides'}{$key}{'include'} ne '') {
- ($includeloc{'override_'.$key},$includestr{'override_'.$key}) =
- split(/:/,$settings->{'overrides'}{$key}{'include'},2);
- $includestr{'override_'.$key} = &unescape($includestr{'override_'.$key});
- }
- }
- }
- }
- }
- my $customclass = 'LC_helpdesk_override';
- my $optionsprefix = 'LC_options_helpdesk_';
-
- my $onclicktypes = "toggleHelpdeskRow(this.form,'overrides','$customclass','$optionsprefix');";
-
- $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
- $numinrow,$othertitle,'overrides',
- \$rownum,$onclicktypes,$customclass);
- $rownum ++;
- $usertypeshash{'default'} = $othertitle;
- foreach my $status (@posstypes) {
- my $css_class;
- if ($rownum%2) {
- $css_class = 'LC_odd_row ';
- }
- $css_class .= $customclass;
- my $rowid = $optionsprefix.$status;
- my $hidden = 1;
- my $currstyle = 'display:none';
- if (grep(/^\Q$status\E$/,@overridden)) {
- $currstyle = 'display:table-row';
- $hidden = 0;
- }
- my $key = 'override_'.$status;
- $datatable .= &overridden_helpdesk($checked{$key},$otheremails{$key},$bccemails{$key},
- $includeloc{$key},$includestr{$key},$status,$rowid,
- $usertypeshash{$status},$css_class,$currstyle,
- \@contacts,$short_titles);
- unless ($hidden) {
- $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 overridden_helpdesk {
- my ($checked,$otheremails,$bccemails,$includeloc,$includestr,$type,$rowid,
- $typetitle,$css_class,$rowstyle,$contacts,$short_titles) = @_;
- my $class = 'LC_left_item';
- if ($css_class) {
- $css_class = ' class="'.$css_class.'"';
- }
- if ($rowid) {
- $rowid = ' id="'.$rowid.'"';
- }
- if ($rowstyle) {
- $rowstyle = ' style="'.$rowstyle.'"';
- }
- my ($output,$description);
- $description = &mt('Helpdesk requests from: [_1] in this domain (overrides default)',"$typetitle");
- $output = ''.
- "$description | \n".
- ''.
- ''.
- ''.
- ' |
'."\n";
- return $output;
-}
-
-sub contacts_javascript {
- return <<"ENDSCRIPT";
-
-
-
-ENDSCRIPT
-}
-
sub print_helpsettings {
my ($position,$dom,$settings,$rowtotal) = @_;
my $confname = $dom.'-domainconfig';
@@ -3373,10 +3062,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))) {
@@ -3403,7 +3090,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) {
@@ -3412,7 +3099,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'));
@@ -3521,9 +3208,7 @@ sub print_helpsettings {
\@templateroles,$newcust).
&Apache::lonuserutils::custom_role_table('Course',\%full,\%levels,
\%levelscurrent,$newcust).
- ''.
- &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname).
- '';
+ '';
$count ++;
$$rowtotal += $count;
}
@@ -3623,7 +3308,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');
}
}
@@ -3652,7 +3337,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}';
@@ -3680,9 +3365,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',
@@ -3780,7 +3463,7 @@ sub radiobutton_prefs {
} else {
$datatable .= '';
}
- $datatable .=
+ $datatable .=
''.
''.
(' 'x2);
}
- $datatable .= ' '.
- ''.$lt{'linktext'}.' '.
- ' '.
- ''.$lt{'explanation'}.' '.
- ' ';
$datatable .= ' ';
foreach my $extra ('passback','roster') {
my $checkedon = '';
@@ -3963,7 +3636,7 @@ sub print_ltitools {
if (!$rolemaps{$role}) {
$selectnone = ' selected="selected"';
}
- $datatable .= ' | '.
+ $datatable .= ' | '.
&Apache::lonnet::plaintext($role,'Course').' '.
' | '."\n";
$itemcount ++;
@@ -4452,7 +4087,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();
@@ -4636,7 +4271,7 @@ sub print_validation_rows {
' ';
}
} elsif ($item eq 'markup') {
- $datatable .= '