version 1.35, 2007/12/16 17:45:20
|
version 1.41, 2008/01/16 20:42:48
|
Line 247 sub handler {
|
Line 247 sub handler {
|
my @ids=&Apache::lonnet::current_machine_ids(); |
my @ids=&Apache::lonnet::current_machine_ids(); |
if (!grep(/^\Q$primarylibserv\E$/,@ids)) { |
if (!grep(/^\Q$primarylibserv\E$/,@ids)) { |
my %designhash = &Apache::loncommon::get_domainconf($dom); |
my %designhash = &Apache::loncommon::get_domainconf($dom); |
my @loginimages = ('img','logo','domlogo'); |
my @loginimages = ('img','logo','domlogo','login'); |
my $custom_img_count = 0; |
my $custom_img_count = 0; |
foreach my $img (@loginimages) { |
foreach my $img (@loginimages) { |
if ($designhash{$dom.'.login.'.$img} ne '') { |
if ($designhash{$dom.'.login.'.$img} ne '') { |
Line 281 sub handler {
|
Line 281 sub handler {
|
' /> '. |
' /> '. |
'<input type="button" value="uncheck all" '. |
'<input type="button" value="uncheck all" '. |
'onclick="javascript:uncheckAll(document.pickactions.actions)"'. |
'onclick="javascript:uncheckAll(document.pickactions.actions)"'. |
' /></p>'); |
' /></p><div class="LC_left_float">'); |
|
my ($numitems,$midpoint,$seconddiv,$count); |
|
$numitems = @prefs_order; |
|
$midpoint = int($numitems/2); |
|
if ($numitems%2) { |
|
$midpoint ++; |
|
} |
|
$count = 0; |
foreach my $item (@prefs_order) { |
foreach my $item (@prefs_order) { |
$r->print('<p><label><input type="checkbox" name="actions" value="'.$item.'" /> '.$prefs{$item}->{'text'}.'</label></p>'); |
$r->print('<h4><label><input type="checkbox" name="actions" value="'.$item.'" /> '.$prefs{$item}->{'text'}.'</label></h4>'); |
|
$count ++; |
|
if ((!$seconddiv) && ($count >= $midpoint)) { |
|
$r->print('</div>'."\n".'<div class="LC_left_float">'."\n"); |
|
$seconddiv = 1; |
|
} |
} |
} |
$r->print('<h3>'.&mt('Display options').'</h3>'."\n". |
$r->print('</div><div class="LC_clear_float_footer"></div><h3>'. |
|
&mt('Display options').'</h3>'."\n". |
'<p><span class="LC_nobreak">'.&mt('Display using: ')."\n". |
'<p><span class="LC_nobreak">'.&mt('Display using: ')."\n". |
'<label><input type="radio" name="numcols" value="1">'. |
'<label><input type="radio" name="numcols" value="1">'. |
&mt('one column').'</label> '. |
&mt('one column').'</label> '. |
Line 555 sub print_footer {
|
Line 568 sub print_footer {
|
sub print_login { |
sub print_login { |
my ($dom,$confname,$phase,$settings,$rowtotal) = @_; |
my ($dom,$confname,$phase,$settings,$rowtotal) = @_; |
my %choices = &login_choices(); |
my %choices = &login_choices(); |
my ($catalogon,$catalogoff,$adminmailon,$adminmailoff); |
my ($catalogon,$catalogoff,$adminmailon,$adminmailoff,$loginheader); |
$catalogon = ' checked="checked" '; |
$catalogon = ' checked="checked" '; |
$adminmailoff = ' checked="checked" '; |
$adminmailoff = ' checked="checked" '; |
my @images = ('img','logo','domlogo'); |
$loginheader = 'image'; |
|
my @images = ('img','logo','domlogo','login'); |
|
my @logintext = ('textcol','bgcol'); |
my @bgs = ('pgbg','mainbg','sidebg'); |
my @bgs = ('pgbg','mainbg','sidebg'); |
my @links = ('link','alink','vlink'); |
my @links = ('link','alink','vlink'); |
my %designhash = &Apache::loncommon::get_domainconf($dom); |
my %designhash = &Apache::loncommon::get_domainconf($dom); |
Line 573 sub print_login {
|
Line 588 sub print_login {
|
foreach my $item (@bgs) { |
foreach my $item (@bgs) { |
$defaults{'bgs'}{$item} = $defaultdesign{'login.'.$item}; |
$defaults{'bgs'}{$item} = $defaultdesign{'login.'.$item}; |
} |
} |
|
foreach my $item (@logintext) { |
|
$defaults{'logintext'}{$item} = $defaultdesign{'login.'.$item}; |
|
} |
foreach my $item (@links) { |
foreach my $item (@links) { |
$defaults{'links'}{$item} = $defaultdesign{'login.'.$item}; |
$defaults{'links'}{$item} = $defaultdesign{'login.'.$item}; |
} |
} |
Line 591 sub print_login {
|
Line 609 sub print_login {
|
$is_custom{$item} = 1; |
$is_custom{$item} = 1; |
} |
} |
} |
} |
|
foreach my $item (@logintext) { |
|
if ($settings->{$item} ne '') { |
|
$designs{'logintext'}{$item} = $settings->{$item}; |
|
$is_custom{$item} = 1; |
|
} |
|
} |
|
if ($settings->{'loginheader'} ne '') { |
|
$loginheader = $settings->{'loginheader'}; |
|
} |
if ($settings->{'font'} ne '') { |
if ($settings->{'font'} ne '') { |
$designs{'font'} = $settings->{'font'}; |
$designs{'font'} = $settings->{'font'}; |
$is_custom{'font'} = 1; |
$is_custom{'font'} = 1; |
Line 633 sub print_login {
|
Line 660 sub print_login {
|
} |
} |
my %alt_text = &Apache::lonlocal::texthash ( img => 'Log-in banner', |
my %alt_text = &Apache::lonlocal::texthash ( img => 'Log-in banner', |
logo => 'Institution Logo', |
logo => 'Institution Logo', |
domlogo => 'Domain Logo'); |
domlogo => 'Domain Logo', |
|
login => 'Login box'); |
my $itemcount = 1; |
my $itemcount = 1; |
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $datatable = |
my $datatable = |
Line 654 sub print_login {
|
Line 682 sub print_login {
|
'<label><input type="radio" name="adminmail"'. |
'<label><input type="radio" name="adminmail"'. |
$adminmailoff.'value="0" />'.&mt('No').'</label></span></td></tr>'; |
$adminmailoff.'value="0" />'.&mt('No').'</label></span></td></tr>'; |
$itemcount ++; |
$itemcount ++; |
$datatable .= &display_color_options($dom,$confname,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal); |
$datatable .= &display_color_options($dom,$confname,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal,\@logintext,$loginheader); |
$datatable .= '</tr></table></td></tr>'; |
$datatable .= '</tr></table></td></tr>'; |
return $datatable; |
return $datatable; |
} |
} |
Line 667 sub login_choices {
|
Line 695 sub login_choices {
|
img => "Header", |
img => "Header", |
logo => "Main Logo", |
logo => "Main Logo", |
domlogo => "Domain Logo", |
domlogo => "Domain Logo", |
|
login => "Log-in Header", |
|
textcol => "Text color", |
|
bgcol => "Box color", |
bgs => "Background colors", |
bgs => "Background colors", |
links => "Link colors", |
links => "Link colors", |
font => "Font color", |
font => "Font color", |
Line 754 sub print_rolecolors {
|
Line 785 sub print_rolecolors {
|
|
|
sub display_color_options { |
sub display_color_options { |
my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs, |
my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs, |
$images,$bgs,$links,$alt_text,$rowtotal) = @_; |
$images,$bgs,$links,$alt_text,$rowtotal,$logintext,$loginheader) = @_; |
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $datatable = '<tr'.$css_class.'>'. |
my $datatable = '<tr'.$css_class.'>'. |
'<td>'.$choices->{'font'}.'</td>'; |
'<td>'.$choices->{'font'}.'</td>'; |
Line 776 sub display_color_options {
|
Line 807 sub display_color_options {
|
$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, $img_import); |
my ($imgfile,$img_import,$login_hdr_pick,$logincolors); |
if ($designs->{$img} ne '') { |
if ($designs->{$img} ne '') { |
$imgfile = $designs->{$img}; |
$imgfile = $designs->{$img}; |
$img_import = ($imgfile =~ m{^/adm/}); |
$img_import = ($imgfile =~ m{^/adm/}); |
} else { |
} else { |
$imgfile = $defaults->{$img}; |
$imgfile = $defaults->{$img}; |
} |
} |
|
if ($img eq 'login') { |
|
$login_hdr_pick = &login_header_options($img,$role,$defaults,$is_custom,$choices, |
|
$loginheader); |
|
$logincolors = |
|
&login_text_colors($img,$role,$logintext,$phase,$choices,$designs); |
|
} |
if ($imgfile) { |
if ($imgfile) { |
my ($showfile,$fullsize); |
my ($showfile,$fullsize); |
if ($imgfile =~ m-^(/res/\Q$dom\E/\Q$confname\E/\Q$img\E)/([^/]+)$-) { |
if ($imgfile =~ m-^(/res/\Q$dom\E/\Q$confname\E/\Q$img\E)/([^/]+)$-) { |
Line 823 sub display_color_options {
|
Line 860 sub display_color_options {
|
} |
} |
} |
} |
if ($showfile) { |
if ($showfile) { |
$showfile = &Apache::loncommon::lonhttpdurl($showfile); |
if ($showfile =~ m{^/(adm|res)/}) { |
$fullsize = &Apache::loncommon::lonhttpdurl($imgfile); |
if ($showfile =~ m{^/res/}) { |
$datatable.= '<td>'; |
my $local_showfile = |
if (!$is_custom->{$img}) { |
&Apache::lonnet::filelocation('',$showfile); |
$datatable .= &mt('Default in use:').'<br />'; |
&Apache::lonnet::repcopy($local_showfile); |
} |
} |
if ($img_import) { |
$showfile = &Apache::loncommon::lonhttpdurl($showfile); |
$datatable.= '<input type="hidden" name="'.$role.'_import_'.$img.'" value="'.$imgfile.'" />'; |
} |
} |
if ($imgfile) { |
$datatable.= '<a href="'.$fullsize.'" target="_blank"><img src="'. |
if ($imgfile =~ m{^/(adm|res)/}) { |
$showfile.'" alt="'.$alt_text->{$img}. |
if ($imgfile =~ m{^/res/}) { |
'" border="0" /></a></td>'; |
my $local_imgfile = |
if ($is_custom->{$img}) { |
&Apache::lonnet::filelocation('',$imgfile); |
$datatable.='<td><span class="LC_nobreak"><label><input type="checkbox" name="'. |
&Apache::lonnet::repcopy($local_imgfile); |
$role.'_del_'.$img.'" value="1" />'.&mt('Delete?'). |
} |
'</label> '.&mt('Replace:').'</span><br />'; |
$fullsize = &Apache::loncommon::lonhttpdurl($imgfile); |
} else { |
} else { |
$datatable.='<td valign="bottom">'.&mt('Upload:').'<br />'; |
$fullsize = $imgfile; |
|
} |
} |
} |
|
$datatable .= '<td>'; |
|
if ($img eq 'login') { |
|
$datatable .= $login_hdr_pick; |
|
} |
|
$datatable .= &image_changes($is_custom->{$img},$alt_text->{$img},$img_import, |
|
$showfile,$fullsize,$role,$img,$imgfile,$logincolors); |
} else { |
} else { |
$datatable .= '<td colspan="2" class="LC_right_item"><br />'. |
$datatable .= '<td colspan="2" class="LC_right_item"><br />'. |
&mt('Upload:'); |
&mt('Upload:'); |
Line 881 sub display_color_options {
|
Line 925 sub display_color_options {
|
$datatable .= ' <span id="css_'.$role.'_'.$item.'" style="background-color: '.$designs->{'bgs'}{$item}.';"> </span>'; |
$datatable .= ' <span id="css_'.$role.'_'.$item.'" style="background-color: '.$designs->{'bgs'}{$item}.';"> </span>'; |
} |
} |
$datatable .= '<br /><input type="text" size="8" name="'.$role.'_'.$item.'" value="'.$designs->{'bgs'}{$item}. |
$datatable .= '<br /><input type="text" size="8" name="'.$role.'_'.$item.'" value="'.$designs->{'bgs'}{$item}. |
'" onblur = "javascript:document.display.css_'.$role.'_'.$item.'.style.background-color = document.display.'.$role.'_'.$item.'.value;"/></td>'; |
'" onblur = "javascript:colchg_span('."'css_".$role.'_'.$item."'".',this);" /></td>'; |
} |
} |
$datatable .= '</tr></table></td></tr>'; |
$datatable .= '</tr></table></td></tr>'; |
$itemcount ++; |
$itemcount ++; |
Line 915 sub display_color_options {
|
Line 959 sub display_color_options {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub login_header_options { |
|
my ($img,$role,$defaults,$is_custom,$choices,$loginheader) = @_; |
|
my $image_checked = ' checked="checked" '; |
|
my $text_checked = ' '; |
|
if ($loginheader eq 'text') { |
|
$image_checked = ' '; |
|
$text_checked = ' checked="checked" '; |
|
} |
|
my $output = '<span class="LC_nobreak"><label><input type="radio" name="'. |
|
'loginheader" value="image" '.$image_checked.'/>'. |
|
&mt('use image').'</label> '. |
|
'<label><input type="radio" name="loginheader" value="text"'. |
|
$text_checked.'/>'.&mt('use text').'</label><br />'."\n"; |
|
if ((!$is_custom->{'textcol'}) || (!$is_custom->{'bgcol'})) { |
|
$output .= &mt('Text default(s)').':<br />'; |
|
if (!$is_custom->{'textcol'}) { |
|
$output .= $choices->{'textcol'}.': '.$defaults->{'logintext'}{'textcol'}. |
|
' '; |
|
} |
|
if (!$is_custom->{'bgcol'}) { |
|
$output .= $choices->{'bgcol'}.': '. |
|
'<span id="css_'.$role.'_font" style="background-color: '. |
|
$defaults->{'logintext'}{'bgcol'}.';"> </span>'; |
|
} |
|
$output .= '<br />'; |
|
} |
|
$output .='<br />'; |
|
return $output; |
|
} |
|
|
|
sub login_text_colors { |
|
my ($img,$role,$logintext,$phase,$choices,$designs) = @_; |
|
my $color_menu = '<table border="0"><tr>'; |
|
foreach my $item (@{$logintext}) { |
|
my $link = &color_pick($phase,$role,$item,$choices->{$item},$designs->{'logintext'}{$item}); |
|
$color_menu .= '<td align="center">'.$link; |
|
if ($designs->{'logintext'}{$item}) { |
|
$color_menu .= ' <span id="css_'.$role.'_'.$item.'" style="background-color: '.$designs->{'logintext'}{$item}.';"> </span>'; |
|
} |
|
$color_menu .= '<br /><input type="text" size="8" name="'.$role.'_'.$item.'" value="'. |
|
$designs->{'logintext'}{$item}.'" onblur = "javascript:colchg_span('."'css_".$role.'_'.$item."'".',this);" /></td>'. |
|
'<td> </td>'; |
|
} |
|
$color_menu .= '</tr></table><br />'; |
|
return $color_menu; |
|
} |
|
|
|
sub image_changes { |
|
my ($is_custom,$alt_text,$img_import,$showfile,$fullsize,$role,$img,$imgfile,$logincolors) = @_; |
|
my $output; |
|
if (!$is_custom) { |
|
if ($img eq 'login') { |
|
$output .= &mt('Default image:').'<br />'; |
|
} else { |
|
$output .= &mt('Default in use:').'<br />'; |
|
} |
|
} |
|
if ($img_import) { |
|
$output .= '<input type="hidden" name="'.$role.'_import_'.$img.'" value="'.$imgfile.'" />'; |
|
} |
|
$output .= '<a href="'.$fullsize.'" target="_blank"><img src="'. |
|
$showfile.'" alt="'.$alt_text.'" border="0" /></a></td>'; |
|
if ($is_custom) { |
|
$output .= '<td>'.$logincolors.'<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="'. |
|
$role.'_del_'.$img.'" value="1" />'.&mt('Delete?'). |
|
'</label> '.&mt('Replace:').'</span><br />'; |
|
} else { |
|
$output .= '<td valign="bottom">'.$logincolors.&mt('Upload:').'<br />'; |
|
} |
|
return $output; |
|
} |
|
|
sub color_pick { |
sub color_pick { |
my ($phase,$role,$item,$desc,$curcol) = @_; |
my ($phase,$role,$item,$desc,$curcol) = @_; |
my $link = '<a href="javascript:pjump('."'color_custom','".$desc. |
my $link = '<a href="javascript:pjump('."'color_custom','".$desc. |
Line 946 sub color_pick_js {
|
Line 1063 sub color_pick_js {
|
document.parmform.pres_marker.value=''; |
document.parmform.pres_marker.value=''; |
} |
} |
} |
} |
|
|
|
function get_id (span_id) { |
|
if (document.getElementById) { |
|
return document.getElementById(span_id); |
|
} |
|
if (document.all) { |
|
return document.all[span_id]; |
|
} |
|
return false; |
|
} |
|
|
|
function colchg_span (span_id_str,new_color_item) { |
|
var span_ref = get_id(span_id_str); |
|
if (span_ref.style) { span_ref = span_ref.style; } |
|
span_ref.background = new_color_item.value; |
|
span_ref.backgroundColor = new_color_item.value; |
|
span_ref.bgColor = new_color_item.value; |
|
} |
|
|
ENDCOL |
ENDCOL |
return $output; |
return $output; |
} |
} |
Line 1022 sub print_autoenroll {
|
Line 1158 sub print_autoenroll {
|
} |
} |
} |
} |
my $domform = &Apache::loncommon::select_dom_form($defdom,'sender_domain',1); |
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='<tr class="LC_odd_row">'. |
my $datatable='<tr class="LC_odd_row">'. |
'<td>'.&mt('Auto-enrollment active?').'</td>'. |
'<td>'.&mt('Auto-enrollment active?').'</td>'. |
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
Line 1034 sub print_autoenroll {
|
Line 1174 sub print_autoenroll {
|
'</td><td class="LC_right_item"><span class="LC_nobreak">'. |
'</td><td class="LC_right_item"><span class="LC_nobreak">'. |
&mt('username').': '. |
&mt('username').': '. |
'<input type="text" name="sender_uname" value="'. |
'<input type="text" name="sender_uname" value="'. |
$settings->{'sender_uname'}. |
$notif_sender.'" size="10" /> '.&mt('domain'). |
'" size="10" /> '.&mt('domain'). |
|
': '.$domform.'</span></td></tr>'; |
': '.$domform.'</span></td></tr>'; |
$$rowtotal += 2; |
$$rowtotal += 2; |
return $datatable; |
return $datatable; |
Line 1178 sub print_directorysrch {
|
Line 1317 sub print_directorysrch {
|
foreach my $title (@{$titleorder}) { |
foreach my $title (@{$titleorder}) { |
if (defined($searchtitles->{$title})) { |
if (defined($searchtitles->{$title})) { |
my $check = ' '; |
my $check = ' '; |
if (ref($settings->{'searchby'}) eq 'ARRAY') { |
if (ref($settings) eq 'HASH') { |
if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) { |
if (ref($settings->{'searchby'}) eq 'ARRAY') { |
$check = ' checked="checked" '; |
if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) { |
|
$check = ' checked="checked" '; |
|
} |
} |
} |
} |
} |
$datatable .= '<td class="LC_left_item">'. |
$datatable .= '<td class="LC_left_item">'. |
Line 1331 sub print_usercreation {
|
Line 1472 sub print_usercreation {
|
$rowcount ++; |
$rowcount ++; |
} |
} |
} |
} |
|
if ($rowcount == 0) { |
|
$datatable .= '<tr><td colspan="2">'.&mt('No format rules have been defined for usernames or IDs in this domain.').'</td></tr>'; |
|
$$rowtotal ++; |
|
$rowcount ++; |
|
} |
} elsif ($position eq 'middle') { |
} elsif ($position eq 'middle') { |
my @creators = ('author','course'); |
my @creators = ('author','course'); |
|
my ($rules,$ruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'username'); |
my %lt = &usercreation_types(); |
my %lt = &usercreation_types(); |
my %checked; |
my %checked; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
Line 1363 sub print_usercreation {
|
Line 1511 sub print_usercreation {
|
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td><span class="LC_nobreak">'.$lt{$item}. |
'<td><span class="LC_nobreak">'.$lt{$item}. |
'</span></td><td align="right">'; |
'</span></td><td align="right">'; |
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 = ' '; |
my $check = ' '; |
if ($checked{$item} eq $option) { |
if ($checked{$item} eq $option) { |
$check = ' checked="checked" '; |
$check = ' checked="checked" '; |
Line 1393 sub print_usercreation {
|
Line 1548 sub print_usercreation {
|
} |
} |
} else { |
} else { |
foreach my $item (@contexts) { |
foreach my $item (@contexts) { |
foreach my $type (@authtypes) { |
foreach my $auth (@authtypes) { |
$checked{$item}{$auth} = ' checked="checked" '; |
$checked{$item}{$auth} = ' checked="checked" '; |
} |
} |
} |
} |
Line 1451 sub user_formats_row {
|
Line 1606 sub user_formats_row {
|
$output .= '<tr>'; |
$output .= '<tr>'; |
} |
} |
my $check = ' '; |
my $check = ' '; |
if (ref($settings->{$type.'_rule'}) eq 'ARRAY') { |
if (ref($settings) eq 'HASH') { |
if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{$type.'_rule'}})) { |
if (ref($settings->{$type.'_rule'}) eq 'ARRAY') { |
$check = ' checked="checked" '; |
if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{$type.'_rule'}})) { |
|
$check = ' checked="checked" '; |
|
} |
} |
} |
} |
} |
$output .= '<td class="LC_left_item">'. |
$output .= '<td class="LC_left_item">'. |
Line 1708 sub usertype_update_row {
|
Line 1865 sub usertype_update_row {
|
$datatable .= '<tr>'; |
$datatable .= '<tr>'; |
} |
} |
my $check = ' '; |
my $check = ' '; |
if (ref($settings->{'fields'}) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'fields'}{$type}) eq 'ARRAY') { |
if (ref($settings->{'fields'}) eq 'HASH') { |
if (grep(/^\Q$fields->[$i]\E$/,@{$settings->{'fields'}{$type}})) { |
if (ref($settings->{'fields'}{$type}) eq 'ARRAY') { |
$check = ' checked="checked" '; |
if (grep(/^\Q$fields->[$i]\E$/,@{$settings->{'fields'}{$type}})) { |
|
$check = ' checked="checked" '; |
|
} |
} |
} |
} |
} |
} |
} |
Line 1741 sub modify_login {
|
Line 1900 sub modify_login {
|
my ($r,$dom,$confname,%domconfig) = @_; |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($resulttext,$errors,$colchgtext,%changes,%colchanges); |
my ($resulttext,$errors,$colchgtext,%changes,%colchanges); |
my %title = ( coursecatalog => 'Display course catalog', |
my %title = ( coursecatalog => 'Display course catalog', |
adminmail => 'Display administrator E-mail address'); |
adminmail => 'Display administrator E-mail address', |
|
loginheader => 'Log-in box header'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my %loginhash; |
my %loginhash; |
($errors,%colchanges) = &modify_colors($r,$dom,$confname,['login'], |
($errors,%colchanges) = &modify_colors($r,$dom,$confname,['login'], |
\%domconfig,\%loginhash); |
\%domconfig,\%loginhash); |
$loginhash{login}{coursecatalog} = $env{'form.coursecatalog'}; |
$loginhash{login}{coursecatalog} = $env{'form.coursecatalog'}; |
$loginhash{login}{adminmail} = $env{'form.adminmail'}; |
$loginhash{login}{adminmail} = $env{'form.adminmail'}; |
|
$loginhash{login}{loginheader} = $env{'form.loginheader'}; |
if (ref($colchanges{'login'}) eq 'HASH') { |
if (ref($colchanges{'login'}) eq 'HASH') { |
$colchgtext = &display_colorchgs($dom,\%colchanges,['login'], |
$colchgtext = &display_colorchgs($dom,\%colchanges,['login'], |
\%loginhash); |
\%loginhash); |
Line 1771 sub modify_login {
|
Line 1932 sub modify_login {
|
($env{'form.adminmail'} eq '1')) { |
($env{'form.adminmail'} eq '1')) { |
$changes{'adminmail'} = 1; |
$changes{'adminmail'} = 1; |
} |
} |
|
if (($domconfig{'login'}{'loginheader'} eq 'text') && |
|
($env{'form.loginheader'} eq 'image')) { |
|
$changes{'loginheader'} = 1; |
|
} elsif (($domconfig{'login'}{'loginheader'} eq '' || |
|
$domconfig{'login'}{'loginheader'} eq 'image') && |
|
($env{'form.loginheader'} eq 'text')) { |
|
$changes{'loginheader'} = 1; |
|
} |
if (keys(%changes) > 0 || $colchgtext) { |
if (keys(%changes) > 0 || $colchgtext) { |
|
&Apache::loncommon::devalidate_domconfig_cache($dom); |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
foreach my $item (sort(keys(%changes))) { |
foreach my $item (sort(keys(%changes))) { |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
if ($item eq 'loginheader') { |
|
$resulttext .= '<li>'.&mt("$title{$item} set to $env{'form.loginheader'}").'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
|
} |
} |
} |
$resulttext .= $colchgtext.'</ul>'; |
$resulttext .= $colchgtext.'</ul>'; |
} else { |
} else { |
Line 1818 sub modify_rolecolors {
|
Line 1992 sub modify_rolecolors {
|
$dom); |
$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
|
&Apache::loncommon::devalidate_domconfig_cache($dom); |
$resulttext = &display_colorchgs($dom,\%changes,$roles, |
$resulttext = &display_colorchgs($dom,\%changes,$roles, |
$rolehash{'rolecolors'}); |
$rolehash{'rolecolors'}); |
} else { |
} else { |
Line 1839 sub modify_colors {
|
Line 2014 sub modify_colors {
|
my (%changes,%choices); |
my (%changes,%choices); |
my @bgs = ('pgbg','mainbg','sidebg'); |
my @bgs = ('pgbg','mainbg','sidebg'); |
my @links = ('link','alink','vlink'); |
my @links = ('link','alink','vlink'); |
|
my @logintext; |
my @images; |
my @images; |
my $servadm = $r->dir_config('lonAdmEMail'); |
my $servadm = $r->dir_config('lonAdmEMail'); |
my $errors; |
my $errors; |
foreach my $role (@{$roles}) { |
foreach my $role (@{$roles}) { |
if ($role eq 'login') { |
if ($role eq 'login') { |
%choices = &login_choices(); |
%choices = &login_choices(); |
|
@logintext = ('textcol','bgcol'); |
} else { |
} else { |
%choices = &color_font_choices(); |
%choices = &color_font_choices(); |
} |
} |
if ($role eq 'login') { |
if ($role eq 'login') { |
@images = ('img','logo','domlogo'); |
@images = ('img','logo','domlogo','login'); |
} else { |
} else { |
@images = ('img'); |
@images = ('img'); |
} |
} |
$confhash->{$role}{'font'} = $env{'form.'.$role.'_font'}; |
$confhash->{$role}{'font'} = $env{'form.'.$role.'_font'}; |
foreach my $item (@bgs,@links) { |
foreach my $item (@bgs,@links,@logintext) { |
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
} |
} |
my ($configuserok,$author_ok,$switchserver,%currroles); |
my ($configuserok,$author_ok,$switchserver,%currroles); |
Line 1868 sub modify_colors {
|
Line 2045 sub modify_colors {
|
} |
} |
} |
} |
my ($width,$height) = &thumb_dimensions(); |
my ($width,$height) = &thumb_dimensions(); |
|
if (ref($domconfig->{$role}) ne 'HASH') { |
|
$domconfig->{$role} = {}; |
|
} |
foreach my $img (@images) { |
foreach my $img (@images) { |
if ( ! $env{'form.'.$role.'_'.$img.'.filename'} |
if ( ! $env{'form.'.$role.'_'.$img.'.filename'} |
&& !defined($domconfig->{$role}{$img}) |
&& !defined($domconfig->{$role}{$img}) |
Line 1975 sub modify_colors {
|
Line 2155 sub modify_colors {
|
} |
} |
} |
} |
} |
} |
|
foreach my $item (@logintext) { |
|
if ($domconfig->{$role}{$item} ne '') { |
|
if ($confhash->{$role}{$item} ne $domconfig->{$role}{$item}) { |
|
$changes{$role}{'logintext'}{$item} = 1; |
|
} |
|
} else { |
|
if ($confhash->{$role}{$item}) { |
|
$changes{$role}{'logintext'}{$item} = 1; |
|
} |
|
} |
|
} |
} else { |
} else { |
&default_change_checker($role,\@images,\@links,\@bgs, |
&default_change_checker($role,\@images,\@links,\@bgs, |
$confhash,\%changes); |
\@logintext,$confhash,\%changes); |
} |
} |
} else { |
} else { |
&default_change_checker($role,\@images,\@links,\@bgs, |
&default_change_checker($role,\@images,\@links,\@bgs, |
$confhash,\%changes); |
\@logintext,$confhash,\%changes); |
} |
} |
} |
} |
return ($errors,%changes); |
return ($errors,%changes); |
} |
} |
|
|
sub default_change_checker { |
sub default_change_checker { |
my ($role,$images,$links,$bgs,$confhash,$changes) = @_; |
my ($role,$images,$links,$bgs,$logintext,$confhash,$changes) = @_; |
foreach my $item (@{$links}) { |
foreach my $item (@{$links}) { |
if ($confhash->{$role}{$item}) { |
if ($confhash->{$role}{$item}) { |
$changes->{$role}{'links'}{$item} = 1; |
$changes->{$role}{'links'}{$item} = 1; |
Line 1999 sub default_change_checker {
|
Line 2190 sub default_change_checker {
|
$changes->{$role}{'bgs'}{$item} = 1; |
$changes->{$role}{'bgs'}{$item} = 1; |
} |
} |
} |
} |
|
foreach my $item (@{$logintext}) { |
|
if ($confhash->{$role}{$item}) { |
|
$changes->{$role}{'logintext'}{$item} = 1; |
|
} |
|
} |
foreach my $img (@{$images}) { |
foreach my $img (@{$images}) { |
if ($env{'form.'.$role.'_del_'.$img}) { |
if ($env{'form.'.$role.'_del_'.$img}) { |
$confhash->{$role}{$img} = ''; |
$confhash->{$role}{$img} = ''; |
Line 2013 sub default_change_checker {
|
Line 2209 sub default_change_checker {
|
sub display_colorchgs { |
sub display_colorchgs { |
my ($dom,$changes,$roles,$confhash) = @_; |
my ($dom,$changes,$roles,$confhash) = @_; |
my (%choices,$resulttext); |
my (%choices,$resulttext); |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
|
if (!grep(/^login$/,@{$roles})) { |
if (!grep(/^login$/,@{$roles})) { |
$resulttext = &mt('Changes made:').'<br />'; |
$resulttext = &mt('Changes made:').'<br />'; |
} |
} |