--- loncom/interface/domainprefs.pm 2007/08/26 15:31:03 1.25 +++ loncom/interface/domainprefs.pm 2007/09/19 17:36:47 1.29 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.25 2007/08/26 15:31:03 raeburn Exp $ +# $Id: domainprefs.pm,v 1.29 2007/09/19 17:36:47 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -67,7 +67,8 @@ sub handler { } my %domconfig = &Apache::lonnet::get_dom('configuration',['login','rolecolors', - 'quotas','autoenroll','autoupdate','directorysrch'],$dom); + 'quotas','autoenroll','autoupdate','directorysrch', + 'usercreation','contacts'],$dom); my @prefs = ( { text => 'Default color schemes', help => 'Default_Color_Schemes', @@ -113,6 +114,21 @@ sub handler { header => [{col1 => 'Setting', col2 => 'Value',}], }, + { text => 'Contact Information', + help => 'Domain_Contact_Information', + action => 'contacts', + header => [{col1 => 'Setting', + col2 => 'Value',}], + }, + + { text => 'User creation', + help => 'Domain_User_Creation', + action => 'usercreation', + header => [{col1 => 'Setting', + col2 => 'Value',}, + {col1 => 'Context', + col2 => 'Assignable Authentication Types'}], + }, ); my @roles = ('student','coordinator','author','admin'); &Apache::lonhtmlcommon::add_breadcrumb @@ -141,9 +157,8 @@ sub handler { &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 @ids=&Apache::lonnet::current_machine_ids(); + if (!grep(/^\Q$primarylibserv\E$/,@ids)) { my %designhash = &Apache::loncommon::get_domainconf($dom); my @loginimages = ('img','logo','domlogo'); my $custom_img_count = 0; @@ -159,7 +174,14 @@ sub handler { } 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)); + $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, (with a Domain Coordinator role selected in the domain) you will be able to update settings when logged in to any server in the LON-CAPA network.").'
'. + &mt("However, you will still need to switch to the domain's primary library server to upload new images or logos.").'

'); + if ($switch_server) { + $r->print($switch_server.' '.&mt('to primary library server for domain: [_1]',$dom)); + } return OK; } } @@ -197,6 +219,10 @@ sub process_changes { $output = &modify_autoupdate($dom,%domconfig); } elsif ($action eq 'directorysrch') { $output = &modify_directorysrch($dom,%domconfig); + } elsif ($action eq 'usercreation') { + $output = &modify_usercreation($dom,%domconfig); + } elsif ($action eq 'contacts') { + $output = &modify_contacts($dom,%domconfig); } return $output; } @@ -212,7 +238,8 @@ sub print_config_box { # '.&mt($item->{text}).' '. # &Apache::loncommon::help_open_topic($item->{'help'}).' # '); - if (($action eq 'autoupdate') || ($action eq 'rolecolors')) { + if (($action eq 'autoupdate') || ($action eq 'rolecolors') || + ($action eq 'usercreation')) { my $colspan = ($action eq 'rolecolors')?' colspan="2"':''; $r->print(' @@ -224,6 +251,8 @@ sub print_config_box { '); if ($action eq 'autoupdate') { $r->print(&print_autoupdate('top',$dom,$settings)); + } elsif ($action eq 'usercreation') { + $r->print(&print_usercreation('top',$dom,$settings)); } else { $r->print(&print_rolecolors($phase,'student',$dom,$confname,$settings)); } @@ -240,6 +269,8 @@ sub print_config_box { '); if ($action eq 'autoupdate') { $r->print(&print_autoupdate('bottom',$dom,$settings)); + } elsif ($action eq 'usercreation') { + $r->print(&print_usercreation('bottom',$dom,$settings)); } else { $r->print(&print_rolecolors($phase,'coordinator',$dom,$confname,$settings).' @@ -282,14 +313,16 @@ sub print_config_box { '.$item->{'header'}->[0]->{'col2'}.' '); if ($action eq 'login') { - $r->print(&print_login($dom,$confname,$phase,$settings)); + $r->print(&print_login($dom,$confname,$phase,$settings)); } elsif ($action eq 'quotas') { - $r->print(&print_quotas($dom,$settings)); + $r->print(&print_quotas($dom,$settings)); } elsif ($action eq 'autoenroll') { - $r->print(&print_autoenroll($dom,$settings)); + $r->print(&print_autoenroll($dom,$settings)); } elsif ($action eq 'directorysrch') { - $r->print(&print_directorysrch($dom,$settings)); - } + $r->print(&print_directorysrch($dom,$settings)); + } elsif ($action eq 'contacts') { + $r->print(&print_contacts($dom,$settings)); + } } $r->print(' @@ -745,7 +778,7 @@ sub print_quotas { my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); my $typecount = 0; my $css_class; - if (@{$types} > 0) { + if (ref($types) eq 'ARRAY') { foreach my $type (@{$types}) { if (defined($usertypes->{$type})) { $typecount ++; @@ -768,7 +801,7 @@ sub print_quotas { $typecount ++; $css_class = $typecount%2?' class="LC_odd_row"':''; $datatable .= ''. - ''.&mt($othertitle).''. + ''.$othertitle.''. ''. ' Mb'; @@ -878,10 +911,12 @@ sub print_autoupdate { gen => 'Generation', ); my $numrows = 0; - if (@{$types} > 0) { - $datatable = - &usertype_update_row($settings,$usertypes,\%fieldtitles, - \@fields,$types,\$numrows); + if (ref($types) eq 'ARRAY') { + if (@{$types} > 0) { + $datatable = + &usertype_update_row($settings,$usertypes,\%fieldtitles, + \@fields,$types,\$numrows); + } } $datatable .= &usertype_update_row($settings,{'default' => $othertitle}, @@ -932,6 +967,7 @@ sub print_directorysrch { my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); my $numinrow = 4; + my $cansrchrow = 0; my $datatable=''. ''.&mt('Directory search available?').''. ''. ''; - $datatable .= &users_cansearch_row($settings,$types,$usertypes,$dom, - $numinrow,$othertitle); - $datatable .= ''. - ''.&mt('Supported search methods'). + if (ref($usertypes) eq 'HASH') { + if (keys(%{$usertypes}) > 0) { + $datatable .= &users_cansearch_row($settings,$types,$usertypes,$dom, + $numinrow,$othertitle); + $cansrchrow = 1; + } + } + if ($cansrchrow) { + $datatable .= ''; + } else { + $datatable .= ''; + } + $datatable .= ''.&mt('Supported search methods'). ''; foreach my $title (@{$titleorder}) { if (defined($searchtitles->{$title})) { @@ -967,9 +1012,14 @@ sub print_directorysrch { $searchtitles->{$title}.''; } } - $datatable .= '
'. - ''.&mt('Search latitude').''. - ''. + $datatable .= ''; + if ($cansrchrow) { + $datatable .= ''; + } else { + $datatable .= ''; + } + $datatable .= ''.&mt('Search latitude').''. + ''. '