--- loncom/interface/domainprefs.pm 2007/05/29 15:58:41 1.17 +++ loncom/interface/domainprefs.pm 2007/06/07 23:19:42 1.21 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.17 2007/05/29 15:58:41 raeburn Exp $ +# $Id: domainprefs.pm,v 1.21 2007/06/07 23:19:42 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -133,6 +133,31 @@ sub handler { my %helphash; my $numprefs = @prefs; &print_header($r,$phase); + if (keys(%domconfig) == 0) { + my $primarylibserv = &Apache::lonnet::domain($dom,'primary'); + my $perlvarref = &LONCAPA::Configuration::read_conf('loncapa.conf'); + my $hostid = $perlvarref->{'lonHostID'}; + if ($hostid ne $primarylibserv) { + my %designhash = &Apache::loncommon::get_domainconf($dom); + my @loginimages = ('img','logo','domlogo'); + my $custom_img_count = 0; + foreach my $img (@loginimages) { + if ($designhash{$dom.'.login.'.$img} ne '') { + $custom_img_count ++; + } + } + foreach my $role (@roles) { + if ($designhash{$dom.'.'.$role.'.img'} ne '') { + $custom_img_count ++; + } + } + if ($custom_img_count > 0) { + my $switch_server = &check_switchserver($dom,$confname); + $r->print(&mt('Domain configuration settings have yet to be saved for this domain via the web-based domain preferences interface.').'
'.&mt("While this remains so, you must switch to the domain's primary library server in order to update settings.").'

'.&mt("Thereafter, you will be able to update settings from this screen when logged in to any server in the LON-CAPA network (with a DC role selected in the domain), although you will still need to switch to the domain's primary library server to upload new images or logos.").'

'.$switch_server.' '.&mt('to primary library server for domain: [_1]',$dom)); + return OK; + } + } + } $r->print(''; my $switchserver = &check_switchserver($dom,$confname); foreach my $img (@{$images}) { - $itemcount ++; + $itemcount ++; $css_class = $itemcount%2?' class="LC_odd_row"':''; $datatable .= ''. ''; - my $imgfile; + my ($imgfile, $img_import); if ($designs->{$img} ne '') { $imgfile = $designs->{$img}; + $img_import = ($imgfile =~ m{^/adm/}); } else { $imgfile = $defaults->{$img}; } @@ -578,6 +604,9 @@ sub display_color_options { if (!$is_custom->{$img}) { $datatable .= &mt('Default in use:').'
'; } + if ($img_import) { + $datatable.= ''; + } $datatable.= ''.$alt_text->{$img}.
                              ''; @@ -849,10 +878,11 @@ sub print_autoupdate { if (keys(%{$usertypes}) > 0) { $othertitle = &mt('Other users'); } - my @fields = ('lastname','firstname','middlename','gen','email','id'); + my @fields = ('lastname','firstname','middlename','gen', + 'permanentemail','id'); my %fieldtitles = &Apache::lonlocal::texthash ( id => 'Student/Employee ID', - email => 'E-mail address', + permanentemail => 'E-mail address', lastname => 'Last Name', firstname => 'First Name', middlename => 'Middle Name', @@ -1052,6 +1082,15 @@ sub modify_colors { } my ($width,$height) = &thumb_dimensions(); foreach my $img (@images) { + if ( ! $env{'form.'.$role.'_'.$img.'.filename'} + && !defined($domconfig->{$role}{$img}) + && !$env{'form.'.$role.'_del_'.$img} + && $env{'form.'.$role.'_import_'.$img}) { + # import the old configured image from the .tab setting + # if they haven't provided a new one + $domconfig->{$role}{$img} = + $env{'form.'.$role.'_import_'.$img}; + } if ($env{'form.'.$role.'_'.$img.'.filename'} ne '') { my $error; if ($configuserok eq 'ok') { @@ -1091,6 +1130,7 @@ sub modify_colors { $dom,$confname,$img,$width,$height); if ($result eq 'ok') { $confhash->{$role}{$img} = $logourl; + $changes{$role}{'images'}{$img} = 1; } } } @@ -1253,7 +1293,7 @@ sub check_dimensions { } chomp($imageinfo); my ($fullsize) = - ($imageinfo =~ /^\Q$inputfile\E\s+\w+\s+(\d+x\d+)\s+/); + ($imageinfo =~ /^\Q$inputfile\E\s+\w+\s+(\d+x\d+)/); if ($fullsize) { ($fullwidth,$fullheight) = split(/x/,$fullsize); } @@ -1647,7 +1687,7 @@ sub modify_autoupdate { my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($dom); my %fieldtitles = &Apache::lonlocal::texthash ( id => 'Student/Employee ID', - email => 'E-mail address', + permanentemail => 'E-mail address', lastname => 'Last Name', firstname => 'First Name', middlename => 'Middle Name',
'); foreach my $item (@prefs) { if ($item->{'action'} eq 'login') { @@ -522,13 +547,14 @@ sub display_color_options { '
'.$choices->{$img}.'