version 1.76.2.6, 2008/12/26 22:27:24
|
version 1.98, 2009/07/25 14:44:50
|
Line 37 use Apache::loncommon();
|
Line 37 use Apache::loncommon();
|
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonmsg(); |
use Apache::lonmsg(); |
|
use Apache::lonconfigsettings; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA::Enrollment; |
use LONCAPA::Enrollment; |
use LONCAPA::lonauthcgi(); |
use LONCAPA::lonauthcgi(); |
Line 53 sub handler {
|
Line 54 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
my $context = 'domain'; |
my $dom = $env{'request.role.domain'}; |
my $dom = $env{'request.role.domain'}; |
my $domdesc = &Apache::lonnet::domain($dom,'description'); |
my $domdesc = &Apache::lonnet::domain($dom,'description'); |
if (&Apache::lonnet::allowed('mau',$dom)) { |
if (&Apache::lonnet::allowed('mau',$dom)) { |
Line 74 sub handler {
|
Line 76 sub handler {
|
&Apache::lonnet::get_dom('configuration',['login','rolecolors', |
&Apache::lonnet::get_dom('configuration',['login','rolecolors', |
'quotas','autoenroll','autoupdate','directorysrch', |
'quotas','autoenroll','autoupdate','directorysrch', |
'usercreation','usermodification','contacts','defaults', |
'usercreation','usermodification','contacts','defaults', |
'scantron','coursecategories','serverstatuses'],$dom); |
'scantron','coursecategories','serverstatuses', |
|
'requestcourses'],$dom); |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
'autoupdate','directorysrch','contacts', |
'autoupdate','directorysrch','contacts', |
'usercreation','usermodification','scantron', |
'usercreation','usermodification','scantron', |
'coursecategories','serverstatuses'); |
'requestcourses','coursecategories','serverstatuses'); |
my %prefs = ( |
my %prefs = ( |
'rolecolors' => |
'rolecolors' => |
{ text => 'Default color schemes', |
{ text => 'Default color schemes', |
Line 105 sub handler {
|
Line 108 sub handler {
|
col2 => 'Value'}], |
col2 => 'Value'}], |
}, |
}, |
'quotas' => |
'quotas' => |
{ text => 'User blogs, home pages and portfolios', |
{ text => 'User blogs, personal information pages and portfolios', |
help => 'Domain_Configuration_Quotas', |
help => 'Domain_Configuration_Quotas', |
header => [{col1 => 'User type', |
header => [{col1 => 'User affiliation', |
col2 => 'Available tools', |
col2 => 'Available tools', |
col3 => 'Portfolio quota',}], |
col3 => 'Portfolio quota',}], |
}, |
}, |
Line 159 sub handler {
|
Line 162 sub handler {
|
col2 => 'Information settable when self-creating account (if directory data blank)'}], |
col2 => 'Information settable when self-creating account (if directory data blank)'}], |
}, |
}, |
'scantron' => |
'scantron' => |
{ text => 'Scantron format file', |
{ text => 'Bubblesheet format file', |
help => 'Domain_Configuration_Scantron_Format', |
help => 'Domain_Configuration_Scantron_Format', |
header => [ {col1 => 'Item', |
header => [ {col1 => 'Item', |
col2 => '', |
col2 => '', |
}], |
}], |
}, |
}, |
|
'requestcourses' => |
|
{text => 'Request creation of courses', |
|
help => 'Domain_Configuration_Request_Courses', |
|
header => [{col1 => 'User affiliation', |
|
col2 => 'Requestable course types',}], |
|
}, |
'coursecategories' => |
'coursecategories' => |
{ text => 'Cataloging of courses', |
{ text => 'Cataloging of courses', |
help => 'Domain_Configuration_Cataloging_Courses', |
help => 'Domain_Configuration_Cataloging_Courses', |
Line 175 sub handler {
|
Line 184 sub handler {
|
}], |
}], |
}, |
}, |
'serverstatuses' => |
'serverstatuses' => |
{text => 'Access to Server Status Pages', |
{text => 'Access to server status pages', |
help => 'Domain_Configuration_Server_Status', |
help => 'Domain_Configuration_Server_Status', |
header => [{col1 => 'Status Page', |
header => [{col1 => 'Status Page', |
col2 => 'Other named users', |
col2 => 'Other named users', |
Line 190 sub handler {
|
Line 199 sub handler {
|
text=>"Pick functionality"}); |
text=>"Pick functionality"}); |
my $confname = $dom.'-domainconfig'; |
my $confname = $dom.'-domainconfig'; |
if ($phase eq 'process') { |
if ($phase eq 'process') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles); |
({href=>"javascript:changePage(document.$phase,'display')", |
|
text=>"Domain Configuration"}, |
|
{href=>"javascript:changePage(document.$phase,'$phase')", |
|
text=>"Updated"}); |
|
&print_header($r,$phase); |
|
foreach my $item (@prefs_order) { |
|
if (grep(/^\Q$item\E$/,@actions)) { |
|
$r->print('<h3>'.&mt($prefs{$item}{'text'}).'</h3>'. |
|
&process_changes($r,$dom,$confname,$item, |
|
\@roles,%domconfig)); |
|
} |
|
} |
|
$r->print('<p>'); |
|
&print_footer($r,$phase,'display','Back to configuration display', |
|
\@actions); |
|
$r->print('</p>'); |
|
} elsif ($phase eq 'display') { |
} elsif ($phase eq 'display') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname); |
({href=>"javascript:changePage(document.$phase,'display')", |
|
text=>"Domain Configuration"}); |
|
&print_header($r,$phase); |
|
if (@actions > 0) { |
|
my $rowsum = 0; |
|
my (%output,%rowtotal,@items); |
|
my $halfway = @actions/2; |
|
foreach my $item (@prefs_order) { |
|
if (grep(/^\Q$item\E$/,@actions)) { |
|
push(@items,$item); |
|
($output{$item},$rowtotal{$item}) = |
|
&print_config_box($r,$dom,$confname,$phase, |
|
$item,$prefs{$item}, |
|
$domconfig{$item}); |
|
$rowsum += $rowtotal{$item}; |
|
} |
|
} |
|
my $colend; |
|
my $halfway = $rowsum/2; |
|
my $aggregate = 0; |
|
my $sumleft = 0; |
|
my $sumright = 0; |
|
my $crossover; |
|
for (my $i=0; $i<@items; $i++) { |
|
$aggregate += $rowtotal{$items[$i]}; |
|
if ($aggregate > $halfway) { |
|
$crossover = $i; |
|
last; |
|
} |
|
} |
|
for (my $i=0; $i<$crossover; $i++) { |
|
$sumleft += $rowtotal{$items[$i]}; |
|
} |
|
for (my $i=$crossover+1; $i<@items; $i++) { |
|
$sumright += $rowtotal{$items[$i]}; |
|
} |
|
if ((@items > 1) && ($env{'form.numcols'} == 2)) { |
|
my $sumdiff = $sumright - $sumleft; |
|
if ($sumdiff > 0) { |
|
$colend = $crossover + 1; |
|
} else { |
|
$colend = $crossover; |
|
} |
|
} else { |
|
$colend = @items; |
|
} |
|
$r->print('<p><table class="LC_double_column"><tr><td class="LC_left_col">'); |
|
for (my $i=0; $i<$colend; $i++) { |
|
$r->print($output{$items[$i]}); |
|
} |
|
$r->print('</td><td></td><td class="LC_right_col">'); |
|
if ($colend < @items) { |
|
for (my $i=$colend; $i<@items; $i++) { |
|
$r->print($output{$items[$i]}); |
|
} |
|
} |
|
$r->print('</td></tr></table></p>'); |
|
$r->print(&print_footer($r,$phase,'process','Save',\@actions)); |
|
} else { |
|
$r->print('<input type="hidden" name="phase" value="" />'. |
|
'<input type="hidden" name="numcols" value="'. |
|
$env{'form.numcols'}.'" />'."\n". |
|
'<span class="LC_error">'.&mt('No settings chosen'). |
|
'</span>'); |
|
} |
|
$r->print('</form>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} else { |
} else { |
if ($phase eq '') { |
|
$phase = 'pickactions'; |
|
} |
|
my %helphash; |
|
&print_header($r,$phase); |
|
if (keys(%domconfig) == 0) { |
if (keys(%domconfig) == 0) { |
my $primarylibserv = &Apache::lonnet::domain($dom,'primary'); |
my $primarylibserv = &Apache::lonnet::domain($dom,'primary'); |
my @ids=&Apache::lonnet::current_machine_ids(); |
my @ids=&Apache::lonnet::current_machine_ids(); |
Line 300 sub handler {
|
Line 221 sub handler {
|
} |
} |
} |
} |
if ($custom_img_count > 0) { |
if ($custom_img_count > 0) { |
|
&Apache::lonconfigsettings::print_header($r,$phase,$context); |
my $switch_server = &check_switchserver($dom,$confname); |
my $switch_server = &check_switchserver($dom,$confname); |
$r->print( |
$r->print( |
&mt('Domain configuration settings have yet to be saved for this domain via the web-based domain preferences interface.').'<br />'. |
&mt('Domain configuration settings have yet to be saved for this domain via the web-based domain preferences interface.').'<br />'. |
Line 309 sub handler {
|
Line 231 sub handler {
|
if ($switch_server) { |
if ($switch_server) { |
$r->print($switch_server.' '.&mt('to primary library server for domain: [_1]',$dom)); |
$r->print($switch_server.' '.&mt('to primary library server for domain: [_1]',$dom)); |
} |
} |
|
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
} |
} |
} |
} |
$r->print('<h3>'.&mt('Functionality to display/modify').'</h3>'); |
&Apache::lonconfigsettings::display_choices($r,$phase,$context,\@prefs_order,\%prefs); |
$r->print('<script type="text/javascript">'."\n". |
|
&Apache::loncommon::check_uncheck_jscript()."\n". |
|
'</script>'."\n".'<p><input type="button" value="'.&mt('check all').'" '. |
|
'onclick="javascript:checkAll(document.pickactions.actions)"'. |
|
' /> '. |
|
'<input type="button" value="'.&mt('uncheck all').'" '. |
|
'onclick="javascript:uncheckAll(document.pickactions.actions)"'. |
|
' /></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) { |
|
$r->print('<h4>'. |
|
&Apache::loncommon::help_open_topic($prefs{$item}->{'help'}). |
|
'<label><input type="checkbox" name="actions" value="'.$item. |
|
'" /> '.&mt($prefs{$item}->{'text'}).'</label></h4>'); |
|
$count ++; |
|
if ((!$seconddiv) && ($count >= $midpoint)) { |
|
$r->print('</div>'."\n".'<div class="LC_left_float">'."\n"); |
|
$seconddiv = 1; |
|
} |
|
} |
|
$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". |
|
'<label><input type="radio" name="numcols" value="1" />'. |
|
&mt('one column').'</label> <label>'. |
|
'<input type="radio" name="numcols" value="2" />'. |
|
&mt('two columns').'</label></span></p>'); |
|
$r->print(&print_footer($r,$phase,'display','Go')); |
|
$r->print('</form>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
} |
return OK; |
return OK; |
} |
} |
|
|
sub process_changes { |
sub process_changes { |
my ($r,$dom,$confname,$action,$roles,%domconfig) = @_; |
my ($r,$dom,$confname,$action,$roles,$values) = @_; |
|
my %domconfig; |
|
if (ref($values) eq 'HASH') { |
|
%domconfig = %{$values}; |
|
} |
my $output; |
my $output; |
if ($action eq 'login') { |
if ($action eq 'login') { |
$output = &modify_login($r,$dom,$confname,%domconfig); |
$output = &modify_login($r,$dom,$confname,%domconfig); |
Line 363 sub process_changes {
|
Line 254 sub process_changes {
|
$output = &modify_rolecolors($r,$dom,$confname,$roles, |
$output = &modify_rolecolors($r,$dom,$confname,$roles, |
%domconfig); |
%domconfig); |
} elsif ($action eq 'quotas') { |
} elsif ($action eq 'quotas') { |
$output = &modify_quotas($dom,%domconfig); |
$output = &modify_quotas($dom,$action,%domconfig); |
} elsif ($action eq 'autoenroll') { |
} elsif ($action eq 'autoenroll') { |
$output = &modify_autoenroll($dom,%domconfig); |
$output = &modify_autoenroll($dom,%domconfig); |
} elsif ($action eq 'autoupdate') { |
} elsif ($action eq 'autoupdate') { |
Line 384 sub process_changes {
|
Line 275 sub process_changes {
|
$output = &modify_coursecategories($dom,%domconfig); |
$output = &modify_coursecategories($dom,%domconfig); |
} elsif ($action eq 'serverstatuses') { |
} elsif ($action eq 'serverstatuses') { |
$output = &modify_serverstatuses($dom,%domconfig); |
$output = &modify_serverstatuses($dom,%domconfig); |
|
} elsif ($action eq 'requestcourses') { |
|
$output = &modify_quotas($dom,$action,%domconfig); |
} |
} |
return $output; |
return $output; |
} |
} |
Line 394 sub print_config_box {
|
Line 287 sub print_config_box {
|
my $output; |
my $output; |
if ($action eq 'coursecategories') { |
if ($action eq 'coursecategories') { |
$output = &coursecategories_javascript($settings); |
$output = &coursecategories_javascript($settings); |
} |
} |
$output .= |
$output .= |
'<table class="LC_nested_outer"> |
'<table class="LC_nested_outer"> |
<tr> |
<tr> |
Line 544 sub print_config_box {
|
Line 437 sub print_config_box {
|
if ($action eq 'login') { |
if ($action eq 'login') { |
$output .= &print_login($dom,$confname,$phase,$settings,\$rowtotal); |
$output .= &print_login($dom,$confname,$phase,$settings,\$rowtotal); |
} elsif ($action eq 'quotas') { |
} elsif ($action eq 'quotas') { |
$output .= &print_quotas($dom,$settings,\$rowtotal); |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
} elsif ($action eq 'autoenroll') { |
} elsif ($action eq 'autoenroll') { |
$output .= &print_autoenroll($dom,$settings,\$rowtotal); |
$output .= &print_autoenroll($dom,$settings,\$rowtotal); |
} elsif ($action eq 'directorysrch') { |
} elsif ($action eq 'directorysrch') { |
Line 557 sub print_config_box {
|
Line 450 sub print_config_box {
|
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'serverstatuses') { |
} elsif ($action eq 'serverstatuses') { |
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'requestcourses') { |
|
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
} |
} |
} |
} |
$output .= ' |
$output .= ' |
Line 567 sub print_config_box {
|
Line 462 sub print_config_box {
|
return ($output,$rowtotal); |
return ($output,$rowtotal); |
} |
} |
|
|
sub print_header { |
|
my ($r,$phase) = @_; |
|
my $alert = &mt('You must select at least one functionality type to display.'); |
|
my $js = ' |
|
<script type="text/javascript"> |
|
function changePage(formname,newphase) { |
|
formname.phase.value = newphase; |
|
numchecked = 0; |
|
if (formname == document.pickactions) { |
|
if (formname.actions.length > 0) { |
|
for (var i = 0; i<formname.actions.length; i++) { |
|
if (formname.actions[i].checked) { |
|
numchecked ++; |
|
} |
|
} |
|
} else { |
|
if (formname.actions.checked) { |
|
numchecked ++; |
|
} |
|
} |
|
if (numchecked > 0) { |
|
formname.submit(); |
|
} else { |
|
alert("'.$alert.'"); |
|
return; |
|
} |
|
} |
|
formname.submit(); |
|
}'."\n"; |
|
if ($phase eq 'pickactions') { |
|
$js .= |
|
&Apache::lonhtmlcommon::set_form_elements({actions => 'checkbox',numcols => 'radio',})."\n". |
|
&javascript_set_colnums(); |
|
} elsif ($phase eq 'display') { |
|
$js .= &color_pick_js()."\n"; |
|
} |
|
$js .= &Apache::loncommon::viewport_size_js().' |
|
</script> |
|
'; |
|
my $additem; |
|
if ($phase eq 'pickactions') { |
|
my %loaditems = ( |
|
'onload' => "javascript:getViewportDims(document.$phase.width,document.$phase.height);setDisplayColumns();setFormElements(document.pickactions);", |
|
); |
|
$additem = {'add_entries' => \%loaditems,}; |
|
} else { |
|
my %loaditems = ( |
|
'onload' => "javascript:getViewportDims(document.$phase.width,document.$phase.height);", |
|
); |
|
$additem = {'add_entries' => \%loaditems,}; |
|
} |
|
$r->print(&Apache::loncommon::start_page('View/Modify Domain Settings', |
|
$js,$additem)); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Domain Settings')); |
|
$r->print(' |
|
<form name="parmform" action=""> |
|
<input type="hidden" name="pres_marker" /> |
|
<input type="hidden" name="pres_type" /> |
|
<input type="hidden" name="pres_value" /> |
|
</form> |
|
'); |
|
$r->print('<form method="post" name="'.$phase.'" action="/adm/domainprefs"'. |
|
' enctype="multipart/form-data">'); |
|
return; |
|
} |
|
|
|
sub print_footer { |
|
my ($r,$phase,$newphase,$button_text,$actions) = @_; |
|
$button_text = &mt($button_text); |
|
$r->print('<input type="hidden" name="phase" value="" />'. |
|
'<input type="hidden" name="width" value="'. |
|
$env{'form.width'}.'" />'. |
|
'<input type="hidden" name="height" value="'. |
|
$env{'form.height'}.'" />'); |
|
if (($phase eq 'display') || ($phase eq 'process')) { |
|
if (ref($actions) eq 'ARRAY') { |
|
foreach my $item (@{$actions}) { |
|
$r->print('<input type="hidden" name="actions" value="'.$item.'" />')."\n"; |
|
} |
|
} |
|
$r->print('<input type="hidden" name="numcols" value="'.$env{'form.numcols'}.'" />'); |
|
} |
|
my $dest='"javascript:changePage(document.'.$phase.','."'$newphase'".')"'; |
|
if ($phase eq 'process') { |
|
$r->print('<p><a href='.$dest.'>'.$button_text.'</a></p>'); |
|
} else { |
|
my $onclick; |
|
if ($phase eq 'display') { |
|
$onclick = '"javascript:changePage(document.'.$phase.','."'$newphase'".')"'; |
|
} else { |
|
$onclick = '"javascript:changePage(document.'.$phase.','."'$newphase'".')"'; |
|
} |
|
$r->print('<p><input type="button" name="store" value="'. |
|
$button_text.'" onclick='.$onclick.' /></p>'); |
|
} |
|
if ($phase eq 'process') { |
|
$r->print('</form>'.&Apache::loncommon::end_page()); |
|
} |
|
return; |
|
} |
|
|
|
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(); |
Line 817 sub login_choices {
|
Line 611 sub login_choices {
|
bgs => "Background colors", |
bgs => "Background colors", |
links => "Link colors", |
links => "Link colors", |
font => "Font color", |
font => "Font color", |
pgbg => "Page", |
pgbg => "Header", |
mainbg => "Main panel", |
mainbg => "Page", |
sidebg => "Side panel", |
sidebg => "Login box", |
link => "Link", |
link => "Link", |
alink => "Active link", |
alink => "Active link", |
vlink => "Visited link", |
vlink => "Visited link", |
Line 840 sub print_rolecolors {
|
Line 634 sub print_rolecolors {
|
my %defaults = ( |
my %defaults = ( |
img => $defaultdesign{$role.'.img'}, |
img => $defaultdesign{$role.'.img'}, |
font => $defaultdesign{$role.'.font'}, |
font => $defaultdesign{$role.'.font'}, |
|
fontmenu => $defaultdesign{$role.'.fontmenu'}, |
); |
); |
foreach my $item (@bgs) { |
foreach my $item (@bgs) { |
$defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item}; |
$defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item}; |
Line 857 sub print_rolecolors {
|
Line 652 sub print_rolecolors {
|
$designs{'font'} = $settings->{$role}->{'font'}; |
$designs{'font'} = $settings->{$role}->{'font'}; |
$is_custom{'font'} = 1; |
$is_custom{'font'} = 1; |
} |
} |
|
if ($settings->{$role}->{'fontmenu'} ne '') { |
|
$designs{'fontmenu'} = $settings->{$role}->{'fontmenu'}; |
|
$is_custom{'fontmenu'} = 1; |
|
} |
foreach my $item (@bgs) { |
foreach my $item (@bgs) { |
if ($settings->{$role}->{$item} ne '') { |
if ($settings->{$role}->{$item} ne '') { |
$designs{'bgs'}{$item} = $settings->{$role}->{$item}; |
$designs{'bgs'}{$item} = $settings->{$role}->{$item}; |
Line 875 sub print_rolecolors {
|
Line 674 sub print_rolecolors {
|
$designs{img} = $designhash{$dom.'.'.$role.'.img'}; |
$designs{img} = $designhash{$dom.'.'.$role.'.img'}; |
$is_custom{'img'} = 1; |
$is_custom{'img'} = 1; |
} |
} |
|
if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') { |
|
$designs{fontmenu} = $designhash{$dom.'.'.$role.'.fontmenu'}; |
|
$is_custom{'fontmenu'} = 1; |
|
} |
if ($designhash{$dom.'.'.$role.'.font'} ne '') { |
if ($designhash{$dom.'.'.$role.'.font'} ne '') { |
$designs{font} = $designhash{$dom.'.'.$role.'.font'}; |
$designs{font} = $designhash{$dom.'.'.$role.'.font'}; |
$is_custom{'font'} = 1; |
$is_custom{'font'} = 1; |
Line 903 sub display_color_options {
|
Line 706 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,$logintext,$loginheader) = @_; |
$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>'. |
'<td>'.$choices->{'font'}.'</td>'; |
'<td>'.$choices->{'font'}.'</td>'; |
if (!$is_custom->{'font'}) { |
if (!$is_custom->{'font'}) { |
$datatable .= '<td>'.&mt('Default in use:').' <span id="css_default_'.$role.'_font" style="color: '.$defaults->{'font'}.';">'.$defaults->{'font'}.'</span></td>'; |
$datatable .= '<td>'.&mt('Default in use:').' <span id="css_default_'.$role.'_font" style="color: '.$defaults->{'font'}.';">'.$defaults->{'font'}.'</span></td>'; |
Line 917 sub display_color_options {
|
Line 720 sub display_color_options {
|
' <span id="css_'.$role.'_font" style="background-color: '. |
' <span id="css_'.$role.'_font" style="background-color: '. |
$designs->{'font'}.';"> </span>'. |
$designs->{'font'}.';"> </span>'. |
'</span></td></tr>'; |
'</span></td></tr>'; |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td>'.$choices->{'fontmenu'}.'</td>'; |
|
if (!$is_custom->{'fontmenu'}) { |
|
$datatable .= '<td>'.&mt('Default in use:').' <span id="css_default_'.$role.'_font" style="color: '.$defaults->{'fontmenu'}.';">'.$defaults->{'fontmenu'}.'</span></td>'; |
|
} else { |
|
$datatable .= '<td> </td>'; |
|
} |
|
$fontlink = &color_pick($phase,$role,'fontmenu',$choices->{'fontmenu'},$designs->{'fontmenu'}); |
|
$datatable .= '<td><span class="LC_nobreak">'. |
|
'<input type="text" size="10" name="'.$role.'_fontmenu"'. |
|
' value="'.$designs->{'fontmenu'}.'" /> '.$fontlink. |
|
' <span id="css_'.$role.'_fontmenu" style="background-color: '. |
|
$designs->{'fontmenu'}.';"> </span>'. |
|
'</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 ++; |
Line 1189 sub color_pick {
|
Line 1006 sub color_pick {
|
return $link; |
return $link; |
} |
} |
|
|
sub color_pick_js { |
|
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
|
my $output = <<"ENDCOL"; |
|
function pclose() { |
|
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms","height=350,width=350,scrollbars=no,menubar=no"); |
|
parmwin.close(); |
|
} |
|
|
|
$pjump_def |
|
|
|
function psub() { |
|
pclose(); |
|
if (document.parmform.pres_marker.value!='') { |
|
if (document.parmform.pres_type.value!='') { |
|
eval('document.display.'+ |
|
document.parmform.pres_marker.value+ |
|
'.value=document.parmform.pres_value.value;'); |
|
} |
|
} else { |
|
document.parmform.pres_value.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 |
|
return $output; |
|
} |
|
|
|
sub print_quotas { |
sub print_quotas { |
my ($dom,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal,$action) = @_; |
my $datatable; |
my $context; |
|
if ($action eq 'quotas') { |
|
$context = 'tools'; |
|
} else { |
|
$context = $action; |
|
} |
|
my ($datatable,$defaultquota,@usertools); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my $typecount = 0; |
my $typecount = 0; |
my $css_class; |
my $css_class; |
my @usertools = ('aboutme','blog','portfolio'); |
if ($context eq 'requestcourses') { |
|
@usertools = ('official','unofficial','community'); |
|
} else { |
|
@usertools = ('aboutme','blog','portfolio'); |
|
} |
my %titles = &tool_titles(); |
my %titles = &tool_titles(); |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
foreach my $type (@{$types}) { |
foreach my $type (@{$types}) { |
my $currdefquota; |
my $currdefquota; |
if (ref($settings) eq 'HASH') { |
unless ($context eq 'requestcourses') { |
if (ref($settings->{defaultquota}) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
$currdefquota = $settings->{defaultquota}->{$type}; |
if (ref($settings->{defaultquota}) eq 'HASH') { |
} else { |
$currdefquota = $settings->{defaultquota}->{$type}; |
$currdefquota = $settings->{$type}; |
} else { |
|
$currdefquota = $settings->{$type}; |
|
} |
} |
} |
} |
} |
if (defined($usertypes->{$type})) { |
if (defined($usertypes->{$type})) { |
Line 1260 sub print_quotas {
|
Line 1043 sub print_quotas {
|
'<td>'.$usertypes->{$type}.'</td>'. |
'<td>'.$usertypes->{$type}.'</td>'. |
'<td class="LC_left_item">'; |
'<td class="LC_left_item">'; |
foreach my $item (@usertools) { |
foreach my $item (@usertools) { |
my $checked = 'checked="checked" '; |
my $checked; |
|
unless ($context eq 'requestcourses') { |
|
$checked = 'checked="checked" '; |
|
} |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if ($settings->{$item}->{$type} == 0) { |
if ($settings->{$item}->{$type} == 0) { |
$checked = ''; |
$checked = ''; |
|
} elsif ($settings->{$item}->{$type} == 1) { |
|
$checked = 'checked="checked" '; |
} |
} |
} |
} |
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="tools_'.$item. |
'<input type="checkbox" name="'.$context.'_'.$item. |
'" value="'.$type.'" '.$checked.'/>'.$titles{$item}. |
'" value="'.$type.'" '.$checked.'/>'.$titles{$item}. |
'</label></span> '; |
'</label></span> '; |
} |
} |
$datatable .= '</td><td class="LC_right_item"><span class="LC_nobreak">'. |
$datatable .= '</td>'; |
|
unless ($context eq 'requestcourses') { |
|
$datatable .= |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<input type="text" name="quota_'.$type. |
'<input type="text" name="quota_'.$type. |
'" value="'.$currdefquota. |
'" value="'.$currdefquota. |
'" size="5" /> Mb</span></td></tr>'; |
'" size="5" /> Mb</span></td>'; |
|
} |
|
$datatable .= '</tr>'; |
} |
} |
} |
} |
} |
} |
my $defaultquota = '20'; |
unless ($context eq 'requestcourses') { |
if (ref($settings) eq 'HASH') { |
$defaultquota = '20'; |
if (ref($settings->{'defaultquota'}) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
$defaultquota = $settings->{'defaultquota'}->{'default'}; |
if (ref($settings->{'defaultquota'}) eq 'HASH') { |
} elsif (defined($settings->{'default'})) { |
$defaultquota = $settings->{'defaultquota'}->{'default'}; |
$defaultquota = $settings->{'default'}; |
} elsif (defined($settings->{'default'})) { |
|
$defaultquota = $settings->{'default'}; |
|
} |
} |
} |
} |
} |
$typecount ++; |
$typecount ++; |
Line 1294 sub print_quotas {
|
Line 1089 sub print_quotas {
|
'<td>'.$othertitle.'</td>'. |
'<td>'.$othertitle.'</td>'. |
'<td class="LC_left_item">'; |
'<td class="LC_left_item">'; |
foreach my $item (@usertools) { |
foreach my $item (@usertools) { |
my $checked = 'checked="checked" '; |
my $checked; |
|
unless ($context eq 'requestcourses') { |
|
$checked = 'checked="checked" '; |
|
} |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if ($settings->{$item}->{'default'} == 0) { |
if ($settings->{$item}->{'default'} == 0) { |
$checked = ''; |
$checked = ''; |
|
} elsif ($settings->{$item}->{'default'} == 1) { |
|
$checked = 'checked="checked" '; |
} |
} |
} |
} |
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="tools_'.$item. |
'<input type="checkbox" name="'.$context.'_'.$item. |
'" value="default" '.$checked.'/>'.$titles{$item}. |
'" value="default" '.$checked.'/>'.$titles{$item}. |
'</label></span> '; |
'</label></span> '; |
} |
} |
$datatable .= '</td><td class="LC_right_item"><span class="LC_nobreak">'. |
$datatable .= '</td>'; |
'<input type="text" name="defaultquota" value="'. |
unless ($context eq 'requestcourses') { |
$defaultquota.'" size="5" /> Mb</span></td></tr>'; |
$datatable .= '<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<input type="text" name="defaultquota" value="'. |
|
$defaultquota.'" size="5" /> Mb</span></td>'; |
|
} |
|
$datatable .= '</tr>'; |
$typecount ++; |
$typecount ++; |
$css_class = $typecount%2?' class="LC_odd_row"':''; |
$css_class = $typecount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td><br/>'.&mt('LON-CAPA Advanced Users').'</td>'. |
'<td>'.&mt('LON-CAPA Advanced Users'). |
|
' <span class="LC_nobreak">('. |
|
&mt('overrides affiliation').')</span></td>'. |
'<td class="LC_left_item" colspan="2"><br />'; |
'<td class="LC_left_item" colspan="2"><br />'; |
foreach my $item (@usertools) { |
foreach my $item (@usertools) { |
my $checked = 'checked="checked" '; |
my $checked; |
|
unless ($context eq 'requestcourses') { |
|
$checked = 'checked="checked" '; |
|
} |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if (ref($settings->{$item}) eq 'HASH') { |
if ($settings->{$item}->{'_LC_adv'} == 0) { |
if ($settings->{$item}->{'_LC_adv'} == 0) { |
$checked = ''; |
$checked = ''; |
|
} elsif ($settings->{$item}->{'_LC_adv'} == 1) { |
|
$checked = 'checked="checked" '; |
} |
} |
} |
} |
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="tools_'.$item. |
'<input type="checkbox" name="'.$context.'_'.$item. |
'" value="_LC_adv" '.$checked.'/>'.$titles{$item}. |
'" value="_LC_adv" '.$checked.'/>'.$titles{$item}. |
'</label></span> '; |
'</label></span> '; |
} |
} |
$datatable .= '<span class="LC_nobreak">('.&mt('overrides affiliation'). |
$datatable .= '</td></tr>'; |
')</span></td></tr>'; |
|
$$rowtotal += $typecount; |
$$rowtotal += $typecount; |
return $datatable; |
return $datatable; |
} |
} |
Line 1513 sub print_directorysrch {
|
Line 1323 sub print_directorysrch {
|
$$rowtotal += 2; |
$$rowtotal += 2; |
if (ref($usertypes) eq 'HASH') { |
if (ref($usertypes) eq 'HASH') { |
if (keys(%{$usertypes}) > 0) { |
if (keys(%{$usertypes}) > 0) { |
$datatable .= &users_cansearch_row($settings,$types,$usertypes,$dom, |
$datatable .= &insttypes_row($settings,$types,$usertypes,$dom, |
$numinrow,$othertitle); |
$numinrow,$othertitle,'cansearch'); |
$cansrchrow = 1; |
$cansrchrow = 1; |
} |
} |
} |
} |
Line 1529 sub print_directorysrch {
|
Line 1339 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) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'searchby'}) eq 'ARRAY') { |
if (ref($settings->{'searchby'}) eq 'ARRAY') { |
if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) { |
if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) { |
$check = ' checked="checked" '; |
$check = ' checked="checked" '; |
Line 1571 sub print_contacts {
|
Line 1381 sub print_contacts {
|
my $datatable; |
my $datatable; |
my @contacts = ('adminemail','supportemail'); |
my @contacts = ('adminemail','supportemail'); |
my (%checked,%to,%otheremails); |
my (%checked,%to,%otheremails); |
my @mailings = ('errormail','packagesmail','helpdeskmail'); |
my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail'); |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
$otheremails{$type} = ''; |
$otheremails{$type} = ''; |
} |
} |
Line 1591 sub print_contacts {
|
Line 1401 sub print_contacts {
|
} |
} |
$otheremails{$type} = $settings->{$type}{'others'}; |
$otheremails{$type} = $settings->{$type}{'others'}; |
} |
} |
|
} elsif ($type eq 'lonstatusmail') { |
|
$checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; |
} |
} |
} |
} |
} else { |
} else { |
Line 1598 sub print_contacts {
|
Line 1410 sub print_contacts {
|
$to{'adminemail'} = $Apache::lonnet::perlvar{'lonAdmEMail'}; |
$to{'adminemail'} = $Apache::lonnet::perlvar{'lonAdmEMail'}; |
$checked{'errormail'}{'adminemail'} = ' checked="checked" '; |
$checked{'errormail'}{'adminemail'} = ' checked="checked" '; |
$checked{'packagesmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'packagesmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" '; |
$checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" '; |
|
$checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; |
} |
} |
my ($titles,$short_titles) = &contact_titles(); |
my ($titles,$short_titles) = &contact_titles(); |
my $rownum = 0; |
my $rownum = 0; |
Line 1642 sub contact_titles {
|
Line 1455 sub contact_titles {
|
'adminemail' => 'Default Server Admin E-mail address', |
'adminemail' => 'Default Server Admin E-mail address', |
'errormail' => 'Error reports to be e-mailed to', |
'errormail' => 'Error reports to be e-mailed to', |
'packagesmail' => 'Package update alerts to be e-mailed to', |
'packagesmail' => 'Package update alerts to be e-mailed to', |
'helpdeskmail' => 'Helpdesk requests to be e-mailed to' |
'helpdeskmail' => 'Helpdesk requests to be e-mailed to', |
|
'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)', |
); |
); |
my %short_titles = &Apache::lonlocal::texthash ( |
my %short_titles = &Apache::lonlocal::texthash ( |
adminemail => 'Admin E-mail address', |
adminemail => 'Admin E-mail address', |
Line 1653 sub contact_titles {
|
Line 1467 sub contact_titles {
|
|
|
sub tool_titles { |
sub tool_titles { |
my %titles = &Apache::lonlocal::texthash ( |
my %titles = &Apache::lonlocal::texthash ( |
aboutme => 'Personal Home Page', |
aboutme => 'Personal Information Page', |
blog => 'Blog', |
blog => 'Blog', |
portfolio => 'Portfolio', |
portfolio => 'Portfolio', |
); |
official => 'Official courses (with institutional codes)', |
|
unofficial => 'Unofficial courses', |
|
community => 'Communities', |
|
); |
return %titles; |
return %titles; |
} |
} |
|
|
Line 1778 sub print_usercreation {
|
Line 1595 sub print_usercreation {
|
} |
} |
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
} |
} |
|
my ($othertitle,$usertypes,$types) = |
|
&Apache::loncommon::sorted_inst_types($dom); |
|
if (ref($usertypes) eq 'HASH') { |
|
if (keys(%{$usertypes}) > 0) { |
|
$datatable .= &insttypes_row($settings->{cancreate},$types,$usertypes, |
|
$dom,$numinrow,$othertitle, |
|
'statustocreate'); |
|
$$rowtotal ++; |
|
} |
|
} |
} else { |
} else { |
my @contexts = ('author','course','domain'); |
my @contexts = ('author','course','domain'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my @authtypes = ('int','krb4','krb5','loc'); |
Line 1894 sub usercreation_types {
|
Line 1721 sub usercreation_types {
|
any => 'Any', |
any => 'Any', |
official => 'Institutional only ', |
official => 'Institutional only ', |
unofficial => 'Non-institutional only', |
unofficial => 'Non-institutional only', |
email => 'Email address', |
email => 'E-mail address', |
login => 'Institutional Login', |
login => 'Institutional Login', |
sso => 'SSO', |
sso => 'SSO', |
none => 'None', |
none => 'None', |
Line 2031 sub print_scantronformat {
|
Line 1858 sub print_scantronformat {
|
%confhash); |
%confhash); |
my $switchserver = &check_switchserver($dom,$confname); |
my $switchserver = &check_switchserver($dom,$confname); |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
default => 'Default scantron format file error', |
default => 'Default bubblesheet format file error', |
custom => 'Custom scantron format file error', |
custom => 'Custom bubblesheet format file error', |
); |
); |
my %scantronfiles = ( |
my %scantronfiles = ( |
default => 'default.tab', |
default => 'default.tab', |
Line 2105 sub print_scantronformat {
|
Line 1932 sub print_scantronformat {
|
} |
} |
} |
} |
} else { |
} else { |
$error{'default'} = &mt("Unable to copy default scantron formatfile to domain's RES space: [_1]",$switchserver); |
$error{'default'} = &mt("Unable to copy default bubblesheet formatfile to domain's RES space: [_1]",$switchserver); |
} |
} |
} |
} |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
Line 2668 sub modifiable_userdata_row {
|
Line 2495 sub modifiable_userdata_row {
|
return $output; |
return $output; |
} |
} |
|
|
sub users_cansearch_row { |
sub insttypes_row { |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle) = @_; |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle,$context) = @_; |
|
my %lt = &Apache::lonlocal::texthash ( |
|
cansearch => 'Users allowed to search', |
|
statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)', |
|
); |
|
my $showdom; |
|
if ($context eq 'cansearch') { |
|
$showdom = ' ('.$dom.')'; |
|
} |
my $output = '<tr class="LC_odd_row">'. |
my $output = '<tr class="LC_odd_row">'. |
'<td>'.&mt('Users allowed to search').' ('.$dom.')'. |
'<td>'.$lt{$context}.$showdom. |
'</td><td class="LC_left_item" colspan="2"><table>'; |
'</td><td class="LC_left_item" colspan="2"><table>'; |
my $rem; |
my $rem; |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
Line 2685 sub users_cansearch_row {
|
Line 2520 sub users_cansearch_row {
|
$output .= '<tr>'; |
$output .= '<tr>'; |
} |
} |
my $check = ' '; |
my $check = ' '; |
if (ref($settings->{'cansearch'}) eq 'ARRAY') { |
if (ref($settings->{$context}) eq 'ARRAY') { |
if (grep(/^\Q$types->[$i]\E$/,@{$settings->{'cansearch'}})) { |
if (grep(/^\Q$types->[$i]\E$/,@{$settings->{$context}})) { |
$check = ' checked="checked" '; |
$check = ' checked="checked" '; |
} |
} |
|
} elsif ($context eq 'statustocreate') { |
|
$check = ' checked="checked" '; |
} |
} |
$output .= '<td class="LC_left_item">'. |
$output .= '<td class="LC_left_item">'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="cansearch" '. |
'<input type="checkbox" name="'.$context.'" '. |
'value="'.$types->[$i].'"'.$check.'/>'. |
'value="'.$types->[$i].'"'.$check.'/>'. |
$usertypes->{$types->[$i]}.'</label></span></td>'; |
$usertypes->{$types->[$i]}.'</label></span></td>'; |
} |
} |
Line 2707 sub users_cansearch_row {
|
Line 2544 sub users_cansearch_row {
|
$output .= '<td class="LC_left_item">'; |
$output .= '<td class="LC_left_item">'; |
} |
} |
my $defcheck = ' '; |
my $defcheck = ' '; |
if (ref($settings->{'cansearch'}) eq 'ARRAY') { |
if (ref($settings->{$context}) eq 'ARRAY') { |
if (grep(/^default$/,@{$settings->{'cansearch'}})) { |
if (grep(/^default$/,@{$settings->{$context}})) { |
$defcheck = ' checked="checked" '; |
$defcheck = ' checked="checked" '; |
} |
} |
|
} elsif ($context eq 'statustocreate') { |
|
$defcheck = ' checked="checked" '; |
} |
} |
$output .= '<span class="LC_nobreak"><label>'. |
$output .= '<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="cansearch" '. |
'<input type="checkbox" name="'.$context.'" '. |
'value="default"'.$defcheck.'/>'. |
'value="default"'.$defcheck.'/>'. |
$othertitle.'</label></span></td>'. |
$othertitle.'</label></span></td>'. |
'</tr></table></td></tr>'; |
'</tr></table></td></tr>'; |
Line 2883 sub color_font_choices {
|
Line 2722 sub color_font_choices {
|
links => "Link colors", |
links => "Link colors", |
images => "Images", |
images => "Images", |
font => "Font color", |
font => "Font color", |
|
fontmenu => "Font Menu", |
pgbg => "Page", |
pgbg => "Page", |
tabbg => "Header", |
tabbg => "Header", |
sidebg => "Border", |
sidebg => "Border", |
Line 2949 sub modify_colors {
|
Line 2789 sub modify_colors {
|
@bgs = ('pgbg','tabbg','sidebg'); |
@bgs = ('pgbg','tabbg','sidebg'); |
} |
} |
$confhash->{$role}{'font'} = $env{'form.'.$role.'_font'}; |
$confhash->{$role}{'font'} = $env{'form.'.$role.'_font'}; |
|
$confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'}; |
foreach my $item (@bgs,@links,@logintext) { |
foreach my $item (@bgs,@links,@logintext) { |
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
$confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; |
} |
} |
Line 3062 sub modify_colors {
|
Line 2903 sub modify_colors {
|
$changes{$role}{'font'} = 1; |
$changes{$role}{'font'} = 1; |
} |
} |
} |
} |
|
if ($domconfig->{$role}{'fontmenu'} ne '') { |
|
if ($confhash->{$role}{'fontmenu'} ne $domconfig->{$role}{'fontmenu'}) { |
|
$changes{$role}{'fontmenu'} = 1; |
|
} |
|
} else { |
|
if ($confhash->{$role}{'fontmenu'}) { |
|
$changes{$role}{'fontmenu'} = 1; |
|
} |
|
} |
foreach my $item (@bgs) { |
foreach my $item (@bgs) { |
if ($domconfig->{$role}{$item} ne '') { |
if ($domconfig->{$role}{$item} ne '') { |
if ($confhash->{$role}{$item} ne $domconfig->{$role}{$item}) { |
if ($confhash->{$role}{$item} ne $domconfig->{$role}{$item}) { |
Line 3491 sub check_switchserver {
|
Line 3341 sub check_switchserver {
|
return $switchserver; |
return $switchserver; |
} |
} |
|
|
sub javascript_set_colnums { |
sub modify_quotas { |
return <<END; |
my ($dom,$action,%domconfig) = @_; |
function setDisplayColumns() { |
my ($context,@usertools); |
if (document.pickactions.width.value > 1100) { |
if ($action eq 'quotas') { |
document.pickactions.numcols[1].checked = true; |
$context = 'tools'; |
|
} else { |
|
$context = $action; |
|
} |
|
if ($context eq 'requestcourses') { |
|
@usertools = ('official','unofficial','community'); |
} else { |
} else { |
document.pickactions.numcols[0].checked = true; |
@usertools = ('aboutme','blog','portfolio'); |
} |
} |
} |
|
END |
|
} |
|
|
|
sub modify_quotas { |
|
my ($dom,%domconfig) = @_; |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my ($resulttext,%changes); |
my ($resulttext,%changes); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my @usertools = ('aboutme','blog','portfolio'); |
|
my %titles = &tool_titles(); |
my %titles = &tool_titles(); |
my (%confhash,%toolshash); |
my (%confhash,%toolshash); |
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
if ($key =~ /^form\.quota_(.+)$/) { |
unless ($context eq 'requestcourses') { |
$confhash{'defaultquota'}{$1} = $env{$key}; |
if ($key =~ /^form\.quota_(.+)$/) { |
} elsif ($key =~ /^form\.tools_(.+)$/) { |
$confhash{'defaultquota'}{$1} = $env{$key}; |
|
} |
|
} |
|
if ($key =~ /^form\.\Q$context\E_(.+)$/) { |
@{$toolshash{$1}} = &Apache::loncommon::get_env_multiple($key); |
@{$toolshash{$1}} = &Apache::loncommon::get_env_multiple($key); |
} |
} |
} |
} |
$confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'}; |
unless ($context eq 'requestcourses') { |
|
$confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'}; |
|
} |
foreach my $item (@usertools) { |
foreach my $item (@usertools) { |
foreach my $type (@{$types},'default','_LC_adv') { |
foreach my $type (@{$types},'default','_LC_adv') { |
if (grep(/^\Q$type\E$/,@{$toolshash{$item}})) { |
if (grep(/^\Q$type\E$/,@{$toolshash{$item}})) { |
Line 3526 sub modify_quotas {
|
Line 3379 sub modify_quotas {
|
} else { |
} else { |
$confhash{$item}{$type} = 0; |
$confhash{$item}{$type} = 0; |
} |
} |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
if (ref($domconfig{$action}) eq 'HASH') { |
if (ref($domconfig{'quotas'}{$item}) eq 'HASH') { |
if (ref($domconfig{$action}{$item}) eq 'HASH') { |
if ($domconfig{'quotas'}{$item}{$type} ne $confhash{$item}{$type}) { |
if ($domconfig{$action}{$item}{$type} ne $confhash{$item}{$type}) { |
$changes{$item}{$type} = 1; |
$changes{$item}{$type} = 1; |
} |
} |
} else { |
} else { |
if (!$confhash{$item}{$type}) { |
if ($context eq 'requestcourses') { |
$changes{$item}{$type} = 1; |
if ($confhash{$item}{$type}) { |
|
$changes{$item}{$type} = 1; |
|
} |
|
} else { |
|
if (!$confhash{$item}{$type}) { |
|
$changes{$item}{$type} = 1; |
|
} |
} |
} |
} |
} |
} else { |
} else { |
if (!$confhash{$item}{$type}) { |
if ($context eq 'requestcourses') { |
$changes{$item}{$type} = 1; |
if ($confhash{$item}{$type}) { |
|
$changes{$item}{$type} = 1; |
|
} |
|
} else { |
|
if (!$confhash{$item}{$type}) { |
|
$changes{$item}{$type} = 1; |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
unless ($context eq 'requestcourses') { |
if (ref($domconfig{'quotas'}{'defaultquota'}) eq 'HASH') { |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
foreach my $key (keys(%{$domconfig{'quotas'}{'defaultquota'}})) { |
if (ref($domconfig{'quotas'}{'defaultquota'}) eq 'HASH') { |
if (exists($confhash{'defaultquota'}{$key})) { |
foreach my $key (keys(%{$domconfig{'quotas'}{'defaultquota'}})) { |
if ($confhash{'defaultquota'}{$key} ne $domconfig{'quotas'}{'defaultquota'}{$key}) { |
if (exists($confhash{'defaultquota'}{$key})) { |
$changes{'defaultquota'}{$key} = 1; |
if ($confhash{'defaultquota'}{$key} ne $domconfig{'quotas'}{'defaultquota'}{$key}) { |
|
$changes{'defaultquota'}{$key} = 1; |
|
} |
|
} else { |
|
$confhash{'defaultquota'}{$key} = $domconfig{'quotas'}{'defaultquota'}{$key}; |
} |
} |
} else { |
|
$confhash{'defaultquota'}{$key} = $domconfig{'quotas'}{'defaultquota'}{$key}; |
|
} |
} |
} |
} else { |
} else { |
foreach my $key (keys(%{$domconfig{'quotas'}})) { |
foreach my $key (keys(%{$domconfig{'quotas'}})) { |
if (exists($confhash{'defaultquota'}{$key})) { |
if (exists($confhash{'defaultquota'}{$key})) { |
if ($confhash{'defaultquota'}{$key} ne $domconfig{'quotas'}{$key}) { |
if ($confhash{'defaultquota'}{$key} ne $domconfig{'quotas'}{$key}) { |
$changes{'defaultquota'}{$key} = 1; |
$changes{'defaultquota'}{$key} = 1; |
} |
|
} else { |
|
$confhash{'defaultquota'}{$key} = $domconfig{'quotas'}{$key}; |
} |
} |
} else { |
|
$confhash{'defaultquota'}{$key} = $domconfig{'quotas'}{$key}; |
|
} |
} |
} |
} |
} |
} |
} |
if (ref($confhash{'defaultquota'}) eq 'HASH') { |
if (ref($confhash{'defaultquota'}) eq 'HASH') { |
foreach my $key (keys(%{$confhash{'defaultquota'}})) { |
foreach my $key (keys(%{$confhash{'defaultquota'}})) { |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
if (ref($domconfig{'quotas'}{'defaultquota'}) eq 'HASH') { |
if (ref($domconfig{'quotas'}{'defaultquota'}) eq 'HASH') { |
if (!exists($domconfig{'quotas'}{'defaultquota'}{$key})) { |
if (!exists($domconfig{'quotas'}{'defaultquota'}{$key})) { |
$changes{'defaultquota'}{$key} = 1; |
$changes{'defaultquota'}{$key} = 1; |
} |
|
} else { |
|
if (!exists($domconfig{'quotas'}{$key})) { |
|
$changes{'defaultquota'}{$key} = 1; |
|
} |
} |
} |
} else { |
} else { |
if (!exists($domconfig{'quotas'}{$key})) { |
$changes{'defaultquota'}{$key} = 1; |
$changes{'defaultquota'}{$key} = 1; |
|
} |
|
} |
} |
} else { |
|
$changes{'defaultquota'}{$key} = 1; |
|
} |
} |
} |
} |
} |
} |
Line 3589 sub modify_quotas {
|
Line 3456 sub modify_quotas {
|
} |
} |
|
|
my %quotahash = ( |
my %quotahash = ( |
quotas => { %confhash } |
$action => { %confhash } |
); |
); |
my $putresult = &Apache::lonnet::put_dom('configuration',\%quotahash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%quotahash, |
$dom); |
$dom); |
Line 3599 sub modify_quotas {
|
Line 3466 sub modify_quotas {
|
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
|
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if (ref($changes{'defaultquota'}) eq 'HASH') { |
unless ($context eq 'requestcourses') { |
$resulttext .= '<li>'.&mt('Portfolio default quotas').'<ul>'; |
if (ref($changes{'defaultquota'}) eq 'HASH') { |
foreach my $type (@{$types},'default') { |
$resulttext .= '<li>'.&mt('Portfolio default quotas').'<ul>'; |
if (defined($changes{'defaultquota'}{$type})) { |
foreach my $type (@{$types},'default') { |
my $typetitle = $usertypes->{$type}; |
if (defined($changes{'defaultquota'}{$type})) { |
if ($type eq 'default') { |
my $typetitle = $usertypes->{$type}; |
$typetitle = $othertitle; |
if ($type eq 'default') { |
|
$typetitle = $othertitle; |
|
} |
|
$resulttext .= '<li>'.&mt('[_1] set to [_2] Mb',$typetitle,$confhash{'defaultquota'}{$type}).'</li>'; |
} |
} |
$resulttext .= '<li>'.&mt('[_1] set to [_2] Mb',$typetitle,$confhash{'defaultquota'}{$type}).'</li>'; |
|
} |
} |
|
$resulttext .= '</ul></li>'; |
} |
} |
$resulttext .= '</ul></li>'; |
|
} |
} |
my %newenv; |
my %newenv; |
foreach my $item (@usertools) { |
foreach my $item (@usertools) { |
if (ref($changes{$item}) eq 'HASH') { |
if (ref($changes{$item}) eq 'HASH') { |
my $newacc = |
my $newacc = |
&Apache::lonnet::usertools_access($env{'user.name'}, |
&Apache::lonnet::usertools_access($env{'user.name'}, |
$env{'user.domain'}, |
$env{'user.domain'}, |
$item,'reload'); |
$item,'reload',$context); |
if ($env{'environment.availabletools.'.$item} ne $newacc) { |
if ($context eq 'requestcourses') { |
|
if ($env{'environment.canrequest.'.$item} ne $newacc) { |
|
$newenv{'environment.canrequest.'.$item} = $newacc; |
|
} |
|
} else { |
|
if ($env{'environment.availabletools.'.$item} ne $newacc) { |
$newenv{'environment.availabletools.'.$item} = $newacc; |
$newenv{'environment.availabletools.'.$item} = $newacc; |
|
} |
} |
} |
$resulttext .= '<li>'.$titles{$item}.'<ul>'; |
$resulttext .= '<li>'.$titles{$item}.'<ul>'; |
foreach my $type (@{$types},'default','_LC_adv') { |
foreach my $type (@{$types},'default','_LC_adv') { |
Line 3646 sub modify_quotas {
|
Line 3521 sub modify_quotas {
|
&Apache::lonnet::appenv(\%newenv); |
&Apache::lonnet::appenv(\%newenv); |
} |
} |
} else { |
} else { |
$resulttext = &mt('No changes made to availability of home pages, blogs, portfolios or default quotas'); |
if ($context eq 'requestcourses') { |
|
$resulttext = &mt('No changes made to rights to request creation of courses.'); |
|
} else { |
|
$resulttext = &mt('No changes made to availability of personal information pages, blogs, portfolios or default quotas'); |
|
} |
} |
} |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
Line 4029 sub modify_contacts {
|
Line 3908 sub modify_contacts {
|
} |
} |
my (%others,%to); |
my (%others,%to); |
my @contacts = ('supportemail','adminemail'); |
my @contacts = ('supportemail','adminemail'); |
my @mailings = ('errormail','packagesmail','helpdeskmail'); |
my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail'); |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
@{$newsetting{$type}} = |
@{$newsetting{$type}} = |
&Apache::loncommon::get_env_multiple('form.'.$type); |
&Apache::loncommon::get_env_multiple('form.'.$type); |
Line 4074 sub modify_contacts {
|
Line 3953 sub modify_contacts {
|
$default{'errormail'} = 'adminemail'; |
$default{'errormail'} = 'adminemail'; |
$default{'packagesmail'} = 'adminemail'; |
$default{'packagesmail'} = 'adminemail'; |
$default{'helpdeskmail'} = 'supportemail'; |
$default{'helpdeskmail'} = 'supportemail'; |
|
$default{'lonstatusmail'} = 'adminemail'; |
foreach my $item (@contacts) { |
foreach my $item (@contacts) { |
if ($to{$item} ne $default{$item}) { |
if ($to{$item} ne $default{$item}) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
Line 4156 sub modify_usercreation {
|
Line 4036 sub modify_usercreation {
|
$cancreate{$item} = $env{'form.can_createuser_'.$item}; |
$cancreate{$item} = $env{'form.can_createuser_'.$item}; |
} |
} |
} |
} |
|
my ($othertitle,$usertypes,$types) = |
|
&Apache::loncommon::sorted_inst_types($dom); |
|
if (ref($types) eq 'ARRAY') { |
|
if (@{$types} > 0) { |
|
@{$cancreate{'statustocreate'}} = |
|
&Apache::loncommon::get_env_multiple('form.statustocreate'); |
|
} |
|
push(@contexts,'statustocreate'); |
|
} |
if (ref($curr_usercreation{'cancreate'}) eq 'HASH') { |
if (ref($curr_usercreation{'cancreate'}) eq 'HASH') { |
foreach my $item (@contexts) { |
foreach my $item (@contexts) { |
if ($item eq 'selfcreate') { |
if (($item eq 'selfcreate') || ($item eq 'statustocreate')) { |
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') { |
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') { |
foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) { |
foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) { |
if (!grep(/^$curr$/,@{$cancreate{$item}})) { |
if (!grep(/^$curr$/,@{$cancreate{$item}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
Line 4346 sub modify_usercreation {
|
Line 4235 sub modify_usercreation {
|
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
} |
} |
|
} elsif ($type eq 'statustocreate') { |
|
if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') && |
|
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) { |
|
if (@{$cancreate{'selfcreate'}} > 0) { |
|
if (@{$cancreate{'statustocreate'}} == 0) { |
|
if (!grep(/^email$/,@{$cancreate{'selfcreate'}})) { |
|
$chgtext .= &mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."); |
|
} |
|
} elsif (ref($usertypes) eq 'HASH') { |
|
if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
|
$chgtext .= &mt('creation of a new account for an institutional user is restricted to the following institutional affiliation(s):').'<ul>'; |
|
foreach my $case (@{$cancreate{$type}}) { |
|
if ($case eq 'default') { |
|
$chgtext .= '<li>'.$othertitle.'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$usertypes->{$case}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} |
|
} |
|
} |
|
} |
} else { |
} else { |
if ($cancreate{$type} eq 'none') { |
if ($cancreate{$type} eq 'none') { |
$chgtext .= &mt('creation of new users is not permitted, except by a Domain Coordinator.'); |
$chgtext .= &mt('creation of new users is not permitted, except by a Domain Coordinator.'); |
Line 4761 sub modify_coursecategories {
|
Line 4673 sub modify_coursecategories {
|
} else { |
} else { |
$changes{'togglecats'} = 1; |
$changes{'togglecats'} = 1; |
$changes{'categorize'} = 1; |
$changes{'categorize'} = 1; |
$domconfig{'coursecategories'}{'togglecats'} = $env{'form.togglecats'}; |
$domconfig{'coursecategories'} = { |
$domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; |
togglecats => $env{'form.togglecats'}, |
|
categorize => $env{'form.categorize'}, |
|
}; |
} |
} |
if (ref($cathash) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
Line 4982 sub modify_serverstatuses {
|
Line 4896 sub modify_serverstatuses {
|
foreach my $setting ('namedusers','machines') { |
foreach my $setting ('namedusers','machines') { |
my (@current,@new); |
my (@current,@new); |
if (ref($currserverstatus{$type}) eq 'HASH') { |
if (ref($currserverstatus{$type}) eq 'HASH') { |
if ($currserverstatus{$type}{$setting} ne '') { |
if ($currserverstatus{$type}{$setting} ne '') { |
@current = split(/,/,$currserverstatus{$type}{$setting}); |
@current = split(/,/,$currserverstatus{$type}{$setting}); |
} |
} |
} |
} |