--- loncom/interface/domainprefs.pm 2008/07/19 02:28:44 1.64
+++ loncom/interface/domainprefs.pm 2010/03/11 02:51:44 1.102.2.11
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.64 2008/07/19 02:28:44 raeburn Exp $
+# $Id: domainprefs.pm,v 1.102.2.11 2010/03/11 02:51:44 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,11 +162,14 @@ use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::lonlocal;
use Apache::lonmsg();
-use LONCAPA;
+use Apache::lonconfigsettings;
+use LONCAPA qw(:DEFAULT :match);
use LONCAPA::Enrollment;
+use LONCAPA::lonauthcgi();
use File::Copy;
use Locale::Language;
use DateTime::TimeZone;
+use DateTime::Locale;
sub handler {
my $r=shift;
@@ -51,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)) {
@@ -70,17 +199,19 @@ sub handler {
}
my %domconfig =
&Apache::lonnet::get_dom('configuration',['login','rolecolors',
- 'quotas','autoenroll','autoupdate','directorysrch',
- 'usercreation','usermodification','contacts','defaults',
- 'scantron','coursecategories'],$dom);
+ 'quotas','autoenroll','autoupdate','autocreate',
+ 'directorysrch','usercreation','usermodification',
+ 'contacts','defaults','scantron','coursecategories',
+ 'serverstatuses','requestcourses','coursedefaults'],$dom);
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
- 'autoupdate','directorysrch','contacts',
+ 'autoupdate','autocreate','directorysrch','contacts',
'usercreation','usermodification','scantron',
- 'coursecategories');
+ 'requestcourses','coursecategories','serverstatuses',
+ 'coursedefaults');
my %prefs = (
'rolecolors' =>
{ text => 'Default color schemes',
- help => 'Default_Color_Schemes',
+ help => 'Domain_Configuration_Color_Schemes',
header => [{col1 => 'Student Settings',
col2 => '',},
{col1 => 'Coordinator Settings',
@@ -92,52 +223,59 @@ sub handler {
},
'login' =>
{ text => 'Log-in page options',
- help => 'Domain_Log-in_Page',
+ help => 'Domain_Configuration_Login_Page',
header => [{col1 => 'Item',
col2 => '',}],
},
'defaults' =>
{ text => 'Default authentication/language/timezone',
- help => '',
+ help => 'Domain_Configuration_LangTZAuth',
header => [{col1 => 'Setting',
col2 => 'Value'}],
},
'quotas' =>
- { text => 'Default quotas for user portfolios',
- help => 'Default_User_Quota',
- header => [{col1 => 'User type',
- col2 => 'Default quota'}],
+ { text => 'User blogs, personal information pages and portfolios',
+ help => 'Domain_Configuration_Quotas',
+ header => [{col1 => 'User affiliation',
+ col2 => 'Available tools',
+ col3 => 'Portfolio quota',}],
},
'autoenroll' =>
{ text => 'Auto-enrollment settings',
- help => 'Domain_Auto_Enrollment',
+ help => 'Domain_Configuration_Auto_Enrollment',
header => [{col1 => 'Configuration setting',
col2 => 'Value(s)'}],
},
'autoupdate' =>
{ text => 'Auto-update settings',
- help => 'Domain_Auto_Update',
+ help => 'Domain_Configuration_Auto_Updates',
header => [{col1 => 'Setting',
col2 => 'Value',},
{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_Directory_Search',
+ help => 'Domain_Configuration_InstDirectory_Search',
header => [{col1 => 'Setting',
col2 => 'Value',}],
},
'contacts' =>
{ text => 'Contact Information',
- help => 'Domain_Contact_Information',
+ help => 'Domain_Configuration_Contact_Info',
header => [{col1 => 'Setting',
col2 => 'Value',}],
},
'usercreation' =>
{ text => 'User creation',
- help => 'Domain_User_Creation',
+ help => 'Domain_Configuration_User_Creation',
header => [{col1 => 'Format rule type',
col2 => 'Format rules in force'},
{col1 => 'User account creation',
@@ -145,9 +283,9 @@ sub handler {
{col1 => 'Context',
col2 => 'Assignable authentication types'}],
},
- 'usermodification' =>
+ 'usermodification' =>
{ text => 'User modification',
- help => 'Domain_User_Modification',
+ help => 'Domain_Configuration_User_Modification',
header => [{col1 => 'Target user has role',
col2 => 'User information updateable in author context'},
{col1 => 'Target user has role',
@@ -155,23 +293,55 @@ sub handler {
{col1 => "Status of user",
col2 => 'Information settable when self-creating account (if directory data blank)'}],
},
- 'scantron' =>
- { text => 'Scantron format file',
- help => 'Domain_Scantron_Formats',
+ 'scantron' =>
+ { text => 'Bubblesheet format file',
+ help => 'Domain_Configuration_Scantron_Format',
header => [ {col1 => 'Item',
col2 => '',
}],
},
- 'coursecategories' =>
- { text => 'Cataloging of courses',
- help => 'Domain_Course_Catalog',
- header => [{col1 => 'Category settings',
+ 'requestcourses' =>
+ {text => 'Request creation of courses',
+ help => 'Domain_Configuration_Request_Courses',
+ header => [{col1 => 'User affiliation',
+ col2 => 'Availability/Processing of requests',},
+ {col1 => 'Setting',
+ col2 => 'Value'}],
+ },
+ 'coursecategories' =>
+ { text => 'Cataloging of courses/communities',
+ help => 'Domain_Configuration_Cataloging_Courses',
+ header => [{col1 => 'Category settings',
col2 => '',},
{col1 => 'Categories',
col2 => '',
}],
- }
+ },
+ 'serverstatuses' =>
+ {text => 'Access to server status pages',
+ help => 'Domain_Configuration_Server_Status',
+ header => [{col1 => 'Status Page',
+ col2 => 'Other named users',
+ col3 => 'Specific IPs',
+ }],
+ },
+ 'coursedefaults' =>
+ {text => 'Course/Community defaults',
+ help => 'Domain_Configuration_Course_Defaults',
+ 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
@@ -179,98 +349,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('