[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface domainprefs.pm
raeburn
raeburn at source.lon-capa.org
Mon Apr 28 00:12:42 EDT 2014
raeburn Mon Apr 28 04:12:42 2014 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface domainprefs.pm
Log:
- For 2.11
- Backport 1.237, 1.238.
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.41 loncom/interface/domainprefs.pm:1.160.6.42
--- loncom/interface/domainprefs.pm:1.160.6.41 Wed Apr 23 12:09:10 2014
+++ loncom/interface/domainprefs.pm Mon Apr 28 04:12:41 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.41 2014/04/23 12:09:10 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.42 2014/04/28 04:12:41 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -387,7 +387,9 @@
'coursecategories' =>
{ text => 'Cataloging of courses/communities',
help => 'Domain_Configuration_Cataloging_Courses',
- header => [{col1 => 'Category settings',
+ header => [{col1 => 'Catalog type/availability',
+ col2 => '',},
+ {col1 => 'Category settings for standard catalog',
col2 => '',},
{col1 => 'Categories',
col2 => '',
@@ -647,7 +649,7 @@
if ($numheaders > 1) {
my $colspan = '';
my $rightcolspan = '';
- if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'defaults') ||
+ if (($action eq 'rolecolors') || ($action eq 'defaults') ||
(($action eq 'login') && ($numheaders < 3))) {
$colspan = ' colspan="2"';
}
@@ -695,8 +697,14 @@
$rowtotal ++;
if (($action eq 'autoupdate') || ($action eq 'usercreation') ||
($action eq 'selfcreation') || ($action eq 'selfenrollment') ||
- ($action eq 'usersessions')) {
- $output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal).'
+ ($action eq 'usersessions') || ($action eq 'coursecategories')) {
+ if ($action eq 'coursecategories') {
+ $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
+ $colspan = ' colspan="2"';
+ } else {
+ $output .= $item->{'print'}->('middle',$dom,$settings,\$rowtotal);
+ }
+ $output .= '
</table>
</td>
</tr>
@@ -706,14 +714,16 @@
<tr class="LC_info_row">
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>
- </tr>'."\n".
- $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ </tr>'."\n";
+ if ($action eq 'coursecategories') {
+ $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
+ } else {
+ $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ }
$rowtotal ++;
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
($action eq 'defaults')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
- } elsif ($action eq 'coursecategories') {
- $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 3) {
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -4728,6 +4738,49 @@
my ($position,$dom,$hdritem,$settings,$rowtotal) = @_;
my $datatable;
if ($position eq 'top') {
+ my (%checked);
+ my @catitems = ('unauth','auth');
+ my @cattypes = ('std','domonly','codesrch','none');
+ $checked{'unauth'} = 'std';
+ $checked{'auth'} = 'std';
+ if (ref($settings) eq 'HASH') {
+ foreach my $type (@cattypes) {
+ if ($type eq $settings->{'unauth'}) {
+ $checked{'unauth'} = $type;
+ }
+ if ($type eq $settings->{'auth'}) {
+ $checked{'auth'} = $type;
+ }
+ }
+ }
+ my %lt = &Apache::lonlocal::texthash (
+ unauth => 'Catalog type for unauthenticated users',
+ auth => 'Catalog type for authenticated users',
+ none => 'No catalog',
+ std => 'Standard catalog',
+ domonly => 'Domain-only catalog',
+ codesrch => "Code search form",
+ );
+ my $itemcount = 0;
+ foreach my $item (@catitems) {
+ my $css_class = $itemcount%2? ' class="LC_odd_row"':'';
+ $datatable .= '<tr '.$css_class.'>'.
+ '<td>'.$lt{$item}.'</td>'.
+ '<td class="LC_right_item"><span class="LC_nobreak">';
+ foreach my $type (@cattypes) {
+ my $ischecked;
+ if ($checked{$item} eq $type) {
+ $ischecked=' checked="checked"';
+ }
+ $datatable .= '<label>'.
+ '<input type="radio" name="coursecat_'.$item.'" value="'.$type.'"'.$ischecked.
+ ' />'.$lt{$type}.'</label> ';
+ }
+ $datatable .= '</td></tr>';
+ $itemcount ++;
+ }
+ $$rowtotal += $itemcount;
+ } elsif ($position eq 'middle') {
my $toggle_cats_crs = ' ';
my $toggle_cats_dom = ' checked="checked" ';
my $can_cat_crs = ' ';
@@ -4934,7 +4987,7 @@
$datatable .= &initialize_categories($itemcount);
}
} else {
- $datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[0]->{'col2'}.'</td>'
+ $datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[1]->{'col2'}.'</td>'
.&initialize_categories($itemcount);
}
$$rowtotal += $itemcount;
@@ -5080,9 +5133,9 @@
$jstext = ' var categories = Array(1);'."\n".
' categories[0] = Array("instcode_pos");'."\n";
}
- my $instcode_reserved = &mt('The name: "instcode" is a reserved category');
- my $communities_reserved = &mt('The name: "communities" is a reserved category');
- my $choose_again = '\\n'.&mt('Please use a different name for the new top level category');
+ my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"');
+ my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"');
+ my $choose_again = '\\n'.&mt('Please use a different name for the new top level category.');
$output = <<"ENDSCRIPT";
<script type="text/javascript">
// <![CDATA[
@@ -9297,6 +9350,8 @@
my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors,
$cathash);
my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory');
+ my @catitems = ('unauth','auth');
+ my @cattypes = ('std','domonly','codesrch','none');
if (ref($domconfig{'coursecategories'}) eq 'HASH') {
$cathash = $domconfig{'coursecategories'}{'cats'};
if ($domconfig{'coursecategories'}{'togglecats'} ne $env{'form.togglecats'}) {
@@ -9315,6 +9370,14 @@
$changes{'categorizecomm'} = 1;
$domconfig{'coursecategories'}{'categorizecomm'} = $env{'form.categorizecomm'};
}
+ foreach my $item (@catitems) {
+ if (grep(/^\Q$env{'form.coursecat_'.$item}\E$/, at cattypes)) {
+ if ($domconfig{'coursecategories'}{$item} ne $env{'form.coursecat_'.$item}) {
+ $changes{$item} = 1;
+ $domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item};
+ }
+ }
+ }
} else {
$changes{'togglecats'} = 1;
$changes{'categorize'} = 1;
@@ -9326,6 +9389,14 @@
togglecatscomm => $env{'form.togglecatscomm'},
categorizecomm => $env{'form.categorizecomm'},
};
+ foreach my $item (@catitems) {
+ if ($env{'form.coursecat_'.$item} ne 'std') {
+ $changes{$item} = 1;
+ }
+ if (grep(/^\Q$env{'form.coursecat_'.$item}\E$/, at cattypes)) {
+ $domconfig{'coursecategories'}{$item} = $env{'form.coursecat_'.$item};
+ }
+ }
}
if (ref($cathash) eq 'HASH') {
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) {
@@ -9448,6 +9519,10 @@
dom => 'set in Domain ("Modify Course/Community")',
crs => 'set in Course ("Course Configuration")',
comm => 'set in Community ("Community Configuration")',
+ none => 'No catalog',
+ std => 'Standard catalog',
+ domonly => 'Domain-only catalog',
+ codesrch => 'Code search form',
);
$resulttext = &mt('Changes made:').'<ul>';
if ($changes{'togglecats'}) {
@@ -9462,6 +9537,12 @@
if ($changes{'categorizecomm'}) {
$resulttext .= '<li>'.&mt("$title{'categorizecomm'} $level{$env{'form.categorizecomm'}}").'</li>';
}
+ if ($changes{'unauth'}) {
+ $resulttext .= '<li>'.&mt('Catalog type for unauthenticated users set to "'.$level{$env{'form.coursecat_unauth'}}.'"').'</li>';
+ }
+ if ($changes{'auth'}) {
+ $resulttext .= '<li>'.&mt('Catalog type for authenticated users set to "'.$level{$env{'form.coursecat_auth'}}.'"').'</li>';
+ }
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) {
my $cathash;
if (ref($domconfig{'coursecategories'}) eq 'HASH') {
More information about the LON-CAPA-cvs
mailing list