--- loncom/auth/lonroles.pm 2009/07/22 21:51:03 1.229
+++ loncom/auth/lonroles.pm 2010/03/16 19:55:31 1.245
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.229 2009/07/22 21:51:03 raeburn Exp $
+# $Id: lonroles.pm,v 1.245 2010/03/16 19:55:31 droeschl Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -138,25 +138,18 @@ use Apache::lonannounce;
use Apache::lonlocal;
use Apache::lonpageflip();
use Apache::lonnavdisplay();
+use Apache::loncoursequeueadmin;
use GDBM_File;
use LONCAPA qw(:DEFAULT :match);
use HTML::Entities;
sub redirect_user {
- my ($r,$title,$url,$msg,$launch_nav) = @_;
+ my ($r,$title,$url,$msg) = @_;
$msg = $title if (! defined($msg));
&Apache::loncommon::content_type($r,'text/html');
&Apache::loncommon::no_cache($r);
$r->send_http_header;
- my $swinfo=&Apache::lonmenu::rawconfig();
- my $navwindow;
- if ($launch_nav eq 'on') {
- $navwindow.=&Apache::lonnavdisplay::launch_win('now',undef,undef,
- ($url =~ m-^/adm/whatsnew-));
- } else {
- $navwindow.=&Apache::lonnavmaps::close();
- }
# Breadcrumbs
my $brcrum = [{'href' => $url,
@@ -171,12 +164,6 @@ sub redirect_user {
$url=~s/ /\%20/g;
$r->print(< $msg '
+ .' '
+ .' '.&mt('[_1]Visit the [_2]Course Catalog[_3] to view all [_4] LON-CAPA courses.','','','',$domdesc).' '
+ .&mt('[_1]Visit the [_2]Course/Community Catalog[_3]'
+ .' to view all [_4] LON-CAPA courses and communities.'
+ ,''
+ ,''
+ ,'',$domdesc)
+ .' '
- .&mt('This is LON-CAPA [_1]',$r->dir_config('lonVersion'))
- .' '
+ .&mt('This LON-CAPA server is version [_1]',$r->dir_config('lonVersion'))
+ .' '.&mt('The [_1]Course Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created.','','',$domdesc).' '.&mt('The [_1]Course/Community Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created, as well as any communities in the domain.','','',$domdesc).' '.&mt('You have rights to request the creation of courses and/or communities in the following domain(s):').''.
- &mt('As your session file for the course has expired, you will need to re-select the course.').'
');
+ &mt('As your session file for the course or community has expired, you will need to re-select it.').'');
} else {
$r->print(
''.
- &mt('You need to choose another user role or enter a specific course for this function').'
');
+ &mt('You need to choose another user role or enter a specific course or community for this function.').
+ '');
}
}
}
@@ -703,27 +688,41 @@ ENDHEADER
$refresh = $now;
&Apache::lonnet::appenv({'user.refresh.time' => $refresh});
if ($env{'user.adv'}) {
- $r->print(
- '
'.&mt('If a course is [_1]not[_2] in your list of current courses below, you may be able to enroll if self-enrollment is permitted.','','').'
'
+ .&mt('If a course or community is [_1]not[_2] in your list of current courses and communities below,'
+ .' you may be able to enroll if self-enrollment is permitted.'
+ ,'','')
+ .''.&mt('Currently no additional roles or courses').'
');
+ $r->print(''.&mt('Currently no additional roles, courses or communities').'
');
} else {
- $r->print(''.&mt('Currently no active roles or courses').'
');
+ $r->print(''.&mt('Currently no active roles, courses or communities').'
');
}
&findcourse_advice($r);
+ &requestcourse_advice($r);
$r->print('');
if ($countfuture) {
$r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture));
@@ -843,12 +842,12 @@ ENDHEADER
$r->print(&Apache::lonnet::getannounce());
if ($advanced) {
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
- $r->print('
'
- .''.&mt('Logout').' '
+ $r->print('
'
+ .''.&mt('Logout').' '
.''
- .&mt('Course Catalog')
+ .&mt('Course/Community Catalog')
.'
');
}
- $r->print('
');
- $r->print(&mt('You can search the course catalog for courses which permit self-enrollment, if you would like to enroll in a course.').''.&mt('Self-Enrollment').'
'.
+ '
');
+ $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'
'.
- &Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row().
- ''.&mt('Date requested').' '.&mt('Course title').' '.
- ''.&mt('User role').' '.&mt('Section').' '.
- &Apache::loncommon::end_data_table_header_row());
- my @sorted = sort { $a <=> $b } (keys(%reqs_by_date));
- foreach my $item (@sorted) {
- if (ref($reqs_by_date{$item}) eq 'ARRAY') {
- foreach my $crs (@{$reqs_by_date{$item}}) {
- my %courseinfo = &Apache::lonnet::coursedescription($crs);
- my $usec = $selfenrollrequests{$crs}{'section'};
- if ($usec eq '') {
- $usec = &mt('No section');
+ my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
+ my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
+ 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').'
'.
+ '');
+ 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(
+ '
'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','','').''.&Apache::lonlocal::locallocaltime($item).' '.
- ''.$courseinfo{'description'}.' '.
- ''.$rolename.' '.$usec.' '.
- &Apache::loncommon::end_data_table_row());
}
}
+ my @showtypes;
+ foreach my $type (@{$types}) {
+ if (grep(/^\Q$type\E$/,@reqtypes)) {
+ push(@showtypes,$type);
+ }
+ }
+ my $requrl = '/adm/requestcourse';
+ if (@reqdoms == 1) {
+ $requrl .= '?showdom='.$reqdoms[0];
+ }
+ if (@showtypes > 0) {
+ $requrl.=(($requrl=~/\?/)?'&':'?').'crstype='.$showtypes[0];
+ }
+ if (@reqdoms == 1 || @showtypes > 0) {
+ $requrl .= '&state=crstype&action=new';
+ }
+ $r->print('