';
my $end_page = &Apache::loncommon::end_page();
my $js_url = &js_escape($url);
- my $remote_js;
- if ($env{'environment.remote'} eq 'on') {
- my ($menucoll,$deeplinkmenu,$menuref) = &Apache::loncommon::menucoll_in_effect();
- if ($menucoll) {
- &Apache::lonnet::put('environment',{'remote' => 'off'});
- &Apache::lonnet::appenv({'environment.remote' => 'off'});
- my $menu_name = &Apache::lonmenu::get_menu_name();
- $remote_js = < a').removeAttr("aria-disabled");
- \$('.isDisabled').removeClass("isDisabled");
-REENABLE
- }
$r->print(<
// a').removeAttr("aria-disabled");
+ \$('.isDisabled').removeClass("isDisabled");
var url = "$js_url";
\$(location).attr('href',url);
});
@@ -238,27 +209,27 @@ sub redirect_user {
&Apache::loncommon::content_type($r,'text/html');
&Apache::loncommon::no_cache($r);
$r->send_http_header;
- my $swinfo=&Apache::lonmenu::rawconfig();
- # Breadcrumbs
- my $brcrum = [{'href' => $url,
- 'text' => 'Switching Role'},];
- my $start_page = &Apache::loncommon::start_page('Switching Role',undef,
- {'redirect' => [1,$url],
- 'bread_crumbs' => $brcrum,});
- my $end_page = &Apache::loncommon::end_page();
+ my $start_page;
+ if ($env{'request.lti.login'}) {
+ $start_page = &Apache::loncommon::start_page(undef,undef,
+ {'redirect' => [0,$url],}).$msg;
+ } else {
+ # Breadcrumbs
+ my $brcrum = [{'href' => $url,
+ 'text' => 'Switching Role'},];
+ $start_page = &Apache::loncommon::start_page('Switching Role',undef,
+ {'redirect' => [1,$url],
+ 'bread_crumbs' => $brcrum,}).
+ "\n
$msg
";
+ }
+ my $end_page = &Apache::loncommon::end_page();
# Note to style police:
# This must only replace the spaces, nothing else, or it bombs elsewhere.
$url=~s/ /\%20/g;
$r->print(<
-//
-
-
$msg
$end_page
ENDREDIR
return;
@@ -428,6 +399,8 @@ sub handler {
}
}
+ $registered_cleanup=0;
+ @{$rosterupdates}=();
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
# -------------------------------------------------- Check if setting hot list
@@ -461,13 +434,19 @@ sub handler {
my $envkey;
my %dcroles = ();
- my %helpdeskroles = ();
- my ($numdc,$numhelpdesk,$numadhoc) =
+ my %helpdeskroles = ();
+ my ($numdc,$numhelpdesk,$numadhoc) =
&check_for_adhoc(\%dcroles,\%helpdeskroles,$update,$then);
my $loncaparev = $r->dir_config('lonVersion');
# ================================================================== Roles Init
if ($env{'form.selectrole'}) {
+ if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq '')) {
+ if ($env{'form.ltitarget'} eq 'iframe') {
+ &Apache::lonnet::appenv({'request.lti.target' => 'iframe'});
+ delete($env{'form.ltitarget'});
+ }
+ }
my $locknum=&Apache::lonnet::get_locks();
if ($locknum) { return 409; }
@@ -508,7 +487,6 @@ sub handler {
"request.course.sec" => '',
"request.course.tied" => '',
"request.course.timechecked" => '',
- "request.course.suppupdated" => '',
"request.role" => 'cm',
"request.role.adv" => $env{'user.adv'},
"request.role.domain" => $env{'user.domain'}});
@@ -521,7 +499,7 @@ sub handler {
if ($custom_adhoc) {
my ($possroles,$description) = &Apache::lonnet::get_my_adhocroles($cdom.'_'.$cnum,1);
if (ref($possroles) eq 'ARRAY') {
- if (grep(/^\Q$rolename\E$/,@{$possroles})) {
+ if (grep(/^\Q$rolename\E$/,@{$possroles})) {
if (&Apache::lonnet::check_adhoc_privs($cdom,$cnum,$update,$refresh,$now,
"cr/$cdom/$cdom".'-domainconfig/'.$rolename,undef,$sec)) {
&Apache::lonnet::appenv({"environment.internal.$cdom.$cnum.cr/$cdom/$cdom".'-domainconfig/'."$rolename.adhoc" => time});
@@ -533,8 +511,8 @@ sub handler {
# Check if user is a DC trying to enter a course or author space and needs privs to be created
# Check if user is a DH or DA trying to enter a course and needs privs to be created
foreach my $envkey (keys(%env)) {
- if ($numdc) {
# Is this an ad-hoc Coordinator role?
+ if ($numdc) {
if (my ($ccrole,$domain,$coursenum) =
($envkey =~ m-^form\.(cc|co)\./($match_domain)/($match_courseid)$-)) {
if ($dcroles{$domain}) {
@@ -625,10 +603,9 @@ sub handler {
}
last;
}
- }
+ }
}
}
-
foreach $envkey (keys(%env)) {
next if ($envkey!~/^user\.role\./);
my ($where,$trolecode,$role,$tstatus,$tend,$tstart);
@@ -785,21 +762,9 @@ ENDENTERKEY
}
my $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum);
$crstype = lc($crstype);
- my ($msg,$critmsg_check,$title,$loadmsg,$only_body);
- $critmsg_check = 1;
- $title = &mt("Loading $crstype");
- $loadmsg = &mt("Please be patient while your $crstype loads");
- if (($env{'request.deeplink.login'}) && ($env{'request.linkprot'})) {
- if ($env{'request.linkprot'} =~ /^\d+(c|d):\Q$env{'form.destinationurl'}\E$/) {
- $title = &mt('Loading LON-CAPA session');
- $loadmsg = &mt('Please be patient while LON-CAPA loads');
- $only_body = 1;
- $critmsg_check = 0;
- }
- }
my $preamble = '
'.
' '.
- $loadmsg.
+ &mt("Please be patient while your $crstype loads").
'
'.
'';
my $closure = <
ENDCLOSE
- &start_loading_course($r,$title,$only_body);
+ my $title = &mt("Loading $crstype");
+ &start_loading_course($r,$title);
my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,undef,$preamble);
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Loading ...'));
$r->rflush();
- if ($critmsg_check) {
- my $blockcrit = &Apache::loncommon::blocking_status('alert',$clientip,$cnum,$cdom,undef,1);
- if ($blockcrit) {
- my $checkrole = "cm./$cdom/$cnum";
- if ($csec ne '') {
- $checkrole .= "/$csec";
- }
- unless ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) &&
- ($trolecode !~ m{^st\./$cdom/$cnum})) {
- $critmsg_check = 0;
- }
+ my ($msg,$blockcrit,$critmsg_check);
+ $critmsg_check = 1;
+ $blockcrit = &Apache::loncommon::blocking_status('alert',$clientip,$cnum,$cdom,undef,1);
+ if ($blockcrit) {
+ my $checkrole = "cm./$cdom/$cnum";
+ if ($csec ne '') {
+ $checkrole .= "/$csec";
+ }
+ unless ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) &&
+ ($trolecode !~ m{^st\./$cdom/$cnum})) {
+ $critmsg_check = 0;
}
}
my ($furl,$ferr)=
@@ -836,7 +802,7 @@ ENDCLOSE
$furl = '/adm/roles?tryagain=1';
} else {
&Apache::lonnet::appenv({'request.course.timechecked'=>$now});
- unless (($env{'form.switchrole'}) ||
+ unless (($env{'form.switchrole'}) ||
($env{"environment.internal.$cdom.$cnum.$role.adhoc"})) {
&Apache::lonnet::put('nohist_crslastlogin',
{$env{'user.name'}.':'.$env{'user.domain'}.
@@ -864,6 +830,7 @@ ENDCLOSE
my ($feeds,$syllabus_time);
&Apache::lonrss::advertisefeeds($cnum,$cdom,undef,\$feeds);
&Apache::lonnet::appenv({'request.course.feeds' => $feeds});
+ &Apache::lonnet::get_numsuppfiles($cnum,$cdom,1);
unless ($env{'course.'.$cdom.'_'.$cnum.'.updatedsyllabus'}) {
unless (($env{'course.'.$cdom.'_'.$cnum.'.externalsyllabus'}) ||
($env{'course.'.$cdom.'_'.$cnum.'.uploadedsyllabus'})) {
@@ -877,7 +844,7 @@ ENDCLOSE
}
if (($env{'form.orgurl'}) &&
($env{'form.orgurl'}!~/^\/adm\/flip/) &&
- ($env{'form.orgurl'} ne '/adm/roles')) {
+ ($env{'form.orgurl'} ne '/adm/roles')) {
my $dest=$env{'form.orgurl'};
if ($env{'form.symb'}) {
if ($dest =~ /\?/) {
@@ -896,18 +863,16 @@ ENDCLOSE
if ($env{'form.symb'}) {
$furl .= '&symb='.&HTML::Entities::encode($env{'form.symb'},'<>&"');
}
- } else {
- &set_supplemental_access($cnum,$cdom);
}
if (($ferr) && ($tadv)) {
- &error_page($r,$ferr,$furl);
+ &error_page($r,$ferr,$furl);
} else {
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) {
if (($env{'form.orgurl'} ne '') && ($env{'form.symb'} ne '')) {
unless (&Apache::lonnet::symbverify($env{'form.symb'},$env{'form.orgurl'})) {
$dest=$env{'form.orgurl'};
}
- }
+ }
}
if ($dest =~ m{^/adm/coursedocs\?folderpath}) {
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) {
@@ -929,13 +894,14 @@ ENDCLOSE
&Apache::loncommon::end_page());
}
} else {
- if ($env{'request.deeplink.login'}) {
- &set_deeplink_target($cnum,$cdom);
+ if (($env{'request.lti.login'}) &&
+ ($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) {
+ &process_lti($r,$cdom,$cnum);
}
$msg = '
'.
&mt('Could not initialize [_1] at this time.',
@@ -959,9 +925,9 @@ ENDCLOSE
&Apache::loncommon::end_page());
}
} else {
- &set_supplemental_access($cnum,$cdom);
- if ($env{'request.deeplink.login'}) {
- &set_deeplink_target($cnum,$cdom);
+ if (($env{'request.lti.login'}) &&
+ ($env{'request.lti.rosterid'} || $env{'request.lti.passbackid'})) {
+ &process_lti($r,$cdom,$cnum);
}
# Check to see if the user is a CC entering a course
# for the first time
@@ -970,6 +936,19 @@ ENDCLOSE
$furl = "/adm/helper/course.initialization.helper";
# Send the user to the course they selected
} elsif ($env{'request.course.id'}) {
+ if ((&Apache::loncommon::course_type() eq 'Placement') &&
+ (!$env{'request.role.adv'})) {
+ my ($score,$incomplete) =
+ &Apache::lonplacementtest::check_completion(undef,undef,1);
+ if (($incomplete) && ($incomplete < 100)) {
+ $msg = '
';
- &finish_loading_course($r,$msg,'/adm/whatsnew?refpage=start',$only_body);
+ &finish_loading_course($r,$msg,'/adm/whatsnew?refpage=start');
$r->rflush();
- return OK;
+ return OK;
}
}
}
# Are we allowed to look at the first resource?
#
# $furl returned by lonuserstate::readmap() has format:
- # $url?symb=escaped($symb). If the resource has the
+ # $url?symb=escaped($symb). If the resource has the
# encrypturl parameter in effect, the entire string
# $url?symb=escaped($symb) is encrypted as a string
# beginning /enc/.
- #
+ #
my ($access,$unencfurl,$unencsymb);
if ($furl =~ m{^(.+)(?:\?|\&)symb=([^&]+)(?:$|&)}) {
my ($poss_url,$poss_symb) = ($1,$2);
@@ -1098,13 +1077,18 @@ ENDCLOSE
$furl = '/adm/navmaps?showOnlyHomework=1';
}
}
- $msg = '
';
+ &finish_loading_course($r,$msg,$furl);
+ }
}
$r->rflush();
- return OK;
+ return OK;
}
}
#
@@ -1117,12 +1101,6 @@ ENDCLOSE
$redirect_url .= $where;
}
$redirect_url .= '/';
- if ($env{'form.orgurl'} =~ /^\Q$redirect_url\E/) {
- my ($path) = ($env{'form.orgurl'} =~ m{^(.+)/[^/]+$});
- if (($path ne '') && (-e $Apache::lonnet::perlvar{'lonDocRoot'}.$path)) {
- $redirect_url = $env{'form.orgurl'};
- }
- }
&redirect_user($r,&mt('Entering Authoring Space'),
$redirect_url);
return OK;
@@ -1190,16 +1168,42 @@ ENDCLOSE
if ($domdefs{'catauth'}) {
$cattype = $domdefs{'catauth'};
}
- my ($funcs,$crumbsright);
- unless (($norolelist) && ((split(/:/,$env{'user.error.msg'}))[2])) {
- $funcs = &get_roles_functions($showcount,$cattype);
- if ($env{'browser.mobile'}) {
- $crumbsright = $funcs;
- undef($funcs);
+ my $placementonly;
+ if ($showcount == 1) {
+ if ($env{'request.course.id'}) {
+ if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') {
+ $placementonly = 1;
+ }
+ } else {
+ foreach my $rolecode (keys(%roles_in_env)) {
+ my ($cid) = ($rolecode =~ m{^\Quser.role.st./\E($match_domain/$match_courseid)(?:/|$)});
+ if ($cid) {
+ my %coursedescription =
+ &Apache::lonnet::coursedescription($cid,{'one_time' => '1'});
+ if ($coursedescription{'type'} eq 'Placement') {
+ $placementonly = 1;
+ }
+ last;
+ }
+ }
+ }
+ }
+ my ($start_page,$funcs);
+ if ($placementonly) {
+ $start_page=&Apache::loncommon::start_page($pagetitle,undef,
+ {bread_crumbs=>$brcrum,crstype=>'Placement'});
+ } else {
+ my $crumbsright;
+ unless (($norolelist) && ((split(/:/,$env{'user.error.msg'}))[2])) {
+ $funcs = &get_roles_functions($showcount,$cattype);
+ if ($env{'browser.mobile'}) {
+ $crumbsright = $funcs;
+ undef($funcs);
+ }
}
+ $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum,
+ bread_crumbs_component=>$crumbsright});
}
- my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum,
- bread_crumbs_component=>$crumbsright});
&js_escape(\$standby);
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.').' ';
@@ -1233,7 +1237,7 @@ function rolesView (caller) {
document.rolechoice.display.value = caller;
} else {
if ((caller == 'doupdate') || (caller == 'requestauthor') ||
- (caller == 'queued')) {
+ (caller == 'queued')) {
document.rolechoice.state.value = caller;
}
}
@@ -1312,7 +1316,7 @@ ENDHEADER
&mt('You may need to login to LON-CAPA directly, or re-launch from a different external system.').
'');
}
- $r->print(&Apache::loncommon::end_page());
+ $r->print(&Apache::loncommon::end_page());
return OK;
} else {
if ($updateresult || $reqauthor || $hotlist) {
@@ -1325,7 +1329,7 @@ ENDHEADER
}
if ($hotlist) {
$showresult .= $hotlist;
- }
+ }
$showresult .= '';
$r->print($showresult);
} elsif ($env{'form.state'} eq 'queued') {
@@ -1360,7 +1364,21 @@ ENDHEADER
\%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev);
$refresh = $now;
&Apache::lonnet::appenv({'user.refresh.time' => $refresh});
- if ((($cattype eq 'std') || ($cattype eq 'domonly')) && (!$env{'user.adv'})) {
+ if ($countactive == 1) {
+ if ($env{'request.course.id'}) {
+ if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') {
+ $placementonly = 1;
+ }
+ } elsif ($possiblerole) {
+ if ($possiblerole =~ m{^st\./($match_domain)/($match_courseid)(?:/|$)}) {
+ if ($env{'course.'.$1.'_'.$2.'.type'} eq 'Placement') {
+ $placementonly = 1;
+ }
+ }
+ }
+ }
+ if ((($cattype eq 'std') || ($cattype eq 'domonly')) && (!$env{'user.adv'}) &&
+ (!$placementonly)) {
if ($countactive > 0) {
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
@@ -1437,6 +1455,16 @@ ENDHEADER
}
$r->print(&Apache::loncommon::end_page());
return OK;
+ } elsif (($placementonly) && ($env{'request.role'} eq 'cm')) {
+ $r->print('
'.&mt('Please stand by.').'
+
+ ');
+ $r->rflush();
+ $r->print('');
+ $r->print(&Apache::loncommon::end_page());
+ return OK;
}
# ----------------------------------------------------------------------- Table
@@ -1584,6 +1612,7 @@ sub gather_roles {
my $advanced = $env{'user.adv'};
my $tryagain = $env{'form.tryagain'};
my @ids = &Apache::lonnet::current_machine_ids();
+ my (%willtrust,%trustchecked);
if (ref($roles_in_env) eq 'HASH') {
my %adhocdesc;
foreach my $envkey (sort(keys(%{$roles_in_env}))) {
@@ -1652,10 +1681,23 @@ sub gather_roles {
if (($role eq 'ca') || ($role eq 'aa')) {
my $home = &Apache::lonnet::homeserver($trest,$tdom);
my $allowed=0;
+ my $prohibited;
foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
if (!$allowed) {
$button=0;
- $switchserver='otherserver='.$home.'&role='.$trolecode;
+ unless ($trustchecked{$tdom}) {
+ if ((&Apache::lonnet::will_trust('othcoau',$env{'user.domain'},$tdom)) &&
+ (&Apache::lonnet::will_trust('coaurem',$tdom,$env{'user.domain'}))) {
+ $willtrust{$tdom} = 1;
+ $trustchecked{$tdom} = 1;
+ }
+ }
+ if ($willtrust{$tdom}) {
+ $switchserver='otherserver='.$home.'&role='.$trolecode;
+ } else {
+ $prohibited = 1;
+ $tremark .= &mt('Session switch required but prohibited.');
+ }
}
#next if ($home eq 'no_host');
$home = &Apache::lonnet::hostname($home);
@@ -1664,7 +1706,9 @@ sub gather_roles {
': '.$tdom.' '.
' '.&mt('Server').': '.$home;
$env{'course.'.$tdom.'_'.$trest.'.description'}='ca';
- $tremark.=&Apache::lonhtmlcommon::authorbombs('/res/'.$tdom.'/'.$trest.'/');
+ unless ($prohibited) {
+ $tremark.=&Apache::lonhtmlcommon::authorbombs('/res/'.$tdom.'/'.$trest.'/');
+ }
$sortkey=$role."$trest:$tdom";
} elsif ($role eq 'au') {
# Authors
@@ -1700,9 +1744,9 @@ sub gather_roles {
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};
}
}
- $desc = $adhocdesc{$tdom}{$rolename};
}
}
if ($desc ne '') {
@@ -1763,6 +1807,9 @@ sub gather_roles {
$skipcal = 1;
}
}
+ if ($ttype eq 'Placement') {
+ $ttype = 'Placement Test';
+ }
if ($tsection) {
$twhere.=' '.&mt('Section').': '.$tsection;
}
@@ -1878,7 +1925,7 @@ sub roletable_headers {
}
sub roletypes {
- my @types = ('Domain','Authoring Space','Course','Community','Unavailable','System');
+ my @types = ('Domain','Authoring Space','Course','Placement Test','Community','Unavailable','System');
return @types;
}
@@ -1940,15 +1987,15 @@ sub findcourse_advice {
'.&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.').'
+
'.&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.').
+ $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.').'