[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm lonuserutils.pm
raeburn
raeburn at source.lon-capa.org
Tue Aug 1 11:56:33 EDT 2023
raeburn Tue Aug 1 15:56:33 2023 EDT
Modified files:
/loncom/interface lonuserutils.pm loncreateuser.pm
Log:
- "User Self-Enrollment" link/icon always shown in Administration box in
People > Users for course personnel with privilege to assign student roles,
even if course configuration (set by DC) makes all self-enrollment options
configurable by a DC and not a CC (settings will be readonly by CC).
-------------- next part --------------
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.215 loncom/interface/lonuserutils.pm:1.216
--- loncom/interface/lonuserutils.pm:1.215 Tue Aug 1 07:48:21 2023
+++ loncom/interface/lonuserutils.pm Tue Aug 1 15:56:32 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.215 2023/08/01 07:48:21 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.216 2023/08/01 15:56:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6780,6 +6780,9 @@
$permission{'selfenrolladmin'} = 1;
}
}
+ unless ($permission{'selfenrolladmin'}) {
+ $permission{'selfenrollview'} = 1;
+ }
}
if ($env{'request.course.id'}) {
my $user;
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.468 loncom/interface/loncreateuser.pm:1.469
--- loncom/interface/loncreateuser.pm:1.468 Tue Jun 20 14:03:52 2023
+++ loncom/interface/loncreateuser.pm Tue Aug 1 15:56:32 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.468 2023/06/20 14:03:52 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.469 2023/08/01 15:56:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4920,7 +4920,7 @@
if (&Apache::lonnet::auto_run($cnum,$cdom) && (($permission->{'cusr'}) || ($permission->{'view'}))) {
push(@allhelp,'Course_Automated_Enrollment');
}
- if ($permission->{'selfenrolladmin'}) {
+ if (($permission->{'selfenrolladmin'}) || ($permission->{'selfenrollview'})) {
push(@allhelp,'Course_Approve_Selfenroll');
}
}
@@ -5460,8 +5460,9 @@
'<span class="LC_error">'.&mt('You do not have permission to modify dates or sections for users').'</span>');
}
} elsif ($env{'form.action'} eq 'selfenroll') {
- if ($permission->{selfenrolladmin}) {
- my %currsettings = (
+ my %currsettings;
+ if ($permission->{selfenrolladmin} || $permission->{selfenrollview}) {
+ %currsettings = (
selfenroll_types => $env{'course.'.$cid.'.internal.selfenroll_types'},
selfenroll_registered => $env{'course.'.$cid.'.internal.selfenroll_registered'},
selfenroll_section => $env{'course.'.$cid.'.internal.selfenroll_section'},
@@ -5477,6 +5478,8 @@
default_enrollment_end_date => $env{'course.'.$cid.'.default_enrollment_end_date'},
uniquecode => $env{'course.'.$cid.'.internal.uniquecode'},
);
+ }
+ if ($permission->{selfenrolladmin}) {
push(@{$brcrum},
{href => '/adm/createuser?action=selfenroll',
text => "Configure Self-enrollment",
@@ -5497,6 +5500,16 @@
$r->print('<h3>'.&mt('Self-enrollment with a student role').'</h3>'."\n");
&update_selfenroll_config($r,$cid,$cdom,$cnum,$context,$crstype,\%currsettings);
}
+ } elsif ($permission->{selfenrollview}) {
+ push(@{$brcrum},
+ {href => '/adm/createuser?action=selfenroll',
+ text => "View Self-enrollment configuration",
+ help => 'Course_Self_Enrollment'});
+ $args = { bread_crumbs => $brcrum,
+ bread_crumbs_component => 'Self-enrollment Settings'};
+ $r->print(&header(undef,$args));
+ $r->print('<h3>'.&mt('Self-enrollment with a student role').'</h3>'."\n");
+ &print_selfenroll_menu($r,'course',$cid,$cdom,$cnum,\%currsettings,'',1);
} else {
$r->print(&header(undef,{'no_nav_bar' => 1}).
'<span class="LC_error">'.&mt('You do not have permission to configure self-enrollment').'</span>');
@@ -6028,7 +6041,7 @@
icon => 'selfenrl-queue.png',
#help => 'Course_Approve_Selfenroll',
url => '/adm/createuser?action=selfenrollqueue',
- permission => $permission->{'selfenrolladmin'},
+ permission => $permission->{'selfenrolladmin'} || $permission->{'selfenrollview'},
linktitle =>'Approve or reject enrollment requests.',
},
);
@@ -6055,7 +6068,7 @@
icon => 'self_enroll.png',
#help => 'Course_Self_Enrollment',
url => '/adm/createuser?action=selfenroll',
- permission => $permission->{'selfenrolladmin'},
+ permission => $permission->{'selfenrolladmin'} || $permission->{'selfenrollview'},
linktitle => 'Configure user self-enrollment.',
},
);
@@ -6326,8 +6339,7 @@
'// ]]>'."\n".
'</script>'."\n".
'<h3>'.$lt->{'selfenroll'}.'</h3>'."\n";
-
- my $visactions = &cat_visibility();
+ my $visactions = &cat_visibility($cdom);
my ($cathash,%cattype);
my %domconfig = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom);
if (ref($domconfig{'coursecategories'}) eq 'HASH') {
@@ -6873,6 +6885,7 @@
}
sub cat_visibility {
+ my ($cdom) = @_;
my %visactions = &Apache::lonlocal::texthash(
vis => 'This course/community currently appears in the Course/Community Catalog for this domain.',
gen => 'Courses can be both self-cataloging, based on an institutional code (e.g., fs08phy231), or can be assigned categories from a hierarchy defined for the domain.',
@@ -6885,13 +6898,24 @@
dc_chgconf => 'Ask a domain coordinator to change the Catalog type for this domain.',
dc_setcode => 'Ask a domain coordinator to assign a six character code to the course',
dc_unhide => 'Ask a domain coordinator to change the "Exclude from course catalog" setting.',
- dc_addinst => 'Ask a domain coordinator to enable display the catalog of "Official courses (with institutional codes)".',
+ dc_addinst => 'Ask a domain coordinator to enable catalog display of "Official courses (with institutional codes)".',
dc_instcode => 'Ask a domain coordinator to assign an institutional code (if this is an official course).',
dc_catalog => 'Ask a domain coordinator to enable or create at least one course category in the domain.',
dc_categories => 'Ask a domain coordinator to create a hierarchy of categories and sub categories for courses in the domain.',
dc_chgcat => 'Ask a domain coordinator to change the category assigned to the course, as the one currently assigned is no longer used in the domain',
dc_addcat => 'Ask a domain coordinator to assign a category to the course.',
);
+ if ($env{'request.role'} eq "dc./$cdom/") {
+ $visactions{'dc_chgconf'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to change the Catalog type for this domain.','»');
+ $visactions{'dc_setcode'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to assign a six character code to the course.','»');
+ $visactions{'dc_unhide'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to change the "Exclude from course catalog" setting.','»');
+ $visactions{'dc_addinst'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to enable catalog display of "Official courses (with institutional codes)".','»');
+ $visactions{'dc_instcode'} = &mt('Use: "Main menu" [_1] "View or modify a course or community" [_1] "View/Modify course owner, institutional code ... " to assign an institutional code (if this is an official course).','»');
+ $visactions{'dc_catalog'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to enable or create at least one course category in the domain.','»');
+ $visactions{'dc_categories'} = &mt('Use: "Main menu" [_1] "Set domain configuration" [_1] "Cataloging of courses/communities" to create a hierarchy of categories and sub categories for courses in the domain.','»');
+ $visactions{'dc_chgcat'} = &mt('Use: "Main menu" [_1] "View or modify a course or community" [_1] "View/Modify catalog settings for course" to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','»');
+ $visactions{'dc_addcat'} = &mt('Use: "Main menu" [_1] "View or modify a course or community" [_1] "View/Modify catalog settings for course" to assign a category to the course.','»');
+ }
$visactions{'unhide'} = &mt('Use [_1]Categorize course[_2] to change the "Exclude from course catalog" setting.','<a href="/adm/courseprefs?phase=display&actions=courseinfo">','</a>"');
$visactions{'chgcat'} = &mt('Use [_1]Categorize course[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','"<a href="/adm/courseprefs?phase=display&actions=courseinfo">','</a>"');
$visactions{'addcat'} = &mt('Use [_1]Categorize course[_2] to assign a category to the course.','"<a href="/adm/courseprefs?phase=display&actions=courseinfo">','</a>"');
@@ -9951,7 +9975,7 @@
} else {
$r->print(&mt('No changes were made to the existing self-enrollment settings in this course.'));
}
- my $visactions = &cat_visibility();
+ my $visactions = &cat_visibility($cdom);
my ($cathash,%cattype);
my %domconfig = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom);
if (ref($domconfig{'coursecategories'}) eq 'HASH') {
More information about the LON-CAPA-cvs
mailing list