version 1.16, 2007/05/27 21:21:26
|
version 1.22, 2007/06/07 23:36:32
|
Line 133 sub handler {
|
Line 133 sub handler {
|
my %helphash; |
my %helphash; |
my $numprefs = @prefs; |
my $numprefs = @prefs; |
&print_header($r,$phase); |
&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.').'<br />'.&mt("While this remains so, you must switch to the domain's primary library server in order to update settings.").'<br /><br />'.&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.").'<br /><br />'.$switch_server.' '.&mt('to primary library server for domain: [_1]',$dom)); |
|
return OK; |
|
} |
|
} |
|
} |
$r->print('<table border="0" width="100%" cellpadding="2" cellspacing="4"><tr><td align="left" valign="top" width="45%">'); |
$r->print('<table border="0" width="100%" cellpadding="2" cellspacing="4"><tr><td align="left" valign="top" width="45%">'); |
foreach my $item (@prefs) { |
foreach my $item (@prefs) { |
if ($item->{'action'} eq 'login') { |
if ($item->{'action'} eq 'login') { |
Line 173 sub print_config_box {
|
Line 198 sub print_config_box {
|
$r->print(' |
$r->print(' |
<table class="LC_nested_outer"> |
<table class="LC_nested_outer"> |
<tr> |
<tr> |
<th>'.&mt($item->{text}).' '. |
<th>'.&mt($item->{text}).' </th></tr>'); |
&Apache::loncommon::help_open_topic($item->{'help'}).'</th> |
# |
</tr>'); |
# FIXME - put the help link back in when the help files exist |
|
# <th>'.&mt($item->{text}).' '. |
|
# &Apache::loncommon::help_open_topic($item->{'help'}).'</th> |
|
# </tr>'); |
if (($action eq 'autoupdate') || ($action eq 'rolecolors')) { |
if (($action eq 'autoupdate') || ($action eq 'rolecolors')) { |
my $colspan = ($action eq 'rolecolors')?' colspan="2"':''; |
my $colspan = ($action eq 'rolecolors')?' colspan="2"':''; |
$r->print(' |
$r->print(' |
Line 522 sub display_color_options {
|
Line 550 sub display_color_options {
|
'</span></td></tr>'; |
'</span></td></tr>'; |
my $switchserver = &check_switchserver($dom,$confname); |
my $switchserver = &check_switchserver($dom,$confname); |
foreach my $img (@{$images}) { |
foreach my $img (@{$images}) { |
$itemcount ++; |
$itemcount ++; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td>'.$choices->{$img}.'</td>'; |
'<td>'.$choices->{$img}.'</td>'; |
my $imgfile; |
my ($imgfile, $img_import); |
if ($designs->{$img} ne '') { |
if ($designs->{$img} ne '') { |
$imgfile = $designs->{$img}; |
$imgfile = $designs->{$img}; |
|
$img_import = ($imgfile =~ m{^/adm/}); |
} else { |
} else { |
$imgfile = $defaults->{$img}; |
$imgfile = $defaults->{$img}; |
} |
} |
Line 578 sub display_color_options {
|
Line 607 sub display_color_options {
|
if (!$is_custom->{$img}) { |
if (!$is_custom->{$img}) { |
$datatable .= &mt('Default in use:').'<br />'; |
$datatable .= &mt('Default in use:').'<br />'; |
} |
} |
|
if ($img_import) { |
|
$datatable.= '<input type="hidden" name="'.$role.'_import_'.$img.'" value="'.$imgfile.'" />'; |
|
} |
$datatable.= '<a href="'.$fullsize.'" target="_blank"><img src="'. |
$datatable.= '<a href="'.$fullsize.'" target="_blank"><img src="'. |
$showfile.'" alt="'.$alt_text->{$img}. |
$showfile.'" alt="'.$alt_text->{$img}. |
'" border="0" /></a></td>'; |
'" border="0" /></a></td>'; |
Line 746 sub print_quotas {
|
Line 778 sub print_quotas {
|
|
|
sub print_autoenroll { |
sub print_autoenroll { |
my ($dom,$settings) = @_; |
my ($dom,$settings) = @_; |
my $defdom = $dom; |
|
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my ($runon,$runoff); |
my ($defdom,$runon,$runoff); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (exists($settings->{'run'})) { |
if (exists($settings->{'run'})) { |
if ($settings->{'run'} eq '0') { |
if ($settings->{'run'} eq '0') { |
Line 850 sub print_autoupdate {
|
Line 881 sub print_autoupdate {
|
if (keys(%{$usertypes}) > 0) { |
if (keys(%{$usertypes}) > 0) { |
$othertitle = &mt('Other users'); |
$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 ( |
my %fieldtitles = &Apache::lonlocal::texthash ( |
id => 'Student/Employee ID', |
id => 'Student/Employee ID', |
email => 'E-mail address', |
permanentemail => 'E-mail address', |
lastname => 'Last Name', |
lastname => 'Last Name', |
firstname => 'First Name', |
firstname => 'First Name', |
middlename => 'Middle Name', |
middlename => 'Middle Name', |
Line 1053 sub modify_colors {
|
Line 1085 sub modify_colors {
|
} |
} |
my ($width,$height) = &thumb_dimensions(); |
my ($width,$height) = &thumb_dimensions(); |
foreach my $img (@images) { |
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 '') { |
if ($env{'form.'.$role.'_'.$img.'.filename'} ne '') { |
my $error; |
my $error; |
if ($configuserok eq 'ok') { |
if ($configuserok eq 'ok') { |
Line 1092 sub modify_colors {
|
Line 1133 sub modify_colors {
|
$dom,$confname,$img,$width,$height); |
$dom,$confname,$img,$width,$height); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
$confhash->{$role}{$img} = $logourl; |
$confhash->{$role}{$img} = $logourl; |
|
$changes{$role}{'images'}{$img} = 1; |
} |
} |
} |
} |
} |
} |
Line 1254 sub check_dimensions {
|
Line 1296 sub check_dimensions {
|
} |
} |
chomp($imageinfo); |
chomp($imageinfo); |
my ($fullsize) = |
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) { |
if ($fullsize) { |
($fullwidth,$fullheight) = split(/x/,$fullsize); |
($fullwidth,$fullheight) = split(/x/,$fullsize); |
} |
} |
Line 1577 sub modify_autoenroll {
|
Line 1619 sub modify_autoenroll {
|
my %title = ( run => 'Auto-enrollment active', |
my %title = ( run => 'Auto-enrollment active', |
sender => 'Sender for notification messages'); |
sender => 'Sender for notification messages'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
|
my $sender_uname = $env{'form.sender_uname'}; |
|
my $sender_domain = $env{'form.sender_domain'}; |
|
if ($sender_domain eq '') { |
|
$sender_uname = ''; |
|
} elsif ($sender_uname eq '') { |
|
$sender_domain = ''; |
|
} |
my %autoenrollhash = ( |
my %autoenrollhash = ( |
autoenroll => { run => $env{'form.autoenroll_run'}, |
autoenroll => { run => $env{'form.autoenroll_run'}, |
sender_uname => $env{'form.sender_uname'}, |
sender_uname => $sender_uname, |
sender_domain => $env{'form.sender_domain'}, |
sender_domain => $sender_domain, |
|
|
} |
} |
); |
); |
Line 1596 sub modify_autoenroll {
|
Line 1645 sub modify_autoenroll {
|
$changes{'run'} = 1; |
$changes{'run'} = 1; |
} |
} |
} |
} |
if (exists($currautoenroll{sender_uname})) { |
if ($currautoenroll{'sender_uname'} ne $sender_uname) { |
if ($currautoenroll{'sender_uname'} ne $env{'form.sender_uname'}) { |
|
$changes{'sender'} = 1; |
|
} |
|
} else { |
|
$changes{'sender'} = 1; |
$changes{'sender'} = 1; |
} |
} |
if (exists($currautoenroll{sender_domain})) { |
if ($currautoenroll{'sender_domain'} ne $sender_domain) { |
if ($currautoenroll{'sender_domain'} ne $env{'form.sender_domain'}) { |
|
$changes{'sender'} = 1; |
|
} |
|
} else { |
|
$changes{'sender'} = 1; |
$changes{'sender'} = 1; |
} |
} |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
Line 1616 sub modify_autoenroll {
|
Line 1657 sub modify_autoenroll {
|
$resulttext .= '<li>'.&mt("$title{'run'} set to $offon[$env{'form.autoenroll_run'}]").'</li>'; |
$resulttext .= '<li>'.&mt("$title{'run'} set to $offon[$env{'form.autoenroll_run'}]").'</li>'; |
} |
} |
if ($changes{'sender'}) { |
if ($changes{'sender'}) { |
$resulttext .= '<li>'.&mt("$title{'sender'} set to [_1]",$env{'form.sender_uname'}.':'.$env{'form.sender_domain'}).'</li>'; |
if ($sender_uname eq '' || $sender_domain eq '') { |
|
$resulttext .= '<li>'.&mt("$title{'sender'} set to default (course owner).").'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt("$title{'sender'} set to [_1]",$sender_uname.':'.$sender_domain).'</li>'; |
|
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
Line 1645 sub modify_autoupdate {
|
Line 1690 sub modify_autoupdate {
|
my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($dom); |
my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($dom); |
my %fieldtitles = &Apache::lonlocal::texthash ( |
my %fieldtitles = &Apache::lonlocal::texthash ( |
id => 'Student/Employee ID', |
id => 'Student/Employee ID', |
email => 'E-mail address', |
permanentemail => 'E-mail address', |
lastname => 'Last Name', |
lastname => 'Last Name', |
firstname => 'First Name', |
firstname => 'First Name', |
middlename => 'Middle Name', |
middlename => 'Middle Name', |