@@ -420,7 +430,7 @@ sub print_modification_menu {
);
}
if ($type eq 'Community') {
- if ($permission->{'setparms'} eq 'edit') {
+ if ($permission->{'setparms'} eq 'edit') {
$categorytitle = 'View/Modify Community Settings';
$linktext{'setparms'} = 'View/Modify community owner';
$linktext{'catsettings'} = 'View/Modify catalog settings for community';
@@ -430,7 +440,7 @@ sub print_modification_menu {
$linktext{'catsettings'} = 'View catalog settings for community';
}
$setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a community.');
- $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a community via Content Editor.');
+ $setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a community via Content Editor.');
} else {
if ($permission->{'setparms'} eq 'edit') {
$categorytitle = 'View/Modify Course Settings';
@@ -515,7 +525,7 @@ sub print_modification_menu {
{
linktext => $linktext{'viewparms'},
url => &phaseurl('viewparms'),
- permission => ($permission->{'viewparms'} && ($type ne 'Community')),
+ permission => ($permission->{'viewparms'} && ($type ne 'Community') && ($type ne 'Placement')),
#help => '',
icon => 'roles.png',
linktitle => ''
@@ -557,7 +567,7 @@ sub print_modification_menu {
} else {
$menu_html .= '
'.&mt('Course owner (permitted to assign Course Coordinator roles in the course).').' '."\n".
'
'.&mt("Institutional code and default authentication (both required for auto-enrollment of students from institutional datafeeds).").' '."\n";
- if (&showcredits($dom)) {
+ if (($type ne 'Placement') && &showcredits($dom)) {
$menu_html .= '
'.&mt('Default credits earned by student on course completion.').' '."\n";
}
$menu_html .= '
'.&mt('Override defaults for who configures self-enrollment for this specific course.').' '."\n";
@@ -612,9 +622,9 @@ sub print_adhocrole_selected {
}
$selectrole = 1;
} elsif ($permission->{'adhocrole'} eq 'custom') {
- my ($okroles,$description) = &Apache::lonnet::get_my_adhocroles($env{'form.pickedcourse'},1);
+ my ($okroles,$description) = &Apache::lonnet::get_my_adhocroles($env{'form.pickedcourse'},1);
if (ref($okroles) eq 'ARRAY') {
- my $possrole = $env{'form.adhocrole'};
+ my $possrole = $env{'form.adhocrole'};
if (($possrole ne '') && (grep(/^\Q$possrole\E$/,@{$okroles}))) {
my $confname = &Apache::lonnet::get_domainconfiguser($cdom);
$newrole = "cr/$cdom/$confname/$possrole./$cdom/$cnum";
@@ -794,7 +804,7 @@ sub print_set_anonsurvey_threshold {
my $hidden_elements = &hidden_form_elements();
my ($disabled,$submit);
if ($readonly) {
- $disabled = ' disabled="disabled"';
+ $disabled = ' disabled="disabled"';
} else {
$submit = '
';
}
@@ -888,7 +898,7 @@ sub domain_postsubtimeout {
my ($cdom,$type,$settings) = @_;
return unless (ref($settings) eq 'HASH');
my $lctype = lc($type);
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
$lctype = 'unofficial';
if ($settings->{'internal.coursecode'}) {
$lctype = 'official';
@@ -951,6 +961,8 @@ sub print_catsettings {
'
'.&mt('Yes').' '.&mt('No').'');
if ($type eq 'Community') {
$r->print(&mt("If a community has been categorized using at least one of the categories defined for communities in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded."));
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt("If a placement test has been categorized using at least one of the categories defined for placement tests in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded."));
} else {
$r->print(&mt("Unless excluded, a course will be listed in the domain's publicly accessible Course/Community Catalog, if at least one of the following applies").':
'.
''.&mt('Auto-cataloging is enabled and the course is assigned an institutional code.').' '.
@@ -972,7 +984,7 @@ sub print_catsettings {
} else {
$r->print(&mt('No categories defined for this domain'));
}
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
$r->print(''.&mt('If auto-cataloging based on institutional code is enabled in the domain, a course will continue to be listed in the catalog of official courses, in addition to receiving a listing under any manually assigned categor(ies).').'
');
}
}
@@ -1019,7 +1031,6 @@ sub print_course_modification_page {
my @specific_managebydc = split(/,/,$settings{'internal.selfenrollmgrdc'});
my @specific_managebycc = split(/,/,$settings{'internal.selfenrollmgrcc'});
my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom);
- my %passwdconf = &Apache::lonnet::get_passwdconf($cdom);
my @default_managebydc = split(/,/,$domdefaults{$type.'selfenrolladmdc'});
if ($crstype eq 'Community') {
$ccrole = 'co';
@@ -1072,7 +1083,7 @@ sub print_course_modification_page {
foreach my $cc (@local_ccs) {
$ownertable .= &Apache::loncommon::start_data_table_row()."\n";
if ($cc eq $enrollvar{'courseowner'}) {
- $ownertable .= ' '."\n";
+ $ownertable .= ' '."\n";
} else {
$ownertable .= ' '."\n";
}
@@ -1094,18 +1105,17 @@ sub print_course_modification_page {
if ($crstype eq 'Community') {
$r->print(&Apache::lonhtmlcommon::row_title(
&Apache::loncommon::help_open_topic('Modify_Community_Owner').
- ' '.&mt('Community Owner'))."\n".
- $ownertable."\n".&Apache::lonhtmlcommon::row_closure());
+ ' '.&mt('Community Owner'))."\n");
} else {
$r->print(&Apache::lonhtmlcommon::row_title(
&Apache::loncommon::help_open_topic('Modify_Course_Instcode').
' '.&mt('Course Code'))."\n".
' '.
&Apache::lonhtmlcommon::row_closure());
- if (&showcredits($cdom)) {
+ if (($crstype eq 'Course') && (&showcredits($cdom))) {
$r->print(&Apache::lonhtmlcommon::row_title(
&Apache::loncommon::help_open_topic('Modify_Course_Credithours').
- ' '.&mt('Credits (students)'))."\n".
+ ' '.&mt('Credits (students)'))."\n".
' '.
&Apache::lonhtmlcommon::row_closure());
}
@@ -1115,21 +1125,8 @@ sub print_course_modification_page {
$authenitems."\n".
&Apache::lonhtmlcommon::row_closure().
&Apache::lonhtmlcommon::row_title(
- &Apache::loncommon::help_open_topic('Modify_Course_Owner').
- ' '.&mt('Course Owner'))."\n".
- $ownertable."\n".&Apache::lonhtmlcommon::row_closure());
- if (($passwdconf{'crsownerchg'}) && ($type ne 'Placement')) {
- my $checked;
- if ($enrollvar{'nopasswdchg'}) {
- $checked = ' checked="checked"';
- }
- $r->print(&Apache::lonhtmlcommon::row_title(
- &Apache::loncommon::help_open_topic('Modify_Course_Chgpasswd').
- ' '.&mt('Changing passwords (internal)'))."\n".
- ' '.
- &mt('Disable changing password for users with student role by course owner').''."\n".
- &Apache::lonhtmlcommon::row_closure());
- }
+ &Apache::loncommon::help_open_topic('Modify_Course_Owner').
+ ' '.&mt('Course Owner'))."\n");
}
my ($cctitle,$rolename,$currmanages,$ccchecked,$dcchecked,$defaultchecked);
my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();
@@ -1139,7 +1136,8 @@ sub print_course_modification_page {
$cctitle = &mt('Course personnel');
}
- $r->print(&Apache::lonhtmlcommon::row_title(
+ $r->print($ownertable."\n".&Apache::lonhtmlcommon::row_closure().
+ &Apache::lonhtmlcommon::row_title(
&Apache::loncommon::help_open_topic('Modify_Course_Selfenrolladmin').
' '.&mt('Self-enrollment configuration')).
&Apache::loncommon::start_data_table()."\n".
@@ -1312,16 +1310,12 @@ sub modify_course {
'internal.pendingco-owners','internal.selfenrollmgrdc',
'internal.selfenrollmgrcc','internal.mysqltables');
my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
push(@items,('internal.coursecode','internal.authtype','internal.autharg',
'internal.sectionnums','internal.crosslistings'));
if (&showcredits($cdom)) {
push(@items,'internal.defaultcredits');
}
- my %passwdconf = &Apache::lonnet::get_passwdconf($cdom);
- if ($passwdconf{'crsownerchg'}) {
- push(@items,'internal.nopasswdchg');
- }
}
my %settings = &Apache::lonnet::get('environment',\@items,$cdom,$cnum);
my $description = $settings{'description'};
@@ -1337,7 +1331,6 @@ sub modify_course {
} else {
%changed = ( code => 0,
owner => 0,
- passwd => 0,
);
$ccrole = 'cc';
unless ($settings{'internal.sectionnums'} eq '') {
@@ -1390,21 +1383,9 @@ sub modify_course {
$newattr{'mysqltables'} = $env{'form.mysqltables'};
$newattr{'mysqltables'} =~ s/\D+//g;
}
- if ($type ne 'Placement') {
- if (&showcredits($cdom) && exists($env{'form.defaultcredits'})) {
- $newattr{'defaultcredits'}=$env{'form.defaultcredits'};
- $newattr{'defaultcredits'} =~ s/[^\d\.]//g;
- }
- if (grep(/^nopasswdchg$/,@modifiable_params)) {
- if ($env{'form.nopasswdchg'}) {
- $newattr{'nopasswdchg'} = 1;
- unless ($currattr{'nopasswdchg'}) {
- $changed{'passwd'} = 1;
- }
- } elsif ($currattr{'nopasswdchg'}) {
- $changed{'passwd'} = 1;
- }
- }
+ if (($type ne 'Placement') && (&showcredits($cdom) && exists($env{'form.defaultcredits'}))) {
+ $newattr{'defaultcredits'}=$env{'form.defaultcredits'};
+ $newattr{'defaultcredits'} =~ s/[^\d\.]//g;
}
}
@@ -1439,7 +1420,7 @@ sub modify_course {
}
}
- if ($changed{'owner'} || $changed{'code'} || $changed{'passwd'}) {
+ if ($changed{'owner'} || $changed{'code'}) {
my %crsinfo = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',$cnum,
undef,undef,'.');
if (ref($crsinfo{$env{'form.pickedcourse'}}) eq 'HASH') {
@@ -1449,29 +1430,10 @@ sub modify_course {
if ($changed{'owner'}) {
$crsinfo{$env{'form.pickedcourse'}}{'owner'} = $env{'form.courseowner'};
}
- if ($changed{'passwd'}) {
- if ($env{'form.nopasswdchg'}) {
- $crsinfo{$env{'form.pickedcourse'}}{'nopasswdchg'} = 1;
- } else {
- delete($crsinfo{'nopasswdchg'});
- }
- }
my $chome = &Apache::lonnet::homeserver($cnum,$cdom);
my $putres = &Apache::lonnet::courseidput($cdom,\%crsinfo,$chome,'notime');
- if (($putres eq 'ok') && (($changed{'owner'} || $changed{'code'}))) {
+ if ($putres eq 'ok') {
&update_coowners($cdom,$cnum,$chome,\%settings,\%newattr);
- if ($changed{'code'}) {
- &Apache::lonnet::devalidate_cache_new('instcats',$cdom);
- # Update cache of self-cataloging courses on institution's server(s).
- if (&Apache::lonnet::shared_institution($cdom)) {
- unless ($registered_cleanup) {
- my $handlers = $r->get_handlers('PerlCleanupHandler');
- $r->set_handlers('PerlCleanupHandler' => [\&devalidate_remote_instcats,@{$handlers}]);
- $registered_cleanup=1;
- $modified_dom = $cdom;
- }
- }
- }
}
}
}
@@ -1517,12 +1479,6 @@ sub modify_course {
$shown = &mt('None');
} elsif (($attr eq 'mysqltables') && ($shown eq '')) {
$shown = &mt('domain default');
- } elsif ($attr eq 'nopasswdchg') {
- if ($shown) {
- $shown = &mt('Yes');
- } else {
- $shown = &mt('No');
- }
}
$chgresponse .= ''.&mt('[_1] now set to: [_2]',$longtype{$attr},$shown).' ';
} else {
@@ -1535,17 +1491,11 @@ sub modify_course {
$shown = &mt('None');
} elsif (($attr eq 'mysqltables') && ($shown eq '')) {
$shown = &mt('domain default');
- } elsif ($attr eq 'nopasswdchg') {
- if ($shown) {
- $shown = &mt('Yes');
- } else {
- $shown = &mt('No');
- }
}
$nochgresponse .= ''.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).' ';
}
}
- if (($type ne 'Community') && ($changed{'code'} || $changed{'owner'})) {
+ if (($type ne 'Community') && ($type ne 'Placement') && ($changed{'code'} || $changed{'owner'})) {
if ( $newattr{'courseowner'} eq '') {
push(@warnings,&mt('There is no owner associated with this LON-CAPA course.').
' '.&mt('If automated enrollment at your institution requires validation of course owners, automated enrollment will fail.'));
@@ -2378,6 +2328,8 @@ ENDSCRIPT
my $bread_text = "View/Modify Courses/Communities";
if ($type eq 'Community') {
$bread_text = 'Community Settings';
+ } elsif ($type eq 'Placement') {
+ $bread_text = 'Placement Test Settings';
} else {
$bread_text = 'Course Settings';
}
@@ -2455,7 +2407,6 @@ sub course_settings_descrip {
'selfenrollmgrdc' => "Course-specific self-enrollment configuration by Domain Coordinator",
'selfenrollmgrcc' => "Course-specific self-enrollment configuration by Course personnel",
'mysqltables' => '"Temporary" student performance tables lifetime (seconds)',
- 'nopasswdchg' => 'Disable changing password for users with student role by course owner',
);
}
return %longtype;
@@ -2468,8 +2419,7 @@ sub hidden_form_elements {
'locarg','krbarg','krbver','counter','hidefromcat','usecategory',
'threshold','postsubmit','postsubtimeout','defaultcredits','uploadquota',
'selfenrollmgrdc','selfenrollmgrcc','action','state','currsec_st',
- 'sections','newsec','mysqltables','nopasswdchg'],
- ['^selfenrollmgr_','^selfenroll_'])."\n".
+ 'sections','newsec','mysqltables'],['^selfenrollmgr_','^selfenroll_'])."\n".
' ';
return $hidden_elements;
}
@@ -2485,7 +2435,6 @@ sub showcredits {
sub get_permission {
my ($dom) = @_;
my ($allowed,%permission);
- my %passwdconf = &Apache::lonnet::get_passwdconf($dom);
if (&Apache::lonnet::allowed('ccc',$dom)) {
$allowed = 1;
%permission = (
@@ -2503,9 +2452,6 @@ sub get_permission {
selfenroll => 'edit',
adhocrole => 'coord',
);
- if ($passwdconf{'crsownerchg'}) {
- $permission{passwdchg} = 'edit';
- }
} elsif (&Apache::lonnet::allowed('rar',$dom)) {
$allowed = 1;
%permission = (
@@ -2518,29 +2464,10 @@ sub get_permission {
selfenroll => 'view',
adhocrole => 'custom',
);
- if ($passwdconf{'crsownerchg'}) {
- $permission{passwdchg} = 'view';
- }
}
return ($allowed,\%permission);
}
-sub devalidate_remote_instcats {
- if ($modified_dom ne '') {
- my %servers = &Apache::lonnet::internet_dom_servers($modified_dom);
- my %thismachine;
- map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
- if (keys(%servers)) {
- foreach my $server (keys(%servers)) {
- next if ($thismachine{$server});
- &Apache::lonnet::remote_devalidate_cache($server,['instcats:'.$modified_dom]);
- }
- }
- $modified_dom = '';
- }
- return;
-}
-
sub handler {
my $r = shift;
if ($r->header_only) {
@@ -2549,9 +2476,6 @@ sub handler {
return OK;
}
- $registered_cleanup=0;
- $modified_dom = '';
-
my $dom = $env{'request.role.domain'};
my $domdesc = &Apache::lonnet::domain($dom,'description');
my ($allowed,$permission) = &get_permission($dom);
@@ -2582,6 +2506,8 @@ sub handler {
}
if ($type eq 'Community') {
$choose_text = "Choose a community";
+ } elsif ($type eq 'Placement') {
+ $choose_text = "Choose a placement test";
} else {
$choose_text = "Choose a course";
}
@@ -2598,6 +2524,8 @@ sub handler {
my $enter_text;
if ($type eq 'Community') {
$enter_text = 'Enter community';
+ } elsif ($type eq 'Placement') {
+ $enter_text = 'Enter placement test';
} else {
$enter_text = 'Enter course';
}
@@ -2620,11 +2548,11 @@ sub handler {
my ($cdom,$cnum) = split(/_/,$env{'form.pickedcourse'});
my ($readonly,$linktext);
if ($permission->{$phase} eq 'view') {
- $readonly = 1;
+ $readonly = 1;
}
if (($phase eq 'setquota') && ($permission->{'setquota'})) {
if ($permission->{'setquota'} eq 'view') {
- $linktext = 'Set quota';
+ $linktext = 'Set quota';
} else {
$linktext = 'Display quota';
}
@@ -2722,6 +2650,8 @@ sub handler {
$r->print('');
if ($type eq 'Community') {
$r->print(&mt('The community you selected is not a valid community in this domain'));
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt('The course you selected is not a valid placement test in this domain'));
} else {
$r->print(&mt('The course you selected is not a valid course in this domain'));
}