version 1.263, 2011/10/25 15:15:02
|
version 1.268, 2012/06/30 23:02:25
|
Line 221 sub handler {
|
Line 221 sub handler {
|
} else { |
} else { |
$checkingtxt = &mt('Checking for new roles ...'); |
$checkingtxt = &mt('Checking for new roles ...'); |
} |
} |
$updateresult = '<div class="LC_info">'.$checkingtxt.'</div>'; |
$updateresult = '<span class="LC_info">'.$checkingtxt.'</span>'; |
$updateresult .= &update_session_roles(); |
$updateresult .= &update_session_roles(); |
&Apache::lonnet::appenv({'user.update.time' => $now}); |
&Apache::lonnet::appenv({'user.update.time' => $now}); |
$update = $now; |
$update = $now; |
Line 519 ENDENTERKEY
|
Line 519 ENDENTERKEY
|
if ($dest =~ m{^/adm/coursedocs\?folderpath}) { |
if ($dest =~ m{^/adm/coursedocs\?folderpath}) { |
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) { |
if ($env{'request.course.id'} eq $cdom.'_'.$cnum) { |
my $chome = &Apache::lonnet::homeserver($cnum,$cdom); |
my $chome = &Apache::lonnet::homeserver($cnum,$cdom); |
&update_content_constraints($cdom,$cnum,$chome,$cdom.'_'.$cnum); |
&Apache::loncommon::update_content_constraints($cdom,$cnum,$chome, |
|
$cdom.'_'.$cnum); |
} |
} |
} |
} |
$r->internal_redirect($dest); |
$r->internal_redirect($dest); |
Line 781 ENDHEADER
|
Line 782 ENDHEADER
|
if ($env{'form.showall'}) { |
if ($env{'form.showall'}) { |
$showall .= ' checked="checked" '; |
$showall .= ' checked="checked" '; |
} |
} |
$showall .= ' />'.&mt('Show all roles').'</label>'. |
$showall .= ' />'.&mt('Show all roles').'</label> '. |
'<input type="submit" value="'.&mt('Update display').'" />'; |
'<input type="submit" value="'.&mt('Update display').'" />'; |
if ($do_update) { |
if ($do_update) { |
$r->print('<div class="LC_left_float"><fieldset>'. |
$r->print('<div class="LC_left_float"><fieldset>'. |
Line 954 ENDHEADER
|
Line 955 ENDHEADER
|
$r->print('<hr /><h2>'.&mt('Current Privileges').'</h2>'); |
$r->print('<hr /><h2>'.&mt('Current Privileges').'</h2>'); |
$r->print(&privileges_info()); |
$r->print(&privileges_info()); |
} |
} |
$r->print(&Apache::lonnet::getannounce()); |
my $announcements = &Apache::lonnet::getannounce(); |
|
$r->print( |
|
'<br />'. |
|
'<h2>'.&mt('Announcements').'</h2>'. |
|
$announcements |
|
) unless (!$announcements); |
if ($advanced) { |
if ($advanced) { |
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>' |
Line 1613 sub check_forcc {
|
Line 1619 sub check_forcc {
|
} else { |
} else { |
$ccrole = 'cc'; |
$ccrole = 'cc'; |
} |
} |
if ($cdom ne '' && $cnum ne '') { |
if (&Apache::lonnet::is_course($cdom,$cnum)) { |
if (&Apache::lonnet::is_course($cdom,$cnum)) { |
my $envkey = 'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum; |
my $envkey = 'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum; |
if (defined($env{$envkey})) { |
if (defined($env{$envkey})) { |
$is_cc = 1; |
$is_cc = 1; |
my ($tstart,$tend)=split(/\./,$env{$envkey}); |
my ($tstart,$tend)=split(/\./,$env{$envkey}); |
my $limit = $update; |
my $limit = $update; |
if ($env{'request.role'} eq $ccrole.'./'.$cdom.'/'.$cnum) { |
if ($env{'request.role'} eq $ccrole.'./'.$cdom.'/'.$cnum) { |
$limit = $then; |
$limit = $then; |
|
} |
|
if ($tstart && $tstart>$refresh) { $is_cc = 0; } |
|
if ($tend && $tend <$limit) { $is_cc = 0; } |
|
} |
} |
|
if ($tstart && $tstart>$refresh) { $is_cc = 0; } |
|
if ($tend && $tend <$limit) { $is_cc = 0; } |
} |
} |
} |
} |
return $is_cc; |
return $is_cc; |
Line 1683 sub check_release_required {
|
Line 1687 sub check_release_required {
|
return ($switchserver,$warning); |
return ($switchserver,$warning); |
} |
} |
|
|
sub update_content_constraints { |
|
my ($cdom,$cnum,$chome,$cid) = @_; |
|
my %curr_reqd_hash = &Apache::lonnet::userenvironment($cdom,$cnum,'internal.releaserequired'); |
|
my ($reqdmajor,$reqdminor) = split(/\./,$curr_reqd_hash{'internal.releaserequired'}); |
|
my %checkresponsetypes; |
|
foreach my $key (keys(%Apache::lonnet::needsrelease)) { |
|
my ($item,$name,$value) = split(/:/,$key); |
|
if ($item eq 'resourcetag') { |
|
if ($name eq 'responsetype') { |
|
$checkresponsetypes{$value} = $Apache::lonnet::needsrelease{$key} |
|
} |
|
} |
|
} |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (defined($navmap)) { |
|
my %allresponses; |
|
foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_problem() },1,0)) { |
|
my %responses = $res->responseTypes(); |
|
foreach my $key (keys(%responses)) { |
|
next unless(exists($checkresponsetypes{$key})); |
|
$allresponses{$key} += $responses{$key}; |
|
} |
|
} |
|
foreach my $key (keys(%allresponses)) { |
|
my ($major,$minor) = split(/\./,$checkresponsetypes{$key}); |
|
if (($major > $reqdmajor) || ($major == $reqdmajor && $minor > $reqdminor)) { |
|
($reqdmajor,$reqdminor) = ($major,$minor); |
|
} |
|
} |
|
undef($navmap); |
|
} |
|
unless (($reqdmajor eq '') && ($reqdminor eq '')) { |
|
&Apache::lonnet::update_released_required($reqdmajor.'.'.$reqdminor,$cdom,$cnum,$chome,$cid); |
|
} |
|
return; |
|
} |
|
|
|
sub courselink { |
sub courselink { |
my ($dcdom,$rowtype) = @_; |
my ($dcdom,$rowtype) = @_; |
my $courseform=&Apache::loncommon::selectcourse_link |
my $courseform=&Apache::loncommon::selectcourse_link |
Line 1871 sub update_session_roles {
|
Line 1838 sub update_session_roles {
|
['active','future','previous'], |
['active','future','previous'], |
undef,undef,1); |
undef,undef,1); |
my ($msg,@newsec,$oldsec,$currrole_expired,@changed_roles, |
my ($msg,@newsec,$oldsec,$currrole_expired,@changed_roles, |
%changed_groups,%dbroles, %deletedroles,%allroles,%allgroups, |
%changed_groups,%dbroles,%deletedroles,%allroles,%allgroups, |
%userroles,%checkedgroup,%crprivs,$hasgroups,%rolechange, |
%userroles,%checkedgroup,%crprivs,$hasgroups,%rolechange, |
%groupchange,%newrole,%newgroup,%customprivchg,%groups_roles, |
%groupchange,%newrole,%newgroup,%customprivchg,%groups_roles, |
@rolecodes); |
@rolecodes); |
Line 2108 sub update_session_roles {
|
Line 2075 sub update_session_roles {
|
foreach my $priv (@privs) { |
foreach my $priv (@privs) { |
my ($blank,@prv) = split(/:/,$priv); |
my ($blank,@prv) = split(/:/,$priv); |
@prv = map { $_ .= (/\&\w+$/ ? '':'&F') } @prv; |
@prv = map { $_ .= (/\&\w+$/ ? '':'&F') } @prv; |
$priv = ':'.join(':',sort(@prv)); |
if (@prv) { |
|
$priv = ':'.join(':',sort(@prv)); |
|
} |
$crprivs{$rest}{$scopes[$i]} = $priv; |
$crprivs{$rest}{$scopes[$i]} = $priv; |
$i++; |
$i++; |
} |
} |
Line 2212 sub update_session_roles {
|
Line 2181 sub update_session_roles {
|
$msg .= '<br />'.&mt('However you can continue to use this role until you logout, click the "Re-Select" button, or your session has been idle for more than 24 hours.').'</div>'; |
$msg .= '<br />'.&mt('However you can continue to use this role until you logout, click the "Re-Select" button, or your session has been idle for more than 24 hours.').'</div>'; |
} |
} |
if (!@changed_roles || !(keys(%changed_groups))) { |
if (!@changed_roles || !(keys(%changed_groups))) { |
$msg .= '<ul>'; |
my ($rolesmsg,$groupsmsg); |
if (!@changed_roles) { |
if (!@changed_roles) { |
$msg .= '<li>'; |
|
if (&Apache::loncommon::show_course()) { |
if (&Apache::loncommon::show_course()) { |
$msg .= &mt('No new courses or communities'); |
$rolesmsg = &mt('No new courses or communities'); |
} else { |
} else { |
$msg .= &mt('No role changes'); |
$rolesmsg = &mt('No role changes'); |
} |
} |
$msg .= '</li>'; |
|
} |
} |
if ($hasgroups && !(keys(%changed_groups)) && !(grep(/gr/,@changed_roles))) { |
if ($hasgroups && !(keys(%changed_groups)) && !(grep(/gr/,@changed_roles))) { |
$msg .= '<li>'.&mt('No changes in course/community groups').'</li>'; |
$groupsmsg = &mt('No changes in course/community groups'); |
} |
} |
$msg .= '</ul>'; |
|
if (!@changed_roles && !(keys(%changed_groups))) { |
if (!@changed_roles && !(keys(%changed_groups))) { |
|
if (($msg ne '') || ($groupsmsg ne '')) { |
|
$msg .= '<ul>'; |
|
if ($rolesmsg) { |
|
$msg .= '<li>'.$rolesmsg.'</li>'; |
|
} |
|
if ($groupsmsg) { |
|
$msg .= '<li>'.$groupsmsg.'</li>'; |
|
} |
|
$msg .= '</ul>'; |
|
} else { |
|
$msg = ' <span class="LC_cusr_emph">'.$rolesmsg.'</span><br /><br />'; |
|
} |
return $msg; |
return $msg; |
} |
} |
} |
} |
Line 2279 sub update_session_roles {
|
Line 2257 sub update_session_roles {
|
} |
} |
if (keys(%deletedroles) > 0) { |
if (keys(%deletedroles) > 0) { |
$changemsg .= '<li>'. |
$changemsg .= '<li>'. |
&mt('Existing roles deleted').'</li>'. |
&mt('Existing roles now expired').'</li>'. |
'<ul>'; |
'<ul>'; |
foreach my $item (sort(keys(%deletedroles))) { |
foreach my $item (sort(keys(%deletedroles))) { |
$changemsg .= '<li>'.$item.'</li>'; |
$changemsg .= '<li>'.$item.'</li>'; |