--- loncom/auth/lonroles.pm 2005/04/22 20:54:43 1.119
+++ loncom/auth/lonroles.pm 2005/11/14 20:03:52 1.135
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.119 2005/04/22 20:54:43 albertel Exp $
+# $Id: lonroles.pm,v 1.135 2005/11/14 20:03:52 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,6 +39,7 @@ use Apache::loncommon;
use Apache::lonhtmlcommon;
use Apache::lonannounce;
use Apache::lonlocal;
+use GDBM_File;
sub redirect_user {
my ($r,$title,$url,$msg,$launch_nav) = @_;
@@ -49,7 +50,8 @@ sub redirect_user {
my $swinfo=&Apache::lonmenu::rawconfig();
my $navwindow;
if ($launch_nav eq 'on') {
- $navwindow.=&Apache::lonnavmaps::launch_win('now');
+ $navwindow.=&Apache::lonnavmaps::launch_win('now',undef,undef,
+ ($url eq '/adm/whatsnew'));
} else {
$navwindow.=&Apache::lonnavmaps::close();
}
@@ -87,6 +89,9 @@ sub handler {
# ================================================================== Roles Init
if ($env{'form.selectrole'}) {
+ if ($env{'form.newrole'}) {
+ $env{'form.'.$env{'form.newrole'}}=1;
+ }
if ($env{'request.course.id'}) {
my %temp=('logout_'.$env{'request.course.id'} => time);
&Apache::lonnet::put('email_status',\%temp);
@@ -226,7 +231,7 @@ ENDENTERKEY
my $tadv=0;
my $msg=&mt('Entering course ...');
- if (($cnum) && ($role ne 'ca')) {
+ if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) {
my ($furl,$ferr)=
&Apache::lonuserstate::readmap($cdom.'/'.$cnum);
if (($env{'form.orgurl'}) &&
@@ -242,7 +247,7 @@ ENDENTERKEY
"request.course.id" => $cdom.'_'.$cnum);
$furl='/adm/roles?tryagain=1';
$msg=
- '
'.
+ ''.
&mt('Could not initialize course at this time.').
'
'.&mt('Please try again.').'
'.$ferr;
}
@@ -259,17 +264,24 @@ ENDENTERKEY
if ($role eq 'cc' && $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.fn'})
+ && ($role eq 'cc' && ($env{'environment.course_init_display'} ne 'firstres'))) {
+ $msg = &mt('Entering course ....');
+ &redirect_user($r,&mt('New in course'),
+ '/adm/whatsnew',$msg,
+ $env{'environment.remotenavmap'});
+ return OK;
}
- # Send the user to the course they selected
- &redirect_user($r,&mt('Entering Course'),
+ &redirect_user($r,&mt('Entering Course'),
$furl,$msg,
$env{'environment.remotenavmap'});
- return OK;
+ return OK;
}
}
#
# Send the user to the construction space they selected
- if ($role =~ /^(au|ca)$/) {
+ if ($role =~ /^(au|ca|aa)$/) {
my $redirect_url = '/priv/';
if ($role eq 'au') {
$redirect_url.=$env{'user.name'};
@@ -303,6 +315,8 @@ ENDENTERKEY
my $swinfo=&Apache::lonmenu::rawconfig();
my $bodytag=&Apache::loncommon::bodytag('User Roles');
+ my $standby=&mt('Role selected. Please stand by.');
+ $standby=~s/\n/\\n/g;
my $helptag=''.&Apache::loncommon::help_open_menu('','General Intro','General_Intro','User Roles',1,undef,undef,undef,undef,,&mt("Click here for help")).' |
';
$r->print(<
@@ -314,6 +328,20 @@ $helptag
ENDHEADER
@@ -335,14 +363,25 @@ ENDHEADER
# --------------------------------------------------------------- Error Header?
if ($error) {
$r->print("LON-CAPA Access Control
");
- $r->print("
Access : ".
+ $r->print("
Access : ".
Apache::lonnet::plaintext($priv)."\n");
$r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n");
- $r->print("Action : $msg\n
");
+ $r->print("Action : $msg\n
");
+ my $url=$fn;
+ my $last;
+ if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
+ &GDBM_READER(),0640)) {
+ $last=$hash{'last_known'};
+ untie(%hash);
+ }
+ if ($last) { $fn.='?symb='.&Apache::lonnet::escape($last); }
+
+ &Apache::londocs::changewarning($r,undef,'You have modified your course recently, [_1] may fix this access problem.',
+ &Apache::lonenc::check_encrypt($fn));
} else {
if ($env{'user.error.msg'}) {
$r->print(
- ''.
+ ''.
&mt('You need to choose another user role or enter a specific course for this function').'
');
}
}
@@ -368,7 +407,7 @@ ENDHEADER
($env{'user.name'},$env{'user.domain'})}.
"
\n");
$r->print(&mt(
- "Author and Co-Author roles may not be available on servers other than your home server."));
+ "Author and Co-Author roles are not available on servers other than their respective home servers."));
}
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
@@ -376,6 +415,7 @@ ENDHEADER
$r->print('