';
+ $datatable .= &mt('(overrides affiliation, if set)').
+ ''.
+ ''.
+ '';
} else {
- $datatable .= ' ';
+ $datatable .= &mt('(overrides affiliation, if checked)').
+ ''.
+ ''.
+ ' ';
}
my %advcell;
foreach my $item (@usertools) {
@@ -1370,9 +1381,6 @@ sub print_quotas {
}
}
}
- if (!$curroption) {
- $curroption = 'norequest';
- }
$datatable .= ' | '.$titles{$item}.' | ';
my $checked = '';
if ($curroption eq '') {
@@ -1831,6 +1839,67 @@ sub print_contacts {
return $datatable;
}
+sub radiobutton_prefs {
+ my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_;
+ return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&
+ (ref($choices) eq 'HASH'));
+
+ my (%checkedon,%checkedoff,$datatable,$css_class);
+
+ foreach my $item (@{$toggles}) {
+ if ($defaultchecked->{$item} eq 'on') {
+ $checkedon{$item} = ' checked="checked" ';
+ $checkedoff{$item} = ' ';
+ } elsif ($defaultchecked->{$item} eq 'off') {
+ $checkedoff{$item} = ' checked="checked" ';
+ $checkedon{$item} = ' ';
+ }
+ }
+ if (ref($settings) eq 'HASH') {
+ foreach my $item (@{$toggles}) {
+ if ($settings->{$item} eq '1') {
+ $checkedon{$item} = ' checked="checked" ';
+ $checkedoff{$item} = ' ';
+ } elsif ($settings->{$item} eq '0') {
+ $checkedoff{$item} = ' checked="checked" ';
+ $checkedon{$item} = ' ';
+ }
+ }
+ }
+ foreach my $item (@{$toggles}) {
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ $datatable .=
+ ' '.$choices->{$item}.
+ ' | '.
+ ''.
+ ' '.
+ ' | '.
+ ' ';
+ $itemcount ++;
+ }
+ return ($datatable,$itemcount);
+}
+
+sub print_coursedefaults {
+ my ($dom,$settings,$rowtotal) = @_;
+ my ($css_class,$datatable);
+ my $itemcount = 1;
+ my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles);
+ %choices =
+ &Apache::lonlocal::texthash (
+ canuse_pdfforms => 'Course/Community users can create/upload PDF forms',
+ );
+ %defaultchecked = ('canuse_pdfforms' => 'off');
+ @toggles = ('canuse_pdfforms',);
+ ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+ \%choices,$itemcount);
+ $$rowtotal += $itemcount;
+ return $datatable;
+}
+
sub contact_titles {
my %titles = &Apache::lonlocal::texthash (
'supportemail' => 'Support E-mail address',
@@ -2442,6 +2511,11 @@ sub print_coursecategories {
my $toggle_cats_dom = ' checked="checked" ';
my $can_cat_crs = ' ';
my $can_cat_dom = ' checked="checked" ';
+ my $toggle_catscomm_comm = ' ';
+ my $toggle_catscomm_dom = ' checked="checked" ';
+ my $can_catcomm_comm = ' ';
+ my $can_catcomm_dom = ' checked="checked" ';
+
if (ref($settings) eq 'HASH') {
if ($settings->{'togglecats'} eq 'crs') {
$toggle_cats_crs = $toggle_cats_dom;
@@ -2451,14 +2525,25 @@ sub print_coursecategories {
$can_cat_crs = $can_cat_dom;
$can_cat_dom = ' ';
}
+ if ($settings->{'togglecatscomm'} eq 'comm') {
+ $toggle_catscomm_comm = $toggle_catscomm_dom;
+ $toggle_catscomm_dom = ' ';
+ }
+ if ($settings->{'categorizecomm'} eq 'comm') {
+ $can_catcomm_comm = $can_catcomm_dom;
+ $can_catcomm_dom = ' ';
+ }
}
my %title = &Apache::lonlocal::texthash (
- togglecats => 'Show/Hide a course in the catalog',
- categorize => 'Assign a category to a course',
+ togglecats => 'Show/Hide a course in catalog',
+ togglecatscomm => 'Show/Hide a community in catalog',
+ categorize => 'Assign a category to a course',
+ categorizecomm => 'Assign a category to a community',
);
my %level = &Apache::lonlocal::texthash (
- dom => 'Set in "Modify Course" (Domain)',
- crs => 'Set in "Modify Parameters" (Course)',
+ dom => 'Set in Domain',
+ crs => 'Set in Course',
+ comm => 'Set in Community',
);
$datatable = ''.
''.$title{'togglecats'}.' | '.
@@ -2474,8 +2559,22 @@ sub print_coursecategories {
$can_cat_dom.' value="dom" />'.$level{'dom'}.' '.
''.
+ ' '.
+ ''.$title{'togglecatscomm'}.' | '.
+ ' '.
+ ' | '.
+ ' '.
+ ''.$title{'categorizecomm'}.' | '.
+ ''.
+ ' '.
+ ' | '.
' ';
- $$rowtotal += 2;
+ $$rowtotal += 4;
} else {
my $css_class;
my $itemcount = 1;
@@ -2497,7 +2596,15 @@ sub print_coursecategories {
if (ref($cats[0]) eq 'ARRAY') {
my $numtop = @{$cats[0]};
my $maxnum = $numtop;
- if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '')) {
+ my %default_names = (
+ instcode => &mt('Official courses'),
+ communities => &mt('Communities'),
+ );
+
+ if ((!grep(/^instcode$/,@{$cats[0]})) ||
+ ($cathash->{'instcode::0'} eq '') ||
+ (!grep(/^communities$/,@{$cats[0]})) ||
+ ($cathash->{'communities::0'} eq '')) {
$maxnum ++;
}
my $lastidx;
@@ -2518,14 +2625,33 @@ sub print_coursecategories {
$datatable .= '';
}
$datatable .= '';
- if ($parent eq 'instcode') {
- $datatable .= ''.&mt('Official courses')
- .' ('
- .&mt('with institutional codes').') | '
- .' '
- .' | ';
+ if ($parent eq 'instcode' || $parent eq 'communities') {
+ $datatable .= ''.
+ .$default_names{$parent}.'';
+ if ($parent eq 'instcode') {
+ $datatable .= ' ('
+ .&mt('with institutional codes')
+ .')';
+ } else {
+ $datatable .= '';
+ }
+ $datatable .= ' | ';
} else {
$datatable .= $parent
.'
|