--- loncom/interface/domainprefs.pm 2007/04/04 00:10:01 1.7 +++ loncom/interface/domainprefs.pm 2007/07/25 20:12:26 1.23 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.7 2007/04/04 00:10:01 albertel Exp $ +# $Id: domainprefs.pm,v 1.23 2007/07/25 20:12:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,6 +38,7 @@ use Apache::lonhtmlcommon(); use Apache::lonlocal; use LONCAPA(); use LONCAPA::Enrollment; +use File::Copy; sub handler { my $r=shift; @@ -66,7 +67,7 @@ sub handler { } my %domconfig = &Apache::lonnet::get_dom('configuration',['login','rolecolors', - 'quotas','autoenroll','autoupdate'],$dom); + 'quotas','autoenroll','autoupdate','directorysrch'],$dom); my @prefs = ( { text => 'Default color schemes', help => 'Default_Color_Schemes', @@ -105,12 +106,19 @@ sub handler { col2 => 'Value',}, {col1 => 'User Population', col2 => 'Updataeable user data'}], - }, + }, + { text => 'Institutional directory searches', + help => 'Domain_Directory_Search', + action => 'directorysrch', + header => [{col1 => 'Setting', + col2 => 'Value',}], + }, ); my @roles = ('student','coordinator','author','admin'); &Apache::lonhtmlcommon::add_breadcrumb ({href=>"javascript:changePage(document.$phase,'display')", text=>"Domain Configuration"}); + my $confname = $dom.'-domainconfig'; if ($phase eq 'process') { &Apache::lonhtmlcommon::add_breadcrumb ({href=>"javascript:changePage(document.$phase,'$phase')", @@ -118,7 +126,8 @@ sub handler { &print_header($r,$phase); foreach my $item (@prefs) { $r->print('
');
&print_footer($r,$phase,'display','Back to actions menu');
@@ -130,52 +139,79 @@ 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('
'); foreach my $item (@prefs) { if ($item->{'action'} eq 'login') { $r->print(' | '); } - &print_config_box($r,$dom,$phase,$item->{'action'}, + &print_config_box($r,$dom,$confname,$phase,$item->{'action'}, $item,$domconfig{$item->{'action'}}); } $r->print(' - |
'.&mt($item->{text}).' '. - &Apache::loncommon::help_open_topic($item->{'help'}).' | -'.&mt($item->{text}).' | '); +# +# FIXME - put the help link back in when the help files exist +#'.&mt($item->{text}).' '. +# &Apache::loncommon::help_open_topic($item->{'help'}).' | +# '); if (($action eq 'autoupdate') || ($action eq 'rolecolors')) { my $colspan = ($action eq 'rolecolors')?' colspan="2"':''; $r->print(' @@ -189,7 +225,7 @@ sub print_config_box { if ($action eq 'autoupdate') { $r->print(&print_autoupdate('top',$dom,$settings)); } else { - $r->print(&print_rolecolors($phase,'student',$dom,$settings)); + $r->print(&print_rolecolors($phase,'student',$dom,$confname,$settings)); } $r->print('
---|