version 1.29, 2007/09/19 17:36:47
|
version 1.40, 2008/01/04 17:47:51
|
Line 61 sub handler {
|
Line 61 sub handler {
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['phase']); |
['phase']); |
my $phase = "display"; |
my $phase = 'pickactions'; |
if ( exists($env{'form.phase'}) ) { |
if ( exists($env{'form.phase'}) ) { |
$phase = $env{'form.phase'}; |
$phase = $env{'form.phase'}; |
} |
} |
my %domconfig = |
my %domconfig = |
&Apache::lonnet::get_dom('configuration',['login','rolecolors', |
&Apache::lonnet::get_dom('configuration',['login','rolecolors', |
'quotas','autoenroll','autoupdate','directorysrch', |
'quotas','autoenroll','autoupdate','directorysrch', |
'usercreation','contacts'],$dom); |
'usercreation','usermodification','contacts'],$dom); |
my @prefs = ( |
my @prefs_order = ('rolecolors','login','quotas','autoenroll', |
{ text => 'Default color schemes', |
'autoupdate','directorysrch','contacts', |
help => 'Default_Color_Schemes', |
'usercreation','usermodification'); |
action => 'rolecolors', |
my %prefs = ( |
header => [{col1 => 'Student Settings', |
'rolecolors' => |
col2 => '',}, |
{ text => 'Default color schemes', |
{col1 => 'Coordinator Settings', |
help => 'Default_Color_Schemes', |
col2 => '',}, |
header => [{col1 => 'Student Settings', |
{col1 => 'Author Settings', |
col2 => '',}, |
col2 => '',}, |
{col1 => 'Coordinator Settings', |
{col1 => 'Administrator Settings', |
col2 => '',}, |
col2 => '',}], |
{col1 => 'Author Settings', |
}, |
col2 => '',}, |
{ text => 'Log-in page options', |
{col1 => 'Administrator Settings', |
help => 'Domain_Log-in_Page', |
col2 => '',}], |
action => 'login', |
}, |
header => [{col1 => 'Item', |
'login' => |
col2 => '',}], |
{ text => 'Log-in page options', |
}, |
help => 'Domain_Log-in_Page', |
{ text => 'Default quotas for user portfolios', |
header => [{col1 => 'Item', |
help => 'Default_User_Quota', |
col2 => '',}], |
action => 'quotas', |
}, |
header => [{col1 => 'User type', |
'quotas' => |
col2 => 'Default quota'}], |
{ text => 'Default quotas for user portfolios', |
}, |
help => 'Default_User_Quota', |
{ text => 'Auto-enrollment settings', |
header => [{col1 => 'User type', |
help => 'Domain_Auto_Enrollment', |
col2 => 'Default quota'}], |
action => 'autoenroll', |
}, |
header => [{col1 => 'Configuration setting', |
'autoenroll' => |
col2 => 'Value(s)'}], |
{ text => 'Auto-enrollment settings', |
}, |
help => 'Domain_Auto_Enrollment', |
{ text => 'Auto-update settings', |
header => [{col1 => 'Configuration setting', |
help => 'Domain_Auto_Update', |
col2 => 'Value(s)'}], |
action => 'autoupdate', |
}, |
header => [{col1 => 'Setting', |
'autoupdate' => |
col2 => 'Value',}, |
{ text => 'Auto-update settings', |
{col1 => 'User Population', |
help => 'Domain_Auto_Update', |
col2 => 'Updataeable user data'}], |
header => [{col1 => 'Setting', |
}, |
col2 => 'Value',}, |
{ text => 'Institutional directory searches', |
{col1 => 'User Population', |
help => 'Domain_Directory_Search', |
col2 => 'Updataeable user data'}], |
action => 'directorysrch', |
}, |
header => [{col1 => 'Setting', |
'directorysrch' => |
col2 => 'Value',}], |
{ text => 'Institutional directory searches', |
}, |
help => 'Domain_Directory_Search', |
{ text => 'Contact Information', |
header => [{col1 => 'Setting', |
help => 'Domain_Contact_Information', |
col2 => 'Value',}], |
action => 'contacts', |
}, |
header => [{col1 => 'Setting', |
'contacts' => |
col2 => 'Value',}], |
{ text => 'Contact Information', |
}, |
help => 'Domain_Contact_Information', |
|
header => [{col1 => 'Setting', |
{ text => 'User creation', |
col2 => 'Value',}], |
help => 'Domain_User_Creation', |
}, |
action => 'usercreation', |
|
header => [{col1 => 'Setting', |
'usercreation' => |
col2 => 'Value',}, |
{ text => 'User creation', |
{col1 => 'Context', |
help => 'Domain_User_Creation', |
col2 => 'Assignable Authentication Types'}], |
header => [{col1 => 'Format Rule Type', |
}, |
col2 => 'Format Rules in force'}, |
|
{col1 => 'User account creation', |
|
col2 => 'Usernames which may be created',}, |
|
{col1 => 'Context', |
|
col2 => 'Assignable Authentication Types'}], |
|
}, |
|
'usermodification' => |
|
{ text => 'User modification', |
|
help => 'Domain_User_Modification', |
|
header => [{col1 => 'Target user has role', |
|
col2 => 'User information updateable in author context'}, |
|
{col1 => 'Target user has role', |
|
col2 => 'User information updateable in course context'}], |
|
}, |
); |
); |
my @roles = ('student','coordinator','author','admin'); |
my @roles = ('student','coordinator','author','admin'); |
|
my @actions = &Apache::loncommon::get_env_multiple('form.actions'); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:changePage(document.$phase,'display')", |
({href=>"javascript:changePage(document.$phase,'pickactions')", |
text=>"Domain Configuration"}); |
text=>"Pick functionality"}); |
my $confname = $dom.'-domainconfig'; |
my $confname = $dom.'-domainconfig'; |
if ($phase eq 'process') { |
if ($phase eq 'process') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:changePage(document.$phase,'$phase')", |
({href=>"javascript:changePage(document.$phase,'display')", |
|
text=>"Domain Configuration"}, |
|
{href=>"javascript:changePage(document.$phase,'$phase')", |
text=>"Updated"}); |
text=>"Updated"}); |
&print_header($r,$phase); |
&print_header($r,$phase); |
foreach my $item (@prefs) { |
foreach my $item (@prefs_order) { |
$r->print('<h3>'.&mt($item->{'text'}).'</h3>'. |
if (grep(/^\Q$item\E$/,@actions)) { |
&process_changes($r,$dom,$confname, |
$r->print('<h3>'.&mt($prefs{$item}{'text'}).'</h3>'. |
$item->{'action'},\@roles,%domconfig)); |
&process_changes($r,$dom,$confname,$item, |
|
\@roles,%domconfig)); |
|
} |
} |
} |
$r->print('<p>'); |
$r->print('<p>'); |
&print_footer($r,$phase,'display','Back to actions menu'); |
&print_footer($r,$phase,'display','Back to configuration display', |
|
\@actions); |
$r->print('</p>'); |
$r->print('</p>'); |
|
} elsif ($phase eq 'display') { |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({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 clas="LC_error">'.&mt('No settings chosen'). |
|
'</span>'); |
|
} |
|
$r->print('</form>'); |
|
$r->print(&Apache::loncommon::end_page()); |
} else { |
} else { |
if ($phase eq '') { |
if ($phase eq '') { |
$phase = 'display'; |
$phase = 'pickactions'; |
} |
} |
my %helphash; |
my %helphash; |
my $numprefs = @prefs; |
|
&print_header($r,$phase); |
&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'); |
Line 180 sub handler {
|
Line 267 sub handler {
|
&mt("Thereafter, (with a Domain Coordinator role selected in the domain) you will be able to update settings when logged in to any server in the LON-CAPA network.").'<br />'. |
&mt("Thereafter, (with a Domain Coordinator role selected in the domain) you will be able to update settings when logged in to any server in the LON-CAPA network.").'<br />'. |
&mt("However, you will still need to switch to the domain's primary library server to upload new images or logos.").'<br /><br />'); |
&mt("However, you will still need to switch to the domain's primary library server to upload new images or logos.").'<br /><br />'); |
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)); |
} |
} |
return OK; |
return OK; |
} |
} |
} |
} |
} |
} |
$r->print('<table border="0" width="100%" cellpadding="2" cellspacing="4"><tr><td align="left" valign="top" width="45%">'); |
$r->print('<h3>'.&mt('Functionality to display/modify').'</h3>'); |
foreach my $item (@prefs) { |
$r->print('<script type="text/javascript">'."\n". |
if ($item->{'action'} eq 'login') { |
&Apache::loncommon::check_uncheck_jscript()."\n". |
$r->print('</td><td width="6%"> </td><td align="left" valign="top" width="47%">'); |
'</script>'."\n".'<p><input type="button" value="check all" '. |
} |
'onclick="javascript:checkAll(document.pickactions.actions)"'. |
&print_config_box($r,$dom,$confname,$phase,$item->{'action'}, |
' /> '. |
$item,$domconfig{$item->{'action'}}); |
'<input type="button" value="uncheck all" '. |
} |
'onclick="javascript:uncheckAll(document.pickactions.actions)"'. |
$r->print(' |
' /></p><div class="LC_left_float">'); |
</td> |
my ($numitems,$midpoint,$seconddiv,$count); |
</tr> |
$numitems = @prefs_order; |
</table>'); |
$midpoint = int($numitems/2); |
&print_footer($r,$phase,'process','Save changes'); |
if ($numitems%2) { |
|
$midpoint ++; |
|
} |
|
$count = 0; |
|
foreach my $item (@prefs_order) { |
|
$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('</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> '. |
|
'<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; |
} |
} |
Line 221 sub process_changes {
|
Line 329 sub process_changes {
|
$output = &modify_directorysrch($dom,%domconfig); |
$output = &modify_directorysrch($dom,%domconfig); |
} elsif ($action eq 'usercreation') { |
} elsif ($action eq 'usercreation') { |
$output = &modify_usercreation($dom,%domconfig); |
$output = &modify_usercreation($dom,%domconfig); |
|
} elsif ($action eq 'usermodification') { |
|
$output = &modify_usermodification($dom,%domconfig); |
} elsif ($action eq 'contacts') { |
} elsif ($action eq 'contacts') { |
$output = &modify_contacts($dom,%domconfig); |
$output = &modify_contacts($dom,%domconfig); |
} |
} |
Line 229 sub process_changes {
|
Line 339 sub process_changes {
|
|
|
sub print_config_box { |
sub print_config_box { |
my ($r,$dom,$confname,$phase,$action,$item,$settings) = @_; |
my ($r,$dom,$confname,$phase,$action,$item,$settings) = @_; |
$r->print(' |
my $rowtotal = 0; |
<table class="LC_nested_outer"> |
my $output = |
|
'<table class="LC_nested_outer"> |
<tr> |
<tr> |
<th>'.&mt($item->{text}).' </th></tr>'); |
<th align="left"><span class="LC_nobreak">'.&mt($item->{text}). |
|
' </span></th></tr>'; |
# |
# |
# FIXME - put the help link back in when the help files exist |
# FIXME - put the help link back in when the help files exist |
# <th>'.&mt($item->{text}).' '. |
# <th>'.&mt($item->{text}).' '. |
# &Apache::loncommon::help_open_topic($item->{'help'}).'</th> |
# &Apache::loncommon::help_open_topic($item->{'help'}).'</th> |
# </tr>'); |
# </tr>'); |
|
$rowtotal ++; |
if (($action eq 'autoupdate') || ($action eq 'rolecolors') || |
if (($action eq 'autoupdate') || ($action eq 'rolecolors') || |
($action eq 'usercreation')) { |
($action eq 'usercreation') || ($action eq 'usermodification')) { |
my $colspan = ($action eq 'rolecolors')?' colspan="2"':''; |
my $colspan = ($action eq 'rolecolors')?' colspan="2"':''; |
$r->print(' |
$output .= ' |
<tr> |
<tr> |
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[0]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[0]->{'col1'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[0]->{'col2'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[0]->{'col2'}.'</td> |
</tr>'); |
</tr>'; |
|
$rowtotal ++; |
if ($action eq 'autoupdate') { |
if ($action eq 'autoupdate') { |
$r->print(&print_autoupdate('top',$dom,$settings)); |
$output .= &print_autoupdate('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'usercreation') { |
} elsif ($action eq 'usercreation') { |
$r->print(&print_usercreation('top',$dom,$settings)); |
$output .= &print_usercreation('top',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'usermodification') { |
|
$output .= &print_usermodification('top',$dom,$settings,\$rowtotal); |
} else { |
} else { |
$r->print(&print_rolecolors($phase,'student',$dom,$confname,$settings)); |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
} |
} |
$r->print(' |
$output .= ' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
Line 266 sub print_config_box {
|
Line 382 sub print_config_box {
|
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[1]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[1]->{'col1'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[1]->{'col2'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[1]->{'col2'}.'</td> |
</tr>'); |
</tr>'; |
|
$rowtotal ++; |
if ($action eq 'autoupdate') { |
if ($action eq 'autoupdate') { |
$r->print(&print_autoupdate('bottom',$dom,$settings)); |
$output .= &print_autoupdate('bottom',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'usercreation') { |
} elsif ($action eq 'usercreation') { |
$r->print(&print_usercreation('bottom',$dom,$settings)); |
$output .= &print_usercreation('middle',$dom,$settings,\$rowtotal).' |
|
</table> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td> |
|
<table class="LC_nested"> |
|
<tr class="LC_info_row"> |
|
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[2]->{'col1'}.'</td> |
|
<td class="LC_right_item">'.$item->{'header'}->[2]->{'col2'}.'</td> </tr>'. |
|
&print_usercreation('bottom',$dom,$settings,\$rowtotal); |
|
$rowtotal ++; |
|
} elsif ($action eq 'usermodification') { |
|
$output .= &print_usermodification('bottom',$dom,$settings,\$rowtotal); |
} else { |
} else { |
$r->print(&print_rolecolors($phase,'coordinator',$dom,$confname,$settings).' |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
Line 283 sub print_config_box {
|
Line 413 sub print_config_box {
|
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[2]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[2]->{'col1'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[2]->{'col2'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[2]->{'col2'}.'</td> |
</tr>'. |
</tr>'. |
&print_rolecolors($phase,'author',$dom,$confname,$settings).' |
&print_rolecolors($phase,'author',$dom,$confname,$settings,\$rowtotal).' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
Line 294 sub print_config_box {
|
Line 424 sub print_config_box {
|
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[3]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[3]->{'col1'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[3]->{'col2'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[3]->{'col2'}.'</td> |
</tr>'. |
</tr>'. |
&print_rolecolors($phase,'admin',$dom,$confname,$settings)); |
&print_rolecolors($phase,'admin',$dom,$confname,$settings,\$rowtotal); |
|
$rowtotal += 2; |
} |
} |
} else { |
} else { |
$r->print(' |
$output .= ' |
<tr> |
<tr> |
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row">'); |
<tr class="LC_info_row">'; |
if (($action eq 'login') || ($action eq 'directorysrch')) { |
if (($action eq 'login') || ($action eq 'directorysrch')) { |
$r->print(' |
$output .= ' |
<td class="LC_left_item" colspan="2">'.$item->{'header'}->[0]->{'col1'}.'</td>'); |
<td class="LC_left_item" colspan="2">'.$item->{'header'}->[0]->{'col1'}.'</td>'; |
} else { |
} else { |
$r->print(' |
$output .= ' |
<td class="LC_left_item">'.$item->{'header'}->[0]->{'col1'}.'</td>'); |
<td class="LC_left_item">'.$item->{'header'}->[0]->{'col1'}.'</td>'; |
} |
} |
$r->print(' |
$output .= ' |
<td class="LC_right_item">'.$item->{'header'}->[0]->{'col2'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[0]->{'col2'}.'</td> |
</tr>'); |
</tr>'; |
|
$rowtotal ++; |
if ($action eq 'login') { |
if ($action eq 'login') { |
$r->print(&print_login($dom,$confname,$phase,$settings)); |
$output .= &print_login($dom,$confname,$phase,$settings,\$rowtotal); |
} elsif ($action eq 'quotas') { |
} elsif ($action eq 'quotas') { |
$r->print(&print_quotas($dom,$settings)); |
$output .= &print_quotas($dom,$settings,\$rowtotal); |
} elsif ($action eq 'autoenroll') { |
} elsif ($action eq 'autoenroll') { |
$r->print(&print_autoenroll($dom,$settings)); |
$output .= &print_autoenroll($dom,$settings,\$rowtotal); |
} elsif ($action eq 'directorysrch') { |
} elsif ($action eq 'directorysrch') { |
$r->print(&print_directorysrch($dom,$settings)); |
$output .= &print_directorysrch($dom,$settings,\$rowtotal); |
} elsif ($action eq 'contacts') { |
} elsif ($action eq 'contacts') { |
$r->print(&print_contacts($dom,$settings)); |
$output .= &print_contacts($dom,$settings,\$rowtotal); |
} |
} |
} |
} |
$r->print(' |
$output .= ' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
</table><br />'); |
</table><br />'; |
return; |
return ($output,$rowtotal); |
} |
} |
|
|
sub print_header { |
sub print_header { |
my ($r,$phase) = @_; |
my ($r,$phase) = @_; |
|
my $alert = &mt('You must select at least one functionality type to display.'); |
my $js = ' |
my $js = ' |
<script type="text/javascript"> |
<script type="text/javascript"> |
function changePage(formname,newphase) { |
function changePage(formname,newphase) { |
formname.phase.value = 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(); |
formname.submit(); |
} |
}'."\n"; |
'. |
if ($phase eq 'pickactions') { |
&color_pick_js().' |
$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> |
</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', |
$r->print(&Apache::loncommon::start_page('View/Modify Domain Settings', |
$js)); |
$js,$additem)); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Domain Settings')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Domain Settings')); |
$r->print(' |
$r->print(' |
<form name="parmform" action=""> |
<form name="parmform" action=""> |
Line 360 function changePage(formname,newphase) {
|
Line 531 function changePage(formname,newphase) {
|
} |
} |
|
|
sub print_footer { |
sub print_footer { |
my ($r,$phase,$newphase,$button_text) = @_; |
my ($r,$phase,$newphase,$button_text,$actions) = @_; |
$button_text = &mt($button_text); |
$button_text = &mt($button_text); |
$r->print('<input type="hidden" name="phase" value="" />'); |
$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'".')"'; |
my $dest='"javascript:changePage(document.'.$phase.','."'$newphase'".')"'; |
if ($phase eq 'process') { |
if ($phase eq 'process') { |
$r->print('<a href='.$dest.'>'.$button_text.'</a>'); |
$r->print('<p><a href='.$dest.'>'.$button_text.'</a></p>'); |
} else { |
} else { |
$r->print('<input type="button" name="store" value="'. |
my $onclick; |
$button_text.'" onclick='.$dest.' />'); |
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()); |
} |
} |
$r->print('</form>'); |
|
$r->print('<br />'.&Apache::loncommon::end_page()); |
|
return; |
return; |
} |
} |
|
|
sub print_login { |
sub print_login { |
my ($dom,$confname,$phase,$settings) = @_; |
my ($dom,$confname,$phase,$settings,$rowtotal) = @_; |
my %choices = &login_choices(); |
my %choices = &login_choices(); |
my ($catalogon,$catalogoff,$adminmailon,$adminmailoff); |
my ($catalogon,$catalogoff,$adminmailon,$adminmailoff); |
$catalogon = ' checked="checked" '; |
$catalogon = ' checked="checked" '; |
Line 477 sub print_login {
|
Line 667 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); |
$datatable .= &display_color_options($dom,$confname,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal); |
$datatable .= '</tr></table></td></tr>'; |
$datatable .= '</tr></table></td></tr>'; |
return $datatable; |
return $datatable; |
} |
} |
Line 504 sub login_choices {
|
Line 694 sub login_choices {
|
} |
} |
|
|
sub print_rolecolors { |
sub print_rolecolors { |
my ($phase,$role,$dom,$confname,$settings) = @_; |
my ($phase,$role,$dom,$confname,$settings,$rowtotal) = @_; |
my %choices = &color_font_choices(); |
my %choices = &color_font_choices(); |
my @bgs = ('pgbg','tabbg','sidebg'); |
my @bgs = ('pgbg','tabbg','sidebg'); |
my @links = ('link','alink','vlink'); |
my @links = ('link','alink','vlink'); |
Line 570 sub print_rolecolors {
|
Line 760 sub print_rolecolors {
|
} |
} |
} |
} |
my $itemcount = 1; |
my $itemcount = 1; |
my $datatable = &display_color_options($dom,$confname,$phase,$role,$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text); |
my $datatable = &display_color_options($dom,$confname,$phase,$role,$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal); |
$datatable .= '</tr></table></td></tr>'; |
$datatable .= '</tr></table></td></tr>'; |
return $datatable; |
return $datatable; |
} |
} |
|
|
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) = @_; |
$images,$bgs,$links,$alt_text,$rowtotal) = @_; |
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>'; |
if (!$is_custom->{'font'}) { |
if (!$is_custom->{'font'}) { |
$datatable .= '<td>'.&mt('Default in use:').' '.$defaults->{'font'}.'</td>'; |
$datatable .= '<td>'.&mt('Default in use:').' <span id="css_default_'.$role.'_font" style="color: '.$defaults->{'font'}.';">'.$defaults->{'font'}.'</span></td>'; |
} else { |
} else { |
$datatable .= '<td> </td>'; |
$datatable .= '<td> </td>'; |
} |
} |
Line 590 sub display_color_options {
|
Line 780 sub display_color_options {
|
$datatable .= '<td><span class="LC_nobreak">'. |
$datatable .= '<td><span class="LC_nobreak">'. |
'<input type="text" size="10" name="'.$role.'_font"'. |
'<input type="text" size="10" name="'.$role.'_font"'. |
' value="'.$designs->{'font'}.'" /> '.$fontlink. |
' value="'.$designs->{'font'}.'" /> '.$fontlink. |
|
' <span id="css_'.$role.'_font" style="background-color: '. |
|
$designs->{'font'}.';"> </span>'. |
'</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}) { |
Line 644 sub display_color_options {
|
Line 836 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/}) { |
|
my $local_showfile = |
|
&Apache::lonnet::filelocation('',$showfile); |
|
&Apache::lonnet::repcopy($local_showfile); |
|
} |
|
$showfile = &Apache::loncommon::lonhttpdurl($showfile); |
|
} |
|
if ($imgfile) { |
|
if ($imgfile =~ m{^/(adm|res)/}) { |
|
if ($imgfile =~ m{^/res/}) { |
|
my $local_imgfile = |
|
&Apache::lonnet::filelocation('',$imgfile); |
|
&Apache::lonnet::repcopy($local_imgfile); |
|
} |
|
$fullsize = &Apache::loncommon::lonhttpdurl($imgfile); |
|
} else { |
|
$fullsize = $imgfile; |
|
} |
|
} |
$datatable.= '<td>'; |
$datatable.= '<td>'; |
if (!$is_custom->{$img}) { |
if (!$is_custom->{$img}) { |
$datatable .= &mt('Default in use:').'<br />'; |
$datatable .= &mt('Default in use:').'<br />'; |
Line 685 sub display_color_options {
|
Line 895 sub display_color_options {
|
my $bgs_def; |
my $bgs_def; |
foreach my $item (@{$bgs}) { |
foreach my $item (@{$bgs}) { |
if (!$is_custom->{$item}) { |
if (!$is_custom->{$item}) { |
$bgs_def .= '<td>'.$choices->{$item}.'<br />'.$defaults->{'bgs'}{$item}.'</td>'; |
$bgs_def .= '<td>'.$choices->{$item}.' <span id="css_default_'.$role.'_'.$item.'" style="background-color: '.$defaults->{'bgs'}{$item}.';"> </span><br />'.$defaults->{'bgs'}{$item}.'</td>'; |
} |
} |
} |
} |
if ($bgs_def) { |
if ($bgs_def) { |
Line 699 sub display_color_options {
|
Line 909 sub display_color_options {
|
my $link = &color_pick($phase,$role,$item,$choices->{$item},$designs->{'bgs'}{$item}); |
my $link = &color_pick($phase,$role,$item,$choices->{$item},$designs->{'bgs'}{$item}); |
$datatable .= '<td align="center">'.$link; |
$datatable .= '<td align="center">'.$link; |
if ($designs->{'bgs'}{$item}) { |
if ($designs->{'bgs'}{$item}) { |
$datatable .= '<span style="background-color:'.$designs->{'bgs'}{$item}.'width: 10px"> </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}. |
'" /></td>'; |
'" onblur = "javascript:document.display.css_'.$role.'_'.$item.'.style.background-color = document.display.'.$role.'_'.$item.'.value;"/></td>'; |
} |
} |
$datatable .= '</tr></table></td></tr>'; |
$datatable .= '</tr></table></td></tr>'; |
$itemcount ++; |
$itemcount ++; |
Line 712 sub display_color_options {
|
Line 922 sub display_color_options {
|
my $links_def; |
my $links_def; |
foreach my $item (@{$links}) { |
foreach my $item (@{$links}) { |
if (!$is_custom->{$item}) { |
if (!$is_custom->{$item}) { |
$links_def .= '<td>'.$choices->{$item}.'<br />'.$defaults->{'links'}{$item}.'</td>'; |
$links_def .= '<td>'.$choices->{$item}.'<br /><span id="css_default_'.$role.'_'.$item.'" style="color: '.$defaults->{'links'}{$item}.';">'.$defaults->{'links'}{$item}.'</span></td>'; |
} |
} |
} |
} |
if ($links_def) { |
if ($links_def) { |
Line 723 sub display_color_options {
|
Line 933 sub display_color_options {
|
$datatable .= '<td class="LC_right_item">'. |
$datatable .= '<td class="LC_right_item">'. |
'<table border="0"><tr>'; |
'<table border="0"><tr>'; |
foreach my $item (@{$links}) { |
foreach my $item (@{$links}) { |
$datatable .= '<td align="center">'; |
$datatable .= '<td align="center">'."\n". |
my $link = &color_pick($phase,$role,$item,$choices->{$item},$designs->{'links'}{$item}); |
&color_pick($phase,$role,$item,$choices->{$item}, |
|
$designs->{'links'}{$item}); |
if ($designs->{'links'}{$item}) { |
if ($designs->{'links'}{$item}) { |
$datatable.='<span style="color: '.$designs->{'links'}{$item}.';">'. |
$datatable.=' <span id="css_'.$role.'_'.$item.'" style="background-color: '.$designs->{'links'}{$item}.';"> </span>'; |
$link.'</span>'; |
|
} else { |
|
$datatable .= $link; |
|
} |
} |
$datatable .= '<br /><input type="text" size="8" name="'.$role.'_'.$item.'" value="'.$designs->{'links'}{$item}. |
$datatable .= '<br /><input type="text" size="8" name="'.$role.'_'.$item.'" value="'.$designs->{'links'}{$item}. |
'" /></td>'; |
'" /></td>'; |
} |
} |
|
$$rowtotal += $itemcount; |
return $datatable; |
return $datatable; |
} |
} |
|
|
Line 773 ENDCOL
|
Line 982 ENDCOL
|
} |
} |
|
|
sub print_quotas { |
sub print_quotas { |
my ($dom,$settings) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $datatable; |
my $datatable; |
my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); |
my $typecount = 0; |
my $typecount = 0; |
Line 805 sub print_quotas {
|
Line 1014 sub print_quotas {
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<input type="text" name="defaultquota" value="'. |
'<input type="text" name="defaultquota" value="'. |
$defaultquota.'" size="5" /> Mb</span></td></tr>'; |
$defaultquota.'" size="5" /> Mb</span></td></tr>'; |
|
$$rowtotal += $typecount; |
return $datatable; |
return $datatable; |
} |
} |
|
|
sub print_autoenroll { |
sub print_autoenroll { |
my ($dom,$settings) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my ($defdom,$runon,$runoff); |
my ($defdom,$runon,$runoff); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
Line 843 sub print_autoenroll {
|
Line 1053 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 855 sub print_autoenroll {
|
Line 1069 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; |
return $datatable; |
return $datatable; |
} |
} |
|
|
sub print_autoupdate { |
sub print_autoupdate { |
my ($position,$dom,$settings) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my $datatable; |
my $datatable; |
if ($position eq 'top') { |
if ($position eq 'top') { |
my $updateon = ' '; |
my $updateon = ' '; |
Line 898 sub print_autoupdate {
|
Line 1112 sub print_autoupdate {
|
'<label><input type="radio" name="classlists"'. |
'<label><input type="radio" name="classlists"'. |
$classlistsoff.'value="0" />'.&mt('No').'</label></span></td>'. |
$classlistsoff.'value="0" />'.&mt('No').'</label></span></td>'. |
'</tr>'; |
'</tr>'; |
|
$$rowtotal += 2; |
} else { |
} else { |
my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); |
my @fields = ('lastname','firstname','middlename','gen', |
my @fields = ('lastname','firstname','middlename','gen', |
'permanentemail','id'); |
'permanentemail','id'); |
my %fieldtitles = &Apache::lonlocal::texthash ( |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
id => 'Student/Employee ID', |
|
permanentemail => 'E-mail address', |
|
lastname => 'Last Name', |
|
firstname => 'First Name', |
|
middlename => 'Middle Name', |
|
gen => 'Generation', |
|
); |
|
my $numrows = 0; |
my $numrows = 0; |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
if (@{$types} > 0) { |
if (@{$types} > 0) { |
$datatable = |
$datatable = |
&usertype_update_row($settings,$usertypes,\%fieldtitles, |
&usertype_update_row($settings,$usertypes,\%fieldtitles, |
\@fields,$types,\$numrows); |
\@fields,$types,\$numrows); |
|
$$rowtotal += @{$types}; |
} |
} |
} |
} |
$datatable .= |
$datatable .= |
&usertype_update_row($settings,{'default' => $othertitle}, |
&usertype_update_row($settings,{'default' => $othertitle}, |
\%fieldtitles,\@fields,['default'], |
\%fieldtitles,\@fields,['default'], |
\$numrows); |
\$numrows); |
|
$$rowtotal ++; |
} |
} |
return $datatable; |
return $datatable; |
} |
} |
|
|
sub print_directorysrch { |
sub print_directorysrch { |
my ($dom,$settings) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $srchon = ' '; |
my $srchon = ' '; |
my $srchoff = ' checked="checked" '; |
my $srchoff = ' checked="checked" '; |
my ($exacton,$containson,$beginson); |
my ($exacton,$containson,$beginson); |
Line 969 sub print_directorysrch {
|
Line 1179 sub print_directorysrch {
|
my $numinrow = 4; |
my $numinrow = 4; |
my $cansrchrow = 0; |
my $cansrchrow = 0; |
my $datatable='<tr class="LC_odd_row">'. |
my $datatable='<tr class="LC_odd_row">'. |
'<td colspan="2">'.&mt('Directory search available?').'</td>'. |
'<td colspan="2"><span class ="LC_nobreak">'.&mt('Directory search available?').'</span></td>'. |
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
'<input type="radio" name="dirsrch_available"'. |
'<input type="radio" name="dirsrch_available"'. |
$srchon.' value="1" />'.&mt('Yes').'</label> '. |
$srchon.' value="1" />'.&mt('Yes').'</label> '. |
'<label><input type="radio" name="dirsrch_available"'. |
'<label><input type="radio" name="dirsrch_available"'. |
$srchoff.' value="0" />'.&mt('No').'</label></span></td>'. |
$srchoff.' value="0" />'.&mt('No').'</label></span></td>'. |
'</tr><tr>'. |
'</tr><tr>'. |
'<td colspan="2">'.&mt('Other domains can search?').'</td>'. |
'<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search?').'</span></td>'. |
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
'<input type="radio" name="dirsrch_localonly"'. |
'<input type="radio" name="dirsrch_localonly"'. |
$localoff.' value="0" />'.&mt('Yes').'</label> '. |
$localoff.' value="0" />'.&mt('Yes').'</label> '. |
'<label><input type="radio" name="dirsrch_localonly"'. |
'<label><input type="radio" name="dirsrch_localonly"'. |
$localon.' value="1" />'.&mt('No').'</label></span></td>'. |
$localon.' value="1" />'.&mt('No').'</label></span></td>'. |
'</tr>'; |
'</tr>'; |
|
$$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 .= &users_cansearch_row($settings,$types,$usertypes,$dom, |
Line 991 sub print_directorysrch {
|
Line 1202 sub print_directorysrch {
|
} |
} |
} |
} |
if ($cansrchrow) { |
if ($cansrchrow) { |
|
$$rowtotal ++; |
$datatable .= '<tr>'; |
$datatable .= '<tr>'; |
} else { |
} else { |
$datatable .= '<tr class="LC_odd_row">'; |
$datatable .= '<tr class="LC_odd_row">'; |
} |
} |
$datatable .= '<td>'.&mt('Supported search methods'). |
$datatable .= '<td><span class ="LC_nobreak">'.&mt('Supported search methods'). |
'</td><td class="LC_left_item" colspan="2"><table><tr>'; |
'</span></td><td class="LC_left_item" colspan="2"><table><tr>'; |
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 1013 sub print_directorysrch {
|
Line 1227 sub print_directorysrch {
|
} |
} |
} |
} |
$datatable .= '</tr></table></td></tr>'; |
$datatable .= '</tr></table></td></tr>'; |
|
$$rowtotal ++; |
if ($cansrchrow) { |
if ($cansrchrow) { |
$datatable .= '<tr class="LC_odd_row">'; |
$datatable .= '<tr class="LC_odd_row">'; |
} else { |
} else { |
$datatable .= '<tr>'; |
$datatable .= '<tr>'; |
} |
} |
$datatable .= '<td>'.&mt('Search latitude').'</td>'. |
$datatable .= '<td><span class ="LC_nobreak">'.&mt('Search latitude').'</span></td>'. |
'<td class="LC_left_item" colspan="2">'. |
'<td class="LC_left_item" colspan="2">'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="searchtypes" '. |
'<input type="checkbox" name="searchtypes" '. |
Line 1030 sub print_directorysrch {
|
Line 1245 sub print_directorysrch {
|
'<label><input type="checkbox" name="searchtypes" '. |
'<label><input type="checkbox" name="searchtypes" '. |
$containson.' value="contains" />'.&mt('Contains'). |
$containson.' value="contains" />'.&mt('Contains'). |
'</label></span></td></tr>'; |
'</label></span></td></tr>'; |
|
$$rowtotal ++; |
return $datatable; |
return $datatable; |
} |
} |
|
|
sub print_contacts { |
sub print_contacts { |
my ($dom,$settings) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $datatable; |
my $datatable; |
my @contacts = ('adminemail','supportemail'); |
my @contacts = ('adminemail','supportemail'); |
my (%checked,%to,%otheremails); |
my (%checked,%to,%otheremails); |
Line 1076 sub print_contacts {
|
Line 1292 sub print_contacts {
|
} else { |
} else { |
$css_class = ' class="LC_odd_row" '; |
$css_class = ' class="LC_odd_row" '; |
} |
} |
$datatable .= '<tr'.$css_class.' ">'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td>'.$titles->{$item}.'</td>'. |
'<td><span class="LC_nobreak">'.$titles->{$item}. |
'<td class="LC_right_item">'. |
'</span></td><td class="LC_right_item">'. |
'<input type="text" name="'.$item.'" value="'. |
'<input type="text" name="'.$item.'" value="'. |
$to{$item}.'" /></td></tr>'; |
$to{$item}.'" /></td></tr>'; |
$rownum ++; |
$rownum ++; |
Line 1090 sub print_contacts {
|
Line 1306 sub print_contacts {
|
$css_class = ' class="LC_odd_row" '; |
$css_class = ' class="LC_odd_row" '; |
} |
} |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td>'.$titles->{$type}.': </td>'. |
'<td><span class="LC_nobreak">'. |
|
$titles->{$type}.': </span></td>'. |
'<td class="LC_left_item">'. |
'<td class="LC_left_item">'. |
'<span class="LC_nobreak">'; |
'<span class="LC_nobreak">'; |
foreach my $item (@contacts) { |
foreach my $item (@contacts) { |
Line 1106 sub print_contacts {
|
Line 1323 sub print_contacts {
|
'</td></tr>'."\n"; |
'</td></tr>'."\n"; |
$rownum ++; |
$rownum ++; |
} |
} |
|
$$rowtotal += $rownum; |
return $datatable; |
return $datatable; |
} |
} |
|
|
Line 1125 sub contact_titles {
|
Line 1343 sub contact_titles {
|
} |
} |
|
|
sub print_usercreation { |
sub print_usercreation { |
my ($position,$dom,$settings) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my $numinrow = 4; |
my $numinrow = 4; |
my $rowcount = 0; |
|
my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($dom); |
|
my $datatable; |
my $datatable; |
my %lt = &Apache::lonlocal::texthash ( |
|
nondc => 'User creation other than by Domain Coordinator: ', |
|
author => 'When adding a co-author/assistant author', |
|
course => 'When adding users to a course', |
|
); |
|
if ($position eq 'top') { |
if ($position eq 'top') { |
|
$$rowtotal ++; |
|
my $rowcount = 0; |
|
my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($dom,'username'); |
|
if (ref($rules) eq 'HASH') { |
|
if (keys(%{$rules}) > 0) { |
|
$datatable .= &user_formats_row('username',$settings,$rules, |
|
$ruleorder,$numinrow,$rowcount); |
|
$$rowtotal ++; |
|
$rowcount ++; |
|
} |
|
} |
|
my ($idrules,$idruleorder) = &Apache::lonnet::inst_userrules($dom,'id'); |
|
if (ref($idrules) eq 'HASH') { |
|
if (keys(%{$idrules}) > 0) { |
|
$datatable .= &user_formats_row('id',$settings,$idrules, |
|
$idruleorder,$numinrow,$rowcount); |
|
$$rowtotal ++; |
|
$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') { |
|
my @creators = ('author','course'); |
|
my ($rules,$ruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'username'); |
|
my %lt = &usercreation_types(); |
my %checked; |
my %checked; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'cancreate'}) eq 'ARRAY') { |
if (ref($settings->{'cancreate'}) eq 'HASH') { |
foreach my $item (@{$settings->{'cancreate'}}) { |
foreach my $item (@creators) { |
$checked{$item} = ' checked="checked" '; |
$checked{$item} = $settings->{'cancreate'}{$item}; |
|
} |
|
} elsif (ref($settings->{'cancreate'}) eq 'ARRAY') { |
|
foreach my $item (@creators) { |
|
if (grep(/^\Q$item\E$/,@{$settings->{'cancreate'}})) { |
|
$checked{$item} = 'none'; |
|
} |
} |
} |
} |
} |
} |
} |
$datatable = '<tr class="LC_odd_row">'. |
my $rownum = 0; |
'<td>'.$lt{'nondc'}.'</td>'. |
foreach my $item (@creators) { |
'<td class="LC_left_item"><table>'; |
$rownum ++; |
foreach my $item ('author','course') { |
if ($checked{$item} eq '') { |
$datatable .= '<tr><td><span class="LC_nobreak"><label>'. |
$checked{$item} = 'any'; |
'<input type="checkbox" name="can_createuser" '. |
} |
$checked{$item}.' value="'.$item.'" />'. |
my $css_class; |
$lt{$item}.'</label><span></td></tr>'; |
if ($rownum%2) { |
} |
$css_class = ''; |
$datatable .= '</table></td></tr>'; |
} else { |
$rowcount ++; |
$css_class = ' class="LC_odd_row" '; |
if (ref($rules) eq 'HASH') { |
} |
if (keys(%{$rules}) > 0) { |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= &username_formats_row($settings,$rules, |
'<td><span class="LC_nobreak">'.$lt{$item}. |
$ruleorder,$numinrow); |
'</span></td><td align="right">'; |
$rowcount ++; |
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 = ' '; |
|
if ($checked{$item} eq $option) { |
|
$check = ' checked="checked" '; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="can_createuser_'. |
|
$item.'" value="'.$option.'"'.$check.'/> '. |
|
$lt{$option}.'</label> </span>'; |
|
} |
|
$datatable .= '</td></tr>'; |
} |
} |
} else { |
} else { |
my @contexts = ('author','course','domain'); |
my @contexts = ('author','course','domain'); |
Line 1178 sub print_usercreation {
|
Line 1441 sub print_usercreation {
|
} |
} |
} |
} |
} |
} |
|
} else { |
|
foreach my $item (@contexts) { |
|
foreach my $auth (@authtypes) { |
|
$checked{$item}{$auth} = ' checked="checked" '; |
|
} |
|
} |
} |
} |
my @authtypes = ('int','krb4','krb5','loc'); |
|
my %title = &context_names(); |
my %title = &context_names(); |
my %authname = &authtype_names(); |
my %authname = &authtype_names(); |
my $rownum = 0; |
my $rownum = 0; |
Line 1190 sub print_usercreation {
|
Line 1458 sub print_usercreation {
|
} else { |
} else { |
$css_class = ' class="LC_odd_row" '; |
$css_class = ' class="LC_odd_row" '; |
} |
} |
$datatable .= '<tr'.$css_class.'">'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td>'.$title{$item}. |
'<td>'.$title{$item}. |
'</td><td class="LC_left_item">'. |
'</td><td class="LC_left_item">'. |
'<span class="LC_nobreak">'; |
'<span class="LC_nobreak">'; |
Line 1203 sub print_usercreation {
|
Line 1471 sub print_usercreation {
|
$datatable .= '</span></td></tr>'; |
$datatable .= '</span></td></tr>'; |
$rownum ++; |
$rownum ++; |
} |
} |
|
$$rowtotal += $rownum; |
} |
} |
return $datatable; |
return $datatable; |
} |
} |
|
|
sub username_formats_row { |
sub user_formats_row { |
my ($settings,$rules,$ruleorder,$numinrow) = @_; |
my ($type,$settings,$rules,$ruleorder,$numinrow,$rowcount) = @_; |
my $output = '<tr>'. |
my $output; |
'<td>'.&mt('Format rules to check for new usernames: '). |
my %text = ( |
'</td><td class="LC_left_item" colspan="2"><table>'; |
'username' => 'new usernames', |
|
'id' => 'IDs', |
|
); |
|
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
|
$output = '<tr '.$css_class.'>'. |
|
'<td><span class="LC_nobreak">'. |
|
&mt("Format rules to check for $text{$type}: "). |
|
'</span></td>'. |
|
'<td class="LC_left_item" colspan="2"><table>'; |
my $rem; |
my $rem; |
if (ref($ruleorder) eq 'ARRAY') { |
if (ref($ruleorder) eq 'ARRAY') { |
for (my $i=0; $i<@{$ruleorder}; $i++) { |
for (my $i=0; $i<@{$ruleorder}; $i++) { |
Line 1224 sub username_formats_row {
|
Line 1501 sub username_formats_row {
|
$output .= '<tr>'; |
$output .= '<tr>'; |
} |
} |
my $check = ' '; |
my $check = ' '; |
if (ref($settings->{'username_rule'}) eq 'ARRAY') { |
if (ref($settings) eq 'HASH') { |
if (grep(/^\Q$ruleorder->[$i]\E$/,@{$settings->{'username_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">'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="username_rule" '. |
'<input type="checkbox" name="'.$type.'_rule" '. |
'value="'.$ruleorder->[$i].'"'.$check.'/>'. |
'value="'.$ruleorder->[$i].'"'.$check.'/>'. |
$rules->{$ruleorder->[$i]}{'name'}.'</label></span></td>'; |
$rules->{$ruleorder->[$i]}{'name'}.'</label></span></td>'; |
} |
} |
Line 1249 sub username_formats_row {
|
Line 1528 sub username_formats_row {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub usercreation_types { |
|
my %lt = &Apache::lonlocal::texthash ( |
|
author => 'When adding a co-author', |
|
course => 'When adding a user to a course', |
|
any => 'Any', |
|
official => 'Institutional only ', |
|
unofficial => 'Non-institutional only', |
|
none => 'None', |
|
); |
|
return %lt; |
|
} |
|
|
sub authtype_names { |
sub authtype_names { |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
int => 'Internal', |
int => 'Internal', |
Line 1268 sub context_names {
|
Line 1559 sub context_names {
|
return %context_title; |
return %context_title; |
} |
} |
|
|
|
sub print_usermodification { |
|
my ($position,$dom,$settings,$rowtotal) = @_; |
|
my $numinrow = 4; |
|
my ($context,$datatable,$rowcount); |
|
if ($position eq 'top') { |
|
$rowcount = 0; |
|
$context = 'author'; |
|
foreach my $role ('ca','aa') { |
|
$datatable .= &modifiable_userdata_row($context,$role,$settings, |
|
$numinrow,$rowcount); |
|
$$rowtotal ++; |
|
$rowcount ++; |
|
} |
|
} else { |
|
$context = 'course'; |
|
$rowcount = 0; |
|
foreach my $role ('st','ep','ta','in','cr') { |
|
$datatable .= &modifiable_userdata_row($context,$role,$settings, |
|
$numinrow,$rowcount); |
|
$$rowtotal ++; |
|
$rowcount ++; |
|
} |
|
} |
|
return $datatable; |
|
} |
|
|
|
sub modifiable_userdata_row { |
|
my ($context,$role,$settings,$numinrow,$rowcount) = @_; |
|
my $rolename; |
|
if ($role eq 'cr') { |
|
$rolename = &mt('Custom role'); |
|
} else { |
|
$rolename = &Apache::lonnet::plaintext($role); |
|
} |
|
my @fields = ('lastname','firstname','middlename','generation', |
|
'permanentemail','id'); |
|
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
|
my $output; |
|
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
|
$output = '<tr '.$css_class.'>'. |
|
'<td><span class="LC_nobreak">'.$rolename.'</span></td>'. |
|
'<td class="LC_left_item" colspan="2"><table>'; |
|
my $rem; |
|
my %checks; |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{$context}) eq 'HASH') { |
|
if (ref($settings->{$context}->{$role}) eq 'HASH') { |
|
foreach my $field (@fields) { |
|
if ($settings->{$context}->{$role}->{$field}) { |
|
$checks{$field} = ' checked="checked" '; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
for (my $i=0; $i<@fields; $i++) { |
|
my $rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$output .= '</tr>'; |
|
} |
|
$output .= '<tr>'; |
|
} |
|
my $check = ' '; |
|
if (exists($checks{$fields[$i]})) { |
|
$check = $checks{$fields[$i]} |
|
} else { |
|
if ($role eq 'st') { |
|
if (ref($settings) ne 'HASH') { |
|
$check = ' checked="checked" '; |
|
} |
|
} |
|
} |
|
$output .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="canmodify_'.$role.'" '. |
|
'value="'.$fields[$i].'"'.$check.'/>'.$fieldtitles{$fields[$i]}. |
|
'</label></span></td>'; |
|
$rem = @fields%($numinrow); |
|
} |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$output .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$output .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$output .= '</tr></table></td></tr>'; |
|
return $output; |
|
} |
|
|
sub users_cansearch_row { |
sub users_cansearch_row { |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle) = @_; |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle) = @_; |
Line 1379 sub usertype_update_row {
|
Line 1760 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 1539 sub modify_colors {
|
Line 1922 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 2009 sub check_switchserver {
|
Line 2395 sub check_switchserver {
|
return $switchserver; |
return $switchserver; |
} |
} |
|
|
|
sub javascript_set_colnums { |
|
return <<END; |
|
function setDisplayColumns() { |
|
if (document.pickactions.width.value > 1100) { |
|
document.pickactions.numcols[1].checked = true; |
|
} else { |
|
document.pickactions.numcols[0].checked = true; |
|
} |
|
} |
|
END |
|
} |
|
|
sub modify_quotas { |
sub modify_quotas { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,%changes); |
my ($resulttext,%changes); |
Line 2530 sub modify_contacts {
|
Line 2928 sub modify_contacts {
|
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = &mt('No changes made to contact information.'); |
$resulttext = &mt('No changes made to contact information'); |
} |
} |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
Line 2541 sub modify_contacts {
|
Line 2939 sub modify_contacts {
|
|
|
sub modify_usercreation { |
sub modify_usercreation { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,%curr_usercreation,%changes,%authallowed); |
my ($resulttext,%curr_usercreation,%changes,%authallowed,%cancreate); |
if (ref($domconfig{'usercreation'}) eq 'HASH') { |
if (ref($domconfig{'usercreation'}) eq 'HASH') { |
foreach my $key (keys(%{$domconfig{'usercreation'}})) { |
foreach my $key (keys(%{$domconfig{'usercreation'}})) { |
$curr_usercreation{$key} = $domconfig{'usercreation'}{$key}; |
$curr_usercreation{$key} = $domconfig{'usercreation'}{$key}; |
Line 2552 sub modify_usercreation {
|
Line 2950 sub modify_usercreation {
|
course => 'adding users to a course', |
course => 'adding users to a course', |
); |
); |
my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule'); |
my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule'); |
my @cancreate = &Apache::loncommon::get_env_multiple('form.can_createuser'); |
my @id_rule = &Apache::loncommon::get_env_multiple('form.id_rule'); |
if (ref($curr_usercreation{'cancreate'}) eq 'ARRAY') { |
my @contexts = ('author','course'); |
foreach my $type (@{$curr_usercreation{'cancreate'}}) { |
foreach my $item(@contexts) { |
if (!grep(/^\Q$type\E$/,@cancreate)) { |
$cancreate{$item} = $env{'form.can_createuser_'.$item}; |
push(@{$changes{'cancreate'}},$type); |
} |
} |
if (ref($curr_usercreation{'cancreate'}) eq 'HASH') { |
|
foreach my $item (@contexts) { |
|
if ($curr_usercreation{'cancreate'}{$item} ne $cancreate{$item}) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
} |
} |
foreach my $type (@cancreate) { |
} elsif (ref($curr_usercreation{'cancreate'}) eq 'ARRAY') { |
if (!grep(/^\Q$type\E$/,@{$curr_usercreation{'cancreate'}})) { |
foreach my $item (@contexts) { |
push(@{$changes{'cancreate'}},$type); |
if (grep(/^\Q$item\E$/,@{$curr_usercreation{'cancreate'}})) { |
|
if ($cancreate{$item} ne 'any') { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} else { |
|
if ($cancreate{$item} ne 'none') { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
} |
} |
} |
} |
} else { |
} else { |
push(@{$changes{'cancreate'}},@cancreate); |
foreach my $item ('author','course') { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
} |
} |
|
|
if (ref($curr_usercreation{'username_rule'}) eq 'ARRAY') { |
if (ref($curr_usercreation{'username_rule'}) eq 'ARRAY') { |
foreach my $type (@{$curr_usercreation{'username_rule'}}) { |
foreach my $type (@{$curr_usercreation{'username_rule'}}) { |
if (!grep(/^\Q$type\E$/,@username_rule)) { |
if (!grep(/^\Q$type\E$/,@username_rule)) { |
Line 2582 sub modify_usercreation {
|
Line 2994 sub modify_usercreation {
|
push(@{$changes{'username_rule'}},@username_rule); |
push(@{$changes{'username_rule'}},@username_rule); |
} |
} |
|
|
|
if (ref($curr_usercreation{'id_rule'}) eq 'ARRAY') { |
|
foreach my $type (@{$curr_usercreation{'id_rule'}}) { |
|
if (!grep(/^\Q$type\E$/,@id_rule)) { |
|
push(@{$changes{'id_rule'}},$type); |
|
} |
|
} |
|
foreach my $type (@id_rule) { |
|
if (!grep(/^\Q$type\E$/,@{$curr_usercreation{'id_rule'}})) { |
|
push(@{$changes{'id_rule'}},$type); |
|
} |
|
} |
|
} else { |
|
push(@{$changes{'id_rule'}},@id_rule); |
|
} |
|
|
my @contexts = ('author','course','domain'); |
my @contexts = ('author','course','domain'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my %authhash; |
my %authhash; |
Line 2614 sub modify_usercreation {
|
Line 3041 sub modify_usercreation {
|
|
|
my %usercreation_hash = ( |
my %usercreation_hash = ( |
usercreation => { |
usercreation => { |
cancreate => \@cancreate, |
cancreate => \%cancreate, |
username_rule => \@username_rule, |
username_rule => \@username_rule, |
authtypes => \%authhash, |
id_rule => \@id_rule, |
|
authtypes => \%authhash, |
} |
} |
); |
); |
|
|
Line 2626 sub modify_usercreation {
|
Line 3054 sub modify_usercreation {
|
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
my $chgtext = '<ul>'; |
my %lt = &usercreation_types(); |
foreach my $type (@cancreate) { |
foreach my $type (@{$changes{'cancreate'}}) { |
$chgtext .= '<li>'.$title{$type}.'</li>'; |
my $chgtext; |
} |
if ($cancreate{$type} eq 'none') { |
$chgtext .= '</ul>'; |
$chgtext = $lt{$type}.' '.&mt('creation of new users is not permitted, except by a Domain Coordinator.'); |
if (@cancreate > 0) { |
} elsif ($cancreate{$type} eq 'any') { |
$resulttext .= '<li>'.&mt('Creation of new users is permitted by a Domain Coordinator, and also by other users when: ').$chgtext.'</li>'; |
$chgtext = $lt{$type}.' '.&mt('creation of new users is permitted for both institutional and non-institutional usernames.'); |
} else { |
} elsif ($cancreate{$type} eq 'official') { |
$resulttext .= '<li>'.&mt("Creation of new users is now only allowed when the user's role is Domain Coordinator.").'</li>'; |
$chgtext = $lt{$type}.' '.&mt('creation of new users is only permitted for institutional usernames.',$lt{$type}); |
|
} elsif ($cancreate{$type} eq 'unofficial') { |
|
$chgtext = $lt{$type}.' '.&mt('creation of new users is only permitted for non-institutional usernames.',$lt{$type}); |
|
} |
|
$resulttext .= '<li>'.$chgtext.'</li>'; |
} |
} |
} |
} |
if (ref($changes{'username_rule'}) eq 'ARRAY') { |
if (ref($changes{'username_rule'}) eq 'ARRAY') { |
my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($dom); |
my ($rules,$ruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'username'); |
my $chgtext = '<ul>'; |
my $chgtext = '<ul>'; |
foreach my $type (@username_rule) { |
foreach my $type (@username_rule) { |
if (ref($rules->{$type}) eq 'HASH') { |
if (ref($rules->{$type}) eq 'HASH') { |
Line 2652 sub modify_usercreation {
|
Line 3085 sub modify_usercreation {
|
$resulttext .= '<li>'.&mt('There are now no username formats restricted to verified users in the institutional directory.').'</li>'; |
$resulttext .= '<li>'.&mt('There are now no username formats restricted to verified users in the institutional directory.').'</li>'; |
} |
} |
} |
} |
|
if (ref($changes{'id_rule'}) eq 'ARRAY') { |
|
my ($idrules,$idruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'id'); |
|
my $chgtext = '<ul>'; |
|
foreach my $type (@id_rule) { |
|
if (ref($idrules->{$type}) eq 'HASH') { |
|
$chgtext .= '<li>'.$idrules->{$type}{'name'}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
if (@id_rule > 0) { |
|
$resulttext .= '<li>'.&mt('IDs with the following formats are restricted to verified users in the institutional directory: ').$chgtext.'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('There are now no ID formats restricted to verified users in the institutional directory.').'</li>'; |
|
} |
|
} |
my %authname = &authtype_names(); |
my %authname = &authtype_names(); |
my %context_title = &context_names(); |
my %context_title = &context_names(); |
if (ref($changes{'authtypes'}) eq 'ARRAY') { |
if (ref($changes{'authtypes'}) eq 'ARRAY') { |
my @unchanged; |
|
my $chgtext = '<ul>'; |
my $chgtext = '<ul>'; |
foreach my $type (@{$changes{'authtypes'}}) { |
foreach my $type (@{$changes{'authtypes'}}) { |
my @allowed; |
my @allowed; |
Line 2677 sub modify_usercreation {
|
Line 3125 sub modify_usercreation {
|
} |
} |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
|
&mt('An error occurred: [_1]',$putresult).'</span>'; |
|
} |
|
return $resulttext; |
|
} |
|
|
|
sub modify_usermodification { |
|
my ($dom,%domconfig) = @_; |
|
my ($resulttext,%curr_usermodification,%changes); |
|
if (ref($domconfig{'usermodification'}) eq 'HASH') { |
|
foreach my $key (keys(%{$domconfig{'usermodification'}})) { |
|
$curr_usermodification{$key} = $domconfig{'usermodification'}{$key}; |
|
} |
|
} |
|
my @contexts = ('author','course'); |
|
my %context_title = ( |
|
author => 'In author context', |
|
course => 'In course context', |
|
); |
|
my @fields = ('lastname','firstname','middlename','generation', |
|
'permanentemail','id'); |
|
my %roles = ( |
|
author => ['ca','aa'], |
|
course => ['st','ep','ta','in','cr'], |
|
); |
|
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
|
my %modifyhash; |
|
foreach my $context (@contexts) { |
|
foreach my $role (@{$roles{$context}}) { |
|
my @modifiable = &Apache::loncommon::get_env_multiple('form.canmodify_'.$role); |
|
foreach my $item (@fields) { |
|
if (grep(/^\Q$item\E$/,@modifiable)) { |
|
$modifyhash{$context}{$role}{$item} = 1; |
|
} else { |
|
$modifyhash{$context}{$role}{$item} = 0; |
|
} |
|
} |
|
} |
|
if (ref($curr_usermodification{$context}) eq 'HASH') { |
|
foreach my $role (@{$roles{$context}}) { |
|
if (ref($curr_usermodification{$context}{$role}) eq 'HASH') { |
|
foreach my $field (@fields) { |
|
if ($modifyhash{$context}{$role}{$field} ne |
|
$curr_usermodification{$context}{$role}{$field}) { |
|
push(@{$changes{$context}},$role); |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
foreach my $context (@contexts) { |
|
foreach my $role (@{$roles{$context}}) { |
|
push(@{$changes{$context}},$role); |
|
} |
|
} |
|
} |
|
} |
|
my %usermodification_hash = ( |
|
usermodification => \%modifyhash, |
|
); |
|
my $putresult = &Apache::lonnet::put_dom('configuration', |
|
\%usermodification_hash,$dom); |
|
if ($putresult eq 'ok') { |
|
if (keys(%changes) > 0) { |
|
$resulttext = &mt('Changes made: ').'<ul>'; |
|
foreach my $context (@contexts) { |
|
if (ref($changes{$context}) eq 'ARRAY') { |
|
$resulttext .= '<li>'.$context_title{$context}.':<ul>'; |
|
if (ref($changes{$context}) eq 'ARRAY') { |
|
foreach my $role (@{$changes{$context}}) { |
|
my $rolename; |
|
if ($role eq 'cr') { |
|
$rolename = &mt('Custom'); |
|
} else { |
|
$rolename = &Apache::lonnet::plaintext($role); |
|
} |
|
my @modifiable; |
|
$resulttext .= '<li><span class="LC_cusr_emph">'.&mt('Target user with [_1] role',$rolename).'</span> - '.&mt('modifiable fields: '); |
|
foreach my $field (@fields) { |
|
if ($modifyhash{$context}{$role}{$field}) { |
|
push(@modifiable,$fieldtitles{$field}); |
|
} |
|
} |
|
if (@modifiable > 0) { |
|
$resulttext .= join(', ',@modifiable); |
|
} else { |
|
$resulttext .= &mt('none'); |
|
} |
|
$resulttext .= '</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
|
} |
|
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made to user modification settings'); |
|
} |
|
} else { |
|
$resulttext = '<span class="LC_error">'. |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
} |
} |
return $resulttext; |
return $resulttext; |