--- loncom/auth/lonroles.pm 2014/05/20 20:36:16 1.304
+++ loncom/auth/lonroles.pm 2014/05/22 14:17:53 1.306
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.304 2014/05/20 20:36:16 musolffc Exp $
+# $Id: lonroles.pm,v 1.306 2014/05/22 14:17:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -203,11 +203,8 @@ sub handler {
my $r = shift;
# Check for critical messages and redirect if present.
- print STDERR "crit check\n";
my ($redirect,$url) = &Apache::loncommon::critical_redirect(300);
- print STDERR "(redirect, url) = $redirect, $url\n";
if ($redirect) {
- print STDERR "check passed. Redirecting to $url\n";
&Apache::loncommon::content_type($r,'text/html');
$r->header_out(Location => $url);
return REDIRECT;
@@ -258,9 +255,7 @@ sub handler {
my $envkey;
my %dcroles = ();
my $numdc = &check_fordc(\%dcroles,$update,$then);
-#my $loncaparev = $Apache::lonnet::perlvar{'lonVersion'};
my $loncaparev = $r->dir_config('lonVersion');
- print STDERR "loncaparev set ||$loncaparev||\n";
# ================================================================== Roles Init
if ($env{'form.selectrole'}) {
@@ -931,12 +926,7 @@ ENDHEADER
# No active roles
if ($countactive==0) {
- if ($inrole) {
- $r->print('
'.&mt('Currently no additional roles, courses or communities').'
');
- } else {
- $r->print(''.&mt('Currently no active roles, courses or communities').'
');
- }
- &requestcourse_advice($r,$cattype);
+ &requestcourse_advice($r,$cattype,$inrole);
$r->print('');
if ($countfuture) {
$r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture));
@@ -1449,29 +1439,26 @@ sub findcourse_advice {
}
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(''.&mt('Request creation of a course or community').'
'.
- ''.&mt('You have rights to request the creation of courses and/or communities in the following domain(s):').'
');
my (@reqdoms,@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 .=
'- '
.&mt('[_1]'.$typename->{$type}.'[_2] in domain: [_3]',
'',
'',
''.$domstr.'')
- .'
'
- );
+ .'';
foreach my $dom (@{$request_doms{$type}}) {
unless (grep(/^\Q$dom\E/,@reqdoms)) {
push(@reqdoms,$dom);
@@ -1494,10 +1481,18 @@ sub requestcourse_advice {
}
if (@reqdoms == 1 || @showtypes > 0) {
$requrl .= '&state=crstype&action=new';
- }
- $r->print('
'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','','').'');
+ }
+ $r->print(''.&mt('Request creation of a course or community').'
'.
+ ''.&mt('You have rights to request the creation of courses and/or communities in the following domain(s):').'
'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','','').'');
}
} elsif (!$env{'user.adv'}) {
+ if ($inrole) {
+ $r->print(''.&mt('Currently no additional roles, courses or communities').'
');
+ } else {
+ $r->print(''.&mt('Currently no active roles, courses or communities').'
');
+ }
&findcourse_advice($r,$cattype);
}
return;
@@ -1767,7 +1762,6 @@ sub check_release_required {
if ($required ne '') {
my ($reqdmajor,$reqdminor) = ($required =~ /^(\d+)\.(\d+)$/);
my ($major,$minor) = ($loncaparev =~ /^\'?(\d+)\.(\d+)\.[\w.\-]+\'?$/);
- print STDERR "version: required ||$required|| loncaparev ||$loncaparev||\n";
if ($reqdmajor ne '' && $reqdminor ne '') {
my $otherserver;
if (($major eq '' && $minor eq '') ||