--- loncom/auth/lonroles.pm 2010/08/20 03:40:01 1.231.4.15
+++ loncom/auth/lonroles.pm 2010/06/02 16:26:21 1.251
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.231.4.15 2010/08/20 03:40:01 raeburn Exp $
+# $Id: lonroles.pm,v 1.251 2010/06/02 16:26:21 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -57,8 +57,7 @@ course they should act on, etc. Both in
handler determines via C's C<&allowed> function that a certain
action is not allowed, C is used as error handler. This
allows the user to select another role which may have permission to do
-what they were trying to do. C can also be accessed via the
-B button in the Remote Control.
+what they were trying to do.
=begin latex
@@ -138,28 +137,25 @@ 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,
+ 'text' => 'Switching Role'},];
my $start_page = &Apache::loncommon::start_page('Switching Role',undef,
- {'redirect' => [1,$url]});
+ {'redirect' => [1,$url],
+ 'bread_crumbs' => $brcrum,});
my $end_page = &Apache::loncommon::end_page();
# Note to style police:
@@ -167,12 +163,6 @@ sub redirect_user {
$url=~s/ /\%20/g;
$r->print(<
-//
-
-$navwindow
$msg
$end_page
ENDREDIR
@@ -185,17 +175,25 @@ sub error_page {
&Apache::loncommon::no_cache($r);
$r->send_http_header;
return OK if $r->header_only;
- $r->print(&Apache::loncommon::start_page('Problems during Course Initialization').
+ # Breadcrumbs
+ my $brcrum = [{'href' => $dest,
+ 'text' => 'Problems during Course Initialization'},];
+ $r->print(&Apache::loncommon::start_page('Problems during Course Initialization',
+ undef,
+ {'bread_crumbs' => $brcrum,})
+ );
+ $r->print(
''.
''.&mt('The following problems occurred:').
- '
'.
+ '
'.
$error.
- '
'.&mt('Continue').''.
- &Apache::loncommon::end_page());
+ '
'.&mt('Continue').''
+ );
+ $r->print(&Apache::loncommon::end_page());
}
sub handler {
@@ -225,16 +223,7 @@ sub handler {
if ($env{'request.course.id'}) {
# Check if user is CC trying to select a course role
if ($env{'form.switchrole'}) {
- my $switch_is_active;
- if (defined($env{'user.role.'.$env{'form.switchrole'}})) {
- my ($start,$end) = split(/\./,$env{'user.role.'.$env{'form.switchrole'}});
- if (!$end || $end > $now) {
- if (!$start || $start < $refresh) {
- $switch_is_active = 1;
- }
- }
- }
- unless ($switch_is_active) {
+ if (!defined($env{'user.role.'.$env{'form.switchrole'}})) {
&adhoc_course_role($refresh,$then);
}
}
@@ -489,7 +478,7 @@ ENDENTERKEY
}
$courseid =~ s/\//_/;
if ((($role eq 'cc') || ($role eq 'co'))
- && ($env{'course.' . $courseid .'.course.helper.not.run'})) {
+ && ($env{'course.' . $courseid .'.course.helper.not.run'})) {
$furl = "/adm/helper/course.initialization.helper";
# Send the user to the course they selected
} elsif ($env{'request.course.id'}) {
@@ -499,10 +488,9 @@ ENDENTERKEY
my $esc_symb = &HTML::Entities::encode($env{'form.destsymb'},'"<>&');
$dest .= '?symb='.$esc_symb;
}
- &redirect_user($r,&mt('Entering [_1]',
- $env{'course.'.$courseid.'.description'}),
- $dest,$msg,
- $env{'environment.remotenavmap'});
+ &redirect_user($r, &mt('Entering [_1]',
+ $env{'course.'.$courseid.'.description'}),
+ $dest, $msg);
return OK;
}
if (&Apache::lonnet::allowed('whn',
@@ -515,9 +503,8 @@ ENDENTERKEY
unless ($startpage eq 'firstres') {
$msg = &mt('Entering [_1] ...',
$env{'course.'.$courseid.'.description'});
- &redirect_user($r,&mt('New in course'),
- '/adm/whatsnew?refpage=start',$msg,
- $env{'environment.remotenavmap'});
+ &redirect_user($r, &mt('New in course'),
+ '/adm/whatsnew?refpage=start', $msg);
return OK;
}
}
@@ -529,10 +516,9 @@ ENDENTERKEY
}
$msg = &mt('Entering [_1] ...',
$env{'course.'.$courseid.'.description'});
- &redirect_user($r,&mt('Entering [_1]',
- $env{'course.'.$courseid.'.description'}),
- $furl,$msg,
- $env{'environment.remotenavmap'});
+ &redirect_user($r, &mt('Entering [_1]',
+ $env{'course.'.$courseid.'.description'}),
+ $furl, $msg);
}
return OK;
}
@@ -711,7 +697,6 @@ ENDHEADER
$r->print(&Apache::loncoursequeueadmin::queued_selfenrollment());
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
-
$r->print(
''
.&mt('[_1]Visit the [_2]Course/Community Catalog[_3]'
@@ -736,7 +721,7 @@ ENDHEADER
$r->print('
'.&mt('Currently no active roles, courses or communities').'
');
}
&findcourse_advice($r);
- &requestcourse_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));
@@ -767,6 +752,7 @@ ENDHEADER
return OK;
}
# ----------------------------------------------------------------------- Table
+
if ($numdc > 0) {
$r->print(&coursepick_jscript());
$r->print(&Apache::loncommon::coursebrowser_javascript().
@@ -784,6 +770,7 @@ ENDHEADER
$env{'form.destsymb'}.'" />');
}
}
+
my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole,$nochoose);
if ($env{'environment.recentroles'}) {
my %recent_roles =
@@ -933,7 +920,7 @@ sub gather_roles {
if ($role =~ /^cr\//) {
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role);
if ($tremark) { $tremark.='
'; }
- $tremark.=&mt('Customrole defined by [_1].',$rauthor.':'.$rdomain);
+ $tremark.=&mt('Defined by [_1] at [_2].',$rauthor,$rdomain);
}
$trole=Apache::lonnet::plaintext($role);
my $ttype;
@@ -997,9 +984,9 @@ sub gather_roles {
$sortkey=$role."\0".$tdom."\0".$newhash{'description'}.
"\0".$envkey;
$twhere=&HTML::Entities::encode($newhash{'description'},'"<>&').
- ' '.
- &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom).
- '';
+ ' '.
+ &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom).
+ '';
$ttype = $newhash{'type'};
$trole = &Apache::lonnet::plaintext($role,$ttype,$tcourseid);
} else {
@@ -1196,12 +1183,12 @@ sub requestcourse_advice {
&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')) {
+ 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);
+ push(@reqtypes,$type);
if (ref($request_doms{$type}) eq 'ARRAY') {
my $domstr = join(', ',map { &Apache::lonnet::domain($_) } sort(@{$request_doms{$type}}));
$r->print(
@@ -1234,7 +1221,7 @@ 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.','','').'');
}
}
@@ -1584,7 +1571,7 @@ sub display_cc_role {
$env{'course.'.$tcourseid.'.description'}=$twhere;
}
my $trole = &Apache::lonnet::plaintext($ccrole,$ttype,$tcourseid);
- $twhere.="
".&mt('Domain').":".$tdom;
+ $twhere.="
".&mt('Domain').":".$1;
($roletext,$roletext_end) = &build_roletext($trolecode,$tdom,$trest,'is',$tryagain,$advanced,'',$tbg,$trole,$twhere,'','','',1,'');
}
}
@@ -1661,8 +1648,7 @@ course they should act on, etc. Both in
handler determines via C's C<&allowed> function that a certain
action is not allowed, C is used as error handler. This
allows the user to select another role which may have permission to do
-what they were trying to do. C can also be accessed via the
-B button in the Remote Control.
+what they were trying to do.
=begin latex