--- loncom/interface/domainprefs.pm 2009/10/23 16:14:43 1.116
+++ loncom/interface/domainprefs.pm 2009/11/30 06:23:32 1.121
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.116 2009/10/23 16:14:43 bisitz Exp $
+# $Id: domainprefs.pm,v 1.121 2009/11/30 06:23:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -202,11 +202,12 @@ sub handler {
'quotas','autoenroll','autoupdate','directorysrch',
'usercreation','usermodification','contacts','defaults',
'scantron','coursecategories','serverstatuses',
- 'requestcourses'],$dom);
+ 'requestcourses','helpsettings','coursedefaults'],$dom);
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','directorysrch','contacts',
'usercreation','usermodification','scantron',
- 'requestcourses','coursecategories','serverstatuses');
+ 'requestcourses','coursecategories','serverstatuses','helpsettings',
+ 'coursedefaults');
my %prefs = (
'rolecolors' =>
{ text => 'Default color schemes',
@@ -303,7 +304,7 @@ sub handler {
col2 => 'Value'}],
},
'coursecategories' =>
- { text => 'Cataloging of courses',
+ { text => 'Cataloging of courses/communities',
help => 'Domain_Configuration_Cataloging_Courses',
header => [{col1 => 'Category settings',
col2 => '',},
@@ -319,8 +320,26 @@ sub handler {
col3 => 'Specific IPs',
}],
},
+ 'helpsettings' =>
+ {text => 'Help page settings',
+ help => 'Domain_Configuration_Help_Settings',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ },
+ 'coursedefaults' =>
+ {text => 'Course/Community defaults',
+ help => 'Domain_Configuration_Course_Defaults',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ },
+ 'privacy' =>
+ {text => 'User Privacy',
+ help => 'Domain_Configuration_User_Privacy',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ },
);
- my %servers = &Apache::lonnet::get_servers($dom);
+ my %servers = &dom_servers($dom);
if (keys(%servers) > 1) {
$prefs{'login'} = { text => 'Log-in page options',
help => 'Domain_Configuration_Login_Page',
@@ -415,6 +434,10 @@ sub process_changes {
$output = &modify_serverstatuses($dom,%domconfig);
} elsif ($action eq 'requestcourses') {
$output = &modify_quotas($dom,$action,%domconfig);
+ } elsif ($action eq 'helpsettings') {
+ $output = &modify_helpsettings($dom,%domconfig);
+ } elsif ($action eq 'coursedefaults') {
+ $output = &modify_coursedefaults($dom,%domconfig);
}
return $output;
}
@@ -465,6 +488,8 @@ sub print_config_box {
$colspan = ' colspan="2"';
} elsif ($action eq 'requestcourses') {
$output .= &print_quotas($dom,$settings,\$rowtotal,$action);
+ } elsif ($action eq 'helpsettings') {
+ $output .= &print_helpsettings($dom,$settings,\$rowtotal);
} else {
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);
}
@@ -600,6 +625,10 @@ sub print_config_box {
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'serverstatuses') {
$output .= &print_serverstatuses($dom,$settings,\$rowtotal);
+ } elsif ($action eq 'helpsettings') {
+ $output .= &print_helpsettings($dom,$settings,\$rowtotal);
+ } elsif ($action eq 'coursedefaults') {
+ $output .= &print_coursedefaults($dom,$settings,\$rowtotal);
}
}
$output .= '
@@ -617,7 +646,7 @@ sub print_login {
my $itemcount = 1;
if ($position eq 'top') {
- my %servers = &Apache::lonnet::get_servers($dom);
+ my %servers = &dom_servers($dom);
my $choice = $choices{'disallowlogin'};
$css_class = ' class="LC_odd_row"';
$datatable .= '
'.$choices{'disallowlogin'}.' | '.
@@ -657,9 +686,8 @@ sub print_login {
'coursecatalog' => 'on',
'adminmail' => 'off',
'newuser' => 'off',
- 'submitbugs' => 'on',
);
- my @toggles = ('coursecatalog','adminmail','newuser','submitbugs');
+ my @toggles = ('coursecatalog','adminmail','newuser');
my (%checkedon,%checkedoff);
foreach my $item (@toggles) {
if ($defaultchecked{$item} eq 'on') {
@@ -791,7 +819,6 @@ sub login_choices {
coursecatalog => 'Display Course/Community Catalog link?',
adminmail => "Display Administrator's E-mail Address?",
disallowlogin => "Login page requests redirected",
- submitbugs => "Display "Submit Bug" link?",
hostid => "Server",
serverurl => "Redirect to log-in via:",
directlogin => "No redirect",
@@ -1918,6 +1945,84 @@ sub print_contacts {
return $datatable;
}
+sub print_helpsettings {
+ my ($dom,$settings,$rowtotal) = @_;
+ my ($css_class,$datatable);
+ my $itemcount = 1;
+ my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles);
+ %choices =
+ &Apache::lonlocal::texthash (
+ submitbugs => 'Display "Submit a bug" link?',
+ );
+ %defaultchecked = ('submitbugs' => 'on');
+ @toggles = ('submitbugs',);
+ ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+ \%choices,$itemcount);
+ $$rowtotal += $itemcount;
+ 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',
@@ -2529,6 +2634,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;
@@ -2538,14 +2648,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'}.' | '.
@@ -2561,8 +2682,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;
@@ -2584,7 +2719,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;
@@ -2605,14 +2748,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
.'