[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm
raeburn
raeburn at source.lon-capa.org
Thu May 22 10:17:54 EDT 2014
raeburn Thu May 22 14:17:54 2014 EDT
Modified files:
/loncom/auth lonroles.pm
Log:
- For users with no active roles, but with rights to request courses
only display invitation to request creation of a course.
- For other users with no active roles display information about Course
Catalog (if appropriate).
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.305 loncom/auth/lonroles.pm:1.306
--- loncom/auth/lonroles.pm:1.305 Tue May 20 20:46:13 2014
+++ loncom/auth/lonroles.pm Thu May 22 14:17:53 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.305 2014/05/20 20:46:13 raeburn Exp $
+# $Id: lonroles.pm,v 1.306 2014/05/22 14:17:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -926,12 +926,7 @@
# No active roles
if ($countactive==0) {
- if ($inrole) {
- $r->print('<h2>'.&mt('Currently no additional roles, courses or communities').'</h2>');
- } else {
- $r->print('<h2>'.&mt('Currently no active roles, courses or communities').'</h2>');
- }
- &requestcourse_advice($r,$cattype);
+ &requestcourse_advice($r,$cattype,$inrole);
$r->print('</form>');
if ($countfuture) {
$r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture));
@@ -1444,29 +1439,26 @@
}
sub requestcourse_advice {
- my ($r,$cattype) = @_;
+ my ($r,$cattype,$inrole) = @_;
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
- my (%can_request,%request_doms);
+ my (%can_request,%request_doms,$output);
&Apache::lonnet::check_can_request($env{'user.domain'},\%can_request,\%request_doms);
if (keys(%request_doms) > 0) {
my ($types,$typename) = &Apache::loncommon::course_types();
if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) {
- $r->print('<h3>'.&mt('Request creation of a course or community').'</h3>'.
- '<p>'.&mt('You have rights to request the creation of courses and/or communities in the following domain(s):').'<ul>');
my (@reqdoms, at reqtypes);
foreach my $type (sort(keys(%request_doms))) {
push(@reqtypes,$type);
if (ref($request_doms{$type}) eq 'ARRAY') {
my $domstr = join(', ',map { &Apache::lonnet::domain($_) } sort(@{$request_doms{$type}}));
- $r->print(
+ $output .=
'<li>'
.&mt('[_1]'.$typename->{$type}.'[_2] in domain: [_3]',
'<i>',
'</i>',
'<b>'.$domstr.'</b>')
- .'</li>'
- );
+ .'</li>';
foreach my $dom (@{$request_doms{$type}}) {
unless (grep(/^\Q$dom\E/, at reqdoms)) {
push(@reqdoms,$dom);
@@ -1489,10 +1481,18 @@
}
if (@reqdoms == 1 || @showtypes > 0) {
$requrl .= '&state=crstype&action=new';
- }
- $r->print('</ul>'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','<a href="'.$requrl.'">','</a>').'</p>');
+ }
+ $r->print('<h3>'.&mt('Request creation of a course or community').'</h3>'.
+ '<p>'.&mt('You have rights to request the creation of courses and/or communities in the following domain(s):').'<ul>'.
+ $output.
+ '</ul>'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','<a href="'.$requrl.'">','</a>').'</p>');
}
} elsif (!$env{'user.adv'}) {
+ if ($inrole) {
+ $r->print('<h3>'.&mt('Currently no additional roles, courses or communities').'</h3>');
+ } else {
+ $r->print('<h3>'.&mt('Currently no active roles, courses or communities').'</h3>');
+ }
&findcourse_advice($r,$cattype);
}
return;
More information about the LON-CAPA-cvs
mailing list