version 1.269, 2012/07/21 21:09:03
|
version 1.273, 2012/08/15 16:56:52
|
Line 225 sub handler {
|
Line 225 sub handler {
|
$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; |
|
&Apache::loncoursequeueadmin::reqauthor_check(); |
|
} |
|
|
|
# -------------------------------------------------- Check for author requests |
|
my $reqauthor; |
|
if ($env{'form.requestauthor'}) { |
|
$reqauthor = &Apache::loncoursequeueadmin::process_reqauthor(\$update); |
} |
} |
|
|
my $envkey; |
my $envkey; |
Line 684 function setToUpdate(thisform) {
|
Line 691 function setToUpdate(thisform) {
|
thisform.submit(); |
thisform.submit(); |
} |
} |
|
|
|
function setToRequestAuthor(thisform) { |
|
thisform.requestauthor.value='1'; |
|
thisform.selectrole.value=''; |
|
thisform.submit(); |
|
} |
|
|
// ]]> |
// ]]> |
</script> |
</script> |
ENDHEADER |
ENDHEADER |
Line 750 ENDHEADER
|
Line 763 ENDHEADER
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} else { |
} else { |
$r->print($updateresult); |
if ($updateresult || $reqauthor) { |
|
$r->print('<div>'. |
|
$updateresult. |
|
$reqauthor. |
|
'</div>'); |
|
} |
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { |
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { |
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; |
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; |
} |
} |
Line 778 ENDHEADER
|
Line 796 ENDHEADER
|
'<input type="button" name="update" value="'. |
'<input type="button" name="update" value="'. |
$updatebutton.'" onclick="javascript:setToUpdate(this.form)" />'; |
$updatebutton.'" onclick="javascript:setToUpdate(this.form)" />'; |
} |
} |
|
my ($requestauthor,$requestcrs); |
|
unless ($reqauthor) { |
|
if ($env{'environment.canrequest.author'}) { |
|
unless (&Apache::loncoursequeueadmin::is_active_author()) { |
|
my ($status,$timestamp) = split(/:/,$env{'environment.requestauthorqueued'}); |
|
if ($status eq 'approval') { |
|
$requestauthor = &mt('A request for authoring space submitted on [_1] is awaiting approval',&Apache::lonlocal::locallocaltime($timestamp)); |
|
} elsif (($status eq 'approved') && ($do_update)) { |
|
my %roleshash = &Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'},'userroles', |
|
['active'],['au'],[$env{'user.domain'}]); |
|
if (keys(%roleshash)) { |
|
$requestauthor = &mt('Your request for an author role has been approved.').'<br />'; |
|
if ($show_course) { |
|
$requestauthor .= &mt('Use the "Check for new courses" button to update your list of roles.'); |
|
} else { |
|
$requestauthor .= &mt('Use the "Check for new roles" button to update your list of roles.'); |
|
} |
|
$requestauthor = '<span class="LC_info">'.$requestauthor.'</span>'; |
|
} |
|
} |
|
unless ($requestauthor) { |
|
$requestauthor = |
|
'<input type="hidden" name="requestauthor" value="" />'. |
|
'<input type="button" name="reqauthor" value="'. |
|
&mt('Request author space').'" '. |
|
'onclick="javascript:setToRequestAuthor(this.form)" />'; |
|
} |
|
} |
|
} |
|
} |
|
my $do_update; |
|
unless (($env{'form.source'} eq 'login') || ($env{'form.doupdate'})) { |
|
$do_update = '<input type="hidden" name="doupdate" value="" />'. |
|
'<input type="button" name="update" value="'. |
|
$updatebutton.'" onclick="javascript:setToUpdate(this.form)" />'; |
|
} |
if ($env{'user.adv'}) { |
if ($env{'user.adv'}) { |
my $showall = '<label><input type="checkbox" name="showall"'; |
my $showall = '<label><input type="checkbox" name="showall"'; |
if ($env{'form.showall'}) { |
if ($env{'form.showall'}) { |
Line 785 ENDHEADER
|
Line 839 ENDHEADER
|
} |
} |
$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 || $requestauthor) { |
$r->print('<div class="LC_left_float"><fieldset>'. |
$r->print('<div class="LC_left_float"><fieldset>'. |
'<legend>'. &mt('Display').'</legend>'. |
'<legend>'. &mt('Display').'</legend>'. |
$showall.'</fieldset></div>'. |
$showall.'</fieldset></div>'); |
'<div class="LC_left_float"><fieldset><legend>'. |
if ($do_update) { |
&mt('Changes?').'</legend>'. |
$r->print('<div class="LC_left_float">'. |
$do_update.'</fieldset></div><br clear="all" />'); |
'<fieldset><legend>'.&mt('Changes?').'</legend>'. |
|
$do_update.'</fieldset></div>'); |
|
} |
|
if ($requestauthor) { |
|
$r->print('<div class="LC_left_float">'. |
|
'<fieldset><legend>'.&mt('Add author role').'</legend>'. |
|
$requestauthor.'</fieldset>'); |
|
} |
|
$r->print('</div><br clear="all" />'); |
} else { |
} else { |
$r->print($showall); |
$r->print($showall); |
} |
} |
} else { |
} else { |
$r->print('<p>'.$do_update.'</p>'); |
if ($do_update && $requestauthor) { |
|
$r->print('<div class="LC_left_float">'. |
|
'<fieldset><legend>'.&mt('Changes?').'</legend>'. |
|
$do_update.'</fieldset></div>'. |
|
'<div class="LC_left_float">'. |
|
'<fieldset><legend>'.&mt('Add author role').'</legend>'. |
|
$requestauthor.'</fieldset></div><br clear="all" />'); |
|
} elsif ($do_update) { |
|
$r->print('<p>'.$do_update.'</p>'); |
|
} elsif ($requestauthor) { |
|
$r->print('<p>'.$requestauthor.'</p>'); |
|
} |
if ($countactive > 0) { |
if ($countactive > 0) { |
$r->print(&Apache::loncoursequeueadmin::queued_selfenrollment()); |
$r->print(&Apache::loncoursequeueadmin::queued_selfenrollment()); |
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); |
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); |
Line 1889 sub update_session_roles {
|
Line 1962 sub update_session_roles {
|
} |
} |
if ($env{$envkey} eq '') { |
if ($env{$envkey} eq '') { |
my $status_in_db = |
my $status_in_db = |
&curr_role_status($tstart,$tend,$refresh,$now); |
&curr_role_status($tstart,$tend,$now,$now); |
&gather_roleprivs(\%allroles,\%allgroups,\%userroles,$where,$role,$tstart,$tend,$status_in_db); |
&gather_roleprivs(\%allroles,\%allgroups,\%userroles,$where,$role,$tstart,$tend,$status_in_db); |
if (($role eq 'st') && ($env{'request.role'} =~ m{^\Q$role\E\.\Q/$udom/$uname\E})) { |
if (($role eq 'st') && ($env{'request.role'} =~ m{^\Q$role\E\.\Q/$udom/$uname\E})) { |
if ($status_in_db eq 'active') { |
if ($status_in_db eq 'active') { |
Line 1933 sub update_session_roles {
|
Line 2006 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 $status_in_db = |
my $status_in_db = |
&curr_role_status($tstart,$tend,$refresh,$now); |
&curr_role_status($tstart,$tend,$now,$now); |
if ($status_in_env ne $status_in_db) { |
if ($status_in_env ne $status_in_db) { |
if ($status_in_env eq 'active') { |
if ($status_in_env eq 'active') { |
if ($role eq 'st') { |
if ($role eq 'st') { |
Line 2204 sub update_session_roles {
|
Line 2277 sub update_session_roles {
|
} |
} |
$msg .= '</ul>'; |
$msg .= '</ul>'; |
} else { |
} else { |
$msg = ' <span class="LC_cusr_emph">'.$rolesmsg.'</span><br /><br />'; |
$msg = ' <span class="LC_cusr_emph">'.$rolesmsg.'</span><br />'; |
} |
} |
return $msg; |
return $msg; |
} |
} |