version 1.269.2.17, 2014/04/05 12:25:19
|
version 1.285, 2013/05/10 15:02:45
|
Line 143 use Apache::lonrss;
|
Line 143 use Apache::lonrss;
|
use GDBM_File; |
use GDBM_File; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use HTML::Entities; |
use HTML::Entities; |
|
|
|
|
sub redirect_user { |
sub redirect_user { |
my ($r,$title,$url,$msg) = @_; |
my ($r,$title,$url,$msg) = @_; |
Line 151 sub redirect_user {
|
Line 151 sub redirect_user {
|
&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 $swinfo=&Apache::lonmenu::rawconfig(); |
|
|
|
# Breadcrumbs |
# Breadcrumbs |
my $brcrum = [{'href' => $url, |
my $brcrum = [{'href' => $url, |
Line 166 sub redirect_user {
|
Line 165 sub redirect_user {
|
$url=~s/ /\%20/g; |
$url=~s/ /\%20/g; |
$r->print(<<ENDREDIR); |
$r->print(<<ENDREDIR); |
$start_page |
$start_page |
<script type="text/javascript"> |
|
// <![CDATA[ |
|
$swinfo |
|
// ]]> |
|
</script> |
|
<p>$msg</p> |
<p>$msg</p> |
$end_page |
$end_page |
ENDREDIR |
ENDREDIR |
Line 221 sub handler {
|
Line 215 sub handler {
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
|
|
# -------------------------------------------------- Check if setting hot list |
# -------------------------------------------------- Check if setting hot list |
my $hotlist; |
my $hotlist; |
if ($env{'form.action'} eq 'verify_and_change_rolespref') { |
if ($env{'form.action'} eq 'verify_and_change_rolespref') { |
$hotlist = &Apache::lonpreferences::verify_and_change_rolespref($r); |
$hotlist = &Apache::lonpreferences::verify_and_change_rolespref($r); |
Line 294 sub handler {
|
Line 288 sub handler {
|
"request.role.domain" => $env{'user.domain'}}); |
"request.role.domain" => $env{'user.domain'}}); |
# 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 DC trying to enter a course or author space and needs privs to be created |
if ($numdc > 0) { |
if ($numdc > 0) { |
foreach my $envkey (keys(%env)) { |
foreach my $envkey (keys %env) { |
# Is this an ad-hoc Coordinator role? |
# Is this an ad-hoc Coordinator role? |
if (my ($ccrole,$domain,$coursenum) = |
if (my ($ccrole,$domain,$coursenum) = |
($envkey =~ m-^form\.(cc|co)\./($match_domain)/($match_courseid)$-)) { |
($envkey =~ m-^form\.(cc|co)\./($match_domain)/($match_courseid)$-)) { |
Line 364 sub handler {
|
Line 358 sub handler {
|
} |
} |
} |
} |
|
|
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); |
&Apache::lonnet::role_status($envkey,$update,$refresh,$now,\$role,\$where, |
&Apache::lonnet::role_status($envkey,$update,$refresh,$now,\$role,\$where, |
Line 526 ENDENTERKEY
|
Line 520 ENDENTERKEY
|
|
|
if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) { |
if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) { |
my $msg; |
my $msg; |
my ($furl,$ferr)= |
my ($furl,$ferr)= |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
unless ($ferr) { |
unless ($ferr) { |
unless (($env{'form.switchrole'}) || |
unless (($env{'form.switchrole'}) || |
($env{"environment.internal.$cdom.$cnum.$role.adhoc"})) { |
($env{"environment.internal.$cdom.$cnum.$role.adhoc"})) { |
&Apache::lonnet::put('nohist_crslastlogin', |
&Apache::lonnet::put('nohist_crslastlogin', |
{$env{'user.name'}.':'.$env{'user.domain'}. |
{$env{'user.name'}.':'.$env{'user.domain'}. |
Line 538 ENDENTERKEY
|
Line 532 ENDENTERKEY
|
my ($feeds,$syllabus_time); |
my ($feeds,$syllabus_time); |
&Apache::lonrss::advertisefeeds($cnum,$cdom,undef,\$feeds); |
&Apache::lonrss::advertisefeeds($cnum,$cdom,undef,\$feeds); |
&Apache::lonnet::appenv({'request.course.feeds' => $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.'.updatedsyllabus'}) { |
unless (($env{'course.'.$cdom.'_'.$cnum.'.externalsyllabus'}) || |
unless (($env{'course.'.$cdom.'_'.$cnum.'.externalsyllabus'}) || |
($env{'course.'.$cdom.'_'.$cnum.'.uploadedsyllabus'})) { |
($env{'course.'.$cdom.'_'.$cnum.'.uploadedsyllabus'})) { |
Line 551 ENDENTERKEY
|
Line 544 ENDENTERKEY
|
} |
} |
} |
} |
if (($env{'form.orgurl'}) && |
if (($env{'form.orgurl'}) && |
($env{'form.orgurl'}!~/^\/adm\/flip/) && |
($env{'form.orgurl'}!~/^\/adm\/flip/)) { |
($env{'form.orgurl'} ne '/adm/roles')) { |
|
my $dest=$env{'form.orgurl'}; |
my $dest=$env{'form.orgurl'}; |
if ($env{'form.symb'}) { |
if ($env{'form.symb'}) { |
if ($dest =~ /\?/) { |
if ($dest =~ /\?/) { |
$dest .= '&'; |
$dest .= '&'; |
} else { |
} else { |
$dest .= '?'; |
$dest .= '?' |
} |
} |
$dest .= 'symb='.$env{'form.symb'}; |
$dest .= 'symb='.$env{'form.symb'}; |
} |
} |
Line 597 ENDENTERKEY
|
Line 589 ENDENTERKEY
|
} else { |
} else { |
# Check to see if the user is a CC entering a course |
# Check to see if the user is a CC entering a course |
# for the first time |
# for the first time |
|
my (undef, undef, $role, $courseid) = split(/\./, $envkey); |
|
if (substr($courseid, 0, 1) eq '/') { |
|
$courseid = substr($courseid, 1); |
|
} |
|
$courseid =~ s/\//_/; |
if ((($role eq 'cc') || ($role eq 'co')) |
if ((($role eq 'cc') || ($role eq 'co')) |
&& ($env{'course.' .$cdom.'_'.$cnum.'.course.helper.not.run'})) { |
&& ($env{'course.' . $courseid .'.course.helper.not.run'})) { |
$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'}) { |
Line 618 ENDENTERKEY
|
Line 615 ENDENTERKEY
|
if ($env{'request.role.adv'}) { |
if ($env{'request.role.adv'}) { |
$dest = &Apache::lonenc::unencrypted($dest); |
$dest = &Apache::lonenc::unencrypted($dest); |
if ($destsymb eq '') { |
if ($destsymb eq '') { |
($destsymb) = ($dest =~ /(?:\?|\&)symb=([^\&]*)/); |
($destsymb) = ($dest =~ /(?:\?|\&)symb=([^\&]*)/); |
$destsymb = &unescape($destsymb); |
$destsymb = &unescape($destsymb); |
} |
} |
} |
} |
Line 643 ENDENTERKEY
|
Line 640 ENDENTERKEY
|
} |
} |
} |
} |
} |
} |
unless (($dest =~ m{^/enc/}) || ($dest =~ /(\?|\&)symb=.+___\d+___.+/)) { |
unless (($dest =~ m{^/enc/}) || ($dest =~ /(\?|\&)symb=.+___\d+___.+/)) { |
if (($destsymb ne '') && ($destsymb !~ m{^/enc/})) { |
if (($destsymb ne '') && ($destsymb !~ m{^/enc/})) { |
my $esc_symb = &escape($destsymb); |
my $esc_symb = &escape($destsymb); |
$dest .= '?symb='.$esc_symb; |
$dest .= '?symb='.$esc_symb; |
} |
} |
} |
} |
&redirect_user($r, &mt('Entering [_1]', |
&redirect_user($r, &mt('Entering [_1]', |
$env{'course.'.$env{'request.course.id'}.'.description'}), |
$env{'course.'.$courseid.'.description'}), |
$dest, $msg); |
$dest, $msg); |
return OK; |
return OK; |
} |
} |
Line 660 ENDENTERKEY
|
Line 657 ENDENTERKEY
|
$env{'request.course.id'}.'/' |
$env{'request.course.id'}.'/' |
.$env{'request.course.sec'}) |
.$env{'request.course.sec'}) |
) { |
) { |
my $startpage = &courseloadpage($env{'request.course.id'}); |
my $startpage = &courseloadpage($courseid); |
unless ($startpage eq 'firstres') { |
unless ($startpage eq 'firstres') { |
$msg = &mt('Entering [_1] ...', |
$msg = &mt('Entering [_1] ...', |
$env{'course.'.$env{'request.course.id'}.'.description'}); |
$env{'course.'.$courseid.'.description'}); |
&redirect_user($r, &mt('New in course'), |
&redirect_user($r, &mt('New in course'), |
'/adm/whatsnew?refpage=start', $msg); |
'/adm/whatsnew?refpage=start', $msg); |
return OK; |
return OK; |
} |
} |
} |
} |
} |
} |
# Are we allowed to look at the first resource? |
# Are we allowed to look at the first resource? |
if ($furl =~ m{^(/adm/wrapper|)/ext/}) { |
if ($furl !~ m|^/adm/|) { |
# If it's an external resource, |
# Guess not ... |
# strip off the symb argument and possible query |
$furl=&Apache::lonpageflip::first_accessible_resource(); |
my ($exturl,$symb) = ($furl =~ m{^(.+)(?:\?|\&)symb=(.+)$}); |
} |
# Unencode $symb |
|
$symb = &unescape($symb); |
|
# Then check for permission |
|
if (!&Apache::lonnet::allowed('bre',$exturl,$symb)) { |
|
$furl = &Apache::lonpageflip::first_accessible_resource(); |
|
} |
|
# For other resources just check for permission |
|
} elsif (!&Apache::lonnet::allowed('bre',$furl)) { |
|
$furl = &Apache::lonpageflip::first_accessible_resource(); |
|
} |
|
|
|
$msg = &mt('Entering [_1] ...', |
$msg = &mt('Entering [_1] ...', |
$env{'course.'.$cdom.'_'.$cnum.'.description'}); |
$env{'course.'.$courseid.'.description'}); |
&redirect_user($r, &mt('Entering [_1]', |
&redirect_user($r, &mt('Entering [_1]', |
$env{'course.'.$cdom.'_'.$cnum.'.description'}), |
$env{'course.'.$courseid.'.description'}), |
$furl, $msg); |
$furl, $msg); |
} |
} |
return OK; |
return OK; |
Line 705 ENDENTERKEY
|
Line 691 ENDENTERKEY
|
$redirect_url .= $where; |
$redirect_url .= $where; |
} |
} |
$redirect_url .= '/'; |
$redirect_url .= '/'; |
&redirect_user($r,&mt('Entering Authoring Space'), |
&redirect_user($r,&mt('Entering Construction Space'), |
$redirect_url); |
$redirect_url); |
return OK; |
return OK; |
} |
} |
Line 737 ENDENTERKEY
|
Line 723 ENDENTERKEY
|
my $crumbtext = 'User Roles'; |
my $crumbtext = 'User Roles'; |
my $pagetitle = 'My Roles'; |
my $pagetitle = 'My Roles'; |
my $recent = &mt('Recent Roles'); |
my $recent = &mt('Recent Roles'); |
my $standby = &mt('Role selected. Please stand by.'); |
|
my $show_course=&Apache::loncommon::show_course(); |
my $show_course=&Apache::loncommon::show_course(); |
if ($show_course) { |
if ($show_course) { |
$crumbtext = 'Courses'; |
$crumbtext = 'Courses'; |
$pagetitle = 'My Courses'; |
$pagetitle = 'My Courses'; |
$recent = &mt('Recent Courses'); |
$recent = &mt('Recent Courses'); |
$standby = &mt('Course selected. Please stand by.'); |
|
} |
} |
my $brcrum =[{href=>"/adm/roles",text=>$crumbtext}]; |
my $brcrum =[{href=>"/adm/roles",text=>$crumbtext}]; |
|
|
Line 753 ENDENTERKEY
|
Line 737 ENDENTERKEY
|
my $swinfo=&Apache::lonmenu::rawconfig(); |
my $swinfo=&Apache::lonmenu::rawconfig(); |
my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum}); |
my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum}); |
my $funcs = &get_roles_functions($showcount); |
my $funcs = &get_roles_functions($showcount); |
|
my $standby=&mt('Role selected. Please stand by.'); |
$standby=~s/\n/\\n/g; |
$standby=~s/\n/\\n/g; |
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 />'; |
|
|
Line 786 function rolesView (caller) {
|
Line 771 function rolesView (caller) {
|
document.rolechoice.display.value = caller; |
document.rolechoice.display.value = caller; |
} else { |
} else { |
if ((caller == 'doupdate') || (caller == 'requestauthor') || |
if ((caller == 'doupdate') || (caller == 'requestauthor') || |
(caller == 'queued')) { |
(caller == 'queued')) { |
document.rolechoice.state.value = caller; |
document.rolechoice.state.value = caller; |
} |
} |
} |
} |
Line 870 ENDHEADER
|
Line 855 ENDHEADER
|
} |
} |
if ($hotlist) { |
if ($hotlist) { |
$showresult .= $hotlist; |
$showresult .= $hotlist; |
} |
} |
$showresult .= '</div>'; |
$showresult .= '</div>'; |
$r->print($showresult); |
$r->print($showresult); |
} elsif ($env{'form.state'} eq 'queued') { |
} elsif ($env{'form.state'} eq 'queued') { |
Line 895 ENDHEADER
|
Line 880 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}); |
unless ($env{'user.adv'}) { |
unless ($env{'user.adv'}) { |
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'},'"<>&'); |
$r->print( |
$r->print( |
'<p>' |
'<p>' |
.&mt('[_1]Visit the [_2]Course/Community Catalog[_3][_4]' |
.&mt('[_1]Visit the [_2]Course/Community Catalog[_3]' |
.' to view all [_5] LON-CAPA courses and communities.' |
.' to view all [_4] LON-CAPA courses and communities.' |
,'<b>' |
,'<b>' |
,'<a href="/adm/coursecatalog?showdom='.$esc_dom.'">' |
,'<a href="/adm/coursecatalog?showdom='.$esc_dom.'">' |
,'</a>' |
,'</a></b>',$domdesc) |
,'</b>' |
|
,'"'. $domdesc.'"') |
|
.'<br />' |
.'<br />' |
.&mt('If a course or community is [_1]not[_2] in your list of current courses and communities below,' |
.&mt('If a course or community is [_1]not[_2] in your list of current courses and communities below,' |
.' you may be able to enroll if self-enrollment is permitted.' |
.' you may be able to enroll if self-enrollment is permitted.' |
Line 1154 sub gather_roles {
|
Line 1137 sub gather_roles {
|
if ($role =~ /^cr\//) { |
if ($role =~ /^cr\//) { |
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); |
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); |
if ($tremark) { $tremark.='<br />'; } |
if ($tremark) { $tremark.='<br />'; } |
$tremark.=&mt('Custom role defined by [_1].',$rauthor.':'.$rdomain); |
$tremark.=&mt('Customrole defined by [_1].',$rauthor.':'.$rdomain); |
} |
} |
$trole=Apache::lonnet::plaintext($role); |
$trole=Apache::lonnet::plaintext($role); |
my $ttype; |
my $ttype; |
Line 1172 sub gather_roles {
|
Line 1155 sub gather_roles {
|
} |
} |
#next if ($home eq 'no_host'); |
#next if ($home eq 'no_host'); |
$home = &Apache::lonnet::hostname($home); |
$home = &Apache::lonnet::hostname($home); |
$ttype='Authoring Space'; |
$ttype='Construction Space'; |
$twhere=&mt('User').': '.$trest.'<br />'.&mt('Domain'). |
$twhere=&mt('User').': '.$trest.'<br />'.&mt('Domain'). |
': '.$tdom.'<br />'. |
': '.$tdom.'<br />'. |
' '.&mt('Server').': '.$home; |
' '.&mt('Server').': '.$home; |
Line 1191 sub gather_roles {
|
Line 1174 sub gather_roles {
|
} |
} |
#next if ($home eq 'no_host'); |
#next if ($home eq 'no_host'); |
$home = &Apache::lonnet::hostname($home); |
$home = &Apache::lonnet::hostname($home); |
$ttype='Authoring Space'; |
$ttype='Construction Space'; |
$twhere=&mt('Domain').': '.$tdom.'<br />'.&mt('Server'). |
$twhere=&mt('Domain').': '.$tdom.'<br />'.&mt('Server'). |
': '.$home; |
': '.$home; |
$env{'course.'.$tdom.'_'.$trest.'.description'}='ca'; |
$env{'course.'.$tdom.'_'.$trest.'.description'}='ca'; |
Line 1364 sub roletable_headers {
|
Line 1347 sub roletable_headers {
|
} |
} |
|
|
sub roletypes { |
sub roletypes { |
my @types = ('Domain','Authoring Space','Course','Community','Unavailable','System'); |
my @types = ('Domain','Construction Space','Course','Community','Unavailable','System'); |
return @types; |
return @types; |
} |
} |
|
|
Line 1503 sub privileges_info {
|
Line 1486 sub privileges_info {
|
my (undef,$tdom,$trest,$tsec)=split(m{/},$where); |
my (undef,$tdom,$trest,$tsec)=split(m{/},$where); |
if ($trest) { |
if ($trest) { |
if ($env{'course.'.$tdom.'_'.$trest.'.description'} eq 'ca') { |
if ($env{'course.'.$tdom.'_'.$trest.'.description'} eq 'ca') { |
$ttype='Authoring Space'; |
$ttype='Construction Space'; |
$twhere='User: '.$trest.', Domain: '.$tdom; |
$twhere='User: '.$trest.', Domain: '.$tdom; |
} else { |
} else { |
$ttype= &Apache::loncommon::course_type($tdom.'_'.$trest); |
$ttype= &Apache::loncommon::course_type($tdom.'_'.$trest); |
Line 1616 sub build_roletext {
|
Line 1599 sub build_roletext {
|
return ($roletext,$roletext_end); |
return ($roletext,$roletext_end); |
} |
} |
|
|
|
sub check_needs_switchserver { |
|
my ($possiblerole) = @_; |
|
my $needs_switchserver; |
|
my ($role,$where) = split(/\./,$possiblerole,2); |
|
my (undef,$tdom,$twho) = split(/\//,$where); |
|
my ($server_status,$home); |
|
if (($role eq 'ca') || ($role eq 'aa')) { |
|
($server_status,$home) = &check_author_homeserver($twho,$tdom); |
|
} else { |
|
($server_status,$home) = &check_author_homeserver($env{'user.name'}, |
|
$env{'user.domain'}); |
|
} |
|
if ($server_status eq 'switchserver') { |
|
$needs_switchserver = 1; |
|
} |
|
return $needs_switchserver; |
|
} |
|
|
sub check_author_homeserver { |
sub check_author_homeserver { |
my ($uname,$udom)=@_; |
my ($uname,$udom)=@_; |
if (($uname eq '') || ($udom eq '')) { |
if (($uname eq '') || ($udom eq '')) { |
Line 1681 sub adhoc_course_role {
|
Line 1682 sub adhoc_course_role {
|
} |
} |
} |
} |
if ($setprivs) { |
if ($setprivs) { |
if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)(.*?)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) { |
if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)([\w/]*)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) { |
my $role = $1; |
my $role = $1; |
my $custom_role = $2; |
my $custom_role = $2; |
my $usec = $3; |
my $usec = $3; |
Line 1756 sub check_release_required {
|
Line 1757 sub check_release_required {
|
my $otherserver; |
my $otherserver; |
if (($major eq '' && $minor eq '') || |
if (($major eq '' && $minor eq '') || |
(($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor)))) { |
(($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor)))) { |
my ($userdomserver) = &Apache::lonnet::choose_server($env{'user.domain'},undef,$required); |
my ($userdomserver) = &Apache::lonnet::choose_server($env{'user.domain'}); |
my $switchlcrev = |
my $switchlcrev = |
&Apache::lonnet::get_server_loncaparev($env{'user.domain'}, |
&Apache::lonnet::get_server_loncaparev($env{'user.domain'}, |
$userdomserver); |
$userdomserver); |
Line 2227 sub update_session_roles {
|
Line 2228 sub update_session_roles {
|
my $status_in_env = |
my $status_in_env = |
&curr_role_status($currstart,$currend,$refresh,$update); |
&curr_role_status($currstart,$currend,$refresh,$update); |
my ($rolekey) = ($envkey =~ /^user\.role\.(.+)$/); |
my ($rolekey) = ($envkey =~ /^user\.role\.(.+)$/); |
my ($role,$rest)=split(m{\./},$rolekey,2); |
my ($role,$rest)=split(/\./,$rolekey,2); |
$rest = '/'.$rest; |
|
if (&Apache::lonnet::delenv($envkey,undef,[$role])) { |
if (&Apache::lonnet::delenv($envkey,undef,[$role])) { |
if ($status_in_env eq 'active') { |
if ($status_in_env eq 'active') { |
if ($role eq 'gr') { |
if ($role eq 'gr') { |
Line 2428 sub update_session_roles {
|
Line 2428 sub update_session_roles {
|
} |
} |
my $groupdesc; |
my $groupdesc; |
unless (ref($curr_groups{$cdom.'_'.$cnum}) eq 'HASH') { |
unless (ref($curr_groups{$cdom.'_'.$cnum}) eq 'HASH') { |
%{$curr_groups{$cdom.'_'.$cnum}} = |
%{$curr_groups{$cdom.'_'.$cnum}} = |
&Apache::longroup::coursegroups($cdom,$cnum); |
&Apache::longroup::coursegroups($cdom,$cnum); |
} |
} |
unless ((ref($groupdescs{$cdom.'_'.$cnum}) eq 'HASH') && |
unless ((ref($groupdescs{$cdom.'_'.$cnum}) eq 'HASH') && |
($groupdescs{$cdom.'_'.$cnum}{$group})) { |
($groupdescs{$cdom.'_'.$cnum}{$group})) { |
|
|
my %groupinfo = |
my %groupinfo = |
&Apache::longroup::get_group_settings($curr_groups{$cdom.'_'.$cnum}{$group}); |
&Apache::longroup::get_group_settings($curr_groups{$cdom.'_'.$cnum}{$group}); |
$groupdescs{$cdom.'_'.$cnum}{$group} = |
$groupdescs{$cdom.'_'.$cnum}{$group} = |
&unescape($groupinfo{'description'}); |
&unescape($groupinfo{'description'}); |
} |
} |
$groupdesc = $groupdescs{$cdom.'_'.$cnum}{$group}; |
$groupdesc = $groupdescs{$cdom.'_'.$cnum}{$group}; |
if ($groupdesc) { |
$groupmsg .= '<li>'. |
$groupmsg .= '<li>'. |
&mt('[_1] with status: [_2].', |
&mt('[_1] with status: [_2].', |
'<b>'.$groupdesc.'</b>',$newgroup{$item}).'</li>'; |
'<b>'.$groupdesc.'</b>',$newgroup{$item}).'</li>'; |
|
} |
|
} |
} |
} |
} |
if ($groupmsg) { |
if ($groupmsg) { |
Line 2458 sub update_session_roles {
|
Line 2456 sub update_session_roles {
|
} |
} |
} |
} |
if (keys(%newrole) > 0) { |
if (keys(%newrole) > 0) { |
my $newmsg; |
$changemsg .= '<li>'.&mt('New roles'). |
|
'<ul>'; |
foreach my $item (sort(keys(%newrole))) { |
foreach my $item (sort(keys(%newrole))) { |
my $desc = &role_desc($item,$update,$refresh,$now); |
my $desc = &role_desc($item,$update,$refresh,$now); |
if ($desc) { |
$changemsg .= '<li>'. |
$newmsg .= '<li>'. |
&mt('[_1] with status: [_2].', |
&mt('[_1] with status: [_2].', |
$desc,$newrole{$item}).'</li>'; |
$desc,$newrole{$item}).'</li>'; |
|
} |
|
} |
|
if ($newmsg) { |
|
$changemsg .= '<li>'.&mt('New roles'). |
|
'<ul>'.$newmsg.'</ul>'. |
|
'</li>'; |
|
} |
} |
|
$changemsg .= '</ul></li>'; |
} |
} |
if (keys(%customprivchg) > 0) { |
if (keys(%customprivchg) > 0) { |
my $privmsg; |
$changemsg .= '<li>'. |
|
&mt('Custom roles with privilege changes'). |
|
'<ul>'; |
foreach my $item (sort(keys(%customprivchg))) { |
foreach my $item (sort(keys(%customprivchg))) { |
my $desc = &role_desc($item,$update,$refresh,$now); |
my $desc = &role_desc($item,$update,$refresh,$now); |
if ($desc) { |
$changemsg .= '<li>'.$desc.'</li>'; |
$privmsg .= '<li>'.$desc.'</li>'; |
|
} |
|
} |
} |
if ($privmsg) { |
$changemsg .= '</ul></li>'; |
$changemsg .= '<li>'. |
|
&mt('Custom roles with privilege changes'). |
|
'<ul>'.$privmsg.'</ul>'. |
|
'</li>'; |
|
} |
|
} |
} |
if (keys(%rolechange) > 0) { |
if (keys(%rolechange) > 0) { |
my $rolemsg; |
$changemsg .= '<li>'. |
|
&mt('Existing roles with status changes').'</li>'. |
|
'<ul>'; |
foreach my $item (sort(keys(%rolechange))) { |
foreach my $item (sort(keys(%rolechange))) { |
my $desc = &role_desc($item,$update,$refresh,$now); |
my $desc = &role_desc($item,$update,$refresh,$now); |
if ($desc) { |
|
$rolemsg .= '<li>'. |
|
&mt('[_1] status now: [_2].',$desc, |
|
$rolechange{$item}).'</li>'; |
|
} |
|
} |
|
if ($rolemsg) { |
|
$changemsg .= '<li>'. |
$changemsg .= '<li>'. |
&mt('Existing roles with status changes').'</li>'. |
&mt('[_1] status now: [_2].',$desc, |
'<ul>'.$rolemsg.'</ul>'. |
$rolechange{$item}).'</li>'; |
'</li>'; |
|
} |
} |
|
$changemsg .= '</ul></li>'; |
} |
} |
if (keys(%deletedroles) > 0) { |
if (keys(%deletedroles) > 0) { |
my $delmsg; |
$changemsg .= '<li>'. |
|
&mt('Existing roles now expired').'</li>'. |
|
'<ul>'; |
foreach my $item (sort(keys(%deletedroles))) { |
foreach my $item (sort(keys(%deletedroles))) { |
my $desc = &role_desc($item,$update,$refresh,$now); |
my $desc = &role_desc($item,$update,$refresh,$now); |
if ($desc) { |
$changemsg .= '<li>'.$desc.'</li>'; |
$delmsg .= '<li>'.$desc.'</li>'; |
|
} |
|
} |
|
if ($delmsg) { |
|
$changemsg .= '<li>'. |
|
&mt('Existing roles now expired').'</li>'. |
|
'<ul>'.$delmsg.'</ul>'. |
|
'</li>'; |
|
} |
} |
|
$changemsg .= '</ul></li>'; |
} |
} |
} |
} |
if ((keys(%changed_groups) > 0) || (keys(%groupchange) > 0)) { |
if ((keys(%changed_groups) > 0) || (keys(%groupchange) > 0)) { |
Line 2555 sub update_session_roles {
|
Line 2533 sub update_session_roles {
|
my $cdom = $env{'course.'.$cid.'.domain'}; |
my $cdom = $env{'course.'.$cid.'.domain'}; |
my $cnum = $env{'course.'.$cid.'.num'}; |
my $cnum = $env{'course.'.$cid.'.num'}; |
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum); |
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum); |
my %groupdesc; |
my %groupdesc; |
if (ref($groupchange{$crs}) eq 'HASH') { |
if (ref($groupchange{$crs}) eq 'HASH') { |
$groupchgmsg .= '<li>'.&mt('Course/Community: [_1]','<b>'.$crsdesc.'</b><ul>'); |
$groupchgmsg .= '<li>'.&mt('Course/Community: [_1]','<b>'.$crsdesc.'</b><ul>'); |
foreach my $group (sort(keys(%{$groupchange{$crs}}))) { |
foreach my $group (sort(keys(%{$groupchange{$crs}}))) { |
Line 2578 sub update_session_roles {
|
Line 2556 sub update_session_roles {
|
} |
} |
if ($changemsg) { |
if ($changemsg) { |
$msg .= '<ul>'.$changemsg.'</ul>'; |
$msg .= '<ul>'.$changemsg.'</ul>'; |
} else { |
|
if (&Apache::loncommon::show_course()) { |
|
$msg = &mt('No new courses or communities'); |
|
} else { |
|
$msg = &mt('No role changes'); |
|
} |
|
} |
} |
return $msg; |
return $msg; |
} |
} |
Line 2595 sub role_desc {
|
Line 2567 sub role_desc {
|
&Apache::lonnet::role_status('user.role.'.$item,$update,$refresh, |
&Apache::lonnet::role_status('user.role.'.$item,$update,$refresh, |
$now,\$role,\$where,\$trolecode, |
$now,\$role,\$where,\$trolecode, |
\$tstatus,\$tstart,\$tend); |
\$tstatus,\$tstart,\$tend); |
return unless ($role); |
|
if ($role =~ /^cr\//) { |
if ($role =~ /^cr\//) { |
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); |
my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); |
$tremark = &mt('Custom role defined by [_1].',$rauthor.':'.$rdomain); |
$tremark = &mt('Customrole defined by [_1].',$rauthor.':'.$rdomain); |
} |
} |
$trole=Apache::lonnet::plaintext($role); |
$trole=Apache::lonnet::plaintext($role); |
my ($tdom,$trest,$tsection)= |
my ($tdom,$trest,$tsection)= |
Line 2637 sub role_desc {
|
Line 2608 sub role_desc {
|
} elsif ($tdom) { |
} elsif ($tdom) { |
$twhere = &mt('Domain').': '.$tdom; |
$twhere = &mt('Domain').': '.$tdom; |
} |
} |
my $output; |
my $output = "$trole -- $twhere"; |
if ($trole) { |
if ($tremark) { |
$output = $trole; |
$output .= '<br />'.$tremark; |
if ($twhere) { |
|
$output .= " -- $twhere"; |
|
} |
|
if ($tremark) { |
|
$output .= '<br />'.$tremark; |
|
} |
|
} |
} |
return $output; |
return $output; |
} |
} |
Line 2731 sub get_roles_functions {
|
Line 2696 sub get_roles_functions {
|
} |
} |
if ($env{'user.adv'}) { |
if ($env{'user.adv'}) { |
if ($env{'form.display'} eq 'showall') { |
if ($env{'form.display'} eq 'showall') { |
push(@links,["javascript:rolesView('noshowall');",'edit-redo-22x22',&mt('Exclude expired')]); |
push(@links,["javascript:rolesView('noshowall');",'edit-redo-22x22',&mt('Exclude expired roles')]); |
} else { |
} else { |
push(@links,["javascript:rolesView('showall');",'edit-undo-22x22',&mt('Include expired')]); |
push(@links,["javascript:rolesView('showall');",'edit-undo-22x22',&mt('Include expired roles')]); |
} |
} |
} |
} |
if (&Apache::loncommon::designparm('login.coursecatalog',$env{'user.domain'})) { |
|
push(@links,['/adm/coursecatalog','ccat-22x22',&mt('Course catalog')]); |
|
} |
|
my $funcs = &Apache::lonhtmlcommon::start_funclist(); |
my $funcs = &Apache::lonhtmlcommon::start_funclist(); |
foreach my $link (@links) { |
foreach my $link (@links) { |
$funcs .= &Apache::lonhtmlcommon::add_item_funclist( |
$funcs .= &Apache::lonhtmlcommon::add_item_funclist( |
Line 2757 sub get_queued {
|
Line 2719 sub get_queued {
|
$env{'user.name'},'^status:'); |
$env{'user.name'},'^status:'); |
foreach my $key (keys(%statusinfo)) { |
foreach my $key (keys(%statusinfo)) { |
next unless (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending')); |
next unless (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending')); |
(undef,my($cdom,$cnum)) = split(/:/,$key); |
(undef,my($cdom,$cnum)) = split(':',$key); |
my $requestkey = $cdom.'_'.$cnum; |
my $requestkey = $cdom.'_'.$cnum; |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
my %history = &Apache::lonnet::restore($requestkey,'courserequests', |
my %history = &Apache::lonnet::restore($requestkey,'courserequests', |
Line 2773 sub get_queued {
|
Line 2735 sub get_queued {
|
if (ref($history{'details'}) eq 'HASH') { |
if (ref($history{'details'}) eq 'HASH') { |
$description = $history{details}{'cdescr'}; |
$description = $history{details}{'cdescr'}; |
} |
} |
@{$reqcrs{$reqtime}} = ($description,$showtype); |
@{$reqcrs{$reqtime}} = ($description,$showtype); |
} |
} |
} |
} |
my @sortedtimes = sort {$a <=> $b} (keys(%reqcrs)); |
my @sortedtimes = sort {$a <=> $b} (keys(%reqcrs)); |