');
}
$r->print(&Apache::loncommon::end_page());
return OK;
@@ -1211,7 +1100,6 @@ sub gather_roles {
my $tryagain = $env{'form.tryagain'};
my @ids = &Apache::lonnet::current_machine_ids();
if (ref($roles_in_env) eq 'HASH') {
- my %adhocdesc;
foreach my $envkey (sort(keys(%{$roles_in_env}))) {
my $button = 1;
my $switchserver='';
@@ -1263,10 +1151,8 @@ sub gather_roles {
my $trole;
if ($role =~ /^cr\//) {
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role);
- unless ($rauthor eq $rdomain.'-domainconfig') {
- if ($tremark) { $tremark.=' '; }
- $tremark.=&mt('Custom role defined by [_1].',$rauthor.':'.$rdomain);
- }
+ if ($tremark) { $tremark.=' '; }
+ $tremark.=&mt('Custom role defined by [_1].',$rauthor.':'.$rdomain);
}
$trole=Apache::lonnet::plaintext($role);
my $ttype;
@@ -1312,32 +1198,7 @@ sub gather_roles {
} elsif ($trest) {
my $tcourseid=$tdom.'_'.$trest;
$ttype = &Apache::loncommon::course_type($tcourseid);
- if ($role !~ /^cr/) {
- $trole = &Apache::lonnet::plaintext($role,$ttype,$tcourseid);
- } elsif ($role =~ m{^\Qcr/$tdom/$tdom\E\-domainconfig/(\w+)$}) {
- my $rolename = $1;
- my $desc;
- if (ref($adhocdesc{$tdom}) eq 'HASH') {
- $desc = $adhocdesc{$tdom}{$rolename};
- } else {
- my %domdef = &Apache::lonnet::get_domain_defaults($tdom);
- if (ref($domdef{'adhocroles'}) eq 'HASH') {
- foreach my $rolename (sort(keys(%{$domdef{'adhocroles'}}))) {
- if (ref($domdef{'adhocroles'}{$rolename}) eq 'HASH') {
- $adhocdesc{$tdom}{$rolename} = $domdef{'adhocroles'}{$rolename}{'desc'};
- $desc = $adhocdesc{$tdom}{$rolename};
- }
- }
- }
- }
- if ($desc ne '') {
- $trole = $desc;
- } else {
- $trole = &mt('Helpdesk[_1]',' '.$rolename);
- }
- } else {
- $trole = (split(/\//,$role,4))[-1];
- }
+ $trole = &Apache::lonnet::plaintext($role,$ttype,$tcourseid);
if ($env{'course.'.$tcourseid.'.description'}) {
my $home=$env{'course.'.$tcourseid.'.home'};
$twhere=$env{'course.'.$tcourseid.'.description'};
@@ -1351,7 +1212,7 @@ sub gather_roles {
my $required = $env{'course.'.$tcourseid.'.internal.releaserequired'};
if ($required ne '') {
($switchserver,$switchwarning) =
- &Apache::loncommon::check_release_required($loncaparev,$tcourseid,$trolecode,$required);
+ &check_release_required($loncaparev,$tcourseid,$trolecode,$required);
if ($switchserver || $switchwarning) {
$button = 0;
}
@@ -1374,7 +1235,7 @@ sub gather_roles {
my $required = $newhash{'internal.releaserequired'};
if ($required ne '') {
($switchserver,$switchwarning) =
- &Apache::loncommon::check_release_required($loncaparev,$tcourseid,$trolecode,$required);
+ &check_release_required($loncaparev,$tcourseid,$trolecode,$required);
if ($switchserver || $switchwarning) {
$button = 0;
}
@@ -1475,7 +1336,7 @@ sub roletable_headers {
my $doheaders;
if ((ref($sortrole) eq 'HASH') && (ref($roleclass) eq 'HASH')) {
$r->print(' '
- .&Apache::loncommon::start_data_table('LC_textsize_mobile')
+ .&Apache::loncommon::start_data_table()
.&Apache::loncommon::start_data_table_header_row()
);
if (!$nochoose) { $r->print('
'); }
@@ -1506,7 +1367,7 @@ sub roletypes {
}
sub print_rolerows {
- my ($r,$doheaders,$roleclass,$sortrole,$dcroles,$roletext,$update,$then) = @_;
+ my ($r,$doheaders,$roleclass,$sortrole,$dcroles,$roletext) = @_;
if ((ref($roleclass) eq 'HASH') && (ref($sortrole) eq 'HASH')) {
my @types = &roletypes();
foreach my $type (@types) {
@@ -1524,14 +1385,12 @@ sub print_rolerows {
&Apache::loncommon::end_data_table_row();
}
}
- if ($sortrole->{$which} =~ m{^user\.role\.dc\./($match_domain)/}) {
+ if ($sortrole->{$which} =~ m-dc\./($match_domain)/-) {
if (ref($dcroles) eq 'HASH') {
if ($dcroles->{$1}) {
$output .= &adhoc_roles_row($1,'');
}
}
- } elsif ($sortrole->{$which} =~ m{^user\.role\.(dh|da)\./($match_domain)/}) {
- $output .= &adhoc_customroles_row($1,$2,'',$update,$then);
}
}
}
@@ -1552,26 +1411,20 @@ sub print_rolerows {
}
sub findcourse_advice {
- my ($r,$cattype,$elapsed) = @_;
+ my ($r,$cattype) = @_;
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
if (&Apache::lonnet::auto_run(undef,$env{'user.domain'})) {
- $r->print('
'.&mt('If you were expecting to see an active role listed for a particular course in the [_1] domain, it may be missing for one of the following reasons:',$domdesc).'
+ $r->print(&mt('If you were expecting to see an active role listed for a particular course in the [_1] domain, it may be missing for one of the following reasons:',$domdesc).'
'.&mt('The course has yet to be created.').'
'.&mt('Automatic enrollment of registered students has not been enabled for the course.').'
'.&mt('You are in a section of course for which automatic enrollment in the corresponding LON-CAPA course is not active.').'
'.&mt('The start date for automated enrollment has yet to be reached.').'
'.&mt('You registered for the course recently and there is a time lag between the time you register, and the time this information becomes available for the update of LON-CAPA course rosters.').'
-
'.&mt('Automated enrollment added you to the course in the time since you last logged-in.').' '.&mt('If that is the case you can use the "Check for changes" link in the gray Functions bar to update the list of your available course roles.').'
-
');
+ ');
} else {
- $r->print('
'.&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'
');
- if ($elapsed > 600) {
- $r->print('
'.&mt('You may also have been assigned to a course in the time since you last logged-in, or checked for changes.').
- ' '.
- &mt('If that is the case you can use the "Check for changes" link in the gray Functions bar to update the list of your available course roles.').'
');
- }
+ $r->print(&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').' ');
}
if (($cattype eq 'std') || ($cattype eq 'domonly')) {
$r->print('
'.&mt('Self-Enrollment').'
'.
@@ -1583,26 +1436,29 @@ sub findcourse_advice {
}
sub requestcourse_advice {
- my ($r,$cattype,$inrole,$elapsed) = @_;
+ my ($r,$cattype) = @_;
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
- my (%can_request,%request_doms,$output);
+ my (%can_request,%request_doms);
&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}}));
- $output .=
+ $r->print(
'
'
.&mt('[_1]'.$typename->{$type}.'[_2] in domain: [_3]',
'',
'',
''.$domstr.'')
- .'
'.&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):').
- '
'.
- $output.
- '
'.
- &mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.',
- '','').
- '');
- }
+ }
+ $r->print('
'.&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,$elapsed);
+ &findcourse_advice($r,$cattype);
}
return;
}
@@ -1705,13 +1546,10 @@ sub privileges_info {
}
sub build_roletext {
- my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$trole,$twhere,
- $tpstart,$tpend,$nochoose,$button,$switchserver,$reinit,$switchwarning) = @_;
- my ($roletext,$roletext_end,$poss_adhoc);
- if ($trolecode =~ m/^d(c|h|a)\./) {
- $poss_adhoc = 1;
- }
- my $rowspan=($poss_adhoc) ? ''
+ my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$trole,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver,$reinit,$switchwarning) = @_;
+ my ($roletext,$roletext_end);
+ my $is_dc=($trolecode =~ m/^dc\./);
+ my $rowspan=($is_dc) ? ''
: ' rowspan="2" ';
unless ($nochoose) {
@@ -1772,7 +1610,7 @@ sub build_roletext {
.'