--- loncom/auth/lonroles.pm 2010/10/06 18:46:53 1.240.2.18
+++ loncom/auth/lonroles.pm 2010/03/22 20:11:08 1.246
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.240.2.18 2010/10/06 18:46:53 raeburn Exp $
+# $Id: lonroles.pm,v 1.246 2010/03/22 20:11:08 droeschl 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
@@ -145,19 +144,11 @@ 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,
@@ -165,7 +156,6 @@ sub redirect_user {
my $start_page = &Apache::loncommon::start_page('Switching Role',undef,
{'redirect' => [1,$url],
'bread_crumbs' => $brcrum,});
- &Apache::lonhtmlcommon::clear_breadcrumbs();
my $end_page = &Apache::loncommon::end_page();
# Note to style police:
@@ -173,12 +163,6 @@ sub redirect_user {
$url=~s/ /\%20/g;
$r->print(<
-//
-
-$navwindow
$msg
$end_page
ENDREDIR
@@ -226,7 +210,6 @@ sub handler {
my %dcroles = ();
my $numdc = &check_fordc(\%dcroles,$then);
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
- my $custommenu = &Apache::loncommon::needs_gci_custom();
# ================================================================== Roles Init
if ($env{'form.selectrole'}) {
@@ -321,9 +304,7 @@ sub handler {
}
}
}
- if (($env{'form.cm'}) && ($env{'form.orgurl'})) {
- $r->internal_redirect($env{'form.orgurl'});
- }
+
foreach $envkey (keys %env) {
next if ($envkey!~/^user\.role\./);
my ($where,$trolecode,$role,$tstatus,$tend,$tstart);
@@ -450,16 +431,8 @@ ENDENTERKEY
if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) {
my $msg;
- if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }
- &Apache::lonnet::appenv({'request.role.adv'=>$tadv});
my ($furl,$ferr)=
&Apache::lonuserstate::readmap($cdom.'/'.$cnum);
- if ($custommenu) {
- unless (($ferr) || ($env{'form.switchrole'})) {
- &Apache::lonnet::put('nohist_crslastlogin',{$env{'user.name'}.':'.$env{'user.domain'}.':'.$csec.':'.$role => $now},
- $cdom,$cnum);
- }
- }
if (($env{'form.orgurl'}) &&
($env{'form.orgurl'}!~/^\/adm\/flip/)) {
my $dest=$env{'form.orgurl'};
@@ -471,6 +444,8 @@ ENDENTERKEY
}
$dest .= 'symb='.$env{'form.symb'};
}
+ if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }
+ &Apache::lonnet::appenv({'request.role.adv'=>$tadv});
if (($ferr) && ($tadv)) {
&error_page($r,$ferr,$dest);
} else {
@@ -489,6 +464,8 @@ ENDENTERKEY
.'
'.&mt('Please try again.').'
'
.'
'.$ferr.'
';
}
+ if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }
+ &Apache::lonnet::appenv({'request.role.adv'=>$tadv});
if (($ferr) && ($tadv)) {
&error_page($r,$ferr,$furl);
@@ -500,7 +477,7 @@ ENDENTERKEY
$courseid = substr($courseid, 1);
}
$courseid =~ s/\//_/;
- if (($cdom ne 'gcitest') && (($role eq 'cc') || ($role eq 'co'))
+ if ((($role eq 'cc') || ($role eq 'co'))
&& ($env{'course.' . $courseid .'.course.helper.not.run'})) {
$furl = "/adm/helper/course.initialization.helper";
# Send the user to the course they selected
@@ -511,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',
@@ -524,12 +500,11 @@ ENDENTERKEY
.$env{'request.course.sec'})
) {
my $startpage = &courseloadpage($courseid);
- unless (($startpage eq 'firstres') || ($cdom eq 'gcitest')) {
+ 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;
}
}
@@ -539,15 +514,11 @@ ENDENTERKEY
# Guess not ...
$furl=&Apache::lonpageflip::first_accessible_resource();
}
- if (($cdom eq 'gcitest') && ($custommenu)) {
- $furl = '/adm/navmaps';
- }
$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;
}
@@ -584,6 +555,7 @@ ENDENTERKEY
}
}
+
# =============================================================== No Roles Init
&Apache::loncommon::content_type($r,'text/html');
@@ -591,47 +563,23 @@ ENDENTERKEY
$r->send_http_header;
return OK if $r->header_only;
- my ($crumbtext,$pagetitle,$recent,$show_course);
- $show_course=&Apache::loncommon::show_course();
+ my $crumbtext = 'User Roles';
+ my $pagetitle = 'My Roles';
+ my $recent = &mt('Recent Roles');
+ my $show_course=&Apache::loncommon::show_course();
+ if ($show_course) {
+ $crumbtext = 'Courses';
+ $pagetitle = 'My Courses';
+ $recent = &mt('Recent Courses');
+ }
+ my $brcrum =[{href=>"/adm/roles",text=>$crumbtext}];
+ my $swinfo=&Apache::lonmenu::rawconfig();
+ my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum});
+ my $standby=&mt('Role selected. Please stand by.');
+ $standby=~s/\n/\\n/g;
my $noscript=''.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').' '.&mt('As this is not the case, most functionality in the system will be unavailable.').' ';
- if ($custommenu) {
- my $brcrum = {'bread_crumbs' => 1};
- if ($env{'form.destinationurl'} eq '/adm/gci_info') {
- undef($brcrum);
- }
- my $start_page = &Apache::loncommon::start_page('Main Menu',undef,$brcrum);
- $r->print(<<"ENDCUSTOM");
-$start_page
-
-
-ENDCUSTOM
- } else {
- $crumbtext = 'User Roles';
- $pagetitle = 'My Roles';
- $recent = &mt('Recent Roles');
- my $standby=&mt('Role selected. Please stand by.');
- if ($show_course) {
- $crumbtext = 'Courses';
- $pagetitle = 'My Courses';
- $recent = &mt('Recent Courses');
- $standby = &mt('Course selected. Please stand by.');
- }
- my $brcrum = [{ href => '/adm/roles',
- text => $crumbtext,},
- ];
- my $args;
- if (($env{'user.domain'} eq 'gcitest') && (!$numdc)) {
- $args = {bread_crumbs => $brcrum,
- bread_crumbs_nomenu => 1};
- } else {
- $args = {bread_crumbs => $brcrum};
- }
- my $start_page=&Apache::loncommon::start_page($pagetitle,undef,$args);
- my $swinfo=&Apache::lonmenu::rawconfig();
- $standby=~s/\n/\\n/g;
- $r->print(<print(<
-
For more information about writing and reviewing Concept Inventory questions
-please refer to the GCI Workbook.
-
-END
-}
-
sub gather_roles {
my ($then,$refresh,$now,$reinit,$nochoose,$roletext,$sortrole,$roleclass,$futureroles,$timezones) = @_;
my ($countactive,$countfuture,$inrole,$possiblerole) = (0,0,0,'');
@@ -1789,8 +1633,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
500 Internal Server Error
Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator at
root@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.
More information about this error may be available
in the server error log.