version 1.160.6.15, 2013/02/02 02:54:04
|
version 1.160.6.16, 2013/03/01 21:17:24
|
Line 210 sub handler {
|
Line 210 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','usersessions', |
'serverstatuses','requestcourses','coursedefaults', |
'loadbalancing','requestauthor'],$dom); |
'usersessions','loadbalancing','requestauthor'],$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','usermodification','scantron', |
'usercreation','usermodification','scantron', |
'requestcourses','requestauthor','coursecategories', |
'requestcourses','requestauthor','coursecategories', |
'serverstatuses','usersessions'); |
'serverstatuses','coursedefaults','usersessions'); |
my %existing; |
my %existing; |
if (ref($domconfig{'loadbalancing'}) eq 'HASH') { |
if (ref($domconfig{'loadbalancing'}) eq 'HASH') { |
%existing = %{$domconfig{'loadbalancing'}}; |
%existing = %{$domconfig{'loadbalancing'}}; |
Line 353 sub handler {
|
Line 353 sub handler {
|
col3 => 'Specific IPs', |
col3 => 'Specific IPs', |
}], |
}], |
}, |
}, |
|
'coursedefaults' => |
|
{text => 'Course/Community defaults', |
|
help => 'Domain_Configuration_Course_Defaults', |
|
header => [{col1 => 'Defaults which can be overridden for each course by a DC', |
|
col2 => 'Value',},], |
|
}, |
'usersessions' => |
'usersessions' => |
{text => 'User session hosting/offloading', |
{text => 'User session hosting/offloading', |
help => 'Domain_Configuration_User_Sessions', |
help => 'Domain_Configuration_User_Sessions', |
Line 395 sub handler {
|
Line 401 sub handler {
|
if ($phase eq 'process') { |
if ($phase eq 'process') { |
&Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles); |
&Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles); |
} elsif ($phase eq 'display') { |
} elsif ($phase eq 'display') { |
my $js = &recaptcha_js(); |
my $js = &recaptcha_js(). |
|
&credits_js(); |
if ((keys(%servers) > 1) || (keys(%existing) > 0)) { |
if ((keys(%servers) > 1) || (keys(%existing) > 0)) { |
my ($othertitle,$usertypes,$types) = |
my ($othertitle,$usertypes,$types) = |
&Apache::loncommon::sorted_inst_types($dom); |
&Apache::loncommon::sorted_inst_types($dom); |
Line 513 sub process_changes {
|
Line 520 sub process_changes {
|
$output = &modify_quotas($dom,$action,%domconfig); |
$output = &modify_quotas($dom,$action,%domconfig); |
} elsif ($action eq 'requestauthor') { |
} elsif ($action eq 'requestauthor') { |
$output = &modify_quotas($dom,$action,%domconfig); |
$output = &modify_quotas($dom,$action,%domconfig); |
|
} elsif ($action eq 'coursedefaults') { |
|
$output = &modify_coursedefaults($dom,%domconfig); |
} elsif ($action eq 'usersessions') { |
} elsif ($action eq 'usersessions') { |
$output = &modify_usersessions($dom,%domconfig); |
$output = &modify_usersessions($dom,%domconfig); |
} elsif ($action eq 'loadbalancing') { |
} elsif ($action eq 'loadbalancing') { |
Line 671 sub print_config_box {
|
Line 680 sub print_config_box {
|
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
&print_usersessions('bottom',$dom,$settings,\$rowtotal); |
&print_usersessions('bottom',$dom,$settings,\$rowtotal); |
$rowtotal ++; |
$rowtotal ++; |
} elsif ($action eq 'coursedefaults') { |
|
$output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'rolecolors') { |
} elsif ($action eq 'rolecolors') { |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
</table> |
</table> |
Line 769 sub print_config_box {
|
Line 776 sub print_config_box {
|
$output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal); |
$output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'loadbalancing') { |
} elsif ($action eq 'loadbalancing') { |
$output .= &print_loadbalancing($dom,$settings,\$rowtotal); |
$output .= &print_loadbalancing($dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'coursedefaults') { |
|
$output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal); |
} |
} |
} |
} |
$output .= ' |
$output .= ' |
Line 1898 sub print_quotas {
|
Line 1907 sub print_quotas {
|
|
|
sub print_requestmail { |
sub print_requestmail { |
my ($dom,$action,$settings,$rowtotal) = @_; |
my ($dom,$action,$settings,$rowtotal) = @_; |
my ($now,$datatable,%dompersonnel,@domcoord,@currapproval,$rows); |
my ($now,$datatable,%currapp,$rows); |
$now = time; |
$now = time; |
$rows = 0; |
|
%dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc'],$now,$now); |
|
foreach my $server (keys(%dompersonnel)) { |
|
foreach my $user (sort(keys(%{$dompersonnel{$server}}))) { |
|
my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user); |
|
if (!grep(/^$uname:$udom$/,@domcoord)) { |
|
push(@domcoord,$uname.':'.$udom); |
|
} |
|
} |
|
} |
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'notify'}) eq 'HASH') { |
if (ref($settings->{'notify'}) eq 'HASH') { |
if ($settings->{'notify'}{'approval'} ne '') { |
if ($settings->{'notify'}{'approval'} ne '') { |
@currapproval = split(',',$settings->{'notify'}{'approval'}); |
map {$currapp{$_}=1;} split(/,/,$settings->{'notify'}{'approval'}); |
} |
|
} |
|
} |
|
if (@currapproval) { |
|
foreach my $dc (@currapproval) { |
|
unless (grep(/^\Q$dc\E$/,@domcoord)) { |
|
push(@domcoord,$dc); |
|
} |
} |
} |
} |
} |
} |
@domcoord = sort(@domcoord); |
my $numinrow = 2; |
my $numinrow = 4; |
|
my $numdc = @domcoord; |
|
my $css_class = 'class="LC_odd_row"'; |
my $css_class = 'class="LC_odd_row"'; |
my $text; |
my $text; |
if ($action eq 'requestcourses') { |
if ($action eq 'requestcourses') { |
Line 1937 sub print_requestmail {
|
Line 1927 sub print_requestmail {
|
$datatable = '<tr '.$css_class.'>'. |
$datatable = '<tr '.$css_class.'>'. |
' <td>'.$text.'</td>'. |
' <td>'.$text.'</td>'. |
' <td class="LC_left_item">'; |
' <td class="LC_left_item">'; |
if (@domcoord > 0) { |
my ($numdc,$table,$rows) = &active_dc_picker($dom,$numinrow,'checkbox', |
$datatable .= '<table>'; |
'reqapprovalnotify',%currapp); |
for (my $i=0; $i<$numdc; $i++) { |
if ($numdc > 0) { |
my $rem = $i%($numinrow); |
$datatable .= $table; |
if ($rem == 0) { |
|
if ($i > 0) { |
|
$datatable .= '</tr>'; |
|
} |
|
$datatable .= '<tr>'; |
|
$rows ++; |
|
} |
|
my $check = ' '; |
|
if (grep(/^\Q$domcoord[$i]\E$/,@currapproval)) { |
|
$check = ' checked="checked" '; |
|
} |
|
my ($uname,$udom) = split(':',$domcoord[$i]); |
|
my $fullname = &Apache::loncommon::plainname($uname,$udom); |
|
if ($i == $numdc-1) { |
|
my $colsleft = $numinrow-$rem; |
|
if ($colsleft > 1) { |
|
$datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'; |
|
} else { |
|
$datatable .= '<td class="LC_left_item">'; |
|
} |
|
} else { |
|
$datatable .= '<td class="LC_left_item">'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="reqapprovalnotify" '. |
|
'value="'.$domcoord[$i].'"'.$check.'/>'. |
|
$fullname.' ('.$uname.':'.$udom.')</label></span></td>'; |
|
} |
|
$datatable .= '</tr></table>'; |
|
} else { |
} else { |
$datatable .= &mt('There are no active Domain Coordinators'); |
$datatable .= &mt('There are no active Domain Coordinators'); |
$rows ++; |
|
} |
} |
$datatable .='</td></tr>'; |
$datatable .='</td></tr>'; |
$$rowtotal += $rows; |
$$rowtotal += $rows; |
Line 2127 sub print_autoupdate {
|
Line 2087 sub print_autoupdate {
|
|
|
sub print_autocreate { |
sub print_autocreate { |
my ($dom,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my (%createon,%createoff); |
my (%createon,%createoff,%currhash); |
my $curr_dc; |
|
my @types = ('xml','req'); |
my @types = ('xml','req'); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
foreach my $item (@types) { |
foreach my $item (@types) { |
Line 2141 sub print_autocreate {
|
Line 2100 sub print_autocreate {
|
} |
} |
} |
} |
} |
} |
$curr_dc = $settings->{'xmldc'}; |
if ($settings->{'xmldc'} ne '') { |
|
$currhash{$settings->{'xmldc'}} = 1; |
|
} |
} else { |
} else { |
foreach my $item (@types) { |
foreach my $item (@types) { |
$createoff{$item} = ' checked="checked" '; |
$createoff{$item} = ' checked="checked" '; |
Line 2149 sub print_autocreate {
|
Line 2110 sub print_autocreate {
|
} |
} |
} |
} |
$$rowtotal += 2; |
$$rowtotal += 2; |
|
my $numinrow = 2; |
my $datatable='<tr class="LC_odd_row">'. |
my $datatable='<tr class="LC_odd_row">'. |
'<td>'.&mt('Create pending official courses from XML files').'</td>'. |
'<td>'.&mt('Create pending official courses from XML files').'</td>'. |
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
Line 2163 sub print_autocreate {
|
Line 2125 sub print_autocreate {
|
$createon{'req'}.' value="1" />'.&mt('Yes').'</label> '. |
$createon{'req'}.' value="1" />'.&mt('Yes').'</label> '. |
'<label><input type="radio" name="autocreate_req"'. |
'<label><input type="radio" name="autocreate_req"'. |
$createoff{'req'}.' value="0" />'.&mt('No').'</label></span>'; |
$createoff{'req'}.' value="0" />'.&mt('No').'</label></span>'; |
my ($numdc,$dctable) = &active_dc_picker($dom,$curr_dc); |
my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio', |
|
'autocreate_xmldc',%currhash); |
if ($numdc > 1) { |
if ($numdc > 1) { |
$datatable .= '</td></tr><tr class="LC_odd_row"><td>'. |
$datatable .= '</td></tr><tr class="LC_odd_row"><td>'. |
&mt('Course creation processed as: (choose Dom. Coord.)'). |
&mt('Course creation processed as: (choose Dom. Coord.)'). |
'</td><td class="LC_left_item">'.$dctable.'</td></tr>'; |
'</td><td class="LC_left_item">'.$dctable.'</td></tr>'; |
$$rowtotal ++ ; |
|
} else { |
} else { |
$datatable .= $dctable.'</td></tr>'; |
$datatable .= $dctable.'</td></tr>'; |
} |
} |
|
$$rowtotal += $rows; |
return $datatable; |
return $datatable; |
} |
} |
|
|
Line 2390 sub print_helpsettings {
|
Line 2353 sub print_helpsettings {
|
} |
} |
|
|
sub radiobutton_prefs { |
sub radiobutton_prefs { |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_; |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick, |
|
$additional) = @_; |
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
(ref($choices) eq 'HASH')); |
(ref($choices) eq 'HASH')); |
|
|
Line 2416 sub radiobutton_prefs {
|
Line 2380 sub radiobutton_prefs {
|
} |
} |
} |
} |
} |
} |
|
if ($onclick) { |
|
$onclick = ' onclick="'.$onclick.'"'; |
|
} |
foreach my $item (@{$toggles}) { |
foreach my $item (@{$toggles}) { |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= |
$datatable .= |
'<tr'.$css_class.'><td><span class="LC_nobreak">'.$choices->{$item}. |
'<tr'.$css_class.'><td valign="top">'. |
|
'<span class="LC_nobreak">'.$choices->{$item}. |
'</span></td>'. |
'</span></td>'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<label><input type="radio" name="'. |
'<label><input type="radio" name="'. |
$item.'" '.$checkedon{$item}.' value="1" />'.&mt('Yes'). |
$item.'" '.$checkedon{$item}.' value="1"'.$onclick.' />'.&mt('Yes'). |
'</label> <label><input type="radio" name="'.$item.'" '. |
'</label> <label><input type="radio" name="'.$item.'" '. |
$checkedoff{$item}.' value="0" />'.&mt('No').'</label>'. |
$checkedoff{$item}.' value="0"'.$onclick.' />'.&mt('No').'</label>'. |
'</span></td>'. |
'</span>'.$additional. |
|
'</td>'. |
'</tr>'; |
'</tr>'; |
$itemcount ++; |
$itemcount ++; |
} |
} |
Line 2435 sub radiobutton_prefs {
|
Line 2404 sub radiobutton_prefs {
|
|
|
sub print_coursedefaults { |
sub print_coursedefaults { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($css_class,$datatable); |
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles); |
my $itemcount = 1; |
my $itemcount = 1; |
|
my %choices = &Apache::lonlocal::texthash ( |
|
canuse_pdfforms => 'Course/Community users can create/upload PDF forms', |
|
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys', |
|
coursecredits => 'Credits can be specified for courses', |
|
); |
if ($position eq 'top') { |
if ($position eq 'top') { |
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
|
%choices = |
|
&Apache::lonlocal::texthash ( |
|
canuse_pdfforms => 'Course/Community users can create/upload PDF forms', |
|
); |
|
%defaultchecked = ('canuse_pdfforms' => 'off'); |
%defaultchecked = ('canuse_pdfforms' => 'off'); |
@toggles = ('canuse_pdfforms',); |
@toggles = ('canuse_pdfforms'); |
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
\%choices,$itemcount); |
\%choices,$itemcount); |
$$rowtotal += $itemcount; |
|
} else { |
} else { |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
my %choices = |
my ($currdefresponder,$def_official_credits,$def_unofficial_credits); |
&Apache::lonlocal::texthash ( |
my $currusecredits = 0; |
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys', |
|
); |
|
my $currdefresponder; |
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
$currdefresponder = $settings->{'anonsurvey_threshold'}; |
$currdefresponder = $settings->{'anonsurvey_threshold'}; |
|
if (ref($settings->{'coursecredits'}) eq 'HASH') { |
|
$def_official_credits = $settings->{'coursecredits'}->{'official'}; |
|
$def_unofficial_credits = $settings->{'coursecredits'}->{'unofficial'}; |
|
if (($def_official_credits ne '') || ($def_unofficial_credits ne '')) { |
|
$currusecredits = 1; |
|
} |
|
} |
} |
} |
if (!$currdefresponder) { |
if (!$currdefresponder) { |
$currdefresponder = 10; |
$currdefresponder = 10; |
Line 2464 sub print_coursedefaults {
|
Line 2436 sub print_coursedefaults {
|
$currdefresponder = 1; |
$currdefresponder = 1; |
} |
} |
$datatable .= |
$datatable .= |
'<tr'.$css_class.'><td><span class="LC_nobreak">'.$choices{'anonsurvey_threshold'}. |
'<tr'.$css_class.'><td><span class="LC_nobreak">'. |
|
$choices{'anonsurvey_threshold'}. |
'</span></td>'. |
'</span></td>'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<input type="text" name="anonsurvey_threshold"'. |
'<input type="text" name="anonsurvey_threshold"'. |
' value="'.$currdefresponder.'" size="5" /></span>'. |
' value="'.$currdefresponder.'" size="5" /></span>'. |
'</td></tr>'; |
'</td></tr>'."\n"; |
|
$itemcount ++; |
|
my $onclick = 'toggleCredits(this.form);'; |
|
my $display = 'none'; |
|
if ($currusecredits) { |
|
$display = 'block'; |
|
} |
|
my $additional = '<div id="credits" style="display: '.$display.'">'. |
|
'<span class="LC_nobreak">'. |
|
&mt('Default credits for official courses [_1]', |
|
'<input type="text" name="official_credits" value="'. |
|
$def_official_credits.'" size="3" />'). |
|
'</span><br />'. |
|
'<span class="LC_nobreak">'. |
|
&mt('Default credits for unofficial courses [_1]', |
|
'<input type="text" name="unofficial_credits" value="'. |
|
$def_unofficial_credits.'" size="3" />'). |
|
'</span></div>'."\n"; |
|
%defaultchecked = ('coursecredits' => 'off'); |
|
@toggles = ('coursecredits'); |
|
my $current = { |
|
'coursecredits' => $currusecredits, |
|
}; |
|
(my $table,$itemcount) = |
|
&radiobutton_prefs($current,\@toggles,\%defaultchecked, |
|
\%choices,$itemcount,$onclick,$additional); |
|
$datatable .= $table; |
} |
} |
|
$$rowtotal += $itemcount; |
return $datatable; |
return $datatable; |
} |
} |
|
|
Line 7829 sub modify_coursedefaults {
|
Line 7829 sub modify_coursedefaults {
|
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,$errors,%changes,%defaultshash); |
my ($resulttext,$errors,%changes,%defaultshash); |
my %defaultchecked = ('canuse_pdfforms' => 'off'); |
my %defaultchecked = ('canuse_pdfforms' => 'off'); |
my @offon = ('off','on'); |
|
my @toggles = ('canuse_pdfforms'); |
my @toggles = ('canuse_pdfforms'); |
|
|
$defaultshash{'coursedefaults'} = {}; |
$defaultshash{'coursedefaults'} = {}; |
Line 7846 sub modify_coursedefaults {
|
Line 7845 sub modify_coursedefaults {
|
if (($domconfig{'coursedefaults'}{$item} eq '') && |
if (($domconfig{'coursedefaults'}{$item} eq '') && |
($env{'form.'.$item} eq '0')) { |
($env{'form.'.$item} eq '0')) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
} elsif ($domconfig{'coursdefaults'}{$item} ne $env{'form.'.$item}) { |
} elsif ($domconfig{'coursedefaults'}{$item} ne $env{'form.'.$item}) { |
$changes{$item} = 1; |
$changes{$item} = 1; |
} |
} |
} elsif ($defaultchecked{$item} eq 'off') { |
} elsif ($defaultchecked{$item} eq 'off') { |
Line 7871 sub modify_coursedefaults {
|
Line 7870 sub modify_coursedefaults {
|
$changes{'anonsurvey_threshold'} = 1; |
$changes{'anonsurvey_threshold'} = 1; |
} |
} |
} |
} |
|
my $officialcreds = $env{'form.official_credits'}; |
|
$officialcreds =~ s/^[^\d\.]//g; |
|
my $unofficialcreds = $env{'form.unofficial_credits'}; |
|
$unofficialcreds =~ s/^[^\d\.]//g; |
|
if (ref($domconfig{'coursedefaults'}{'coursecredits'} ne 'HASH') && |
|
($env{'form.coursecredits'} eq '1')) { |
|
$changes{'coursecredits'} = 1; |
|
} else { |
|
if (($domconfig{'coursedefaults'}{'coursecredits'}{'official'} ne $officialcreds) || |
|
($domconfig{'coursedefaults'}{'coursecredits'}{'unofficial'} ne $unofficialcreds)) { |
|
$changes{'coursecredits'} = 1; |
|
} |
|
} |
|
$defaultshash{'coursedefaults'}{'coursecredits'} = { |
|
official => $officialcreds, |
|
unofficial => $unofficialcreds, |
|
} |
} |
} |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
$dom); |
$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
|
my %domdefaults; |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
if ($changes{'canuse_pdfforms'}) { |
if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'})) { |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
%domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
$domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'}; |
if ($changes{'canuse_pdfforms'}) { |
|
$domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'}; |
|
} |
|
if ($changes{'coursecredits'}) { |
|
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { |
|
$domdefaults{'officialcredits'} = |
|
$defaultshash{'coursedefaults'}{'coursecredits'}{'official'}; |
|
$domdefaults{'unofficialcredits'} = |
|
$defaultshash{'coursedefaults'}{'coursecredits'}{'unofficial'}; |
|
} |
|
} |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
} |
} |
Line 7892 sub modify_coursedefaults {
|
Line 7919 sub modify_coursedefaults {
|
} |
} |
} elsif ($item eq 'anonsurvey_threshold') { |
} elsif ($item eq 'anonsurvey_threshold') { |
$resulttext .= '<li>'.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'</li>'; |
$resulttext .= '<li>'.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'</li>'; |
|
} elsif ($item eq 'coursecredits') { |
|
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { |
|
if (($domdefaults{'officialcredits'} eq '') && |
|
($domdefaults{'unofficialcredits'} eq '')) { |
|
$resulttext .= '<li>'.&mt('Student credits not in use for courses in this domain').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Student credits can be set per course by a Domain Coordinator, with the following defaults applying:').'<ul>'. |
|
'<li>'.&mt('Official courses: [_1]',$defaultshash{'coursedefaults'}{'coursecredits'}{'official'}).'</li>'. |
|
'<li>'.&mt('Unofficial courses: [_1]',$defaultshash{'coursedefaults'}{'coursecredits'}{'unofficial'}).'</li>'. |
|
'</ul>'. |
|
'</li>'; |
|
} |
|
} else { |
|
$resulttext .= '<li>'.&mt('Student credits not in use for courses in this domain').'</li>'; |
|
} |
} |
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
Line 8416 sub recurse_cat_deletes {
|
Line 8458 sub recurse_cat_deletes {
|
|
|
sub get_active_dcs { |
sub get_active_dcs { |
my ($dom) = @_; |
my ($dom) = @_; |
my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc']); |
my $now = time; |
|
my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc'],$now,$now); |
my %domcoords; |
my %domcoords; |
my $numdcs = 0; |
my $numdcs = 0; |
my $now = time; |
|
foreach my $server (keys(%dompersonnel)) { |
foreach my $server (keys(%dompersonnel)) { |
foreach my $user (sort(keys(%{$dompersonnel{$server}}))) { |
foreach my $user (sort(keys(%{$dompersonnel{$server}}))) { |
my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user); |
my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user); |
my ($end,$start) = split(':',$dompersonnel{$server}{$user}); |
$domcoords{$uname.':'.$udom} = $dompersonnel{$server}{$user}; |
if (($end eq '') || ($end == 0) || ($end > $now)) { |
|
if ($start <= $now) { |
|
$domcoords{$uname.':'.$udom} = $dompersonnel{$server}{$user}; |
|
} |
|
} |
|
} |
} |
} |
} |
return %domcoords; |
return %domcoords; |
} |
} |
|
|
sub active_dc_picker { |
sub active_dc_picker { |
my ($dom,$curr_dc) = @_; |
my ($dom,$numinrow,$inputtype,$name,%currhash) = @_; |
my %domcoords = &get_active_dcs($dom); |
my %domcoords = &get_active_dcs($dom); |
my @dcs = sort(keys(%domcoords)); |
my @domcoord = keys(%domcoords); |
my $numdcs = scalar(@dcs); |
if (keys(%currhash)) { |
my $datatable; |
foreach my $dc (keys(%currhash)) { |
my $numinrow = 2; |
unless (exists($domcoords{$dc})) { |
|
push(@domcoord,$dc); |
|
} |
|
} |
|
} |
|
@domcoord = sort(@domcoord); |
|
my $numdcs = scalar(@domcoord); |
|
my $rows = 0; |
|
my $table; |
if ($numdcs > 1) { |
if ($numdcs > 1) { |
$datatable = '<table>'; |
$table = '<table>'; |
for (my $i=0; $i<@dcs; $i++) { |
for (my $i=0; $i<@domcoord; $i++) { |
my $rem = $i%($numinrow); |
my $rem = $i%($numinrow); |
if ($rem == 0) { |
if ($rem == 0) { |
if ($i > 0) { |
if ($i > 0) { |
$datatable .= '</tr>'; |
$table .= '</tr>'; |
} |
} |
$datatable .= '<tr>'; |
$table .= '<tr>'; |
|
$rows ++; |
} |
} |
my $check = ' '; |
my $check = ''; |
if ($curr_dc eq '') { |
if ($inputtype eq 'radio') { |
if (!$i) { |
if (keys(%currhash) == 0) { |
$check = ' checked="checked" '; |
if (!$i) { |
|
$check = ' checked="checked"'; |
|
} |
|
} elsif (exists($currhash{$domcoord[$i]})) { |
|
$check = ' checked="checked"'; |
|
} |
|
} else { |
|
if (exists($currhash{$domcoord[$i]})) { |
|
$check = ' checked="checked"'; |
} |
} |
} elsif ($dcs[$i] eq $curr_dc) { |
|
$check = ' checked="checked" '; |
|
} |
} |
if ($i == @dcs - 1) { |
if ($i == @domcoord - 1) { |
my $colsleft = $numinrow - $rem; |
my $colsleft = $numinrow - $rem; |
if ($colsleft > 1) { |
if ($colsleft > 1) { |
$datatable .= '<td colspan="'.$colsleft.'">'; |
$table .= '<td class="LC_left_item" colspan="'.$colsleft.'">'; |
} else { |
} else { |
$datatable .= '<td>'; |
$table .= '<td class="LC_left_item">'; |
} |
} |
} else { |
} else { |
$datatable .= '<td>'; |
$table .= '<td class="LC_left_item">'; |
|
} |
|
my ($dcname,$dcdom) = split(':',$domcoord[$i]); |
|
my $user = &Apache::loncommon::plainname($dcname,$dcdom); |
|
$table .= '<span class="LC_nobreak"><label>'. |
|
'<input type="'.$inputtype.'" name="'.$name.'"'. |
|
' value="'.$domcoord[$i].'"'.$check.' />'.$user; |
|
if ($user ne $dcname.':'.$dcdom) { |
|
$table .= ' ('.$dcname.':'.$dcdom.')'. |
|
'</label></span></td>'; |
} |
} |
my ($dcname,$dcdom) = split(':',$dcs[$i]); |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="autocreate_xmldc"'. |
|
' value="'.$dcs[$i].'"'.$check.'/>'. |
|
&Apache::loncommon::plainname($dcname,$dcdom). |
|
' ('.$dcname.':'.$dcdom.')'. |
|
'</label></span></td>'; |
|
} |
} |
$datatable .= '</tr></table>'; |
$table .= '</tr></table>'; |
} elsif (@dcs) { |
} elsif ($numdcs == 1) { |
$datatable .= '<input type="hidden" name="autocreate_dc" value="'. |
if ($inputtype eq 'radio') { |
$dcs[0].'" />'; |
$table .= '<input type="hidden" name="'.$name.'" value="'.$domcoord[0].'" />'; |
|
} else { |
|
my $check; |
|
if (exists($currhash{$domcoord[0]})) { |
|
$check = ' checked="checked"'; |
|
} |
|
$table .= '<input type="checkbox" name="'.$name.'" '. |
|
'value="'.$domcoord[0].'"'.$check.' />'; |
|
$rows ++; |
|
} |
} |
} |
return ($numdcs,$datatable); |
return ($numdcs,$table,$rows); |
} |
} |
|
|
sub usersession_titles { |
sub usersession_titles { |
Line 9002 function updateCaptcha(caller,context) {
|
Line 9065 function updateCaptcha(caller,context) {
|
} |
} |
} |
} |
return; |
return; |
|
} |
|
|
|
// ]]> |
|
</script> |
|
|
|
END |
|
|
|
} |
|
|
|
sub credits_js { |
|
return <<"END"; |
|
|
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
|
|
function toggleCredits(domForm) { |
|
if (document.getElementById('credits')) { |
|
creditsitem = document.getElementById('credits'); |
|
var creditsLength = domForm.coursecredits.length; |
|
if (creditsLength) { |
|
var currval; |
|
for (var i=0; i<creditsLength; i++) { |
|
if (domForm.coursecredits[i].checked) { |
|
currval = domForm.coursecredits[i].value; |
|
} |
|
} |
|
if (currval == 1) { |
|
creditsitem.style.display = 'block'; |
|
} else { |
|
creditsitem.style.display = 'none'; |
|
} |
|
} |
|
} |
|
return; |
} |
} |
|
|
// ]]> |
// ]]> |