--- loncom/interface/lonmodifycourse.pm 2006/11/14 20:38:21 1.28
+++ loncom/interface/lonmodifycourse.pm 2007/12/05 02:55:40 1.35
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# handler for DC-only modifiable course settings
#
-# $Id: lonmodifycourse.pm,v 1.28 2006/11/14 20:38:21 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.35 2007/12/05 02:55:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -67,7 +67,7 @@ sub get_enrollment_settings {
} else {
$enrollvar{$type} = localtime($settings{$item});
}
- } elsif ($type eq "sectionums") {
+ } elsif ($type eq "sectionnums") {
$enrollvar{$type} = $settings{$item};
$enrollvar{$type} =~ s/,/, /g;
} elsif ($type eq "authtype"
@@ -138,6 +138,9 @@ sub print_course_selection_page {
'ownerdomfilter','coursefilter'];
my %filter;
my $type = $env{'form.type'};
+ if ($type eq '') {
+ $type = 'Course';
+ }
my $action = '/adm/modifycourse';
my $dctitle = &Apache::lonnet::plaintext('dc');
$r->print(&mt('Revise your search criteria for this domain').' ('.$domdesc.').
');
@@ -310,7 +313,7 @@ all settings except course code, course
'usrd' => 'Use the radio buttons to select a different course owner.',
'deam' => "Default Authentication method",
'deus' => "The default authentication method, and default authentication parameter (domain, initial password or argument) are used when automatic enrollment of students in a course requires addition of new user accounts in your domain, and the class list file contains empty entries for the <authtype> and <autharg> properties for the new student. If you choose 'internally authenticated', and leave the initial password field empty, the automated enrollment process will create a randomized password for each new student account that it adds to your LON-CAPA domain.",
- 'gobt' => "Modify settings",
+ 'gobt' => "Save",
);
my @bgcolors = ('#eeeeee','#cccccc');
@@ -365,19 +368,24 @@ all settings except course code, course
}
unless ($curr_authtype eq '') {
$curr_authfield = $curr_authtype.'arg';
- }
+ }
my $javascript_validations=&Apache::londropadd::javascript_validations('modifycourse',$krbdefdom,$curr_authtype,$curr_authfield);
- my %param = ( formname => 'document.cmod',
+ my %param = ( formname => 'document.'.$env{'form.phase'},
kerb_def_dom => $krbdefdom,
kerb_def_auth => $krbdef,
mode => 'modifycourse',
curr_authtype => $curr_authtype,
curr_autharg => $enrollvar{'autharg'}
);
- my $krbform = &Apache::loncommon::authform_kerberos(%param);
- my $intform = &Apache::loncommon::authform_internal(%param);
- my $locform = &Apache::loncommon::authform_local(%param);
-
+ my (%authform,$authenitems);
+ $authform{'krb'} = &Apache::loncommon::authform_kerberos(%param);
+ $authform{'int'} = &Apache::loncommon::authform_internal(%param);
+ $authform{'loc'} = &Apache::loncommon::authform_local(%param);
+ foreach my $item ('krb','int','loc') {
+ if ($authform{$item} ne '') {
+ $authenitems .= $authform{$item}.'
';
+ }
+ }
if ($numlocalcc == 0) {
$ownertable = $lt{'nocc'};
}
@@ -421,17 +429,20 @@ all settings except course code, course
}
&print_header($r,$cdesc,$javascript_validations);
my $type = $env{'form.type'};
+ if ($type eq '') {
+ $type = 'Course';
+ }
my $dctitle = &Apache::lonnet::plaintext('dc');
my $cctitle = &Apache::lonnet::plaintext('cc',$type);
my $mainheader = &mt('Course settings modifiable by [_1] only.',$dctitle);
my $hidden_elements = &hidden_form_elements();
$r->print(<
Use the appropriate text boxes and radio buttons below to change some or all of the four automated enrollment settings that may only be changed by a Domain Coordinator. Click the "$lt{'gobt'}" button to save your changes. | +Use the appropriate text boxes and radio buttons below to change some or all of the four automated enrollment settings that may only be changed by a Domain Coordinator. | ||
@@ -449,12 +460,7 @@ all settings except course code, course | |||
$lt{'deam'}: - $krbform - - $intform - - $locform - + $authenitems $lt{'deus'}. |
@@ -477,7 +483,7 @@ ENDDOCUMENT
}
sub modify_course {
- my ($r,$cdom,$cnum,$cdesc,$domdesc) = @_;
+ my ($r,$cdom,$cnum,$cdesc,$domdesc,$type) = @_;
my %longtype = &course_settings_descrip();
my %settings = &Apache::lonnet::get('environment',['internal.courseowner','internal.coursecode','internal.authtype','internal.autharg','internal.sectionnums','internal.crosslistings','description'],$cdom,$cnum);
my %currattr = ();
@@ -554,10 +560,18 @@ sub modify_course {
}
}
if ($changeowner == 1 || $changecode == 1) {
- my $courseid_entry = &escape($cdom.'_'.$cnum).'='.&escape($description).':'.&escape($env{'form.coursecode'}).':'.&escape($env{'form.courseowner'});
- &Apache::lonnet::courseidput($cdom,$courseid_entry,&Apache::lonnet::homeserver($cnum,$cdom));
+ my $courseid_entry = &escape($cdom.'_'.$cnum).'='.&escape($description).':'.&escape($env{'form.coursecode'}).':'.&escape($env{'form.courseowner'}).':'.&escape($type);
+ my %courseid_entry = (
+ $cdom.'_'.$cnum => {
+ description => $description,
+ inst_code => $env{'form.coursecode'},
+ owner => $env{'form.courseowner'},
+ type => $type,
+ },
+ );
+ &Apache::lonnet::courseidput($cdom,\%courseid_entry,
+ &Apache::lonnet::homeserver($cnum,$cdom),'notime');
}
-
foreach my $param (@modifiable_params) {
if ($currattr{$param} eq $newattr{$param}) {
push(@nochanges,$param);
@@ -567,17 +581,16 @@ sub modify_course {
push(@changes,$param);
}
}
-
if (@changes > 0) {
$chgresponse = &mt("The following automated enrollment parameters have been changed: