--- loncom/interface/domainprefs.pm 2007/12/16 17:45:20 1.35
+++ loncom/interface/domainprefs.pm 2008/01/04 17:47:51 1.40
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.35 2007/12/16 17:45:20 raeburn Exp $
+# $Id: domainprefs.pm,v 1.40 2008/01/04 17:47:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -281,11 +281,24 @@ sub handler {
' /> '.
'
');
+ ' />'."\n".''."\n");
+ $seconddiv = 1;
+ }
}
- $r->print('
'.&mt('Display options').'
'."\n".
+ $r->print(''.
+ &mt('Display options').'
'."\n".
''.&mt('Display using: ')."\n".
' '.
@@ -823,8 +836,26 @@ sub display_color_options {
}
}
if ($showfile) {
- $showfile = &Apache::loncommon::lonhttpdurl($showfile);
- $fullsize = &Apache::loncommon::lonhttpdurl($imgfile);
+ if ($showfile =~ m{^/(adm|res)/}) {
+ if ($showfile =~ m{^/res/}) {
+ my $local_showfile =
+ &Apache::lonnet::filelocation('',$showfile);
+ &Apache::lonnet::repcopy($local_showfile);
+ }
+ $showfile = &Apache::loncommon::lonhttpdurl($showfile);
+ }
+ if ($imgfile) {
+ if ($imgfile =~ m{^/(adm|res)/}) {
+ if ($imgfile =~ m{^/res/}) {
+ my $local_imgfile =
+ &Apache::lonnet::filelocation('',$imgfile);
+ &Apache::lonnet::repcopy($local_imgfile);
+ }
+ $fullsize = &Apache::loncommon::lonhttpdurl($imgfile);
+ } else {
+ $fullsize = $imgfile;
+ }
+ }
$datatable.= '
';
if (!$is_custom->{$img}) {
$datatable .= &mt('Default in use:').' ';
@@ -1022,6 +1053,10 @@ sub print_autoenroll {
}
}
my $domform = &Apache::loncommon::select_dom_form($defdom,'sender_domain',1);
+ my $notif_sender;
+ if (ref($settings) eq 'HASH') {
+ $notif_sender = $settings->{'sender_uname'};
+ }
my $datatable=' | '.
''.&mt('Auto-enrollment active?').' | '.
' | '.
&mt('username').': '.
' '.&mt('domain').
+ $notif_sender.'" size="10" /> '.&mt('domain').
': '.$domform.' |
';
$$rowtotal += 2;
return $datatable;
@@ -1178,9 +1212,11 @@ sub print_directorysrch {
foreach my $title (@{$titleorder}) {
if (defined($searchtitles->{$title})) {
my $check = ' ';
- if (ref($settings->{'searchby'}) eq 'ARRAY') {
- if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) {
- $check = ' checked="checked" ';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{'searchby'}) eq 'ARRAY') {
+ if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) {
+ $check = ' checked="checked" ';
+ }
}
}
$datatable .= ''.
@@ -1331,8 +1367,15 @@ sub print_usercreation {
$rowcount ++;
}
}
+ if ($rowcount == 0) {
+ $datatable .= ' | '.&mt('No format rules have been defined for usernames or IDs in this domain.').' |
';
+ $$rowtotal ++;
+ $rowcount ++;
+ }
} elsif ($position eq 'middle') {
my @creators = ('author','course');
+ my ($rules,$ruleorder) =
+ &Apache::lonnet::inst_userrules($dom,'username');
my %lt = &usercreation_types();
my %checked;
if (ref($settings) eq 'HASH') {
@@ -1363,7 +1406,14 @@ sub print_usercreation {
$datatable .= ''.
''.$lt{$item}.
' | ';
- foreach my $option ('any','official','unofficial','none') {
+ my @options = ('any');
+ if (ref($rules) eq 'HASH') {
+ if (keys(%{$rules}) > 0) {
+ push(@options,('official','unofficial'));
+ }
+ }
+ push(@options,'none');
+ foreach my $option (@options) {
my $check = ' ';
if ($checked{$item} eq $option) {
$check = ' checked="checked" ';
@@ -1393,7 +1443,7 @@ sub print_usercreation {
}
} else {
foreach my $item (@contexts) {
- foreach my $type (@authtypes) {
+ foreach my $auth (@authtypes) {
$checked{$item}{$auth} = ' checked="checked" ';
}
}
@@ -1451,9 +1501,11 @@ sub user_formats_row {
$output .= ' |
';
}
my $check = ' ';
- if (ref($settings->{$type.'_rule'}) eq 'ARRAY') {
- if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{$type.'_rule'}})) {
- $check = ' checked="checked" ';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{$type.'_rule'}) eq 'ARRAY') {
+ if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{$type.'_rule'}})) {
+ $check = ' checked="checked" ';
+ }
}
}
$output .= ''.
@@ -1708,10 +1760,12 @@ sub usertype_update_row {
$datatable .= ' |
';
}
my $check = ' ';
- if (ref($settings->{'fields'}) eq 'HASH') {
- if (ref($settings->{'fields'}{$type}) eq 'ARRAY') {
- if (grep(/^\Q$fields->[$i]\E$/,@{$settings->{'fields'}{$type}})) {
- $check = ' checked="checked" ';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{'fields'}) eq 'HASH') {
+ if (ref($settings->{'fields'}{$type}) eq 'ARRAY') {
+ if (grep(/^\Q$fields->[$i]\E$/,@{$settings->{'fields'}{$type}})) {
+ $check = ' checked="checked" ';
+ }
}
}
}
@@ -1868,6 +1922,9 @@ sub modify_colors {
}
}
my ($width,$height) = &thumb_dimensions();
+ if (ref($domconfig->{$role}) ne 'HASH') {
+ $domconfig->{$role} = {};
+ }
foreach my $img (@images) {
if ( ! $env{'form.'.$role.'_'.$img.'.filename'}
&& !defined($domconfig->{$role}{$img})