version 1.160.6.71, 2016/09/18 19:22:48
|
version 1.160.6.78, 2017/01/24 00:19:15
|
Line 19
|
Line 19
|
# |
# |
# You should have received a copy of the GNU General Public License |
# You should have received a copy of the GNU General Public License |
# along with LON-CAPA; if not, write to the Free Software |
# along with LON-CAPA; if not, write to the Free Software |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA# |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
# |
# /home/httpd/html/adm/gpl.txt |
# /home/httpd/html/adm/gpl.txt |
# |
# |
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
Line 213 sub handler {
|
Line 214 sub handler {
|
'quotas','autoenroll','autoupdate','autocreate', |
'quotas','autoenroll','autoupdate','autocreate', |
'directorysrch','usercreation','usermodification', |
'directorysrch','usercreation','usermodification', |
'contacts','defaults','scantron','coursecategories', |
'contacts','defaults','scantron','coursecategories', |
'serverstatuses','requestcourses','coursedefaults', |
'serverstatuses','requestcourses','helpsettings', |
'usersessions','loadbalancing','requestauthor', |
'coursedefaults','usersessions','loadbalancing', |
'selfenrollment','inststatus'],$dom); |
'requestauthor','selfenrollment','inststatus'],$dom); |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
'autoupdate','autocreate','directorysrch','contacts', |
'autoupdate','autocreate','directorysrch','contacts', |
'usercreation','selfcreation','usermodification','scantron', |
'usercreation','selfcreation','usermodification','scantron', |
'requestcourses','requestauthor','coursecategories', |
'requestcourses','requestauthor','coursecategories', |
'serverstatuses','coursedefaults','selfenrollment', |
'serverstatuses','helpsettings','coursedefaults', |
'usersessions'); |
'selfenrollment','usersessions'); |
my %existing; |
my %existing; |
if (ref($domconfig{'loadbalancing'}) eq 'HASH') { |
if (ref($domconfig{'loadbalancing'}) eq 'HASH') { |
%existing = %{$domconfig{'loadbalancing'}}; |
%existing = %{$domconfig{'loadbalancing'}}; |
Line 304 sub handler {
|
Line 305 sub handler {
|
modify => \&modify_autocreate, |
modify => \&modify_autocreate, |
}, |
}, |
'directorysrch' => |
'directorysrch' => |
{ text => 'Institutional directory searches', |
{ text => 'Directory searches', |
help => 'Domain_Configuration_InstDirectory_Search', |
help => 'Domain_Configuration_InstDirectory_Search', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Institutional Directory Setting', |
|
col2 => 'Value',}, |
|
{col1 => 'LON-CAPA Directory Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
print => \&print_directorysrch, |
print => \&print_directorysrch, |
modify => \&modify_directorysrch, |
modify => \&modify_directorysrch, |
}, |
}, |
'contacts' => |
'contacts' => |
{ text => 'Contact Information', |
{ text => 'E-mail addresses and helpform', |
help => 'Domain_Configuration_Contact_Info', |
help => 'Domain_Configuration_Contact_Info', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Default e-mail addresses', |
col2 => 'Value',}], |
col2 => 'Value',}, |
|
{col1 => 'Recipient(s) for notifications', |
|
col2 => 'Value',}, |
|
{col1 => 'Ask helpdesk form settings', |
|
col2 => 'Value',},], |
print => \&print_contacts, |
print => \&print_contacts, |
modify => \&modify_contacts, |
modify => \&modify_contacts, |
}, |
}, |
Line 411 sub handler {
|
Line 418 sub handler {
|
print => \&print_serverstatuses, |
print => \&print_serverstatuses, |
modify => \&modify_serverstatuses, |
modify => \&modify_serverstatuses, |
}, |
}, |
|
'helpsettings' => |
|
{text => 'Support settings', |
|
help => 'Domain_Configuration_Help_Settings', |
|
header => [{col1 => 'Help Page Settings (logged-in users)', |
|
col2 => 'Value'}, |
|
{col1 => 'Helpdesk Roles', |
|
col2 => 'Settings'},], |
|
print => \&print_helpsettings, |
|
modify => \&modify_helpsettings, |
|
}, |
'coursedefaults' => |
'coursedefaults' => |
{text => 'Course/Community defaults', |
{text => 'Course/Community defaults', |
help => 'Domain_Configuration_Course_Defaults', |
help => 'Domain_Configuration_Course_Defaults', |
Line 445 sub handler {
|
Line 462 sub handler {
|
print => \&print_usersessions, |
print => \&print_usersessions, |
modify => \&modify_usersessions, |
modify => \&modify_usersessions, |
}, |
}, |
'loadbalancing' => |
'loadbalancing' => |
{text => 'Dedicated Load Balancer(s)', |
{text => 'Dedicated Load Balancer(s)', |
help => 'Domain_Configuration_Load_Balancing', |
help => 'Domain_Configuration_Load_Balancing', |
header => [{col1 => 'Balancers', |
header => [{col1 => 'Balancers', |
Line 509 $javascript_validations
|
Line 526 $javascript_validations
|
$coursebrowserjs |
$coursebrowserjs |
END |
END |
} |
} |
|
if (grep(/^contacts$/,@actions)) { |
|
$js .= &contacts_javascript(); |
|
} |
&Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,$js); |
&Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,$js); |
} else { |
} else { |
# check if domconfig user exists for the domain. |
# check if domconfig user exists for the domain. |
Line 619 sub process_changes {
|
Line 639 sub process_changes {
|
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); |
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); |
} elsif ($action eq 'requestauthor') { |
} elsif ($action eq 'requestauthor') { |
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); |
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); |
|
} elsif ($action eq 'helpsettings') { |
|
$output = &modify_helpsettings($r,$dom,$confname,$lastactref,%domconfig); |
} elsif ($action eq 'coursedefaults') { |
} elsif ($action eq 'coursedefaults') { |
$output = &modify_coursedefaults($dom,$lastactref,%domconfig); |
$output = &modify_coursedefaults($dom,$lastactref,%domconfig); |
} elsif ($action eq 'selfenrollment') { |
} elsif ($action eq 'selfenrollment') { |
Line 639 sub print_config_box {
|
Line 661 sub print_config_box {
|
$output = &coursecategories_javascript($settings); |
$output = &coursecategories_javascript($settings); |
} elsif ($action eq 'defaults') { |
} elsif ($action eq 'defaults') { |
$output = &defaults_javascript($settings); |
$output = &defaults_javascript($settings); |
|
} elsif ($action eq 'helpsettings') { |
|
my (%privs,%levelscurrent); |
|
my %full=(); |
|
my %levels=( |
|
course => {}, |
|
domain => {}, |
|
system => {}, |
|
); |
|
my $context = 'domain'; |
|
my $crstype = 'Course'; |
|
my $formname = 'display'; |
|
&Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent); |
|
my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype); |
|
$output = |
|
&Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full, |
|
\@templateroles); |
} |
} |
$output .= |
$output .= |
'<table class="LC_nested_outer"> |
'<table class="LC_nested_outer"> |
Line 656 sub print_config_box {
|
Line 694 sub print_config_box {
|
my $colspan = ''; |
my $colspan = ''; |
my $rightcolspan = ''; |
my $rightcolspan = ''; |
if (($action eq 'rolecolors') || ($action eq 'defaults') || |
if (($action eq 'rolecolors') || ($action eq 'defaults') || |
|
($action eq 'directorysrch') || |
(($action eq 'login') && ($numheaders < 4))) { |
(($action eq 'login') && ($numheaders < 4))) { |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
} |
} |
Line 673 sub print_config_box {
|
Line 712 sub print_config_box {
|
$rowtotal ++; |
$rowtotal ++; |
if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') || |
if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') || |
($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') || |
($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') || |
($action eq 'selfenrollment') || ($action eq 'usersessions')) { |
($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'directorysrch') || |
|
($action eq 'helpsettings') || ($action eq 'contacts')) { |
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal); |
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal); |
Line 703 sub print_config_box {
|
Line 743 sub print_config_box {
|
$rowtotal ++; |
$rowtotal ++; |
if (($action eq 'autoupdate') || ($action eq 'usercreation') || |
if (($action eq 'autoupdate') || ($action eq 'usercreation') || |
($action eq 'selfcreation') || ($action eq 'selfenrollment') || |
($action eq 'selfcreation') || ($action eq 'selfenrollment') || |
($action eq 'usersessions') || ($action eq 'coursecategories')) { |
($action eq 'usersessions') || ($action eq 'coursecategories') || |
|
($action eq 'contacts')) { |
if ($action eq 'coursecategories') { |
if ($action eq 'coursecategories') { |
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); |
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
Line 728 sub print_config_box {
|
Line 769 sub print_config_box {
|
} |
} |
$rowtotal ++; |
$rowtotal ++; |
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || |
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || |
($action eq 'defaults')) { |
($action eq 'defaults') || ($action eq 'directorysrch') || |
|
($action eq 'helpsettings')) { |
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'login') { |
} elsif ($action eq 'login') { |
if ($numheaders == 4) { |
if ($numheaders == 4) { |
Line 841 sub print_config_box {
|
Line 883 sub print_config_box {
|
<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') { |
$output .= ' |
$output .= ' |
<td class="LC_left_item" colspan="2">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>'; |
<td class="LC_left_item" colspan="2">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>'; |
} elsif ($action eq 'serverstatuses') { |
} elsif ($action eq 'serverstatuses') { |
Line 885 sub print_config_box {
|
Line 927 sub print_config_box {
|
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'quotas') { |
if ($action eq 'quotas') { |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
} elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || ($action eq 'directorysrch') || |
} elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || |
($action eq 'contacts') || ($action eq 'serverstatuses') || ($action eq 'loadbalancing')) { |
($action eq 'serverstatuses') || ($action eq 'loadbalancing')) { |
$output .= $item->{'print'}->($dom,$settings,\$rowtotal); |
$output .= $item->{'print'}->($dom,$settings,\$rowtotal); |
} elsif ($action eq 'scantron') { |
} elsif ($action eq 'scantron') { |
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'helpsettings') { |
|
$output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal); |
|
} |
} |
} |
} |
$output .= ' |
$output .= ' |
Line 2604 sub print_autocreate {
|
Line 2644 sub print_autocreate {
|
} |
} |
|
|
sub print_directorysrch { |
sub print_directorysrch { |
my ($dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my $srchon = ' '; |
my $datatable; |
my $srchoff = ' checked="checked" '; |
if ($position eq 'top') { |
my ($exacton,$containson,$beginson); |
my $instsrchon = ' '; |
my $localon = ' '; |
my $instsrchoff = ' checked="checked" '; |
my $localoff = ' checked="checked" '; |
my ($exacton,$containson,$beginson); |
if (ref($settings) eq 'HASH') { |
my $instlocalon = ' '; |
if ($settings->{'available'} eq '1') { |
my $instlocaloff = ' checked="checked" '; |
$srchon = $srchoff; |
if (ref($settings) eq 'HASH') { |
$srchoff = ' '; |
if ($settings->{'available'} eq '1') { |
} |
$instsrchon = $instsrchoff; |
if ($settings->{'localonly'} eq '1') { |
$instsrchoff = ' '; |
$localon = $localoff; |
} |
$localoff = ' '; |
if ($settings->{'localonly'} eq '1') { |
} |
$instlocalon = $instlocaloff; |
if (ref($settings->{'searchtypes'}) eq 'ARRAY') { |
$instlocaloff = ' '; |
foreach my $type (@{$settings->{'searchtypes'}}) { |
} |
if ($type eq 'exact') { |
if (ref($settings->{'searchtypes'}) eq 'ARRAY') { |
|
foreach my $type (@{$settings->{'searchtypes'}}) { |
|
if ($type eq 'exact') { |
|
$exacton = ' checked="checked" '; |
|
} elsif ($type eq 'contains') { |
|
$containson = ' checked="checked" '; |
|
} elsif ($type eq 'begins') { |
|
$beginson = ' checked="checked" '; |
|
} |
|
} |
|
} else { |
|
if ($settings->{'searchtypes'} eq 'exact') { |
|
$exacton = ' checked="checked" '; |
|
} elsif ($settings->{'searchtypes'} eq 'contains') { |
|
$containson = ' checked="checked" '; |
|
} elsif ($settings->{'searchtypes'} eq 'specify') { |
$exacton = ' checked="checked" '; |
$exacton = ' checked="checked" '; |
} elsif ($type eq 'contains') { |
|
$containson = ' checked="checked" '; |
$containson = ' checked="checked" '; |
} elsif ($type eq 'begins') { |
|
$beginson = ' checked="checked" '; |
|
} |
} |
} |
} |
} else { |
|
if ($settings->{'searchtypes'} eq 'exact') { |
|
$exacton = ' checked="checked" '; |
|
} elsif ($settings->{'searchtypes'} eq 'contains') { |
|
$containson = ' checked="checked" '; |
|
} elsif ($settings->{'searchtypes'} eq 'specify') { |
|
$exacton = ' checked="checked" '; |
|
$containson = ' checked="checked" '; |
|
} |
|
} |
} |
} |
my ($searchtitles,$titleorder) = &sorted_searchtitles(); |
my ($searchtitles,$titleorder) = &sorted_searchtitles(); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
|
|
my $numinrow = 4; |
my $numinrow = 4; |
my $cansrchrow = 0; |
my $cansrchrow = 0; |
my $datatable='<tr class="LC_odd_row">'. |
$datatable='<tr class="LC_odd_row">'. |
'<td colspan="2"><span class ="LC_nobreak">'.&mt('Directory search available?').'</span></td>'. |
'<td colspan="2"><span class ="LC_nobreak">'.&mt('Institutional 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> '. |
$instsrchon.' 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>'. |
$instsrchoff.' value="0" />'.&mt('No').'</label></span></td>'. |
'</tr><tr>'. |
'</tr><tr>'. |
'<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search?').'</span></td>'. |
'<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search institution?').'</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_instlocalonly"'. |
$localoff.' value="0" />'.&mt('Yes').'</label> '. |
$instlocaloff.' value="0" />'.&mt('Yes').'</label> '. |
'<label><input type="radio" name="dirsrch_localonly"'. |
'<label><input type="radio" name="dirsrch_instlocalonly"'. |
$localon.' value="1" />'.&mt('No').'</label></span></td>'. |
$instlocalon.' value="1" />'.&mt('No').'</label></span></td>'. |
'</tr>'; |
'</tr>'; |
$$rowtotal += 2; |
$$rowtotal += 2; |
if (ref($usertypes) eq 'HASH') { |
if (ref($usertypes) eq 'HASH') { |
if (keys(%{$usertypes}) > 0) { |
if (keys(%{$usertypes}) > 0) { |
$datatable .= &insttypes_row($settings,$types,$usertypes,$dom, |
$datatable .= &insttypes_row($settings,$types,$usertypes,$dom, |
$numinrow,$othertitle,'cansearch'); |
$numinrow,$othertitle,'cansearch'); |
$cansrchrow = 1; |
$cansrchrow = 1; |
|
} |
} |
} |
} |
if ($cansrchrow) { |
if ($cansrchrow) { |
$$rowtotal ++; |
$$rowtotal ++; |
$datatable .= '<tr>'; |
$datatable .= '<tr>'; |
} else { |
} else { |
$datatable .= '<tr class="LC_odd_row">'; |
$datatable .= '<tr class="LC_odd_row">'; |
} |
} |
$datatable .= '<td><span class ="LC_nobreak">'.&mt('Supported search methods'). |
$datatable .= '<td><span class ="LC_nobreak">'.&mt('Supported search methods'). |
'</span></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) 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" '; |
} |
} |
} |
} |
} |
|
$datatable .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="searchby" '. |
|
'value="'.$title.'"'.$check.'/>'. |
|
$searchtitles->{$title}.'</label></span></td>'; |
} |
} |
$datatable .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="searchby" '. |
|
'value="'.$title.'"'.$check.'/>'. |
|
$searchtitles->{$title}.'</label></span></td>'; |
|
} |
} |
} |
$datatable .= '</tr></table></td></tr>'; |
$datatable .= '</tr></table></td></tr>'; |
$$rowtotal ++; |
$$rowtotal ++; |
if ($cansrchrow) { |
if ($cansrchrow) { |
$datatable .= '<tr class="LC_odd_row">'; |
$datatable .= '<tr class="LC_odd_row">'; |
} else { |
|
$datatable .= '<tr>'; |
|
} |
|
$datatable .= '<td><span class ="LC_nobreak">'.&mt('Search latitude').'</span></td>'. |
|
'<td class="LC_left_item" colspan="2">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="searchtypes" '. |
|
$exacton.' value="exact" />'.&mt('Exact match'). |
|
'</label> '. |
|
'<label><input type="checkbox" name="searchtypes" '. |
|
$beginson.' value="begins" />'.&mt('Begins with'). |
|
'</label> '. |
|
'<label><input type="checkbox" name="searchtypes" '. |
|
$containson.' value="contains" />'.&mt('Contains'). |
|
'</label></span></td></tr>'; |
|
$$rowtotal ++; |
} else { |
} else { |
$datatable .= '<tr>'; |
my $domsrchon = ' checked="checked" '; |
|
my $domsrchoff = ' '; |
|
my $domlocalon = ' '; |
|
my $domlocaloff = ' checked="checked" '; |
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{'lclocalonly'} eq '1') { |
|
$domlocalon = $domlocaloff; |
|
$domlocaloff = ' '; |
|
} |
|
if ($settings->{'lcavailable'} eq '0') { |
|
$domsrchoff = $domsrchon; |
|
$domsrchon = ' '; |
|
} |
|
} |
|
$datatable='<tr class="LC_odd_row">'. |
|
'<td colspan="2"><span class ="LC_nobreak">'.&mt('LON-CAPA directory search available?').'</span></td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="dirsrch_domavailable"'. |
|
$domsrchon.' value="1" />'.&mt('Yes').'</label> '. |
|
'<label><input type="radio" name="dirsrch_domavailable"'. |
|
$domsrchoff.' value="0" />'.&mt('No').'</label></span></td>'. |
|
'</tr><tr>'. |
|
'<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search LON-CAPA domain?').'</span></td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="dirsrch_domlocalonly"'. |
|
$domlocaloff.' value="0" />'.&mt('Yes').'</label> '. |
|
'<label><input type="radio" name="dirsrch_domlocalonly"'. |
|
$domlocalon.' value="1" />'.&mt('No').'</label></span></td>'. |
|
'</tr>'; |
|
$$rowtotal += 2; |
} |
} |
$datatable .= '<td><span class ="LC_nobreak">'.&mt('Search latitude').'</span></td>'. |
|
'<td class="LC_left_item" colspan="2">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="searchtypes" '. |
|
$exacton.' value="exact" />'.&mt('Exact match'). |
|
'</label> '. |
|
'<label><input type="checkbox" name="searchtypes" '. |
|
$beginson.' value="begins" />'.&mt('Begins with'). |
|
'</label> '. |
|
'<label><input type="checkbox" name="searchtypes" '. |
|
$containson.' value="contains" />'.&mt('Contains'). |
|
'</label></span></td></tr>'; |
|
$$rowtotal ++; |
|
return $datatable; |
return $datatable; |
} |
} |
|
|
sub print_contacts { |
sub print_contacts { |
my ($dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my $datatable; |
my $datatable; |
my @contacts = ('adminemail','supportemail'); |
my @contacts = ('adminemail','supportemail'); |
my (%checked,%to,%otheremails,%bccemails); |
my (%checked,%to,%otheremails,%bccemails,%includestr,%includeloc,%currfield, |
my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail', |
$maxsize,$fields,$fieldtitles,$fieldoptions,$possoptions,@mailings); |
'requestsmail','updatesmail','idconflictsmail'); |
if ($position eq 'top') { |
foreach my $type (@mailings) { |
if (ref($settings) eq 'HASH') { |
$otheremails{$type} = ''; |
foreach my $item (@contacts) { |
} |
if (exists($settings->{$item})) { |
$bccemails{'helpdeskmail'} = ''; |
$to{$item} = $settings->{$item}; |
if (ref($settings) eq 'HASH') { |
} |
foreach my $item (@contacts) { |
|
if (exists($settings->{$item})) { |
|
$to{$item} = $settings->{$item}; |
|
} |
} |
} |
} |
|
} elsif ($position eq 'middle') { |
|
@mailings = ('errormail','packagesmail','lonstatusmail','requestsmail', |
|
'updatesmail','idconflictsmail'); |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
if (exists($settings->{$type})) { |
$otheremails{$type} = ''; |
if (ref($settings->{$type}) eq 'HASH') { |
} |
foreach my $item (@contacts) { |
} else { |
if ($settings->{$type}{$item}) { |
@mailings = ('helpdeskmail','otherdomsmail'); |
$checked{$type}{$item} = ' checked="checked" '; |
foreach my $type (@mailings) { |
|
$otheremails{$type} = ''; |
|
} |
|
$bccemails{'helpdeskmail'} = ''; |
|
$bccemails{'otherdomsmail'} = ''; |
|
$includestr{'helpdeskmail'} = ''; |
|
$includestr{'otherdomsmail'} = ''; |
|
($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields(); |
|
} |
|
if (ref($settings) eq 'HASH') { |
|
unless ($position eq 'top') { |
|
foreach my $type (@mailings) { |
|
if (exists($settings->{$type})) { |
|
if (ref($settings->{$type}) eq 'HASH') { |
|
foreach my $item (@contacts) { |
|
if ($settings->{$type}{$item}) { |
|
$checked{$type}{$item} = ' checked="checked" '; |
|
} |
|
} |
|
$otheremails{$type} = $settings->{$type}{'others'}; |
|
if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) { |
|
$bccemails{$type} = $settings->{$type}{'bcc'}; |
|
if ($settings->{$type}{'include'} ne '') { |
|
($includeloc{$type},$includestr{$type}) = split(/:/,$settings->{$type}{'include'},2); |
|
$includestr{$type} = &unescape($includestr{$type}); |
|
} |
} |
} |
} |
} |
$otheremails{$type} = $settings->{$type}{'others'}; |
} elsif ($type eq 'lonstatusmail') { |
if ($type eq 'helpdeskmail') { |
$checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; |
$bccemails{$type} = $settings->{$type}{'bcc'}; |
} |
|
} |
|
} |
|
if ($position eq 'bottom') { |
|
foreach my $type (@mailings) { |
|
$bccemails{$type} = $settings->{$type}{'bcc'}; |
|
if ($settings->{$type}{'include'} ne '') { |
|
($includeloc{$type},$includestr{$type}) = split(/:/,$settings->{$type}{'include'},2); |
|
$includestr{$type} = &unescape($includestr{$type}); |
|
} |
|
} |
|
if (ref($settings->{'helpform'}) eq 'HASH') { |
|
if (ref($fields) eq 'ARRAY') { |
|
foreach my $field (@{$fields}) { |
|
$currfield{$field} = $settings->{'helpform'}{$field}; |
|
} |
|
} |
|
if (exists($settings->{'helpform'}{'maxsize'})) { |
|
$maxsize = $settings->{'helpform'}{'maxsize'}; |
|
} else { |
|
$maxsize = '1.0'; |
|
} |
|
} else { |
|
if (ref($fields) eq 'ARRAY') { |
|
foreach my $field (@{$fields}) { |
|
$currfield{$field} = 'yes'; |
} |
} |
} |
} |
} elsif ($type eq 'lonstatusmail') { |
$maxsize = '1.0'; |
$checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; |
|
} |
} |
} |
} |
} else { |
} else { |
$to{'supportemail'} = $Apache::lonnet::perlvar{'lonSupportEMail'}; |
if ($position eq 'top') { |
$to{'adminemail'} = $Apache::lonnet::perlvar{'lonAdmEMail'}; |
$to{'supportemail'} = $Apache::lonnet::perlvar{'lonSupportEMail'}; |
$checked{'errormail'}{'adminemail'} = ' checked="checked" '; |
$to{'adminemail'} = $Apache::lonnet::perlvar{'lonAdmEMail'}; |
$checked{'packagesmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'errormail'}{'adminemail'} = ' checked="checked" '; |
$checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" '; |
$checked{'packagesmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'requestsmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'requestsmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'updatesmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'updatesmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" '; |
$checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" '; |
|
} elsif ($position eq 'bottom') { |
|
$checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" '; |
|
$checked{'otherdomsmail'}{'supportemail'} = ' checked="checked" '; |
|
if (ref($fields) eq 'ARRAY') { |
|
foreach my $field (@{$fields}) { |
|
$currfield{$field} = 'yes'; |
|
} |
|
} |
|
$maxsize = '1.0'; |
|
} |
} |
} |
my ($titles,$short_titles) = &contact_titles(); |
my ($titles,$short_titles) = &contact_titles(); |
my $rownum = 0; |
my $rownum = 0; |
my $css_class; |
my $css_class; |
foreach my $item (@contacts) { |
if ($position eq 'top') { |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
foreach my $item (@contacts) { |
$datatable .= '<tr'.$css_class.'>'. |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
'<td><span class="LC_nobreak">'.$titles->{$item}. |
$datatable .= '<tr'.$css_class.'>'. |
'</span></td><td class="LC_right_item">'. |
'<td><span class="LC_nobreak">'.$titles->{$item}. |
'<input type="text" name="'.$item.'" value="'. |
'</span></td><td class="LC_right_item">'. |
$to{$item}.'" /></td></tr>'; |
'<input type="text" name="'.$item.'" value="'. |
$rownum ++; |
$to{$item}.'" /></td></tr>'; |
|
$rownum ++; |
|
} |
|
} else { |
|
foreach my $type (@mailings) { |
|
$css_class = $rownum%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td><span class="LC_nobreak">'. |
|
$titles->{$type}.': </span></td>'. |
|
'<td class="LC_left_item">'; |
|
if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) { |
|
$datatable .= '<fieldset><legend>'.&mt('E-mail recipient(s)').'</legend>'; |
|
} |
|
$datatable .= '<span class="LC_nobreak">'; |
|
foreach my $item (@contacts) { |
|
$datatable .= '<label>'. |
|
'<input type="checkbox" name="'.$type.'"'. |
|
$checked{$type}{$item}. |
|
' value="'.$item.'" />'.$short_titles->{$item}. |
|
'</label> '; |
|
} |
|
$datatable .= '</span><br />'.&mt('Others').': '. |
|
'<input type="text" name="'.$type.'_others" '. |
|
'value="'.$otheremails{$type}.'" />'; |
|
my %locchecked; |
|
if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) { |
|
foreach my $loc ('s','b') { |
|
if ($includeloc{$type} eq $loc) { |
|
$locchecked{$loc} = ' checked="checked"'; |
|
last; |
|
} |
|
} |
|
$datatable .= '<br />'.&mt('Bcc:').(' 'x6). |
|
'<input type="text" name="'.$type.'_bcc" '. |
|
'value="'.$bccemails{$type}.'" /></fieldset>'. |
|
'<fieldset><legend>'.&mt('Optional added text').'</legend>'. |
|
&mt('Text automatically added to e-mail:').' '. |
|
'<input type="text" name="'.$type.'_includestr" value="'.$includestr{$type}.'" /><br >'. |
|
'<span class="LC_nobreak">'.&mt('Location:').' '. |
|
'<label><input type="radio" name="'.$type.'_includeloc" value="s"'.$locchecked{'s'}.' />'.&mt('in subject').'</label>'. |
|
(' 'x2). |
|
'<label><input type="radio" name="'.$type.'_includeloc" value="b"'.$locchecked{'b'}.' />'.&mt('in body').'</label>'. |
|
'</span></fieldset>'; |
|
} |
|
$datatable .= '</td></tr>'."\n"; |
|
$rownum ++; |
|
} |
} |
} |
foreach my $type (@mailings) { |
if ($position eq 'middle') { |
|
my %choices; |
|
$choices{'reporterrors'} = &mt('E-mail error reports to [_1]', |
|
&Apache::loncommon::modal_link('http://loncapa.org/core.html', |
|
&mt('LON-CAPA core group - MSU'),600,500)); |
|
$choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]', |
|
&Apache::loncommon::modal_link('http://loncapa.org/core.html', |
|
&mt('LON-CAPA core group - MSU'),600,500)); |
|
my @toggles = ('reporterrors','reportupdates'); |
|
my %defaultchecked = ('reporterrors' => 'on', |
|
'reportupdates' => 'on'); |
|
(my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
|
\%choices,$rownum); |
|
$datatable .= $reports; |
|
} elsif ($position eq 'bottom') { |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
$css_class = $rownum%2?' class="LC_odd_row"':''; |
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td><span class="LC_nobreak">'. |
'<td>'.&mt('Extra helpdesk form fields:').'<br />'. |
$titles->{$type}.': </span></td>'. |
&mt('(e-mail, subject, and description always shown)'). |
'<td class="LC_left_item">'. |
'</td><td class="LC_left_item">'; |
'<span class="LC_nobreak">'; |
if ((ref($fields) eq 'ARRAY') && (ref($fieldtitles) eq 'HASH') && |
foreach my $item (@contacts) { |
(ref($fieldoptions) eq 'HASH') && (ref($possoptions) eq 'HASH')) { |
$datatable .= '<label>'. |
$datatable .= '<table><tr><th>'.&mt('Field').'</th><th>'.&mt('Status').'</th></tr>'; |
'<input type="checkbox" name="'.$type.'"'. |
foreach my $field (@{$fields}) { |
$checked{$type}{$item}. |
$datatable .= '<tr><td>'.$fieldtitles->{$field}; |
' value="'.$item.'" />'.$short_titles->{$item}. |
if (($field eq 'screenshot') || ($field eq 'cc')) { |
'</label> '; |
$datatable .= ' '.&mt('(logged-in users)'); |
} |
} |
$datatable .= '</span><br />'.&mt('Others').': '. |
$datatable .='</td><td>'; |
'<input type="text" name="'.$type.'_others" '. |
my $clickaction; |
'value="'.$otheremails{$type}.'" />'; |
if ($field eq 'screenshot') { |
if ($type eq 'helpdeskmail') { |
$clickaction = ' onclick="screenshotSize(this);"'; |
$datatable .= '<br />'.&mt('Bcc:').(' 'x6). |
} |
'<input type="text" name="'.$type.'_bcc" '. |
if (ref($possoptions->{$field}) eq 'ARRAY') { |
'value="'.$bccemails{$type}.'" />'; |
foreach my $option (@{$possoptions->{$field}}) { |
|
my $checked; |
|
if ($currfield{$field} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="helpform_'.$field.'" '. |
|
'value="'.$option.'"'.$checked.$clickaction.' />'.$fieldoptions->{$option}. |
|
'</label></span>'.(' 'x2); |
|
} |
|
} |
|
if ($field eq 'screenshot') { |
|
my $display; |
|
if ($currfield{$field} eq 'no') { |
|
$display = ' style="display:none"'; |
|
} |
|
$datatable .= '</td></tr><tr id="help_screenshotsize"'.$display.' />'. |
|
'<td>'.&mt('Maximum size for upload (MB)').'</td><td>'. |
|
'<input type="text" size="5" name="helpform_maxsize" value="'.$maxsize.'" />'; |
|
} |
|
$datatable .= '</td></tr>'; |
|
} |
|
$datatable .= '</table>'; |
} |
} |
$datatable .= '</td></tr>'."\n"; |
$datatable .= '</td></tr>'."\n"; |
$rownum ++; |
$rownum ++; |
} |
} |
my %choices; |
|
$choices{'reporterrors'} = &mt('E-mail error reports to [_1]', |
|
&Apache::loncommon::modal_link('http://loncapa.org/core.html', |
|
&mt('LON-CAPA core group - MSU'),600,500)); |
|
$choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]', |
|
&Apache::loncommon::modal_link('http://loncapa.org/core.html', |
|
&mt('LON-CAPA core group - MSU'),600,500)); |
|
my @toggles = ('reporterrors','reportupdates'); |
|
my %defaultchecked = ('reporterrors' => 'on', |
|
'reportupdates' => 'on'); |
|
(my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
|
\%choices,$rownum); |
|
$datatable .= $reports; |
|
$$rowtotal += $rownum; |
$$rowtotal += $rownum; |
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub contacts_javascript { |
|
return <<"ENDSCRIPT"; |
|
|
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
|
|
function screenshotSize(field) { |
|
if (document.getElementById('help_screenshotsize')) { |
|
if (field.value == 'no') { |
|
document.getElementById('help_screenshotsize').style.display="none"; |
|
} else { |
|
document.getElementById('help_screenshotsize').style.display=""; |
|
} |
|
} |
|
return; |
|
} |
|
|
|
// ]]> |
|
</script> |
|
|
|
ENDSCRIPT |
|
} |
|
|
sub print_helpsettings { |
sub print_helpsettings { |
my ($dom,$confname,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
|
my $confname = $dom.'-domainconfig'; |
|
my $formname = 'display'; |
my ($datatable,$itemcount); |
my ($datatable,$itemcount); |
$itemcount = 1; |
if ($position eq 'top') { |
my (%choices,%defaultchecked,@toggles); |
$itemcount = 1; |
$choices{'submitbugs'} = &mt('Display link to: [_1]?', |
my (%choices,%defaultchecked,@toggles); |
&Apache::loncommon::modal_link('http://bugs.loncapa.org', |
$choices{'submitbugs'} = &mt('Display link to: [_1]?', |
&mt('LON-CAPA bug tracker'),600,500)); |
&Apache::loncommon::modal_link('http://bugs.loncapa.org', |
%defaultchecked = ('submitbugs' => 'on'); |
&mt('LON-CAPA bug tracker'),600,500)); |
@toggles = ('submitbugs',); |
%defaultchecked = ('submitbugs' => 'on'); |
|
@toggles = ('submitbugs'); |
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
\%choices,$itemcount); |
\%choices,$itemcount); |
|
$$rowtotal ++; |
|
} else { |
|
my $css_class; |
|
my %existing=&Apache::lonnet::dump('roles',$dom,$confname,'rolesdef_'); |
|
my (%customroles,%ordered,%current); |
|
if (ref($settings->{'adhoc'}) eq 'HASH') { |
|
%current = %{$settings->{'adhoc'}}; |
|
} |
|
my $count = 0; |
|
foreach my $key (sort(keys(%existing))) { |
|
if ($key=~/^rolesdef\_(\w+)$/) { |
|
my $rolename = $1; |
|
my (%privs,$order); |
|
($privs{'system'},$privs{'domain'},$privs{'course'}) = split(/\_/,$existing{$key}); |
|
$customroles{$rolename} = \%privs; |
|
if (ref($current{$rolename}) eq 'HASH') { |
|
$order = $current{$rolename}{'order'}; |
|
} |
|
if ($order eq '') { |
|
$order = $count; |
|
} |
|
$ordered{$order} = $rolename; |
|
$count++; |
|
} |
|
} |
|
my $maxnum = scalar(keys(%ordered)); |
|
my @roles_by_num = (); |
|
foreach my $item (sort {$a <=> $b } (keys(%ordered))) { |
|
push(@roles_by_num,$item); |
|
} |
|
my $context = 'domprefs'; |
|
my $crstype = 'Course'; |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
my @accesstypes = ('all','none'); |
|
my ($numstatustypes,@jsarray); |
|
if (ref($types) eq 'ARRAY') { |
|
if (@{$types} > 0) { |
|
$numstatustypes = scalar(@{$types}); |
|
push(@accesstypes,'status'); |
|
@jsarray = ('bystatus'); |
|
} |
|
} |
|
my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh']); |
|
if (keys(%domhelpdesk)) { |
|
push(@accesstypes,('inc','exc')); |
|
push(@jsarray,('notinc','notexc')); |
|
} |
|
my $hiddenstr = join("','",@jsarray); |
|
$datatable .= &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname); |
|
my $context = 'domprefs'; |
|
my $crstype = 'Course'; |
|
my $prefix = 'helproles_'; |
|
my $add_class = 'LC_hidden'; |
|
foreach my $num (@roles_by_num) { |
|
my $role = $ordered{$num}; |
|
my ($desc,$access,@statuses); |
|
if (ref($current{$role}) eq 'HASH') { |
|
$desc = $current{$role}{'desc'}; |
|
$access = $current{$role}{'access'}; |
|
if (ref($current{$role}{'insttypes'}) eq 'ARRAY') { |
|
@statuses = @{$current{$role}{'insttypes'}}; |
|
} |
|
} |
|
if ($desc eq '') { |
|
$desc = $role; |
|
} |
|
my $identifier = 'custhelp'.$num; |
|
my %full=(); |
|
my %levels= ( |
|
course => {}, |
|
domain => {}, |
|
system => {}, |
|
); |
|
my %levelscurrent=( |
|
course => {}, |
|
domain => {}, |
|
system => {}, |
|
); |
|
&Apache::lonuserutils::custom_role_privs($customroles{$role},\%full,\%levels,\%levelscurrent); |
|
my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype); |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my $chgstr = ' onchange="javascript:reorderHelpRoles(this.form,'."'helproles_".$num."_pos'".');"'; |
|
$datatable .= '<tr '.$css_class.'><td valign="top"><b>'.$role.'</b><br />'. |
|
'<select name="helproles_'.$num.'_pos"'.$chgstr.'>'; |
|
for (my $k=0; $k<=$maxnum; $k++) { |
|
my $vpos = $k+1; |
|
my $selstr; |
|
if ($k == $num) { |
|
$selstr = ' selected="selected" '; |
|
} |
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
|
} |
|
$datatable .= '</select>'.(' 'x2). |
|
'<input type="hidden" name="helproles_'.$num.'" value="'.$role.'" />'. |
|
'</td>'. |
|
'<td><fieldset><legend>'.&mt('Role name').'</legend>'. |
|
&mt('Name shown to users:'). |
|
'<input type="text" name="helproles_'.$num.'_desc" value="'.$desc.'" />'. |
|
'</fieldset>'. |
|
&helpdeskroles_access($dom,$prefix,$num,$add_class,$current{$role},\@accesstypes, |
|
$othertitle,$usertypes,$types,\%domhelpdesk). |
|
'<fieldset>'. |
|
'<legend>'.&mt('Role privileges').&adhocbutton($prefix,$num,'privs','show').'</legend>'. |
|
&Apache::lonuserutils::custom_role_table($crstype,\%full,\%levels, |
|
\%levelscurrent,$identifier, |
|
'LC_hidden',$prefix.$num.'_privs'). |
|
'</fieldset></td>'; |
|
$itemcount ++; |
|
} |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my $newcust = 'custhelp'.$count; |
|
my (%privs,%levelscurrent); |
|
my %full=(); |
|
my %levels= ( |
|
course => {}, |
|
domain => {}, |
|
system => {}, |
|
); |
|
&Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent); |
|
my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype); |
|
my $chgstr = ' onchange="javascript:reorderHelpRoles(this.form,'."'helproles_".$count."_pos'".');"'; |
|
$datatable .= '<tr '.$css_class.'><td valign="top"><span class="LC_nobreak"><label>'. |
|
'<input type="hidden" name="helproles_maxnum" value="'.$maxnum.'" />'."\n". |
|
'<select name="helproles_'.$count.'_pos"'.$chgstr.'>'; |
|
for (my $k=0; $k<$maxnum+1; $k++) { |
|
my $vpos = $k+1; |
|
my $selstr; |
|
if ($k == $maxnum) { |
|
$selstr = ' selected="selected" '; |
|
} |
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
|
} |
|
$datatable .= '</select> '."\n". |
|
'<input type="checkbox" name="newcusthelp" value="'.$count.'" />'. &mt('Add'). |
|
'</label></span></td>'. |
|
'<td><fieldset><legend>'.&mt('Role name').'</legend>'. |
|
'<span class="LC_nobreak">'. |
|
&mt('Internal name:'). |
|
'<input type="text" size="10" name="custhelpname'.$count.'" value="" />'. |
|
'</span>'.(' 'x4). |
|
'<span class="LC_nobreak">'. |
|
&mt('Name shown to users:'). |
|
'<input type="text" size="20" name="helproles_'.$count.'_desc" value="" />'. |
|
'</span></fieldset>'. |
|
&helpdeskroles_access($dom,$prefix,$count,'',undef,\@accesstypes,$othertitle, |
|
$usertypes,$types,\%domhelpdesk). |
|
'<fieldset><legend>'.&mt('Role privileges').'</legend>'. |
|
&Apache::lonuserutils::custom_role_header($context,$crstype, |
|
\@templateroles,$newcust). |
|
&Apache::lonuserutils::custom_role_table('Course',\%full,\%levels, |
|
\%levelscurrent,$newcust). |
|
'</fieldset></td></tr>'; |
|
$count ++; |
|
$$rowtotal += $count; |
|
} |
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub adhocbutton { |
|
my ($prefix,$num,$field,$visibility) = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
|
show => 'Show details', |
|
hide => 'Hide details', |
|
); |
|
return '<span style="text-decoration:line-through; font-weight: normal;">'.(' 'x10). |
|
'</span>'.(' 'x2).'<input type="button" id="'.$prefix.$num.'_'.$field.'_vis"'. |
|
' value="'.$lt{$visibility}.'" style="height:20px;" '. |
|
'onclick="toggleHelpdeskItem('."'$num','$field'".');" />'.(' 'x2); |
|
} |
|
|
|
sub helpsettings_javascript { |
|
my ($roles_by_num,$total,$hiddenstr,$formname) = @_; |
|
return unless(ref($roles_by_num) eq 'ARRAY'); |
|
my %html_js_lt = &Apache::lonlocal::texthash( |
|
show => 'Show details', |
|
hide => 'Hide details', |
|
); |
|
&html_escape(\%html_js_lt); |
|
my $jstext = ' var helproles = Array('."'".join("','",@{$roles_by_num})."'".');'."\n"; |
|
return <<"ENDSCRIPT"; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
|
|
function reorderHelpRoles(form,item) { |
|
var changedVal; |
|
$jstext |
|
var newpos = 'helproles_${total}_pos'; |
|
var maxh = 1 + $total; |
|
var current = new Array(); |
|
var newitemVal = form.elements[newpos].options[form.elements[newpos].selectedIndex].value; |
|
if (item == newpos) { |
|
changedVal = newitemVal; |
|
} else { |
|
changedVal = form.elements[item].options[form.elements[item].selectedIndex].value; |
|
current[newitemVal] = newpos; |
|
} |
|
for (var i=0; i<helproles.length; i++) { |
|
var elementName = 'helproles_'+helproles[i]+'_pos'; |
|
if (elementName != item) { |
|
if (form.elements[elementName]) { |
|
var currVal = form.elements[elementName].options[form.elements[elementName].selectedIndex].value; |
|
current[currVal] = elementName; |
|
} |
|
} |
|
} |
|
var oldVal; |
|
for (var j=0; j<maxh; j++) { |
|
if (current[j] == undefined) { |
|
oldVal = j; |
|
} |
|
} |
|
if (oldVal < changedVal) { |
|
for (var k=oldVal+1; k<=changedVal ; k++) { |
|
var elementName = current[k]; |
|
form.elements[elementName].selectedIndex = form.elements[elementName].selectedIndex - 1; |
|
} |
|
} else { |
|
for (var k=changedVal; k<oldVal; k++) { |
|
var elementName = current[k]; |
|
form.elements[elementName].selectedIndex = form.elements[elementName].selectedIndex + 1; |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function helpdeskAccess(num) { |
|
var curraccess = null; |
|
if (document.$formname.elements['helproles_'+num+'_access'].length) { |
|
for (var i=0; i<document.$formname.elements['helproles_'+num+'_access'].length; i++) { |
|
if (document.$formname.elements['helproles_'+num+'_access'][i].checked) { |
|
curraccess = document.$formname.elements['helproles_'+num+'_access'][i].value; |
|
} |
|
} |
|
} |
|
var shown = Array(); |
|
var hidden = Array(); |
|
if (curraccess == 'none') { |
|
hidden = Array('$hiddenstr'); |
|
} else { |
|
if (curraccess == 'status') { |
|
shown = Array('bystatus'); |
|
hidden = Array('notinc','notexc'); |
|
} else { |
|
if (curraccess == 'exc') { |
|
shown = Array('notexc'); |
|
hidden = Array('notinc','bystatus'); |
|
} |
|
if (curraccess == 'inc') { |
|
shown = Array('notinc'); |
|
hidden = Array('notexc','bystatus'); |
|
} |
|
if (curraccess == 'all') { |
|
hidden = Array('notinc','notexc','bystatus'); |
|
} |
|
} |
|
} |
|
if (hidden.length > 0) { |
|
for (var i=0; i<hidden.length; i++) { |
|
if (document.getElementById('helproles_'+num+'_'+hidden[i])) { |
|
document.getElementById('helproles_'+num+'_'+hidden[i]).style.display = 'none'; |
|
} |
|
} |
|
} |
|
if (shown.length > 0) { |
|
for (var i=0; i<shown.length; i++) { |
|
if (document.getElementById('helproles_'+num+'_'+shown[i])) { |
|
if (shown[i] == 'privs') { |
|
document.getElementById('helproles_'+num+'_'+shown[i]).style.display = 'block'; |
|
} else { |
|
document.getElementById('helproles_'+num+'_'+shown[i]).style.display = 'inline-block'; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
function toggleHelpdeskItem(num,field) { |
|
if (document.getElementById('helproles_'+num+'_'+field)) { |
|
if (document.getElementById('helproles_'+num+'_'+field).className.match(/(?:^|\\s)LC_hidden(?!\\S)/)) { |
|
document.getElementById('helproles_'+num+'_'+field).className = |
|
document.getElementById('helproles_'+num+'_'+field).className.replace(/(?:^|\\s)LC_hidden(?!\\S)/g ,''); |
|
if (document.getElementById('helproles_'+num+'_'+field+'_vis')) { |
|
document.getElementById('helproles_'+num+'_'+field+'_vis').value = '$html_js_lt{hide}'; |
|
} |
|
} else { |
|
document.getElementById('helproles_'+num+'_'+field).className += ' LC_hidden'; |
|
if (document.getElementById('helproles_'+num+'_'+field+'_vis')) { |
|
document.getElementById('helproles_'+num+'_'+field+'_vis').value = '$html_js_lt{show}'; |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
|
|
// ]]> |
|
</script> |
|
|
|
ENDSCRIPT |
|
} |
|
|
|
sub helpdeskroles_access { |
|
my ($dom,$prefix,$num,$add_class,$current,$accesstypes,$othertitle, |
|
$usertypes,$types,$domhelpdesk) = @_; |
|
return unless ((ref($accesstypes) eq 'ARRAY') && (ref($domhelpdesk) eq 'HASH')); |
|
my %lt = &Apache::lonlocal::texthash( |
|
'rou' => 'Role usage', |
|
'whi' => 'Which helpdesk personnel may use this role?', |
|
'all' => 'All', |
|
'none' => 'None', |
|
'status' => 'Determined based on institutional status', |
|
'inc' => 'Include all, but exclude specific personnel', |
|
'exc' => 'Exclude all, but include specific personnel', |
|
); |
|
my %usecheck = ( |
|
all => ' checked="checked"', |
|
); |
|
my %displaydiv = ( |
|
status => 'none', |
|
inc => 'none', |
|
exc => 'none', |
|
priv => 'block', |
|
); |
|
my $output; |
|
if (ref($current) eq 'HASH') { |
|
if (($current->{'access'} ne '') && ($current->{'access'} ne 'all')) { |
|
if (grep(/^\Q$current->{access}\E$/,@{$accesstypes})) { |
|
$usecheck{$current->{access}} = $usecheck{'all'}; |
|
delete($usecheck{'all'}); |
|
if ($current->{access} =~ /^(status|inc|exc)$/) { |
|
my $access = $1; |
|
$displaydiv{$access} = 'inline'; |
|
} elsif ($current->{access} eq 'none') { |
|
$displaydiv{'priv'} = 'none'; |
|
} |
|
} |
|
} |
|
} |
|
$output = '<fieldset id="'.$prefix.$num.'_usage"><legend>'.$lt{'rou'}.'</legend>'. |
|
'<p>'.$lt{'whi'}.'</p>'; |
|
foreach my $access (@{$accesstypes}) { |
|
$output .= '<p><label><input type="radio" name="'.$prefix.$num.'_access" value="'.$access.'" '.$usecheck{$access}. |
|
' onclick="helpdeskAccess('."'$num'".');" />'. |
|
$lt{$access}.'</label>'; |
|
if ($access eq 'status') { |
|
$output .= '<div id="'.$prefix.$num.'_bystatus" style="display:'.$displaydiv{$access}.'">'. |
|
&Apache::lonuserutils::adhoc_status_types($dom,$prefix,$num,$current->{$access}, |
|
$othertitle,$usertypes,$types). |
|
'</div>'; |
|
} elsif (($access eq 'inc') && (keys(%{$domhelpdesk}) > 0)) { |
|
$output .= '<div id="'.$prefix.$num.'_notinc" style="display:'.$displaydiv{$access}.'">'. |
|
&Apache::lonuserutils::adhoc_staff($access,$prefix,$num,$current->{$access},$domhelpdesk). |
|
'</div>'; |
|
} elsif (($access eq 'exc') && (keys(%{$domhelpdesk}) > 0)) { |
|
$output .= '<div id="'.$prefix.$num.'_notexc" style="display:'.$displaydiv{$access}.'">'. |
|
&Apache::lonuserutils::adhoc_staff($access,$prefix,$num,$current->{$access},$domhelpdesk). |
|
'</div>'; |
|
} |
|
$output .= '</p>'; |
|
} |
|
$output .= '</fieldset>'; |
|
return $output; |
|
} |
|
|
sub radiobutton_prefs { |
sub radiobutton_prefs { |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick, |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick, |
$additional,$align) = @_; |
$additional,$align) = @_; |
Line 3879 sub print_loadbalancing {
|
Line 4467 sub print_loadbalancing {
|
my ($numspares,@spares) = &count_servers($lonhost,%servers); |
my ($numspares,@spares) = &count_servers($lonhost,%servers); |
my @sparestypes = ('primary','default'); |
my @sparestypes = ('primary','default'); |
my %typetitles = &sparestype_titles(); |
my %typetitles = &sparestype_titles(); |
|
my %hostherechecked = ( |
|
no => ' checked="checked"', |
|
); |
foreach my $sparetype (@sparestypes) { |
foreach my $sparetype (@sparestypes) { |
my $targettable; |
my $targettable; |
for (my $i=0; $i<$numspares; $i++) { |
for (my $i=0; $i<$numspares; $i++) { |
Line 3924 sub print_loadbalancing {
|
Line 4515 sub print_loadbalancing {
|
$datatable .= '<i>'.$typetitles{$sparetype}.'</i><br />'. |
$datatable .= '<i>'.$typetitles{$sparetype}.'</i><br />'. |
'<table><tr>'.$targettable.'</tr></table><br />'; |
'<table><tr>'.$targettable.'</tr></table><br />'; |
} |
} |
|
$hostherechecked{$sparetype} = ''; |
|
if (ref($currtargets{$lonhost}) eq 'HASH') { |
|
if (ref($currtargets{$lonhost}{$sparetype}) eq 'ARRAY') { |
|
if (grep(/^\Q$lonhost\E$/,@{$currtargets{$lonhost}{$sparetype}})) { |
|
$hostherechecked{$sparetype} = ' checked="checked"'; |
|
$hostherechecked{'no'} = ''; |
|
} |
|
} |
|
} |
|
} |
|
$datatable .= &mt('Hosting on balancer itself').'<br />'. |
|
'<label><input type="radio" name="loadbalancing_target_'.$balnum.'_hosthere" value="no"'. |
|
$hostherechecked{'no'}.' />'.&mt('No').'</label><br />'; |
|
foreach my $sparetype (@sparestypes) { |
|
$datatable .= '<label><input type="radio" name="loadbalancing_target_'.$balnum.'_hosthere" '. |
|
'value="'.$sparetype.'"'.$hostherechecked{$sparetype}.' /><i>'.$typetitles{$sparetype}. |
|
'</i></label><br />'; |
} |
} |
$datatable .= '</div></td></tr>'. |
$datatable .= '</div></td></tr>'. |
&loadbalancing_rules($dom,$intdom,$currrules{$lonhost}, |
&loadbalancing_rules($dom,$intdom,$currrules{$lonhost}, |
Line 4141 sub sparestype_titles {
|
Line 4749 sub sparestype_titles {
|
|
|
sub contact_titles { |
sub contact_titles { |
my %titles = &Apache::lonlocal::texthash ( |
my %titles = &Apache::lonlocal::texthash ( |
'supportemail' => 'Support E-mail address', |
'supportemail' => 'Support E-mail address', |
'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 for this domain's users", |
'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)', |
'otherdomsmail' => 'Helpdesk requests for other (unconfigured) domains', |
'requestsmail' => 'E-mail from course requests requiring approval', |
'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)', |
'updatesmail' => 'E-mail from nightly check of LON-CAPA module integrity/updates', |
'requestsmail' => 'E-mail from course requests requiring approval', |
|
'updatesmail' => 'E-mail from nightly check of LON-CAPA module integrity/updates', |
'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID', |
'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID', |
); |
); |
my %short_titles = &Apache::lonlocal::texthash ( |
my %short_titles = &Apache::lonlocal::texthash ( |
Line 4158 sub contact_titles {
|
Line 4767 sub contact_titles {
|
return (\%titles,\%short_titles); |
return (\%titles,\%short_titles); |
} |
} |
|
|
|
sub helpform_fields { |
|
my %titles = &Apache::lonlocal::texthash ( |
|
'username' => 'Name', |
|
'user' => 'Username/domain', |
|
'phone' => 'Phone', |
|
'cc' => 'Cc e-mail', |
|
'course' => 'Course Details', |
|
'section' => 'Sections', |
|
'screenshot' => 'File upload', |
|
); |
|
my @fields = ('username','phone','user','course','section','cc','screenshot'); |
|
my %possoptions = ( |
|
username => ['yes','no','req'], |
|
phone => ['yes','no','req'], |
|
user => ['yes','no'], |
|
cc => ['yes','no'], |
|
course => ['yes','no'], |
|
section => ['yes','no'], |
|
screenshot => ['yes','no'], |
|
); |
|
my %fieldoptions = &Apache::lonlocal::texthash ( |
|
'yes' => 'Optional', |
|
'req' => 'Required', |
|
'no' => "Not shown", |
|
); |
|
return (\@fields,\%titles,\%fieldoptions,\%possoptions); |
|
} |
|
|
sub tool_titles { |
sub tool_titles { |
my %titles = &Apache::lonlocal::texthash ( |
my %titles = &Apache::lonlocal::texthash ( |
aboutme => 'Personal web page', |
aboutme => 'Personal web page', |
Line 6165 sub modify_login {
|
Line 6802 sub modify_login {
|
$errors .= '<li><span class="LC_error">'.$puberror.'</span></li>'; |
$errors .= '<li><span class="LC_error">'.$puberror.'</span></li>'; |
if ((grep(/^\Q$lang\E$/,@currlangs)) && |
if ((grep(/^\Q$lang\E$/,@currlangs)) && |
(!grep(/^\Q$lang\E$/,@delurls))) { |
(!grep(/^\Q$lang\E$/,@delurls))) { |
|
|
$loginhash{'login'}{'helpurl'}{$lang} = $domconfig{'login'}{'helpurl'}{$lang}; |
$loginhash{'login'}{'helpurl'}{$lang} = $domconfig{'login'}{'helpurl'}{$lang}; |
} |
} |
} |
} |
Line 6189 sub modify_login {
|
Line 6825 sub modify_login {
|
if ($domservers{$lonhost}) { |
if ($domservers{$lonhost}) { |
if (ref($domconfig{'login'}{'headtag'}{$lonhost}) eq 'HASH') { |
if (ref($domconfig{'login'}{'headtag'}{$lonhost}) eq 'HASH') { |
$currheadtagurls{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'url'}; |
$currheadtagurls{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'url'}; |
$currexempt{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'exempt'} |
$currexempt{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'exempt'}; |
} |
} |
} |
} |
} |
} |
Line 6259 sub modify_login {
|
Line 6895 sub modify_login {
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
} |
} |
} |
} |
|
|
&process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'}); |
&process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'}); |
|
|
my $defaulthelpfile = '/adm/loginproblems.html'; |
my $defaulthelpfile = '/adm/loginproblems.html'; |
Line 7495 sub modify_quotas {
|
Line 8130 sub modify_quotas {
|
} |
} |
if ($env{'form.validationdc'}) { |
if ($env{'form.validationdc'}) { |
my $newval = $env{'form.validationdc'}; |
my $newval = $env{'form.validationdc'}; |
my %domcoords = &get_active_dcs($dom); |
my %domcoords = &Apache::lonnet::get_active_domroles($dom,['dc']); |
if (exists($domcoords{$newval})) { |
if (exists($domcoords{$newval})) { |
$confhash{'validation'}{'dc'} = $newval; |
$confhash{'validation'}{'dc'} = $newval; |
} |
} |
Line 8231 sub modify_autocreate {
|
Line 8866 sub modify_autocreate {
|
$newvals{$item} = 0 if ($newvals{$item} eq ''); |
$newvals{$item} = 0 if ($newvals{$item} eq ''); |
} |
} |
$newvals{'xmldc'} = $env{'form.autocreate_xmldc'}; |
$newvals{'xmldc'} = $env{'form.autocreate_xmldc'}; |
my %domcoords = &get_active_dcs($dom); |
my %domcoords = &Apache::lonnet::get_active_domroles($dom,['dc']); |
unless (exists($domcoords{$newvals{'xmldc'}})) { |
unless (exists($domcoords{$newvals{'xmldc'}})) { |
$newvals{'xmldc'} = ''; |
$newvals{'xmldc'} = ''; |
} |
} |
Line 8296 sub modify_directorysrch {
|
Line 8931 sub modify_directorysrch {
|
$currdirsrch{$key} = $domconfig{'directorysrch'}{$key}; |
$currdirsrch{$key} = $domconfig{'directorysrch'}{$key}; |
} |
} |
} |
} |
my %title = ( available => 'Directory search available', |
my %title = ( available => 'Institutional directory search available', |
localonly => 'Other domains can search', |
localonly => 'Other domains can search institution', |
|
lcavailable => 'LON-CAPA directory search available', |
|
lclocalonly => 'Other domains can search LON-CAPA domain', |
searchby => 'Search types', |
searchby => 'Search types', |
searchtypes => 'Search latitude'); |
searchtypes => 'Search latitude'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
Line 8371 sub modify_directorysrch {
|
Line 9008 sub modify_directorysrch {
|
my %dirsrch_hash = ( |
my %dirsrch_hash = ( |
directorysrch => { available => $env{'form.dirsrch_available'}, |
directorysrch => { available => $env{'form.dirsrch_available'}, |
cansearch => \@cansearch, |
cansearch => \@cansearch, |
localonly => $env{'form.dirsrch_localonly'}, |
localonly => $env{'form.dirsrch_instlocalonly'}, |
|
lclocalonly => $env{'form.dirsrch_domlocalonly'}, |
|
lcavailable => $env{'form.dirsrch_domavailable'}, |
searchby => \@searchby, |
searchby => \@searchby, |
searchtypes => \@searchtypes, |
searchtypes => \@searchtypes, |
} |
} |
Line 8388 sub modify_directorysrch {
|
Line 9027 sub modify_directorysrch {
|
$changes{'available'} = 1; |
$changes{'available'} = 1; |
} |
} |
} |
} |
|
if (exists($currdirsrch{'lcavailable'})) { |
|
if ($currdirsrch{'lcavailable'} ne $env{'form.dirsrch_domavailable'}) { |
|
$changes{'lcavailable'} = 1; |
|
} |
|
} else { |
|
if ($env{'form.dirsrch_lcavailable'} eq '1') { |
|
$changes{'lcavailable'} = 1; |
|
} |
|
} |
if (exists($currdirsrch{'localonly'})) { |
if (exists($currdirsrch{'localonly'})) { |
if ($currdirsrch{'localonly'} ne $env{'form.dirsrch_localonly'}) { |
if ($currdirsrch{'localonly'} ne $env{'form.dirsrch_instlocalonly'}) { |
$changes{'localonly'} = 1; |
$changes{'localonly'} = 1; |
} |
} |
} else { |
} else { |
if ($env{'form.dirsrch_localonly'} eq '1') { |
if ($env{'form.dirsrch_instlocalonly'} eq '1') { |
$changes{'localonly'} = 1; |
$changes{'localonly'} = 1; |
} |
} |
} |
} |
|
if (exists($currdirsrch{'lclocalonly'})) { |
|
if ($currdirsrch{'lclocalonly'} ne $env{'form.dirsrch_domlocalonly'}) { |
|
$changes{'lclocalonly'} = 1; |
|
} |
|
} else { |
|
if ($env{'form.dirsrch_domlocalonly'} eq '1') { |
|
$changes{'lclocalonly'} = 1; |
|
} |
|
} |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if ($changes{'available'}) { |
if ($changes{'available'}) { |
$resulttext .= '<li>'.&mt("$title{'available'} set to: $offon[$env{'form.dirsrch_available'}]").'</li>'; |
$resulttext .= '<li>'.&mt("$title{'available'} set to: $offon[$env{'form.dirsrch_available'}]").'</li>'; |
} |
} |
|
if ($changes{'lcavailable'}) { |
|
$resulttext .= '<li>'.&mt("$title{'lcavailable'} set to: $offon[$env{'form.dirsrch_domavailable'}]").'</li>'; |
|
} |
if ($changes{'localonly'}) { |
if ($changes{'localonly'}) { |
$resulttext .= '<li>'.&mt("$title{'localonly'} set to: $otherdoms[$env{'form.dirsrch_localonly'}]").'</li>'; |
$resulttext .= '<li>'.&mt("$title{'localonly'} set to: $otherdoms[$env{'form.dirsrch_instlocalonly'}]").'</li>'; |
|
} |
|
if ($changes{'lclocalonly'}) { |
|
$resulttext .= '<li>'.&mt("$title{'lclocalonly'} set to: $otherdoms[$env{'form.dirsrch_domlocalonly'}]").'</li>'; |
} |
} |
|
|
if (ref($changes{'cansearch'}) eq 'ARRAY') { |
if (ref($changes{'cansearch'}) eq 'ARRAY') { |
my $chgtext; |
my $chgtext; |
if (ref($usertypes) eq 'HASH') { |
if (ref($usertypes) eq 'HASH') { |
Line 8456 sub modify_directorysrch {
|
Line 9118 sub modify_directorysrch {
|
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = &mt('No changes made to institution directory search settings'); |
$resulttext = &mt('No changes made to directory search settings'); |
} |
} |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
Line 8473 sub modify_contacts {
|
Line 9135 sub modify_contacts {
|
$currsetting{$key} = $domconfig{'contacts'}{$key}; |
$currsetting{$key} = $domconfig{'contacts'}{$key}; |
} |
} |
} |
} |
my (%others,%to,%bcc); |
my (%others,%to,%bcc,%includestr,%includeloc); |
my @contacts = ('supportemail','adminemail'); |
my @contacts = ('supportemail','adminemail'); |
my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail', |
my @mailings = ('errormail','packagesmail','helpdeskmail','otherdomsmail', |
'requestsmail','updatesmail','idconflictsmail'); |
'lonstatusmail','requestsmail','updatesmail','idconflictsmail'); |
my @toggles = ('reporterrors','reportupdates'); |
my @toggles = ('reporterrors','reportupdates'); |
|
my ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields(); |
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 8487 sub modify_contacts {
|
Line 9150 sub modify_contacts {
|
} else { |
} else { |
$contacts_hash{contacts}{$type}{$item} = 0; |
$contacts_hash{contacts}{$type}{$item} = 0; |
} |
} |
} |
} |
$others{$type} = $env{'form.'.$type.'_others'}; |
$others{$type} = $env{'form.'.$type.'_others'}; |
$contacts_hash{contacts}{$type}{'others'} = $others{$type}; |
$contacts_hash{contacts}{$type}{'others'} = $others{$type}; |
if ($type eq 'helpdeskmail') { |
if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) { |
$bcc{$type} = $env{'form.'.$type.'_bcc'}; |
$bcc{$type} = $env{'form.'.$type.'_bcc'}; |
$contacts_hash{contacts}{$type}{'bcc'} = $bcc{$type}; |
$contacts_hash{contacts}{$type}{'bcc'} = $bcc{$type}; |
|
if (($env{'form.'.$type.'_includestr'} ne '') && ($env{'form.'.$type.'_includeloc'} =~ /^s|b$/)) { |
|
$includestr{$type} = $env{'form.'.$type.'_includestr'}; |
|
$includeloc{$type} = $env{'form.'.$type.'_includeloc'}; |
|
$contacts_hash{contacts}{$type}{'include'} = $includeloc{$type}.':'.&escape($includestr{$type}); |
|
} |
} |
} |
} |
} |
foreach my $item (@contacts) { |
foreach my $item (@contacts) { |
Line 8504 sub modify_contacts {
|
Line 9172 sub modify_contacts {
|
$contacts_hash{'contacts'}{$item} = $env{'form.'.$item}; |
$contacts_hash{'contacts'}{$item} = $env{'form.'.$item}; |
} |
} |
} |
} |
|
if ((ref($fields) eq 'ARRAY') && (ref($possoptions) eq 'HASH')) { |
|
foreach my $field (@{$fields}) { |
|
if (ref($possoptions->{$field}) eq 'ARRAY') { |
|
my $value = $env{'form.helpform_'.$field}; |
|
$value =~ s/^\s+|\s+$//g; |
|
if (grep(/^\Q$value\E$/,@{$possoptions->{$field}})) { |
|
$contacts_hash{contacts}{'helpform'}{$field} = $value; |
|
if ($field eq 'screenshot') { |
|
$env{'form.helpform_maxsize'} =~ s/^\s+|\s+$//g; |
|
if ($env{'form.helpform_maxsize'} =~ /^\d+\.?\d*$/) { |
|
$contacts_hash{contacts}{'helpform'}{'maxsize'} = $env{'form.helpform_maxsize'}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
if (keys(%currsetting) > 0) { |
if (keys(%currsetting) > 0) { |
foreach my $item (@contacts) { |
foreach my $item (@contacts) { |
if ($to{$item} ne $currsetting{$item}) { |
if ($to{$item} ne $currsetting{$item}) { |
Line 8523 sub modify_contacts {
|
Line 9208 sub modify_contacts {
|
if ($others{$type} ne $currsetting{$type}{'others'}) { |
if ($others{$type} ne $currsetting{$type}{'others'}) { |
push(@{$changes{$type}},'others'); |
push(@{$changes{$type}},'others'); |
} |
} |
if ($type eq 'helpdeskmail') { |
if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) { |
if ($bcc{$type} ne $currsetting{$type}{'bcc'}) { |
if ($bcc{$type} ne $currsetting{$type}{'bcc'}) { |
push(@{$changes{$type}},'bcc'); |
push(@{$changes{$type}},'bcc'); |
} |
} |
|
my ($currloc,$currstr) = split(/:/,$currsetting{$type}{'include'},2); |
|
if (($includeloc{$type} ne $currloc) || (&escape($includestr{$type}) ne $currstr)) { |
|
push(@{$changes{$type}},'include'); |
|
} |
|
} |
|
} |
|
if (ref($fields) eq 'ARRAY') { |
|
if (ref($currsetting{'helpform'}) eq 'HASH') { |
|
foreach my $field (@{$fields}) { |
|
if ($currsetting{'helpform'}{$field} ne $contacts_hash{'contacts'}{'helpform'}{$field}) { |
|
push(@{$changes{'helpform'}},$field); |
|
} |
|
if (($field eq 'screenshot') && ($contacts_hash{'contacts'}{'helpform'}{'screenshot'} ne 'no')) { |
|
if ($currsetting{'helpform'}{'maxsize'} ne $contacts_hash{'contacts'}{'helpform'}{'maxsize'}) { |
|
push(@{$changes{'helpform'}},'maxsize'); |
|
} |
|
} |
|
} |
|
} else { |
|
foreach my $field (@{$fields}) { |
|
if ($contacts_hash{'contacts'}{'helpform'}{$field} ne 'yes') { |
|
push(@{$changes{'helpform'}},$field); |
|
} |
|
if (($field eq 'screenshot') && ($contacts_hash{'contacts'}{'helpform'}{'screenshot'} ne 'no')) { |
|
if ($contacts_hash{'contacts'}{'helpform'}{'maxsize'} != 1) { |
|
push(@{$changes{'helpform'}},'maxsize'); |
|
} |
|
} |
|
} |
} |
} |
} |
} |
} else { |
} else { |
Line 8536 sub modify_contacts {
|
Line 9250 sub modify_contacts {
|
$default{'errormail'} = 'adminemail'; |
$default{'errormail'} = 'adminemail'; |
$default{'packagesmail'} = 'adminemail'; |
$default{'packagesmail'} = 'adminemail'; |
$default{'helpdeskmail'} = 'supportemail'; |
$default{'helpdeskmail'} = 'supportemail'; |
|
$default{'otherdomsmail'} = 'supportemail'; |
$default{'lonstatusmail'} = 'adminemail'; |
$default{'lonstatusmail'} = 'adminemail'; |
$default{'requestsmail'} = 'adminemail'; |
$default{'requestsmail'} = 'adminemail'; |
$default{'updatesmail'} = 'adminemail'; |
$default{'updatesmail'} = '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; |
} |
} |
} |
} |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
if ((@{$newsetting{$type}} != 1) || ($newsetting{$type}[0] ne $default{$type})) { |
if ((@{$newsetting{$type}} != 1) || ($newsetting{$type}[0] ne $default{$type})) { |
|
|
push(@{$changes{$type}},@{$newsetting{$type}}); |
push(@{$changes{$type}},@{$newsetting{$type}}); |
} |
} |
if ($others{$type} ne '') { |
if ($others{$type} ne '') { |
push(@{$changes{$type}},'others'); |
push(@{$changes{$type}},'others'); |
} |
} |
if ($type eq 'helpdeskmail') { |
if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) { |
if ($bcc{$type} ne '') { |
if ($bcc{$type} ne '') { |
push(@{$changes{$type}},'bcc'); |
push(@{$changes{$type}},'bcc'); |
} |
} |
|
if (($includeloc{$type} =~ /^b|s$/) && ($includestr{$type} ne '')) { |
|
push(@{$changes{$type}},'include'); |
|
} |
|
} |
|
} |
|
if (ref($fields) eq 'ARRAY') { |
|
foreach my $field (@{$fields}) { |
|
if ($contacts_hash{'contacts'}{'helpform'}{$field} ne 'yes') { |
|
push(@{$changes{'helpform'}},$field); |
|
} |
|
if (($field eq 'screenshot') && ($contacts_hash{'contacts'}{'helpform'}{'screenshot'} ne 'no')) { |
|
if ($contacts_hash{'contacts'}{'helpform'}{'maxsize'} != 1) { |
|
push(@{$changes{'helpform'}},'maxsize'); |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
Line 8587 sub modify_contacts {
|
Line 9316 sub modify_contacts {
|
} |
} |
foreach my $type (@mailings) { |
foreach my $type (@mailings) { |
if (ref($changes{$type}) eq 'ARRAY') { |
if (ref($changes{$type}) eq 'ARRAY') { |
$resulttext .= '<li>'.$titles->{$type}.': '; |
if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) { |
|
$resulttext .= '<li>'.$titles->{$type}.' -- '.&mt('sent to').': '; |
|
} else { |
|
$resulttext .= '<li>'.$titles->{$type}.': '; |
|
} |
my @text; |
my @text; |
foreach my $item (@{$newsetting{$type}}) { |
foreach my $item (@{$newsetting{$type}}) { |
push(@text,$short_titles->{$item}); |
push(@text,$short_titles->{$item}); |
Line 8595 sub modify_contacts {
|
Line 9328 sub modify_contacts {
|
if ($others{$type} ne '') { |
if ($others{$type} ne '') { |
push(@text,$others{$type}); |
push(@text,$others{$type}); |
} |
} |
$resulttext .= '<span class="LC_cusr_emph">'. |
if (@text) { |
join(', ',@text).'</span>'; |
$resulttext .= '<span class="LC_cusr_emph">'. |
if ($type eq 'helpdeskmail') { |
join(', ',@text).'</span>'; |
|
} |
|
if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) { |
if ($bcc{$type} ne '') { |
if ($bcc{$type} ne '') { |
$resulttext .= ' '.&mt('with Bcc to').': <span class="LC_cusr_emph">'.$bcc{$type}.'</span>'; |
my $bcctext; |
|
if (@text) { |
|
$bcctext = ' '.&mt('with Bcc to'); |
|
} else { |
|
$bcctext = '(Bcc)'; |
|
} |
|
$resulttext .= $bcctext.': <span class="LC_cusr_emph">'.$bcc{$type}.'</span>'; |
|
} elsif (!@text) { |
|
$resulttext .= &mt('No one'); |
|
} |
|
if ($includestr{$type} ne '') { |
|
if ($includeloc{$type} eq 'b') { |
|
$resulttext .= '<br />'.&mt('Text automatically added to e-mail body:').' '.$includestr{$type}; |
|
} elsif ($includeloc{$type} eq 's') { |
|
$resulttext .= '<br />'.&mt('Text automatically added to e-mail subject:').' '.$includestr{$type}; |
|
} |
} |
} |
|
} elsif (!@text) { |
|
$resulttext .= &mt('No recipients'); |
} |
} |
$resulttext .= '</li>'; |
$resulttext .= '</li>'; |
} |
} |
Line 8622 sub modify_contacts {
|
Line 9374 sub modify_contacts {
|
&mt('LON-CAPA core group - MSU'),600,500)). |
&mt('LON-CAPA core group - MSU'),600,500)). |
'</li>'; |
'</li>'; |
} |
} |
|
if ((ref($changes{'helpform'}) eq 'ARRAY') && (ref($fields) eq 'ARRAY')) { |
|
my (@optional,@required,@unused,$maxsizechg); |
|
foreach my $field (@{$changes{'helpform'}}) { |
|
if ($field eq 'maxsize') { |
|
$maxsizechg = 1; |
|
next; |
|
} |
|
if ($contacts_hash{'contacts'}{'helpform'}{$field} eq 'yes') { |
|
push(@optional,$field); |
|
} elsif ($contacts_hash{'contacts'}{'helpform'}{$field} eq 'no') { |
|
push(@unused,$field); |
|
} elsif ($contacts_hash{'contacts'}{'helpform'}{$field} eq 'req') { |
|
push(@required,$field); |
|
} |
|
} |
|
if (@optional) { |
|
$resulttext .= '<li>'. |
|
&mt('Help form fields changed to "Optional": [_1].', |
|
'<span class="LC_cusr_emph">'.join(', ',map { $fieldtitles->{$_}; } @optional)).'</span>'. |
|
'</li>'; |
|
} |
|
if (@required) { |
|
$resulttext .= '<li>'. |
|
&mt('Help form fields changed to "Required": [_1].', |
|
'<span class="LC_cusr_emph">'.join(', ',map { $fieldtitles->{$_}; } @required)).'</span>'. |
|
'</li>'; |
|
} |
|
if (@unused) { |
|
$resulttext .= '<li>'. |
|
&mt('Help form fields changed to "Not shown": [_1].', |
|
'<span class="LC_cusr_emph">'.join(', ',map { $fieldtitles->{$_}; } @unused)).'</span>'. |
|
'</li>'; |
|
} |
|
if ($maxsizechg) { |
|
$resulttext .= '<li>'. |
|
&mt('Max size for file uploaded to help form by logged-in user set to [_1] MB.', |
|
$contacts_hash{'contacts'}{'helpform'}{'maxsize'}). |
|
'</li>'; |
|
|
|
} |
|
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = &mt('No changes made to contact information'); |
$resulttext = &mt('No changes made to contacts and form settings'); |
} |
} |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
Line 10360 sub modify_serverstatuses {
|
Line 11153 sub modify_serverstatuses {
|
} |
} |
|
|
sub modify_helpsettings { |
sub modify_helpsettings { |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($r,$dom,$confname,$lastactref,%domconfig) = @_; |
my ($resulttext,$errors,%changes,%helphash); |
my ($resulttext,$errors,%changes,%helphash); |
my %defaultchecked = ('submitbugs' => 'on'); |
my %defaultchecked = ('submitbugs' => 'on'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my @toggles = ('submitbugs'); |
my @toggles = ('submitbugs'); |
|
my %current = ('submitbugs' => '', |
|
'adhoc' => {}, |
|
); |
if (ref($domconfig{'helpsettings'}) eq 'HASH') { |
if (ref($domconfig{'helpsettings'}) eq 'HASH') { |
foreach my $item (@toggles) { |
%current = %{$domconfig{'helpsettings'}}; |
if ($defaultchecked{$item} eq 'on') { |
} |
if ($domconfig{'helpsettings'}{$item} eq '') { |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
if ($env{'form.'.$item} eq '0') { |
foreach my $item (@toggles) { |
$changes{$item} = 1; |
if ($defaultchecked{$item} eq 'on') { |
} |
if ($current{$item} eq '') { |
} elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) { |
if ($env{'form.'.$item} eq '0') { |
$changes{$item} = 1; |
$changes{$item} = 1; |
} |
} |
} elsif ($defaultchecked{$item} eq 'off') { |
} elsif ($current{$item} ne $env{'form.'.$item}) { |
if ($domconfig{'helpsettings'}{$item} eq '') { |
$changes{$item} = 1; |
if ($env{'form.'.$item} eq '1') { |
} |
$changes{$item} = 1; |
} elsif ($defaultchecked{$item} eq 'off') { |
} |
if ($current{$item} eq '') { |
} elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) { |
if ($env{'form.'.$item} eq '1') { |
$changes{$item} = 1; |
$changes{$item} = 1; |
} |
} |
|
} elsif ($current{$item} ne $env{'form.'.$item}) { |
|
$changes{$item} = 1; |
} |
} |
if (($env{'form.'.$item} eq '0') || ($env{'form.'.$item} eq '1')) { |
} |
$helphash{'helpsettings'}{$item} = $env{'form.'.$item}; |
if (($env{'form.'.$item} eq '0') || ($env{'form.'.$item} eq '1')) { |
|
$helphash{'helpsettings'}{$item} = $env{'form.'.$item}; |
|
} |
|
} |
|
my $maxnum = $env{'form.helproles_maxnum'}; |
|
my $confname = $dom.'-domainconfig'; |
|
my %existing=&Apache::lonnet::dump('roles',$dom,$confname,'rolesdef_'); |
|
my (@allpos,%newsettings,%changedprivs,$newrole); |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
my @accesstypes = ('all','none','status','inc','exc'); |
|
my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh']); |
|
my %lt = &Apache::lonlocal::texthash( |
|
s => 'system', |
|
d => 'domain', |
|
order => 'Display order', |
|
access => 'Role usage', |
|
all => 'All', |
|
none => 'None', |
|
status => 'Determined based on institutional status', |
|
inc => 'Include all, but exclude specific personnel', |
|
exc => 'Exclude all, but include specific personnel', |
|
); |
|
for (my $num=0; $num<=$maxnum; $num++) { |
|
my ($prefix,$identifier,$rolename,%curr); |
|
if ($num == $maxnum) { |
|
next unless ($env{'form.newcusthelp'} == $maxnum); |
|
$identifier = 'custhelp'.$num; |
|
$prefix = 'helproles_'.$num; |
|
$rolename = $env{'form.custhelpname'.$num}; |
|
$rolename=~s/[^A-Za-z0-9]//gs; |
|
next if ($rolename eq ''); |
|
next if (exists($existing{'rolesdef_'.$rolename})); |
|
my %newprivs = &Apache::lonuserutils::custom_role_update($rolename,$identifier); |
|
my $result = &Apache::lonnet::definerole($rolename,$newprivs{'s'},$newprivs{'d'}, |
|
$newprivs{'c'},$confname,$dom); |
|
if ($result ne 'ok') { |
|
$errors .= '<li><span class="LC_error">'. |
|
&mt('An error occurred storing the new custom role: [_1]', |
|
$result).'</span></li>'; |
|
next; |
|
} else { |
|
$changedprivs{$rolename} = \%newprivs; |
|
$newrole = $rolename; |
|
} |
|
} else { |
|
$prefix = 'helproles_'.$num; |
|
$rolename = $env{'form.'.$prefix}; |
|
next if ($rolename eq ''); |
|
next unless (exists($existing{'rolesdef_'.$rolename})); |
|
$identifier = 'custhelp'.$num; |
|
my %newprivs = &Apache::lonuserutils::custom_role_update($rolename,$identifier); |
|
my %currprivs; |
|
($currprivs{'s'},$currprivs{'d'},$currprivs{'c'}) = |
|
split(/\_/,$existing{'rolesdef_'.$rolename}); |
|
foreach my $level ('c','d','s') { |
|
if ($newprivs{$level} ne $currprivs{$level}) { |
|
my $result = &Apache::lonnet::definerole($rolename,$newprivs{'s'},$newprivs{'d'}, |
|
$newprivs{'c'},$confname,$dom); |
|
if ($result ne 'ok') { |
|
$errors .= '<li><span class="LC_error">'. |
|
&mt('An error occurred storing privileges for existing role [_1]: [_2]', |
|
$rolename,$result).'</span></li>'; |
|
} else { |
|
$changedprivs{$rolename} = \%newprivs; |
|
} |
|
last; |
|
} |
|
} |
|
if (ref($current{'adhoc'}) eq 'HASH') { |
|
if (ref($current{'adhoc'}{$rolename}) eq 'HASH') { |
|
%curr = %{$current{'adhoc'}{$rolename}}; |
|
} |
|
} |
|
} |
|
my $newpos = $env{'form.'.$prefix.'_pos'}; |
|
$newpos =~ s/\D+//g; |
|
$allpos[$newpos] = $rolename; |
|
my $newdesc = $env{'form.'.$prefix.'_desc'}; |
|
$helphash{'helpsettings'}{'adhoc'}{$rolename}{'desc'} = $newdesc; |
|
if ($curr{'desc'}) { |
|
if ($curr{'desc'} ne $newdesc) { |
|
$changes{'customrole'}{$rolename}{'desc'} = 1; |
|
$newsettings{$rolename}{'desc'} = $newdesc; |
|
} |
|
} elsif ($newdesc ne '') { |
|
$changes{'customrole'}{$rolename}{'desc'} = 1; |
|
$newsettings{$rolename}{'desc'} = $newdesc; |
|
} |
|
my $access = $env{'form.'.$prefix.'_access'}; |
|
if (grep(/^\Q$access\E$/,@accesstypes)) { |
|
$helphash{'helpsettings'}{'adhoc'}{$rolename}{'access'} = $access; |
|
if ($access eq 'status') { |
|
my @statuses = &Apache::loncommon::get_env_multiple('form.'.$prefix.'_status'); |
|
if (scalar(@statuses) == 0) { |
|
$helphash{'helpsettings'}{'adhoc'}{$rolename}{'access'} = 'none'; |
|
} else { |
|
my (@shownstatus,$numtypes); |
|
$helphash{'helpsettings'}{'adhoc'}{$rolename}{$access} = []; |
|
if (ref($types) eq 'ARRAY') { |
|
$numtypes = scalar(@{$types}); |
|
foreach my $type (sort(@statuses)) { |
|
if ($type eq 'default') { |
|
push(@{$helphash{'helpsettings'}{'adhoc'}{$rolename}{$access}},$type); |
|
} elsif (grep(/^\Q$type\E$/,@{$types})) { |
|
push(@{$helphash{'helpsettings'}{'adhoc'}{$rolename}{$access}},$type); |
|
push(@shownstatus,$usertypes->{$type}); |
|
} |
|
} |
|
} |
|
if (grep(/^default$/,@statuses)) { |
|
push(@shownstatus,$othertitle); |
|
} |
|
if (scalar(@shownstatus) == 1+$numtypes) { |
|
$helphash{'helpsettings'}{'adhoc'}{$rolename}{'access'} = 'all'; |
|
delete($helphash{'helpsettings'}{'adhoc'}{$rolename}{'status'}); |
|
} else { |
|
$newsettings{$rolename}{'status'} = join(' '.&mt('or').' ',@shownstatus); |
|
if (ref($curr{'status'}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($helphash{'helpsettings'}{'adhoc'}{$rolename}{$access},$curr{$access}); |
|
if (@diffs) { |
|
$changes{'customrole'}{$rolename}{$access} = 1; |
|
} |
|
} elsif (@{$helphash{'helpsettings'}{'adhoc'}{$rolename}{$access}}) { |
|
$changes{'customrole'}{$rolename}{$access} = 1; |
|
} |
|
} |
|
} |
|
} elsif (($access eq 'inc') || ($access eq 'exc')) { |
|
my @personnel = &Apache::loncommon::get_env_multiple('form.'.$prefix.'_staff_'.$access); |
|
my @newspecstaff; |
|
$helphash{'helpsettings'}{'adhoc'}{$rolename}{$access} = []; |
|
foreach my $person (sort(@personnel)) { |
|
if ($domhelpdesk{$person}) { |
|
push(@{$helphash{'helpsettings'}{'adhoc'}{$rolename}{$access}},$person); |
|
} |
|
} |
|
if (ref($curr{$access}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($helphash{'helpsettings'}{'adhoc'}{$rolename}{$access},$curr{$access}); |
|
if (@diffs) { |
|
$changes{'customrole'}{$rolename}{$access} = 1; |
|
} |
|
} elsif (@{$helphash{'helpsettings'}{'adhoc'}{$rolename}{$access}}) { |
|
$changes{'customrole'}{$rolename}{$access} = 1; |
|
} |
|
foreach my $person (@{$helphash{'helpsettings'}{'adhoc'}{$rolename}{$access}}) { |
|
my ($uname,$udom) = split(/:/,$person); |
|
push(@newspecstaff,&Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$udom,'lastname'),$uname,$udom)); |
|
} |
|
$newsettings{$rolename}{$access} = join(', ',sort(@newspecstaff)); |
|
} |
|
} else { |
|
$helphash{'helpsettings'}{'adhoc'}{$rolename}{'access'}= 'all'; |
|
} |
|
unless ($curr{'access'} eq $access) { |
|
$changes{'customrole'}{$rolename}{'access'} = 1; |
|
$newsettings{$rolename}{'access'} = $lt{$helphash{'helpsettings'}{'adhoc'}{$rolename}{'access'}}; |
|
} |
|
} |
|
if (@allpos > 0) { |
|
my $idx = 0; |
|
foreach my $rolename (@allpos) { |
|
if ($rolename ne '') { |
|
$helphash{'helpsettings'}{'adhoc'}{$rolename}{'order'} = $idx; |
|
if (ref($current{'adhoc'}) eq 'HASH') { |
|
if (ref($current{'adhoc'}{$rolename}) eq 'HASH') { |
|
if ($current{'adhoc'}{$rolename}{'order'} ne $idx) { |
|
$changes{'customrole'}{$rolename}{'order'} = 1; |
|
$newsettings{$rolename}{'order'} = $idx+1; |
|
} |
|
} |
|
} |
|
$idx ++; |
} |
} |
} |
} |
} |
} |
Line 10393 sub modify_helpsettings {
|
Line 11362 sub modify_helpsettings {
|
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
$putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom); |
$putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
$resulttext = &mt('Changes made:').'<ul>'; |
if (ref($helphash{'helpsettings'}) eq 'HASH') { |
|
$domdefaults{'submitbugs'} = $helphash{'helpsettings'}{'submitbugs'}; |
|
if (ref($helphash{'helpsettings'}{'adhoc'}) eq 'HASH') { |
|
$domdefaults{'adhocroles'} = $helphash{'helpsettings'}{'adhoc'}; |
|
} |
|
} |
|
my $cachetime = 24*60*60; |
|
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'domdefaults'} = 1; |
|
} |
|
} else { |
|
$errors .= '<li><span class="LC_error">'. |
|
&mt('An error occurred storing the settings: [_1]', |
|
$putresult).'</span></li>'; |
|
} |
|
} |
|
if ((keys(%changes) && ($putresult eq 'ok')) || (keys(%changedprivs))) { |
|
$resulttext = &mt('Changes made:').'<ul>'; |
|
my (%shownprivs,@levelorder); |
|
@levelorder = ('c','d','s'); |
|
if ((keys(%changes)) && ($putresult eq 'ok')) { |
foreach my $item (sort(keys(%changes))) { |
foreach my $item (sort(keys(%changes))) { |
if ($item eq 'submitbugs') { |
if ($item eq 'submitbugs') { |
$resulttext .= '<li>'.&mt('Display link to: [_1] set to "'.$offon[$env{'form.'.$item}].'".', |
$resulttext .= '<li>'.&mt('Display link to: [_1] set to "'.$offon[$env{'form.'.$item}].'".', |
&Apache::loncommon::modal_link('http://bugs.loncapa.org', |
&Apache::loncommon::modal_link('http://bugs.loncapa.org', |
&mt('LON-CAPA bug tracker'),600,500)).'</li>'; |
&mt('LON-CAPA bug tracker'),600,500)).'</li>'; |
|
} elsif ($item eq 'customrole') { |
|
if (ref($changes{'customrole'}) eq 'HASH') { |
|
my @keyorder = ('order','desc','access','status','exc','inc'); |
|
my %keytext = &Apache::lonlocal::texthash( |
|
order => 'Order', |
|
desc => 'Role description', |
|
access => 'Role usage', |
|
status => 'Allowed instituional types', |
|
exc => 'Allowed personnel', |
|
inc => 'Disallowed personnel', |
|
); |
|
foreach my $role (sort(keys(%{$changes{'customrole'}}))) { |
|
if (ref($changes{'customrole'}{$role}) eq 'HASH') { |
|
if ($role eq $newrole) { |
|
$resulttext .= '<li>'.&mt('New custom role added: [_1]', |
|
$role).'<ul>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Existing custom role modified: [_1]', |
|
$role).'<ul>'; |
|
} |
|
foreach my $key (@keyorder) { |
|
if ($changes{'customrole'}{$role}{$key}) { |
|
$resulttext .= '<li>'.&mt("[_1] set to: [_2]", |
|
$keytext{$key},$newsettings{$role}{$key}). |
|
'</li>'; |
|
} |
|
} |
|
if (ref($changedprivs{$role}) eq 'HASH') { |
|
$shownprivs{$role} = 1; |
|
$resulttext .= '<li>'.&mt('Privileges set to :').'<ul>'; |
|
foreach my $level (@levelorder) { |
|
foreach my $item (split(/\:/,$changedprivs{$role}{$level})) { |
|
next if ($item eq ''); |
|
my ($priv) = split(/\&/,$item,2); |
|
if (&Apache::lonnet::plaintext($priv)) { |
|
$resulttext .= '<li>'.&Apache::lonnet::plaintext($priv); |
|
unless ($level eq 'c') { |
|
$resulttext .= ' ('.$lt{$level}.')'; |
|
} |
|
$resulttext .= '</li>'; |
|
} |
|
} |
|
} |
|
$resulttext .= '</ul>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (keys(%changedprivs)) { |
|
foreach my $role (sort(keys(%changedprivs))) { |
|
unless ($shownprivs{$role}) { |
|
$resulttext .= '<li>'.&mt('Existing custom role modified: [_1]', |
|
$role).'<ul>'. |
|
'<li>'.&mt('Privileges set to :').'<ul>'; |
|
foreach my $level (@levelorder) { |
|
foreach my $item (split(/\:/,$changedprivs{$role}{$level})) { |
|
next if ($item eq ''); |
|
my ($priv) = split(/\&/,$item,2); |
|
if (&Apache::lonnet::plaintext($priv)) { |
|
$resulttext .= '<li>'.&Apache::lonnet::plaintext($priv); |
|
unless ($level eq 'c') { |
|
$resulttext .= ' ('.$lt{$level}.')'; |
|
} |
|
$resulttext .= '</li>'; |
|
} |
|
} |
|
} |
|
$resulttext .= '</ul></li></ul></li>'; |
} |
} |
} |
} |
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made to help settings'); |
|
$errors .= '<li><span class="LC_error">'. |
|
&mt('An error occurred storing the settings: [_1]', |
|
$putresult).'</span></li>'; |
|
} |
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made to help settings'); |
} |
} |
if ($errors) { |
if ($errors) { |
$resulttext .= '<br />'.&mt('The following errors occurred: ').'<ul>'. |
$resulttext .= '<br />'.&mt('The following errors occurred: ').'<ul>'. |
$errors.'</ul>'; |
$errors.'</ul>'; |
} |
} |
return $resulttext; |
return $resulttext; |
} |
} |
Line 11407 sub modify_loadbalancing {
|
Line 12466 sub modify_loadbalancing {
|
push(@offloadto,$target); |
push(@offloadto,$target); |
} |
} |
} |
} |
$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto; |
|
} |
} |
|
if ($env{'form.loadbalancing_target_'.$i.'_hosthere'} eq $sparetype) { |
|
unless(grep(/^\Q$balancer\E$/,@offloadto)) { |
|
push(@offloadto,$balancer); |
|
} |
|
} |
|
$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto; |
} |
} |
if (ref($currtargets{$balancer}) eq 'HASH') { |
if (ref($currtargets{$balancer}) eq 'HASH') { |
foreach my $sparetype (@sparestypes) { |
foreach my $sparetype (@sparestypes) { |
Line 11642 sub recurse_cat_deletes {
|
Line 12706 sub recurse_cat_deletes {
|
return; |
return; |
} |
} |
|
|
sub get_active_dcs { |
|
my ($dom) = @_; |
|
my $now = time; |
|
my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc'],$now,$now); |
|
my %domcoords; |
|
my $numdcs = 0; |
|
foreach my $server (keys(%dompersonnel)) { |
|
foreach my $user (sort(keys(%{$dompersonnel{$server}}))) { |
|
my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user); |
|
$domcoords{$uname.':'.$udom} = $dompersonnel{$server}{$user}; |
|
} |
|
} |
|
return %domcoords; |
|
} |
|
|
|
sub active_dc_picker { |
sub active_dc_picker { |
my ($dom,$numinrow,$inputtype,$name,%currhash) = @_; |
my ($dom,$numinrow,$inputtype,$name,%currhash) = @_; |
my %domcoords = &get_active_dcs($dom); |
my %domcoords = &Apache::lonnet::get_active_domroles($dom,['dc']); |
my @domcoord = keys(%domcoords); |
my @domcoord = keys(%domcoords); |
if (keys(%currhash)) { |
if (keys(%currhash)) { |
foreach my $dc (keys(%currhash)) { |
foreach my $dc (keys(%currhash)) { |