version 1.307, 2014/05/22 14:32:48
|
version 1.325, 2017/01/28 03:48:52
|
Line 140 use Apache::lonnavdisplay();
|
Line 140 use Apache::lonnavdisplay();
|
use Apache::loncoursequeueadmin; |
use Apache::loncoursequeueadmin; |
use Apache::longroup; |
use Apache::longroup; |
use Apache::lonrss; |
use Apache::lonrss; |
|
use Apache::lonplacementtest; |
use GDBM_File; |
use GDBM_File; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use HTML::Entities; |
use HTML::Entities; |
Line 202 sub handler {
|
Line 203 sub handler {
|
|
|
my $r = shift; |
my $r = shift; |
|
|
# Check for critical messages and redirect if present. |
# Check for critical messages and redirect if present. |
my ($redirect,$url) = &Apache::loncommon::critical_redirect(300); |
my ($redirect,$url) = &Apache::loncommon::critical_redirect(300); |
if ($redirect) { |
if ($redirect) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 254 sub handler {
|
Line 255 sub handler {
|
|
|
my $envkey; |
my $envkey; |
my %dcroles = (); |
my %dcroles = (); |
my $numdc = &check_fordc(\%dcroles,$update,$then); |
my %helpdeskroles = (); |
|
my ($numdc,$numhelpdesk,$numadhoc) = |
|
&check_for_adhoc(\%dcroles,\%helpdeskroles,$update,$then); |
my $loncaparev = $r->dir_config('lonVersion'); |
my $loncaparev = $r->dir_config('lonVersion'); |
|
|
# ================================================================== Roles Init |
# ================================================================== Roles Init |
Line 263 sub handler {
|
Line 266 sub handler {
|
my $locknum=&Apache::lonnet::get_locks(); |
my $locknum=&Apache::lonnet::get_locks(); |
if ($locknum) { return 409; } |
if ($locknum) { return 409; } |
|
|
|
my $custom_adhoc; |
if ($env{'form.newrole'}) { |
if ($env{'form.newrole'}) { |
$env{'form.'.$env{'form.newrole'}}=1; |
$env{'form.'.$env{'form.newrole'}}=1; |
|
# Check if this is a Domain Helpdesk or Domain Helpdesk Assistant role trying to enter a course |
|
if ($env{'form.newrole'} =~ m{^cr/($match_domain)/\1\-domainconfig/\w+\./\1/$match_courseid$}) { |
|
if ($helpdeskroles{$1}) { |
|
$custom_adhoc = 1; |
|
} |
|
} |
} |
} |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
# Check if user is CC trying to select a course role |
# Check if user is CC trying to select a course role |
Line 286 sub handler {
|
Line 296 sub handler {
|
&Apache::lonnet::put('email_status',\%temp); |
&Apache::lonnet::put('email_status',\%temp); |
&Apache::lonnet::delenv('user.state.'.$env{'request.course.id'}); |
&Apache::lonnet::delenv('user.state.'.$env{'request.course.id'}); |
} |
} |
&Apache::lonnet::appenv({"request.course.id" => '', |
&Apache::lonnet::appenv({"request.course.id" => '', |
"request.course.fn" => '', |
"request.course.fn" => '', |
"request.course.uri" => '', |
"request.course.uri" => '', |
"request.course.sec" => '', |
"request.course.sec" => '', |
"request.course.tied" => '', |
"request.course.tied" => '', |
"request.role" => 'cm', |
"request.course.timechecked" => '', |
"request.role.adv" => $env{'user.adv'}, |
"request.role" => 'cm', |
"request.role.domain" => $env{'user.domain'}}); |
"request.role.adv" => $env{'user.adv'}, |
# Check if user is a DC trying to enter a course or author space and needs privs to be created |
"request.role.domain" => $env{'user.domain'}}); |
if ($numdc > 0) { |
# Check if Domain Helpdesk role trying to enter a course needs privs to be created |
foreach my $envkey (keys(%env)) { |
if ($env{'form.newrole'} =~ m{^cr/($match_domain)/\1\-domainconfig/(\w+)\./\1/($match_courseid)(?:/(\w+)|$)}) { |
# Is this an ad-hoc Coordinator role? |
my $cdom = $1; |
if (my ($ccrole,$domain,$coursenum) = |
my $rolename = $2; |
($envkey =~ m-^form\.(cc|co)\./($match_domain)/($match_courseid)$-)) { |
my $cnum = $3; |
if ($dcroles{$domain}) { |
my $sec = $4; |
if (&Apache::lonnet::check_adhoc_privs($domain,$coursenum, |
if ($custom_adhoc) { |
$update,$refresh,$now,$ccrole)) { |
my ($possroles,$description) = &Apache::lonnet::get_my_adhocroles($cdom.'_'.$cnum,1); |
&Apache::lonnet::appenv({"environment.internal.$domain.$coursenum.$ccrole.adhoc" => time}); |
if (ref($possroles) eq 'ARRAY') { |
|
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}); |
} |
} |
} |
} |
last; |
|
} |
} |
# Is this an ad-hoc CA-role? |
} |
if (my ($domain,$user) = |
} elsif (($numdc > 0) || ($numhelpdesk > 0)) { |
($envkey =~ m-^form\.ca\./($match_domain)/($match_username)$-)) { |
# Check if user is a DC trying to enter a course or author space and needs privs to be created |
if (($domain eq $env{'user.domain'}) && ($user eq $env{'user.name'})) { |
# Check if user is a DH or DA trying to enter a course and needs privs to be created |
delete($env{$envkey}); |
foreach my $envkey (keys(%env)) { |
$env{'form.au./'.$domain.'/'} = 1; |
# Is this an ad-hoc Coordinator role? |
my ($server_status,$home) = &check_author_homeserver($user,$domain); |
if ($numdc) { |
if ($server_status eq 'switchserver') { |
if (my ($ccrole,$domain,$coursenum) = |
my $trolecode = 'au./'.$domain.'/'; |
($envkey =~ m-^form\.(cc|co)\./($match_domain)/($match_courseid)$-)) { |
my $switchserver = '/adm/switchserver?otherserver='.$home.'&role='.$trolecode; |
if ($dcroles{$domain}) { |
$r->internal_redirect($switchserver); |
if (&Apache::lonnet::check_adhoc_privs($domain,$coursenum, |
return OK; |
$update,$refresh,$now,$ccrole)) { |
|
&Apache::lonnet::appenv({"environment.internal.$domain.$coursenum.$ccrole.adhoc" => time}); |
|
} |
} |
} |
last; |
last; |
} |
} |
if (my ($castart,$caend) = ($env{'user.role.ca./'.$domain.'/'.$user} =~ /^(\d*)\.(\d*)$/)) { |
# Is this an ad-hoc CA-role? |
if (((($castart) && ($castart < $now)) || !$castart) && |
if (my ($domain,$user) = |
((!$caend) || (($caend) && ($caend > $now)))) { |
($envkey =~ m-^form\.ca\./($match_domain)/($match_username)$-)) { |
|
if (($domain eq $env{'user.domain'}) && ($user eq $env{'user.name'})) { |
|
delete($env{$envkey}); |
|
$env{'form.au./'.$domain.'/'} = 1; |
my ($server_status,$home) = &check_author_homeserver($user,$domain); |
my ($server_status,$home) = &check_author_homeserver($user,$domain); |
if ($server_status eq 'switchserver') { |
if ($server_status eq 'switchserver') { |
my $trolecode = 'ca./'.$domain.'/'.$user; |
my $trolecode = 'au./'.$domain.'/'; |
my $switchserver = '/adm/switchserver?otherserver='.$home.'&role='.$trolecode; |
my $switchserver = '/adm/switchserver?otherserver='.$home.'&role='.$trolecode; |
$r->internal_redirect($switchserver); |
$r->internal_redirect($switchserver); |
return OK; |
return OK; |
} |
} |
last; |
last; |
} |
} |
} |
if (my ($castart,$caend) = ($env{'user.role.ca./'.$domain.'/'.$user} =~ /^(\d*)\.(\d*)$/)) { |
# Check if author blocked ca-access |
if (((($castart) && ($castart < $now)) || !$castart) && |
my %blocked=&Apache::lonnet::get('environment',['domcoord.author'],$domain,$user); |
((!$caend) || (($caend) && ($caend > $now)))) { |
if ($blocked{'domcoord.author'} eq 'blocked') { |
my ($server_status,$home) = &check_author_homeserver($user,$domain); |
delete($env{$envkey}); |
if ($server_status eq 'switchserver') { |
$env{'user.error.msg'}=':::1:User '.$user.' in domain '.$domain.' blocked domain coordinator access'; |
my $trolecode = 'ca./'.$domain.'/'.$user; |
|
my $switchserver = '/adm/switchserver?otherserver='.$home.'&role='.$trolecode; |
|
$r->internal_redirect($switchserver); |
|
return OK; |
|
} |
|
last; |
|
} |
|
} |
|
# Check if author blocked ca-access |
|
my %blocked=&Apache::lonnet::get('environment',['domcoord.author'],$domain,$user); |
|
if ($blocked{'domcoord.author'} eq 'blocked') { |
|
delete($env{$envkey}); |
|
$env{'user.error.msg'}=':::1:User '.$user.' in domain '.$domain.' blocked domain coordinator access'; |
|
last; |
|
} |
|
if ($dcroles{$domain}) { |
|
my ($server_status,$home) = &check_author_homeserver($user,$domain); |
|
if (($server_status eq 'ok') || ($server_status eq 'switchserver')) { |
|
&Apache::lonnet::check_adhoc_privs($domain,$user,$update, |
|
$refresh,$now,'ca'); |
|
if ($server_status eq 'switchserver') { |
|
my $trolecode = 'ca./'.$domain.'/'.$user; |
|
my $switchserver = '/adm/switchserver?' |
|
.'otherserver='.$home.'&role='.$trolecode; |
|
$r->internal_redirect($switchserver); |
|
return OK; |
|
} |
|
} else { |
|
delete($env{$envkey}); |
|
} |
|
} else { |
|
delete($env{$envkey}); |
|
} |
last; |
last; |
} |
} |
if ($dcroles{$domain}) { |
} |
my ($server_status,$home) = &check_author_homeserver($user,$domain); |
if ($numhelpdesk) { |
if (($server_status eq 'ok') || ($server_status eq 'switchserver')) { |
# Is this an ad hoc custom role in a course/community? |
&Apache::lonnet::check_adhoc_privs($domain,$user,$update, |
if (my ($domain,$rolename,$coursenum,$sec) = ($envkey =~ m{^form\.cr/($match_domain)/\1\-domainconfig/(\w+)\./\1/($match_courseid)(?:/(\w+)|$)})) { |
$refresh,$now,'ca'); |
if ($helpdeskroles{$domain}) { |
if ($server_status eq 'switchserver') { |
my ($possroles,$description) = &Apache::lonnet::get_my_adhocroles($domain.'_'.$coursenum,1); |
my $trolecode = 'ca./'.$domain.'/'.$user; |
if (ref($possroles) eq 'ARRAY') { |
my $switchserver = '/adm/switchserver?' |
if (grep(/^\Q$rolename\E$/,@{$possroles})) { |
.'otherserver='.$home.'&role='.$trolecode; |
if (&Apache::lonnet::check_adhoc_privs($domain,$coursenum,$update,$refresh,$now, |
$r->internal_redirect($switchserver); |
"cr/$domain/$domain".'-domainconfig/'.$rolename, |
return OK; |
undef,$sec)) { |
|
&Apache::lonnet::appenv({"environment.internal.$domain.$coursenum.cr/$domain/$domain". |
|
'-domainconfig/'."$rolename.adhoc" => time}); |
|
} |
|
} else { |
|
delete($env{$envkey}); |
|
} |
|
} else { |
|
delete($env{$envkey}); |
} |
} |
} else { |
} else { |
delete($env{$envkey}); |
delete($env{$envkey}); |
} |
} |
} else { |
last; |
delete($env{$envkey}); |
|
} |
} |
last; |
|
} |
} |
} |
} |
} |
} |
|
|
foreach $envkey (keys(%env)) { |
foreach $envkey (keys(%env)) { |
next if ($envkey!~/^user\.role\./); |
next if ($envkey!~/^user\.role\./); |
my ($where,$trolecode,$role,$tstatus,$tend,$tstart); |
my ($where,$trolecode,$role,$tstatus,$tend,$tstart); |
Line 382 sub handler {
|
Line 437 sub handler {
|
my %curr_reqd_hash = &Apache::lonnet::userenvironment($cdom,$cnum,'internal.releaserequired'); |
my %curr_reqd_hash = &Apache::lonnet::userenvironment($cdom,$cnum,'internal.releaserequired'); |
if ($curr_reqd_hash{'internal.releaserequired'} ne '') { |
if ($curr_reqd_hash{'internal.releaserequired'} ne '') { |
my ($switchserver,$switchwarning) = |
my ($switchserver,$switchwarning) = |
&check_release_required($loncaparev,$cdom.'_'.$cnum,$trolecode,$curr_reqd_hash{'internal.releaserequired'}); |
&Apache::loncommon::check_release_required($loncaparev,$cdom.'_'.$cnum,$trolecode, |
|
$curr_reqd_hash{'internal.releaserequired'}); |
if ($switchwarning ne '' || $switchserver ne '') { |
if ($switchwarning ne '' || $switchserver ne '') { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
my $end_page=&Apache::loncommon::end_page(); |
$r->print(&Apache::loncommon::check_release_result($switchwarning,$switchserver)); |
$r->print(&Apache::loncommon::start_page('Selected course unavailable on this server'). |
|
'<p class="LC_warning">'); |
|
if ($switchwarning) { |
|
$r->print($switchwarning.'<br /><a href="/adm/roles">'); |
|
if (&Apache::loncommon::show_course()) { |
|
$r->print(&mt('Display courses')); |
|
} else { |
|
$r->print(&mt('Display roles')); |
|
} |
|
$r->print('</a>'); |
|
} elsif ($switchserver) { |
|
$r->print(&mt('This course requires a newer version of LON-CAPA than is installed on this server.'). |
|
'<br />'. |
|
'<a href="/adm/switchserver?'.$switchserver.'">'. |
|
&mt('Switch Server'). |
|
'</a>'); |
|
} |
|
$r->print('</p>'.&Apache::loncommon::end_page()); |
|
return OK; |
return OK; |
} |
} |
} |
} |
Line 518 ENDENTERKEY
|
Line 556 ENDENTERKEY
|
$env{'user.name'}, |
$env{'user.name'}, |
$env{'user.home'}, |
$env{'user.home'}, |
"Role ".$trolecode); |
"Role ".$trolecode); |
|
|
&Apache::lonnet::appenv( |
&Apache::lonnet::appenv( |
{'request.role' => $trolecode, |
{'request.role' => $trolecode, |
'request.role.domain' => $cdom, |
'request.role.domain' => $cdom, |
Line 527 ENDENTERKEY
|
Line 565 ENDENTERKEY
|
my $tadv=0; |
my $tadv=0; |
|
|
if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) { |
if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) { |
|
if ($role =~ m{^\Qcr/$cdom/$cdom\E\-domainconfig/(\w+)$}) { |
|
my $rolename = $1; |
|
my %domdef = &Apache::lonnet::get_domain_defaults($cdom); |
|
if (ref($domdef{'adhocroles'}) eq 'HASH') { |
|
if (ref($domdef{'adhocroles'}{$rolename}) eq 'HASH') { |
|
&Apache::lonnet::appenv({'request.role.desc' => $domdef{'adhocroles'}{$rolename}{'desc'}}); |
|
} |
|
} |
|
} |
my $msg; |
my $msg; |
my ($furl,$ferr)= |
my ($furl,$ferr)= |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
Line 604 ENDENTERKEY
|
Line 651 ENDENTERKEY
|
$furl = "/adm/helper/course.initialization.helper"; |
$furl = "/adm/helper/course.initialization.helper"; |
# Send the user to the course they selected |
# Send the user to the course they selected |
} elsif ($env{'request.course.id'}) { |
} 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)) { |
|
&redirect_user($r, &mt('Entering [_1]', |
|
$env{'course.'.$cdom.'_'.$cnum.'.description'}), |
|
'/adm/placement', $msg); |
|
return OK; |
|
} |
|
} |
my ($dest,$destsymb,$checkenc); |
my ($dest,$destsymb,$checkenc); |
$dest = $env{'form.destinationurl'}; |
$dest = $env{'form.destinationurl'}; |
$destsymb = $env{'form.destsymb'}; |
$destsymb = $env{'form.destsymb'}; |
Line 673 ENDENTERKEY
|
Line 731 ENDENTERKEY
|
} |
} |
} |
} |
# Are we allowed to look at the first resource? |
# Are we allowed to look at the first resource? |
|
my $access; |
if ($furl =~ m{^(/adm/wrapper|)/ext/}) { |
if ($furl =~ m{^(/adm/wrapper|)/ext/}) { |
# If it's an external resource, |
# If it's an external resource, |
# strip off the symb argument and possible query |
# strip off the symb argument and possible query |
Line 680 ENDENTERKEY
|
Line 739 ENDENTERKEY
|
# Unencode $symb |
# Unencode $symb |
$symb = &unescape($symb); |
$symb = &unescape($symb); |
# Then check for permission |
# Then check for permission |
if (!&Apache::lonnet::allowed('bre',$exturl,$symb)) { |
$access = &Apache::lonnet::allowed('bre',$exturl,$symb); |
$furl = &Apache::lonpageflip::first_accessible_resource(); |
|
} |
|
# For other resources just check for permission |
# For other resources just check for permission |
} elsif (!&Apache::lonnet::allowed('bre',$furl)) { |
} else { |
|
$access = &Apache::lonnet::allowed('bre',$furl); |
|
} |
|
if (!$access) { |
$furl = &Apache::lonpageflip::first_accessible_resource(); |
$furl = &Apache::lonpageflip::first_accessible_resource(); |
|
} elsif ($access eq 'B') { |
|
$furl = '/adm/navmaps?showOnlyHomework=1'; |
} |
} |
|
|
$msg = &mt('Entering [_1] ...', |
$msg = &mt('Entering [_1] ...', |
$env{'course.'.$cdom.'_'.$cnum.'.description'}); |
$env{'course.'.$cdom.'_'.$cnum.'.description'}); |
&redirect_user($r, &mt('Entering [_1]', |
&redirect_user($r, &mt('Entering [_1]', |
Line 717 ENDENTERKEY
|
Line 778 ENDENTERKEY
|
$redirect_url); |
$redirect_url); |
return OK; |
return OK; |
} |
} |
|
if ($role eq 'dh') { |
|
my $redirect_url = '/adm/menu/'; |
|
&redirect_user($r,&mt('Loading Domain Helpdesk Menu'), |
|
$redirect_url); |
|
return OK; |
|
} |
|
if ($role eq 'da') { |
|
my $redirect_url = '/adm/menu/'; |
|
&redirect_user($r,&mt('Loading Domain Helpdesk Assistant Menu'), |
|
$redirect_url); |
|
return OK; |
|
} |
if ($role eq 'sc') { |
if ($role eq 'sc') { |
my $redirect_url = '/adm/grades?command=scantronupload'; |
my $redirect_url = '/adm/grades?command=scantronupload'; |
&redirect_user($r,&mt('Loading Data Upload Page'), |
&redirect_user($r,&mt('Loading Data Upload Page'), |
Line 753 ENDENTERKEY
|
Line 826 ENDENTERKEY
|
my $showcount = &roles_from_env(\%roles_in_env,$update); |
my $showcount = &roles_from_env(\%roles_in_env,$update); |
|
|
my $swinfo=&Apache::lonmenu::rawconfig(); |
my $swinfo=&Apache::lonmenu::rawconfig(); |
my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum}); |
|
my %domdefs=&Apache::lonnet::get_domain_defaults($env{'user.domain'}); |
my %domdefs=&Apache::lonnet::get_domain_defaults($env{'user.domain'}); |
my $cattype = 'std'; |
my $cattype = 'std'; |
if ($domdefs{'catauth'}) { |
if ($domdefs{'catauth'}) { |
$cattype = $domdefs{'catauth'}; |
$cattype = $domdefs{'catauth'}; |
} |
} |
my $funcs = &get_roles_functions($showcount,$cattype); |
my $placementonly; |
$standby=~s/\n/\\n/g; |
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 { |
|
$funcs = &get_roles_functions($showcount,$cattype); |
|
my $crumbsright; |
|
if ($env{'browser.mobile'}) { |
|
$crumbsright = $funcs; |
|
undef($funcs); |
|
} |
|
$start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum, |
|
bread_crumbs_component=>$crumbsright}); |
|
} |
|
&js_escape(\$standby); |
my $noscript='<br /><span class="LC_error">'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'<br />'.&mt('As this is not the case, most functionality in the system will be unavailable.').'</span><br />'; |
my $noscript='<br /><span class="LC_error">'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'<br />'.&mt('As this is not the case, most functionality in the system will be unavailable.').'</span><br />'; |
|
|
$r->print(<<ENDHEADER); |
$r->print(<<ENDHEADER); |
Line 902 ENDHEADER
|
Line 1007 ENDHEADER
|
\%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev); |
\%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev); |
$refresh = $now; |
$refresh = $now; |
&Apache::lonnet::appenv({'user.refresh.time' => $refresh}); |
&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) { |
if ($countactive > 0) { |
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); |
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); |
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); |
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); |
Line 933 ENDHEADER
|
Line 1052 ENDHEADER
|
my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole, |
my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole, |
$nochoose); |
$nochoose); |
&print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles, |
&print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles, |
\%roletext); |
\%roletext,$update,$then); |
my $tremark=''; |
my $tremark=''; |
my $tbg; |
my $tbg; |
if ($env{'request.role'} eq 'cm') { |
if ($env{'request.role'} eq 'cm') { |
Line 955 ENDHEADER
|
Line 1074 ENDHEADER
|
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
|
} elsif (($placementonly) && ($env{'request.role'} eq 'cm')) { |
|
$r->print('<h3>'.&mt('Please stand by.').'</h3> |
|
<input type="hidden" name="'.$possiblerole.'" value="1" /> |
|
<noscript><br /> |
|
<input type="submit" name="submit" value="'.&mt('Continue').'" /> |
|
</noscript></form>'); |
|
$r->rflush(); |
|
$r->print('<script type="text/javascript">document.forms.rolechoice.submit();</script>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
return OK; |
} |
} |
# ----------------------------------------------------------------------- Table |
# ----------------------------------------------------------------------- Table |
|
|
if ($numdc > 0) { |
if (($numdc > 0) || (($numhelpdesk > 0) && ($numadhoc > 0))) { |
$r->print(&coursepick_jscript()); |
$r->print(&coursepick_jscript()); |
$r->print(&Apache::loncommon::coursebrowser_javascript(). |
$r->print(&Apache::loncommon::coursebrowser_javascript(). |
&Apache::loncommon::authorbrowser_javascript()); |
&Apache::loncommon::authorbrowser_javascript()); |
Line 991 ENDHEADER
|
Line 1120 ENDHEADER
|
$roletext{'user.role.'.$role}->[1]. |
$roletext{'user.role.'.$role}->[1]. |
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
} |
} |
if ($role =~ m{dc\./($match_domain)/} |
if ($role =~ m{^dc\./($match_domain)/$} |
&& $dcroles{$1}) { |
&& $dcroles{$1}) { |
$output .= &adhoc_roles_row($1,'recent'); |
$output .= &adhoc_roles_row($1,'recent'); |
|
} elsif ($role =~ m{^(dh|da)\./($match_domain)/$}) { |
|
$output .= &adhoc_customroles_row($1,$2,'recent',$update,$then); |
} |
} |
} elsif ($numdc > 0) { |
} elsif ($numdc > 0) { |
unless ($role =~/^error\:/) { |
unless ($role =~/^error\:/) { |
Line 1022 ENDHEADER
|
Line 1153 ENDHEADER
|
$doheaders ++; |
$doheaders ++; |
} |
} |
} |
} |
&print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles,\%roletext); |
&print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles,\%roletext,$update,$then); |
if ($countactive > 1) { |
if ($countactive > 1) { |
my $tremark=''; |
my $tremark=''; |
my $tbg; |
my $tbg; |
Line 1067 ENDHEADER
|
Line 1198 ENDHEADER
|
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); |
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); |
$r->print('<p><small><i>' |
$r->print('<p><small><i>' |
.&mt('This LON-CAPA server is version [_1]',$r->dir_config('lonVersion')) |
.&mt('This LON-CAPA server is version [_1]',$r->dir_config('lonVersion')) |
.'</i><br />' |
.'</i></small></p>'); |
.'<a href="/adm/logout">'.&mt('Logout').'</a> ' |
|
.'<a href="/adm/coursecatalog?showdom='.$esc_dom.'">' |
|
.&mt('Course/Community Catalog') |
|
.'</a></small></p>'); |
|
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
Line 1103 sub gather_roles {
|
Line 1230 sub gather_roles {
|
my $tryagain = $env{'form.tryagain'}; |
my $tryagain = $env{'form.tryagain'}; |
my @ids = &Apache::lonnet::current_machine_ids(); |
my @ids = &Apache::lonnet::current_machine_ids(); |
if (ref($roles_in_env) eq 'HASH') { |
if (ref($roles_in_env) eq 'HASH') { |
|
my %adhocdesc; |
foreach my $envkey (sort(keys(%{$roles_in_env}))) { |
foreach my $envkey (sort(keys(%{$roles_in_env}))) { |
my $button = 1; |
my $button = 1; |
my $switchserver=''; |
my $switchserver=''; |
Line 1154 sub gather_roles {
|
Line 1282 sub gather_roles {
|
my $trole; |
my $trole; |
if ($role =~ /^cr\//) { |
if ($role =~ /^cr\//) { |
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); |
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); |
if ($tremark) { $tremark.='<br />'; } |
unless ($rauthor eq $rdomain.'-domainconfig') { |
$tremark.=&mt('Custom role defined by [_1].',$rauthor.':'.$rdomain); |
if ($tremark) { $tremark.='<br />'; } |
|
$tremark.=&mt('Custom role defined by [_1].',$rauthor.':'.$rdomain); |
|
} |
} |
} |
$trole=Apache::lonnet::plaintext($role); |
$trole=Apache::lonnet::plaintext($role); |
my $ttype; |
my $ttype; |
my $twhere; |
my $twhere; |
|
my $skipcal; |
my ($tdom,$trest,$tsection)= |
my ($tdom,$trest,$tsection)= |
split(/\//,Apache::lonnet::declutter($where)); |
split(/\//,Apache::lonnet::declutter($where)); |
# First, Co-Authorship roles |
# First, Co-Authorship roles |
Line 1201 sub gather_roles {
|
Line 1332 sub gather_roles {
|
} elsif ($trest) { |
} elsif ($trest) { |
my $tcourseid=$tdom.'_'.$trest; |
my $tcourseid=$tdom.'_'.$trest; |
$ttype = &Apache::loncommon::course_type($tcourseid); |
$ttype = &Apache::loncommon::course_type($tcourseid); |
$trole = &Apache::lonnet::plaintext($role,$ttype,$tcourseid); |
if ($role !~ /^cr/) { |
|
$trole = &Apache::lonnet::plaintext($role,$ttype,$tcourseid); |
|
} elsif ($role =~ m{^\Qcr/$tdom/$tdom\E\-domainconfig/(\w+)$}) { |
|
my $rolename = $1; |
|
my $desc; |
|
if (ref($adhocdesc{$tdom}) eq 'HASH') { |
|
$desc = $adhocdesc{$tdom}{$rolename}; |
|
} else { |
|
my %domdef = &Apache::lonnet::get_domain_defaults($tdom); |
|
if (ref($domdef{'adhocroles'}) eq 'HASH') { |
|
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}; |
|
} |
|
} |
|
} |
|
} |
|
if ($desc ne '') { |
|
$trole = $desc; |
|
} else { |
|
$trole = &mt('Helpdesk[_1]',' '.$rolename); |
|
} |
|
} else { |
|
$trole = (split(/\//,$role,4))[-1]; |
|
} |
if ($env{'course.'.$tcourseid.'.description'}) { |
if ($env{'course.'.$tcourseid.'.description'}) { |
my $home=$env{'course.'.$tcourseid.'.home'}; |
my $home=$env{'course.'.$tcourseid.'.home'}; |
$twhere=$env{'course.'.$tcourseid.'.description'}; |
$twhere=$env{'course.'.$tcourseid.'.description'}; |
Line 1215 sub gather_roles {
|
Line 1371 sub gather_roles {
|
my $required = $env{'course.'.$tcourseid.'.internal.releaserequired'}; |
my $required = $env{'course.'.$tcourseid.'.internal.releaserequired'}; |
if ($required ne '') { |
if ($required ne '') { |
($switchserver,$switchwarning) = |
($switchserver,$switchwarning) = |
&check_release_required($loncaparev,$tcourseid,$trolecode,$required); |
&Apache::loncommon::check_release_required($loncaparev,$tcourseid,$trolecode,$required); |
if ($switchserver || $switchwarning) { |
if ($switchserver || $switchwarning) { |
$button = 0; |
$button = 0; |
} |
} |
Line 1238 sub gather_roles {
|
Line 1394 sub gather_roles {
|
my $required = $newhash{'internal.releaserequired'}; |
my $required = $newhash{'internal.releaserequired'}; |
if ($required ne '') { |
if ($required ne '') { |
($switchserver,$switchwarning) = |
($switchserver,$switchwarning) = |
&check_release_required($loncaparev,$tcourseid,$trolecode,$required); |
&Apache::loncommon::check_release_required($loncaparev,$tcourseid,$trolecode,$required); |
if ($switchserver || $switchwarning) { |
if ($switchserver || $switchwarning) { |
$button = 0; |
$button = 0; |
} |
} |
Line 1249 sub gather_roles {
|
Line 1405 sub gather_roles {
|
$env{'course.'.$tcourseid.'.description'}=$twhere; |
$env{'course.'.$tcourseid.'.description'}=$twhere; |
$sortkey=$role."\0".$tdom."\0".$twhere."\0".$envkey; |
$sortkey=$role."\0".$tdom."\0".$twhere."\0".$envkey; |
$ttype = 'Unavailable'; |
$ttype = 'Unavailable'; |
|
$skipcal = 1; |
} |
} |
} |
} |
|
if ($ttype eq 'Placement') { |
|
$ttype = 'Placement Test'; |
|
} |
if ($tsection) { |
if ($tsection) { |
$twhere.='<br />'.&mt('Section').': '.$tsection; |
$twhere.='<br />'.&mt('Section').': '.$tsection; |
} |
} |
Line 1267 sub gather_roles {
|
Line 1427 sub gather_roles {
|
($role_text,$role_text_end) = |
($role_text,$role_text_end) = |
&build_roletext($trolecode,$tdom,$trest,$tstatus,$tryagain, |
&build_roletext($trolecode,$tdom,$trest,$tstatus,$tryagain, |
$advanced,$tremark,$tbg,$trole,$twhere,$tpstart, |
$advanced,$tremark,$tbg,$trole,$twhere,$tpstart, |
$tpend,$nochoose,$button,$switchserver,$reinit,$switchwarning); |
$tpend,$nochoose,$button,$switchserver,$reinit, |
|
$switchwarning,$skipcal); |
$roletext->{$envkey}=[$role_text,$role_text_end]; |
$roletext->{$envkey}=[$role_text,$role_text_end]; |
if (!$sortkey) {$sortkey=$twhere."\0".$envkey;} |
if (!$sortkey) {$sortkey=$twhere."\0".$envkey;} |
$sortrole->{$sortkey}=$envkey; |
$sortrole->{$sortkey}=$envkey; |
Line 1339 sub roletable_headers {
|
Line 1500 sub roletable_headers {
|
my $doheaders; |
my $doheaders; |
if ((ref($sortrole) eq 'HASH') && (ref($roleclass) eq 'HASH')) { |
if ((ref($sortrole) eq 'HASH') && (ref($roleclass) eq 'HASH')) { |
$r->print('<br />' |
$r->print('<br />' |
.&Apache::loncommon::start_data_table() |
.&Apache::loncommon::start_data_table('LC_textsize_mobile') |
.&Apache::loncommon::start_data_table_header_row() |
.&Apache::loncommon::start_data_table_header_row() |
); |
); |
if (!$nochoose) { $r->print('<th> </th>'); } |
if (!$nochoose) { $r->print('<th> </th>'); } |
Line 1365 sub roletable_headers {
|
Line 1526 sub roletable_headers {
|
} |
} |
|
|
sub roletypes { |
sub roletypes { |
my @types = ('Domain','Authoring Space','Course','Community','Unavailable','System'); |
my @types = ('Domain','Authoring Space','Course','Placement Test','Community','Unavailable','System'); |
return @types; |
return @types; |
} |
} |
|
|
sub print_rolerows { |
sub print_rolerows { |
my ($r,$doheaders,$roleclass,$sortrole,$dcroles,$roletext) = @_; |
my ($r,$doheaders,$roleclass,$sortrole,$dcroles,$roletext,$update,$then) = @_; |
if ((ref($roleclass) eq 'HASH') && (ref($sortrole) eq 'HASH')) { |
if ((ref($roleclass) eq 'HASH') && (ref($sortrole) eq 'HASH')) { |
my @types = &roletypes(); |
my @types = &roletypes(); |
foreach my $type (@types) { |
foreach my $type (@types) { |
Line 1388 sub print_rolerows {
|
Line 1549 sub print_rolerows {
|
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
} |
} |
} |
} |
if ($sortrole->{$which} =~ m-dc\./($match_domain)/-) { |
if ($sortrole->{$which} =~ m{^user\.role\.dc\./($match_domain)/}) { |
if (ref($dcroles) eq 'HASH') { |
if (ref($dcroles) eq 'HASH') { |
if ($dcroles->{$1}) { |
if ($dcroles->{$1}) { |
$output .= &adhoc_roles_row($1,''); |
$output .= &adhoc_roles_row($1,''); |
} |
} |
} |
} |
|
} elsif ($sortrole->{$which} =~ m{^user\.role\.(dh|da)\./($match_domain)/}) { |
|
$output .= &adhoc_customroles_row($1,$2,'',$update,$then); |
} |
} |
} |
} |
} |
} |
Line 1561 sub privileges_info {
|
Line 1724 sub privileges_info {
|
} |
} |
|
|
sub build_roletext { |
sub build_roletext { |
my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$trole,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver,$reinit,$switchwarning) = @_; |
my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$trole,$twhere, |
|
$tpstart,$tpend,$nochoose,$button,$switchserver,$reinit,$switchwarning,$skipcal) = @_; |
my ($roletext,$roletext_end); |
my ($roletext,$roletext_end); |
my $is_dc=($trolecode =~ m/^dc\./); |
my $is_dc=($trolecode =~ m/^dc\./); |
my $rowspan=($is_dc) ? '' |
my $rowspan=($is_dc) ? '' |
Line 1617 sub build_roletext {
|
Line 1781 sub build_roletext {
|
$trolecode."','".$buttonname.'\');" /></td>'; |
$trolecode."','".$buttonname.'\');" /></td>'; |
} |
} |
} |
} |
if ($trolecode !~ m/^(dc|ca|au|aa)\./) { |
if (($trolecode !~ m/^(dc|ca|au|aa)\./) && (!$skipcal)) { |
$tremark.=&Apache::lonannounce::showday(time,1, |
$tremark.=&Apache::lonannounce::showday(time,1, |
&Apache::lonannounce::readcalendar($tdom.'_'.$trest)); |
&Apache::lonannounce::readcalendar($tdom.'_'.$trest)); |
} |
} |
Line 1650 sub check_author_homeserver {
|
Line 1814 sub check_author_homeserver {
|
} |
} |
} |
} |
|
|
sub check_fordc { |
sub check_for_adhoc { |
my ($dcroles,$update,$then) = @_; |
my ($dcroles,$helpdeskroles,$update,$then) = @_; |
my $numdc = 0; |
my $numdc = 0; |
|
my $numhelpdesk = 0; |
|
my $numadhoc = 0; |
|
my $num_custom_adhoc = 0; |
if ($env{'user.adv'}) { |
if ($env{'user.adv'}) { |
foreach my $envkey (sort keys %env) { |
foreach my $envkey (sort(keys(%env))) { |
if ($envkey=~/^user\.role\.dc\.\/($match_domain)\/$/) { |
if ($envkey=~/^user\.role\.(dc|dh|da)\.\/($match_domain)\/$/) { |
my $dcdom = $1; |
my $role = $1; |
my $livedc = 1; |
my $roledom = $2; |
|
my $liverole = 1; |
my ($tstart,$tend)=split(/\./,$env{$envkey}); |
my ($tstart,$tend)=split(/\./,$env{$envkey}); |
my $limit = $update; |
my $limit = $update; |
if ($env{'request.role'} eq 'dc./'.$dcdom.'/') { |
if ($env{'request.role'} eq "$role./$roledom/") { |
$limit = $then; |
$limit = $then; |
} |
} |
if ($tstart && $tstart>$limit) { $livedc = 0; } |
if ($tstart && $tstart>$limit) { $liverole = 0; } |
if ($tend && $tend <$limit) { $livedc = 0; } |
if ($tend && $tend <$limit) { $liverole = 0; } |
if ($livedc) { |
if ($liverole) { |
$$dcroles{$dcdom} = $envkey; |
if ($role eq 'dc') { |
$numdc++; |
$dcroles->{$roledom} = $envkey; |
|
$numdc++; |
|
} else { |
|
$helpdeskroles->{$roledom} = $envkey; |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($roledom); |
|
if (ref($domdefaults{'adhocroles'}) eq 'HASH') { |
|
if (keys(%{$domdefaults{'adhocroles'}})) { |
|
$numadhoc ++; |
|
} |
|
} |
|
$numhelpdesk++; |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
return $numdc; |
return ($numdc,$numhelpdesk,$numadhoc); |
} |
} |
|
|
sub adhoc_course_role { |
sub adhoc_course_role { |
Line 1713 sub adhoc_course_role {
|
Line 1892 sub adhoc_course_role {
|
my %cgroups = |
my %cgroups = |
&Apache::lonnet::get_active_groups($env{'user.domain'}, |
&Apache::lonnet::get_active_groups($env{'user.domain'}, |
$env{'user.name'},$cdom,$cnum); |
$env{'user.name'},$cdom,$cnum); |
|
my $ccrole; |
|
if ($crstype eq 'Community') { |
|
$ccrole = 'co'; |
|
} else { |
|
$ccrole = 'cc'; |
|
} |
foreach my $group (keys(%cgroups)) { |
foreach my $group (keys(%cgroups)) { |
$group_privs{$group} = |
$group_privs{$group} = |
$env{'user.priv.cc./'.$cdom.'/'.$cnum.'./'.$cdom.'/'.$cnum.'/'.$group}; |
$env{'user.priv.'.$ccrole.'./'.$cdom.'/'.$cnum.'./'.$cdom.'/'.$cnum.'/'.$group}; |
} |
} |
$newgroups{'/'.$cdom.'/'.$cnum} = \%group_privs; |
$newgroups{'/'.$cdom.'/'.$cnum} = \%group_privs; |
my $area = '/'.$cdom.'/'.$cnum; |
my $area = '/'.$cdom.'/'.$cnum; |
Line 1763 sub check_forcc {
|
Line 1948 sub check_forcc {
|
return $is_cc; |
return $is_cc; |
} |
} |
|
|
sub check_release_required { |
|
my ($loncaparev,$tcourseid,$trolecode,$required) = @_; |
|
my ($switchserver,$warning); |
|
if ($required ne '') { |
|
my ($reqdmajor,$reqdminor) = ($required =~ /^(\d+)\.(\d+)$/); |
|
my ($major,$minor) = ($loncaparev =~ /^\'?(\d+)\.(\d+)\.[\w.\-]+\'?$/); |
|
if ($reqdmajor ne '' && $reqdminor ne '') { |
|
my $otherserver; |
|
if (($major eq '' && $minor eq '') || |
|
(($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor)))) { |
|
my ($userdomserver) = &Apache::lonnet::choose_server($env{'user.domain'},undef,$required,1); |
|
my $switchlcrev = |
|
&Apache::lonnet::get_server_loncaparev($env{'user.domain'}, |
|
$userdomserver); |
|
my ($swmajor,$swminor) = ($switchlcrev =~ /^\'?(\d+)\.(\d+)\.[\w.\-]+\'?$/); |
|
if (($swmajor eq '' && $swminor eq '') || ($reqdmajor > $swmajor) || |
|
(($reqdmajor == $swmajor) && ($reqdminor > $swminor))) { |
|
my $cdom = $env{'course.'.$tcourseid.'.domain'}; |
|
if ($cdom ne $env{'user.domain'}) { |
|
my ($coursedomserver,$coursehostname) = &Apache::lonnet::choose_server($cdom,undef,$required,1); |
|
my $serverhomeID = &Apache::lonnet::get_server_homeID($coursehostname); |
|
my $serverhomedom = &Apache::lonnet::host_domain($serverhomeID); |
|
my %defdomdefaults = &Apache::lonnet::get_domain_defaults($serverhomedom); |
|
my %udomdefaults = &Apache::lonnet::get_domain_defaults($env{'user.domain'}); |
|
my $remoterev = &Apache::lonnet::get_server_loncaparev($serverhomedom,$coursedomserver); |
|
my $canhost = |
|
&Apache::lonnet::can_host_session($env{'user.domain'}, |
|
$coursedomserver, |
|
$remoterev, |
|
$udomdefaults{'remotesessions'}, |
|
$defdomdefaults{'hostedsessions'}); |
|
|
|
if ($canhost) { |
|
$otherserver = $coursedomserver; |
|
} else { |
|
$warning = &mt('Requires LON-CAPA version [_1].',$env{'course.'.$tcourseid.'.internal.releaserequired'}).'<br />'. &mt("No suitable server could be found amongst servers in either your own domain or in the course's domain."); |
|
} |
|
} else { |
|
$warning = &mt('Requires LON-CAPA version [_1].',$env{'course.'.$tcourseid.'.internal.releaserequired'}).'<br />'.&mt("No suitable server could be found amongst servers in your own domain (which is also the course's domain)."); |
|
} |
|
} else { |
|
$otherserver = $userdomserver; |
|
} |
|
} |
|
if ($otherserver ne '') { |
|
$switchserver = 'otherserver='.$otherserver.'&role='.$trolecode; |
|
} |
|
} |
|
} |
|
return ($switchserver,$warning); |
|
} |
|
|
|
sub courselink { |
sub courselink { |
my ($dcdom,$rowtype) = @_; |
my ($roledom,$rowtype,$role) = @_; |
my $courseform=&Apache::loncommon::selectcourse_link |
my $courseform=&Apache::loncommon::selectcourse_link |
('rolechoice','dccourse'.$rowtype.'_'.$dcdom, |
('rolechoice','course'.$rowtype.'_'.$roledom.'_'.$role, |
'dcdomain'.$rowtype.'_'.$dcdom,'coursedesc'.$rowtype.'_'. |
'domain'.$rowtype.'_'.$roledom.'_'.$role, |
$dcdom,$dcdom,undef,'Course/Community'); |
'coursedesc'.$rowtype.'_'.$roledom.'_'.$role, |
my $hiddenitems = '<input type="hidden" name="dcdomain'.$rowtype.'_'.$dcdom.'" value="'.$dcdom.'" />'. |
$roledom.':'.$role,undef,'Course/Community'); |
'<input type="hidden" name="origdom'.$rowtype.'_'.$dcdom.'" value="'.$dcdom.'" />'. |
my $hiddenitems = '<input type="hidden" name="domain'.$rowtype.'_'.$roledom.'_'.$role.'" value="'.$roledom.'" />'. |
'<input type="hidden" name="dccourse'.$rowtype.'_'.$dcdom.'" value="" />'. |
'<input type="hidden" name="origdom'.$rowtype.'_'.$roledom.'_'.$role.'" value="'.$roledom.'" />'. |
'<input type="hidden" name="coursedesc'.$rowtype.'_'.$dcdom.'" value="" />'; |
'<input type="hidden" name="course'.$rowtype.'_'.$roledom.'_'.$role.'" value="" />'. |
|
'<input type="hidden" name="coursedesc'.$rowtype.'_'.$roledom.'_'.$role.'" value="" />'; |
return $courseform.$hiddenitems; |
return $courseform.$hiddenitems; |
} |
} |
|
|
sub coursepick_jscript { |
sub coursepick_jscript { |
my %lt = &Apache::lonlocal::texthash( |
my %js_lt = &Apache::lonlocal::texthash( |
plsu => "Please use the 'Select Course/Community' link to open a separate pick course window where you may select the course or community you wish to enter.", |
plsu => "Please use the 'Select Course/Community' link to open a separate pick course window where you may select the course or community you wish to enter.", |
youc => 'You can only use this screen to select courses and communities in the current domain.', |
youc => 'You can only use this screen to select courses and communities in the current domain.', |
); |
); |
|
&js_escape(\%js_lt); |
my $verify_script = <<"END"; |
my $verify_script = <<"END"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 1849 function verifyCoursePick(caller) {
|
Line 1984 function verifyCoursePick(caller) {
|
} |
} |
} |
} |
else { |
else { |
alert("$lt{'plsu'}"); |
alert("$js_lt{'plsu'}"); |
} |
} |
} |
} |
else { |
else { |
alert("$lt{'youc'}") |
alert("$js_lt{'youc'}") |
} |
} |
} |
} |
function getIndex(caller) { |
function getIndex(caller) { |
Line 1891 sub display_cc_role {
|
Line 2026 sub display_cc_role {
|
my $trolecode = $ccrole.'./'.$tdom.'/'.$trest; |
my $trolecode = $ccrole.'./'.$tdom.'/'.$trest; |
my $twhere; |
my $twhere; |
my $ttype; |
my $ttype; |
|
my $skipcal; |
my $tbg='LC_roles_is'; |
my $tbg='LC_roles_is'; |
my %newhash=&Apache::lonnet::coursedescription($tcourseid); |
my %newhash=&Apache::lonnet::coursedescription($tcourseid); |
if (%newhash) { |
if (%newhash) { |
Line 1902 sub display_cc_role {
|
Line 2038 sub display_cc_role {
|
} else { |
} else { |
$twhere=&mt('Currently not available'); |
$twhere=&mt('Currently not available'); |
$env{'course.'.$tcourseid.'.description'}=$twhere; |
$env{'course.'.$tcourseid.'.description'}=$twhere; |
|
$skipcal = 1; |
} |
} |
my $trole = &Apache::lonnet::plaintext($ccrole,$ttype,$tcourseid); |
my $trole = &Apache::lonnet::plaintext($ccrole,$ttype,$tcourseid); |
$twhere.="<br />".&mt('Domain').":".$tdom; |
$twhere.="<br />".&mt('Domain').":".$tdom; |
($roletext,$roletext_end) = &build_roletext($trolecode,$tdom,$trest,'is',$tryagain,$advanced,'',$tbg,$trole,$twhere,'','','',1,''); |
($roletext,$roletext_end) = &build_roletext($trolecode,$tdom,$trest,'is',$tryagain,$advanced,'',$tbg,$trole,$twhere,'','','',1,'','','',$skipcal); |
} |
} |
} |
} |
return ($roletext,$roletext_end); |
return ($roletext,$roletext_end); |
Line 1914 sub display_cc_role {
|
Line 2051 sub display_cc_role {
|
sub adhoc_roles_row { |
sub adhoc_roles_row { |
my ($dcdom,$rowtype) = @_; |
my ($dcdom,$rowtype) = @_; |
my $output = &Apache::loncommon::continue_data_table_row() |
my $output = &Apache::loncommon::continue_data_table_row() |
.' <td colspan="5">' |
.' <td colspan="5" class="LC_textsize_mobile">' |
.&mt('[_1]Ad hoc[_2] roles in domain [_3] --' |
.&mt('[_1]Ad hoc[_2] roles in domain [_3] --' |
,'<span class="LC_cusr_emph">','</span>',$dcdom) |
,'<span class="LC_cusr_emph">','</span>',$dcdom) |
.' '; |
.' '; |
my $selectcclink = &courselink($dcdom,$rowtype); |
my $role = 'cc'; |
|
my $selectcclink = &courselink($dcdom,$rowtype,$role); |
my $ccrole = &Apache::lonnet::plaintext('co',undef,undef,1); |
my $ccrole = &Apache::lonnet::plaintext('co',undef,undef,1); |
my $carole = &Apache::lonnet::plaintext('ca'); |
my $carole = &Apache::lonnet::plaintext('ca'); |
my $selectcalink = &coauthorlink($dcdom,$rowtype); |
my $selectcalink = &coauthorlink($dcdom,$rowtype); |
Line 1928 sub adhoc_roles_row {
|
Line 2066 sub adhoc_roles_row {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub adhoc_customroles_row { |
|
my ($role,$dhdom,$rowtype,$update,$then) = @_; |
|
my $liverole = 1; |
|
my ($tstart,$tend)=split(/\./,$env{"user.role.$role./$dhdom/"}); |
|
my $limit = $update; |
|
if (($role eq 'dh') && ($env{'request.role'} eq 'dh./'.$dhdom.'/')) { |
|
$limit = $then; |
|
} |
|
if ($tstart && $tstart>$limit) { $liverole = 0; } |
|
if ($tend && $tend <$limit) { $liverole = 0; } |
|
return unless ($liverole); |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dhdom); |
|
if (ref($domdefaults{'adhocroles'}) eq 'HASH') { |
|
if (scalar(keys(%{$domdefaults{'adhocroles'}})) > 0) { |
|
return &Apache::loncommon::continue_data_table_row() |
|
.' <td colspan="5" class="LC_textsize_mobile">' |
|
.&mt('[_1]Ad hoc[_2] course/community roles in domain [_3] --', |
|
'<span class="LC_cusr_emph">','</span>',$dhdom) |
|
.' '.&courselink($dhdom,$rowtype,$role); |
|
} |
|
} |
|
return; |
|
} |
|
|
sub recent_filename { |
sub recent_filename { |
my $area=shift; |
my $area=shift; |
return 'nohist_recent_'.&escape($area); |
return 'nohist_recent_'.&escape($area); |
Line 2756 sub get_roles_functions {
|
Line 2918 sub get_roles_functions {
|
unless ($cattype eq 'none') { |
unless ($cattype eq 'none') { |
push(@links,['/adm/coursecatalog','ccat-22x22',&mt('Course catalog')]); |
push(@links,['/adm/coursecatalog','ccat-22x22',&mt('Course catalog')]); |
} |
} |
my $funcs = &Apache::lonhtmlcommon::start_funclist(); |
my $funcs; |
foreach my $link (@links) { |
if ($env{'browser.mobile'}) { |
$funcs .= &Apache::lonhtmlcommon::add_item_funclist( |
my @functions; |
'<a href="'.$link->[0].'" class="LC_menubuttons_link">'. |
foreach my $link (@links) { |
'<img src="/res/adm/pages/'.$link->[1].'.png" class="LC_icon" alt="'.$link->[2].'" />'. |
push(@functions,[$link->[0],$link->[2]]); |
$link->[2].'</a>'); |
} |
|
my $title = 'Display options'; |
|
if ($env{'user.adv'}) { |
|
$title = 'Roles options'; |
|
} |
|
$funcs = &Apache::lonmenu::create_submenu('','',$title,\@functions,1,'LC_breadcrumbs_hoverable'); |
|
$funcs = '<ol class="LC_primary_menu LC_floatright">'.$funcs.'</ol>'; |
|
} else { |
|
$funcs = &Apache::lonhtmlcommon::start_funclist(); |
|
foreach my $link (@links) { |
|
$funcs .= &Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$link->[0].'" class="LC_menubuttons_link">'. |
|
'<img src="/res/adm/pages/'.$link->[1].'.png" class="LC_icon" alt="'.$link->[2].'" />'. |
|
$link->[2].'</a>'); |
|
} |
|
$funcs .= &Apache::lonhtmlcommon::end_funclist(); |
|
$funcs = &Apache::loncommon::head_subbox($funcs); |
} |
} |
$funcs .= &Apache::lonhtmlcommon::end_funclist(); |
return $funcs; |
return &Apache::loncommon::head_subbox($funcs); |
|
} |
} |
|
|
sub get_queued { |
sub get_queued { |