--- loncom/interface/domainprefs.pm 2009/02/08 21:04:01 1.86
+++ loncom/interface/domainprefs.pm 2010/03/11 21:18:24 1.130
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.86 2009/02/08 21:04:01 raeburn Exp $
+# $Id: domainprefs.pm,v 1.130 2010/03/11 21:18:24 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -28,6 +28,131 @@
###############################################################
##############################################################
+=pod
+
+=head1 NAME
+
+Apache::domainprefs.pm
+
+=head1 SYNOPSIS
+
+Handles configuration of a LON-CAPA domain.
+
+This is part of the LearningOnline Network with CAPA project
+described at http://www.lon-capa.org.
+
+
+=head1 OVERVIEW
+
+Each institution using LON-CAPA will typically have a single domain designated
+for use by individuals affliated with the institution. Accordingly, each domain
+may define a default set of logos and a color scheme which can be used to "brand"
+the LON-CAPA instance. In addition, an institution will typically have a language
+and timezone which are used for the majority of courses.
+
+LON-CAPA provides a mechanism to display and modify these defaults, as well as a
+host of other domain-wide settings which determine the types of functionality
+available to users and courses in the domain.
+
+There is also a mechanism to configure cataloging of courses in the domain, and
+controls on the operation of automated processes which govern such things as
+roster updates, user directory updates and processing of course requests.
+
+The domain coordination manual which is built dynamically on install/update of
+LON-CAPA from the relevant help items provides more information about domain
+configuration.
+
+Most of the domain settings are stored in the configuration.db GDBM file which is
+housed on the primary library server for the domain in /home/httpd/lonUsers/$dom,
+where $dom is the domain. The configuration.db stores settings in a number of
+frozen hashes of hashes. In a few cases, domain information must be uploaded to
+the domain as files (e.g., image files for logos etc., or plain text files for
+bubblesheet formats). In this case the domainprefs.pm must be running in a user
+session hosted on the primary library server in the domain, as these files are
+stored in author space belonging to a special $dom-domainconfig user.
+
+domainprefs.pm in combination with lonconfigsettings.pm will retrieve and display
+the current settings, and provides an interface to make modifications.
+
+=head1 SUBROUTINES
+
+=over
+
+=item print_quotas()
+
+Inputs: 4
+
+$dom,$settings,$rowtotal,$action.
+
+$dom is the domain, $settings is a reference to a hash of current settings for
+the current context, $rowtotal is a reference to the scalar used to record the
+number of rows displayed on the page, and $action is the context (either quotas
+or requestcourses).
+
+The print_quotas routine was orginally created to display/store information
+about default quota sizes for portfolio spaces for the different types of
+institutional affiliation in the domain (e.g., Faculty, Staff, Student etc.),
+but is now also used to manage availability of user tools:
+i.e., blogs, aboutme page, and portfolios, and the course request tool,
+used by course owners to request creation of a course.
+
+Outputs: 1
+
+$datatable - HTML containing form elements which allow settings to be changed.
+
+In the case of course requests, radio buttons are displayed for each institutional
+affiliate type (and also default, and _LC_adv) for each of the course types
+(official, unofficial and community). In each case the radio buttons allow the
+selection of one of four values:
+
+0, approval, validate, autolimit=N (where N is blank, or a positive integer).
+which have the following effects:
+
+0
+
+=over
+
+- course requests are not allowed for this course types/affiliation
+
+=back
+
+approval
+
+=over
+
+- course requests must be approved by a Doman Coordinator in the
+course's domain
+
+=back
+
+validate
+
+=over
+
+- an institutional validation (e.g., check requestor is instructor
+of record) needs to be passed before the course will be created. The required
+validation is in localenroll.pm on the primary library server for the course
+domain.
+
+=back
+
+autolimit
+
+=over
+
+- course requests will be processed autoatically up to a limit of
+N requests for the course type for the particular requestor.
+If N is undefined, there is no limit to the number of course requests
+which a course owner may submit and have processed automatically.
+
+=back
+
+=item modify_quotas()
+
+=back
+
+=cut
+
package Apache::domainprefs;
use strict;
@@ -37,6 +162,7 @@ use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::lonlocal;
use Apache::lonmsg();
+use Apache::lonconfigsettings;
use LONCAPA qw(:DEFAULT :match);
use LONCAPA::Enrollment;
use LONCAPA::lonauthcgi();
@@ -53,6 +179,7 @@ sub handler {
return OK;
}
+ my $context = 'domain';
my $dom = $env{'request.role.domain'};
my $domdesc = &Apache::lonnet::domain($dom,'description');
if (&Apache::lonnet::allowed('mau',$dom)) {
@@ -72,14 +199,16 @@ sub handler {
}
my %domconfig =
&Apache::lonnet::get_dom('configuration',['login','rolecolors',
- 'quotas','autoenroll','autoupdate','directorysrch',
- 'usercreation','usermodification','contacts','defaults',
- 'scantron','coursecategories','serverstatuses',
- 'requestcourses'],$dom);
+ 'quotas','autoenroll','autoupdate','autocreate',
+ 'directorysrch','usercreation','usermodification',
+ 'contacts','defaults','scantron','coursecategories',
+ 'serverstatuses','requestcourses','helpsettings',
+ 'coursedefaults'],$dom);
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
- 'autoupdate','directorysrch','contacts',
+ 'autoupdate','autocreate','directorysrch','contacts',
'usercreation','usermodification','scantron',
- 'requestcourses','coursecategories','serverstatuses');
+ 'requestcourses','coursecategories','serverstatuses','helpsettings',
+ 'coursedefaults');
my %prefs = (
'rolecolors' =>
{ text => 'Default color schemes',
@@ -93,12 +222,13 @@ sub handler {
{col1 => 'Administrator Settings',
col2 => '',}],
},
- 'login' =>
+ 'login' =>
{ text => 'Log-in page options',
help => 'Domain_Configuration_Login_Page',
header => [{col1 => 'Item',
col2 => '',}],
},
+
'defaults' =>
{ text => 'Default authentication/language/timezone',
help => 'Domain_Configuration_LangTZAuth',
@@ -106,7 +236,7 @@ sub handler {
col2 => 'Value'}],
},
'quotas' =>
- { text => 'User blogs, home pages and portfolios',
+ { text => 'User blogs, personal information pages and portfolios',
help => 'Domain_Configuration_Quotas',
header => [{col1 => 'User affiliation',
col2 => 'Available tools',
@@ -126,6 +256,12 @@ sub handler {
{col1 => 'User population',
col2 => 'Updataeable user data'}],
},
+ 'autocreate' =>
+ { text => 'Auto-course creation settings',
+ help => 'Domain_Configuration_Auto_Creation',
+ header => [{col1 => 'Configuration Setting',
+ col2 => 'Value',}],
+ },
'directorysrch' =>
{ text => 'Institutional directory searches',
help => 'Domain_Configuration_InstDirectory_Search',
@@ -160,7 +296,7 @@ sub handler {
col2 => 'Information settable when self-creating account (if directory data blank)'}],
},
'scantron' =>
- { text => 'Scantron format file',
+ { text => 'Bubblesheet format file',
help => 'Domain_Configuration_Scantron_Format',
header => [ {col1 => 'Item',
col2 => '',
@@ -170,10 +306,12 @@ sub handler {
{text => 'Request creation of courses',
help => 'Domain_Configuration_Request_Courses',
header => [{col1 => 'User affiliation',
- col2 => 'Requestable course types',}],
+ col2 => 'Availability/Processing of requests',},
+ {col1 => 'Setting',
+ col2 => 'Value'}],
},
'coursecategories' =>
- { text => 'Cataloging of courses',
+ { text => 'Cataloging of courses/communities',
help => 'Domain_Configuration_Cataloging_Courses',
header => [{col1 => 'Category settings',
col2 => '',},
@@ -189,7 +327,37 @@ sub handler {
col3 => 'Specific IPs',
}],
},
+ 'helpsettings' =>
+ {text => 'Help page settings',
+ help => 'Domain_Configuration_Help_Settings',
+ header => [{col1 => 'Authenticated Help Settings',
+ col2 => ''},
+ {col1 => 'Unauthenticated Help Settings',
+ col2 => ''}],
+ },
+ '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 = &dom_servers($dom);
+ if (keys(%servers) > 1) {
+ $prefs{'login'} = { text => 'Log-in page options',
+ help => 'Domain_Configuration_Login_Page',
+ header => [{col1 => 'Log-in Service',
+ col2 => 'Server Setting',},
+ {col1 => 'Log-in Page Items',
+ col2 => ''}],
+ };
+ }
my @roles = ('student','coordinator','author','admin');
my @actions = &Apache::loncommon::get_env_multiple('form.actions');
&Apache::lonhtmlcommon::add_breadcrumb
@@ -197,98 +365,10 @@ sub handler {
text=>"Pick functionality"});
my $confname = $dom.'-domainconfig';
if ($phase eq 'process') {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:changePage(document.$phase,'display')",
- text=>"Domain Configuration"},
- {href=>"javascript:changePage(document.$phase,'$phase')",
- text=>"Updated"});
- &print_header($r,$phase);
- foreach my $item (@prefs_order) {
- if (grep(/^\Q$item\E$/,@actions)) {
- $r->print('