version 1.118, 2015/07/21 21:26:32
|
version 1.132, 2025/03/22 21:18:30
|
Line 1
|
Line 1
|
|
# The LearningOnline Network |
|
# What's New in a course |
# |
# |
# $Id$ |
# $Id$ |
# |
# |
Line 62 sub handler {
|
Line 64 sub handler {
|
my $command = $env{'form.command'}; |
my $command = $env{'form.command'}; |
my $refpage = $env{'form.refpage'}; |
my $refpage = $env{'form.refpage'}; |
|
|
my %checkallowed = ( coursenormalmail => 1, |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
coursecritmail => 1, ); |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
my ($isadhoc,%checkallowed); |
|
|
|
if ($env{'request.role'} =~ m{^(cc|co)/}) { |
|
my $rolecode = $1; |
|
if ($env{"environment.internal.$cdom.$crs.$env{'request.role'}.adhoc"}) { |
|
$isadhoc = 1; |
|
} |
|
} elsif ($env{'request.role'} =~ m{^cr/$cdom/$cdom\-domainconfig/(\w+)\./}) { |
|
my $rolename = $1; |
|
if ($env{"environment.internal.$cdom.$crs.cr/$cdom/$cdom-domainconfig/$rolename.adhoc"}) { |
|
$isadhoc = 1; |
|
} |
|
} |
|
unless ($isadhoc) { |
|
%checkallowed = ( coursenormalmail => 1, |
|
coursecritmail => 1,); |
|
} |
foreach my $perm_check (['whn','whatsnew',1], |
foreach my $perm_check (['whn','whatsnew',1], |
['pch','coursediscussion',1], |
['pch','coursediscussion',1], |
['mgr','handgrading',1], |
['mgr','handgrading',1], |
['vgr','abovethreshold',1], |
['vgr','abovethreshold',1], |
['opa','haserrors',1], |
['vgr','haserrors',1], |
['mdc','versionchanges',0], |
['whn','versionchanges',1], |
['vcl','newroles',1], |
['vcl','newroles',1], |
['vcl','oldroles',1], |
['vcl','oldroles',1], |
['whn','crslogin',1], |
['whn','crslogin',1], |
|
['vcl','sessions',1], |
|
['mgr','resetcounters',1], |
) { |
) { |
my ($perm,$key,$check_section) = @{ $perm_check }; |
my ($perm,$key,$check_section) = @{ $perm_check }; |
my $scope = $env{'request.course.id'}; |
my $scope = $env{'request.course.id'}; |
Line 96 sub handler {
|
Line 118 sub handler {
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
$r->print(&display_header($command,\%checkallowed)); |
my $udom = $env{'user.domain'}; |
|
my $uname = $env{'user.name'}; |
|
my $cid = $env{'request.course.id'}; |
|
my $store_result = &store_display_settings($uname,$udom,$cid,\%checkallowed); |
|
my $store_error; |
|
|
|
unless ($store_result eq 'ok') { |
|
my $lctype = lc(&Apache::loncommon::course_type()); |
|
&Apache::lonnet::logthis('Error saving whatsnew settings: '. |
|
$store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid); |
|
$store_error = '<span class="LC_error">' |
|
.&mt('Unable to save visibility settings due to [_1]', |
|
$store_result) |
|
.'</span>'; |
|
} |
|
|
|
$r->print(&display_header($command,$uname,$udom,$cid,\%checkallowed)); |
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
Line 151 sub handler {
|
Line 189 sub handler {
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
("What's New?",#'Course_Action_Items_Intervals' |
("What's New?",#'Course_Action_Items_Intervals' |
)); |
)); |
|
} elsif ($command eq 'chgsessionlimit' && $checkallowed{'sessions'}) { |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>'/adm/whatsnew?command=chgsessionlimit&refpage='.$refpage, |
|
text=>"Change session range"}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
|
("What's New?",#'Course_Action_Items_Sessions' |
|
)); |
} else { |
} else { |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
$r->print(&Apache::lonhtmlcommon::breadcrumbs |
("What's New?",#'Course_Action_Items_Display' |
("What's New?",#'Course_Action_Items_Display' |
)); |
)); |
} |
} |
&display_main_box($r,$command,$refpage,\%checkallowed); |
&display_main_box($r,$command,$refpage,\%checkallowed,$cdom,$crs,$store_error); |
return OK; |
return OK; |
} |
} |
|
|
Line 167 sub handler {
|
Line 212 sub handler {
|
#------------------------------ |
#------------------------------ |
|
|
sub display_main_box { |
sub display_main_box { |
my ($r,$command,$refpage,$checkallowed) = @_; |
my ($r,$command,$refpage,$checkallowed,$cdom,$crs,$store_error) = @_; |
my $domain=&Apache::loncommon::determinedomain(); |
my $domain=&Apache::loncommon::determinedomain(); |
my $function = &Apache::loncommon::get_users_function(); |
my $function = &Apache::loncommon::get_users_function(); |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
$r->print('<table width="100%" border="0" cellpadding="5" cellspacing="0"><tr><td width="100%">'); |
|
|
|
my %threshold_titles = &Apache::lonlocal::texthash ( |
my %threshold_titles = &Apache::lonlocal::texthash ( |
av_attempts => 'Average number of attempts', |
av_attempts => 'Average number of attempts', |
Line 202 sub display_main_box {
|
Line 246 sub display_main_box {
|
604800 => 'last logins for users in last 7 days', |
604800 => 'last logins for users in last 7 days', |
86400 => 'last logins for users in last 24 hours', |
86400 => 'last logins for users in last 24 hours', |
); |
); |
|
my %sessions = ( |
|
300 => 'course sessions active in the last 5 minutes', |
|
600 => 'course sessions active in the last 10 minutes', |
|
1800 => 'course sessions active in the last 30 minutes', |
|
7200 => 'course sessions active in the last 2 hours', |
|
-7200 => 'course sessions with last activity more than 2 hours ago', |
|
); |
my %interval_titles = ( |
my %interval_titles = ( |
versions => \%versions, |
versions => \%versions, |
newroles => \%newroles, |
newroles => \%newroles, |
oldroles => \%oldroles, |
oldroles => \%oldroles, |
crslogin => \%crslogins, |
crslogin => \%crslogins, |
|
sessions => \%sessions, |
); |
); |
my %initpage = &Apache::lonlocal::texthash ( |
my %initpage = ( |
firstres => "first resource in the $lctype", |
firstres => "first resource in the $lctype", |
whatsnew => "What's New Page", |
whatsnew => "What's New Page", |
userpref => 'your general user preferences', |
userpref => 'your general user preferences', |
coursespecific => "specific setting for this $lctype", |
coursespecific => "specific setting for this $lctype", |
); |
); |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
$r->print('<div class="LC_landmark" role="main">'); |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
if (($command eq 'chgthreshold') |
if (($command eq 'chgthreshold') |
&& $checkallowed->{'abovethreshold'}) { |
&& $checkallowed->{'abovethreshold'}) { |
&display_threshold_config($r,$refpage,\%threshold_titles, |
&display_threshold_config($r,$refpage,\%threshold_titles,$cdom,$crs); |
$cdom,$crs); |
|
} elsif (($command eq 'chginterval') |
} elsif (($command eq 'chginterval') |
&& $checkallowed->{'versionchanges'}) { |
&& $checkallowed->{'versionchanges'}) { |
&display_interval_config($r,$refpage,\%interval_titles,'versions'); |
&display_interval_config($r,$refpage,\%interval_titles,'versions'); |
Line 238 sub display_main_box {
|
Line 288 sub display_main_box {
|
} elsif (($command eq 'chgcrslogininterval') |
} elsif (($command eq 'chgcrslogininterval') |
&& $checkallowed->{'crslogin'}) { |
&& $checkallowed->{'crslogin'}) { |
&display_interval_config($r,$refpage,\%interval_titles,'crslogin'); |
&display_interval_config($r,$refpage,\%interval_titles,'crslogin'); |
|
} elsif (($command eq 'chgsessionlimit') |
|
&& $checkallowed->{'sessions'}) { |
|
&display_interval_config($r,$refpage,\%interval_titles,'sessions'); |
} else { |
} else { |
&display_actions_box($r,$command,$refpage,\%threshold_titles, |
&display_actions_box($r,$command,$refpage,\%threshold_titles, |
\%interval_titles,\%initpage,$cdom,$crs,$checkallowed); |
\%interval_titles,\%initpage,$cdom,$crs, |
|
$checkallowed,$store_error); |
} |
} |
my $end_page = &Apache::loncommon::end_page(); |
my $end_page = &Apache::loncommon::end_page(); |
$r->print(<<END_OF_BLOCK); |
$r->print('<br /></div>'.$end_page); |
</td> |
|
</tr> |
|
</table><br /> |
|
$end_page |
|
END_OF_BLOCK |
|
} |
} |
|
|
#------------------------------- |
#------------------------------- |
Line 259 END_OF_BLOCK
|
Line 308 END_OF_BLOCK
|
#------------------------------- |
#------------------------------- |
|
|
sub display_header { |
sub display_header { |
my ($command,$checkallowed) = @_; |
my ($command,$uname,$udom,$cid,$checkallowed) = @_; |
|
|
my $scripttag; |
my $scripttag; |
unless ($command eq 'chgthreshold' || $command eq 'chginterval' || |
my $args = {}; |
$command eq 'chgoldroleinterval' || |
my %loadentries; |
$command eq 'chgnewroleinterval' || $command eq 'chgcrslogininterval') { |
|
$scripttag = <<"END"; |
if ($command eq 'courseinit') { |
|
$scripttag = <<"END"; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function toggleCourseInit(form) { |
|
if (document.getElementById('courseinit_by_course')) { |
|
var radioelem = form.elements['courseinit_control']; |
|
if (radioelem.length) { |
|
for (var i=0; i<radioelem.length; i++) { |
|
if (radioelem[i].checked) { |
|
if (radioelem[i].value == 'coursespecific') { |
|
document.getElementById('courseinit_by_course').style.display = 'inline'; |
|
} else { |
|
document.getElementById('courseinit_by_course').style.display = 'none'; |
|
} |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
// ]]> |
|
</script> |
|
END |
|
$loadentries{'onload'} = 'toggleCourseInit(document.courseinitswitch);'; |
|
} else { |
|
unless (($command eq 'chgthreshold' && $checkallowed->{'abovethreshold'}) || |
|
($command eq 'chginterval' && $checkallowed->{'versionchanges'}) || |
|
($command eq 'chgdisc' && $checkallowed->{'coursediscussion'}) || |
|
($command eq 'chgoldroleinterval' && $checkallowed->{'oldroles'}) || |
|
($command eq 'chgnewroleinterval' && $checkallowed->{'newroles'}) || |
|
($command eq 'chgcrslogininterval' && $checkallowed->{'crslogin'}) || |
|
($command eq 'chgsessionlimit' && $checkallowed->{'sessions'})) { |
|
my %display_settings = &get_display_settings($uname,$udom,$cid); |
|
$scripttag = <<"END"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
function change_display(caller,change) { |
function change_display(caller,change) { |
Line 275 function change_display(caller,change) {
|
Line 359 function change_display(caller,change) {
|
|
|
function changeAll(change) { |
function changeAll(change) { |
END |
END |
foreach my $item (keys(%{$checkallowed})) { |
foreach my $item (keys(%{$checkallowed})) { |
if ($item =~ /_section$/) { next; } |
if ($item =~ /_section$/) { next; } |
if ($$checkallowed{$item}) { |
if ($$checkallowed{$item}) { |
$scripttag.='document.visible.display_'.$item.'.value=change'. |
$scripttag.='document.visible.display_'.$item.'.value=change'. |
"\n"; |
"\n"; |
|
} |
} |
} |
} |
$scripttag.=<<"ENDTOGG"; |
$scripttag.='document.visible.submit(); |
document.visible.submit(); |
} |
} |
|
|
function thresholdreset() { |
function thresholdreset() { |
Line 290 function thresholdreset() {
|
Line 375 function thresholdreset() {
|
document.visible.submit(); |
document.visible.submit(); |
} |
} |
|
|
function togglelogins() { |
function toggledetails(prefix) { |
var total = document.visible.logincount.value; |
var total = document.visible[prefix+'count'].value; |
var sumrow = document.visible.loginrow.value; |
var sumrow = document.visible[prefix+'row'].value; |
if (total == 0) { |
if (total == 0) { |
return; |
return; |
} |
} |
var showlogindetails = 0; |
var showdetails = 0; |
for (var i=0; i<document.visible.logindetails.length; i++) { |
for (var i=0; i<document.visible[prefix+'details'].length; i++) { |
if (document.visible.logindetails[i].checked) { |
if (document.visible[prefix+'details'][i].checked) { |
showlogindetails = document.visible.logindetails[i].value; |
showdetails = document.visible[prefix+'details'][i].value; |
} |
} |
} |
} |
var detval = "none"; |
var detval = "none"; |
var sumval = ""; |
var sumval = ""; |
if (showlogindetails == 1) { |
if (showdetails == 1) { |
detval = ""; |
detval = ""; |
sumval = "none"; |
sumval = "none"; |
} |
} |
for (var j=0; j<total; j++) { |
for (var j=0; j<total; j++) { |
var counter = j+1; |
var counter = j+1; |
var itemid = "logindet_"+counter; |
var itemid = prefix+"det_"+counter; |
personele = document.getElementById(itemid); |
personele = document.getElementById(itemid); |
if (personele != null) { |
if (personele != null) { |
personele.style.display = detval; |
personele.style.display = detval; |
} |
} |
} |
} |
var detheaderele = document.getElementById("logintitledet"); |
var detheaderele = document.getElementById(prefix+"titledet"); |
if (detheaderele != null) { |
if (detheaderele != null) { |
detheaderele.style.display = detval; |
detheaderele.style.display = detval; |
} |
} |
for (var k=0; k<sumrow; k++) { |
for (var k=0; k<sumrow; k++) { |
var counter = k+1; |
var counter = k+1; |
var itemid = "loginsum_"+counter; |
var itemid = prefix+"sum_"+counter; |
logincatele = document.getElementById(itemid); |
catele = document.getElementById(itemid); |
if (logincatele != null) { |
if (catele != null) { |
logincatele.style.display = sumval; |
catele.style.display = sumval; |
} |
} |
} |
} |
var sumheaderele = document.getElementById("logintitlesum"); |
var sumheaderele = document.getElementById(prefix+"titlesum"); |
if (sumheaderele != null) { |
if (sumheaderele != null) { |
sumheaderele.style.display = sumval; |
sumheaderele.style.display = sumval; |
} |
} |
Line 336 function togglelogins() {
|
Line 421 function togglelogins() {
|
} |
} |
// ]]> |
// ]]> |
</script> |
</script> |
'; |
ENDTOGG |
|
if (($checkallowed->{'crslogin'}) && ($display_settings{$cid.':crslogin'} ne 'hide')) { |
|
$loadentries{'onload'} = "toggledetails('login');"; |
|
} |
|
if (($checkallowed->{'sessions'}) && ($display_settings{$cid.':sessions'} ne 'hide')) { |
|
$loadentries{'onload'} .= "toggledetails('session');"; |
|
} |
|
} |
} |
} |
my $course_type=&Apache::loncommon::course_type(); |
my $course_type=&Apache::loncommon::course_type(); |
|
if (keys(%loadentries)) { |
|
$args->{'add_entries'} = \%loadentries; |
|
} |
return &Apache::loncommon::start_page("What's New?", |
return &Apache::loncommon::start_page("What's New?", |
$scripttag); |
$scripttag,$args); |
} |
} |
|
|
#------------------------------- |
#------------------------------- |
Line 352 function togglelogins() {
|
Line 447 function togglelogins() {
|
|
|
sub display_actions_box { |
sub display_actions_box { |
my ($r,$command,$refpage,$threshold_titles,$interval_titles,$initpage, |
my ($r,$command,$refpage,$threshold_titles,$interval_titles,$initpage, |
$cdom,$crs,$checkallowed) = @_; |
$cdom,$crs,$checkallowed,$store_error) = @_; |
my $udom = $env{'user.domain'}; |
my $udom = $env{'user.domain'}; |
my $uname = $env{'user.name'}; |
my $uname = $env{'user.name'}; |
my $cid = $env{'request.course.id'}; |
my $cid = $env{'request.course.id'}; |
Line 388 sub display_actions_box {
|
Line 483 sub display_actions_box {
|
my %activated; |
my %activated; |
my %loggedin; |
my %loggedin; |
my $logincount; |
my $logincount; |
|
my %sessions; |
|
my $sessioncount; |
my %res_title = (); |
my %res_title = (); |
my %show = (); |
my %show = (); |
my $needitems = 0; |
my $needitems = 0; |
Line 427 sub display_actions_box {
|
Line 524 sub display_actions_box {
|
} |
} |
$header .= &mt('Page set to be displayed after you have selected a role in this '.$lctype).'.' |
$header .= &mt('Page set to be displayed after you have selected a role in this '.$lctype).'.' |
.' <span class="LC_nobreak">' |
.' <span class="LC_nobreak">' |
.&mt('Currently: [_1].','<i>'.$currinit.'</i>') |
.&mt('Currently: [_1].','<span class="LC_cusr_emph">'.$currinit.'</span>') |
.' ' |
.' ' |
.&mt('[_1]Change[_2] for just [_3]this '.$lctype.'[_4] or for [_5]all your courses/communities[_6].' |
.&mt('[_1]Change[_2] for just [_3]this '.$lctype.'[_4] or for [_5]all your courses/communities[_6].' |
,'<b>' |
,'<b>' |
Line 441 sub display_actions_box {
|
Line 538 sub display_actions_box {
|
$r->print(&Apache::loncommon::head_subbox($header)); |
$r->print(&Apache::loncommon::head_subbox($header)); |
|
|
if ($command eq 'reset') { |
if ($command eq 'reset') { |
$result = &process_reset($cdom,$crs); |
$result = &process_reset($cdom,$crs,$checkallowed); |
} elsif ($command eq 'update') { |
} elsif ($command eq 'update') { |
$result = &process_update($uname,$udom,$threshold_titles); |
$result = &process_update($uname,$udom,$threshold_titles); |
} elsif ($command eq 'newinterval') { |
} elsif ($command eq 'newinterval') { |
Line 450 sub display_actions_box {
|
Line 547 sub display_actions_box {
|
$result = &store_discussion_setting($uname,$udom,$cid); |
$result = &store_discussion_setting($uname,$udom,$cid); |
} |
} |
|
|
my $store_result=&store_display_settings($uname,$udom,$cid,$checkallowed); |
if ($store_error) { |
|
$result = $store_error; |
unless ($store_result eq 'ok') { |
|
&Apache::lonnet::logthis('Error saving whatsnew settings: '. |
|
$store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid); |
|
$result .= '<span class="LC_error">' |
|
.&mt('Unable to save visibility settings due to [_1]', |
|
$store_result) |
|
.'</span>'; |
|
} |
} |
|
|
if ($result) { |
if ($result) { |
Line 532 sub display_actions_box {
|
Line 622 sub display_actions_box {
|
$headings{'crslogin'} = &mt('Last login for users in last 24 hours'); |
$headings{'crslogin'} = &mt('Last login for users in last 24 hours'); |
} |
} |
|
|
|
$timediff{'sessions'} = $display_settings{$cid.':sessionactivity'}; |
|
unless (defined($timediff{'sessions'})) { $timediff{'sessions'} = 7200; } |
|
$interval{'sessions'} = $interval_titles->{'sessions'}->{$timediff{'sessions'}}; |
|
|
|
if ($timediff{'sessions'} == -7200) { |
|
$headings{'sessions'} = &mt('Session with activity more than 2 hours ago'); |
|
} elsif ($timediff{'sessions'} == 7200) { |
|
$headings{'sessions'} = &mt('Session with activity in last 2 hours'); |
|
} elsif ($timediff{'sessions'} == 1800) { |
|
$headings{'sessions'} = &mt('Session with activity in last 30 minutes'); |
|
} elsif ($timediff{'sessions'} == 600) { |
|
$headings{'sessions'} = &mt('Session with activity in last 10 minutes'); |
|
} elsif ($timediff{'sessions'} == 300) { |
|
$headings{'sessions'} = &mt('Session with activity in last 5 minutes'); |
|
} |
|
|
my ($now,$starttime,$activatedstart,$expiredstart,$crsloginstart); |
my ($now,$starttime,$activatedstart,$expiredstart,$crsloginstart); |
$now = time; |
$now = time; |
|
|
Line 572 sub display_actions_box {
|
Line 678 sub display_actions_box {
|
$threshold{'av_attempts'},$threshold{'degdiff'}, |
$threshold{'av_attempts'},$threshold{'degdiff'}, |
'<br />',$threshold{'numstudents'}); |
'<br />',$threshold{'numstudents'}); |
|
|
my @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles','crslogin'); |
my @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles','crslogin','sessions'); |
|
my %actioncolumn = ( |
|
handgrading => 'left', |
|
haserrors => 'left', |
|
abovethreshold => 'left', |
|
versionchanges => 'left', |
|
coursediscussion => 'right', |
|
coursenormalmail => 'right', |
|
coursecritmail => 'right', |
|
newroles => 'right', |
|
oldroles => 'right', |
|
crslogin => 'right', |
|
sessions => 'right', |
|
); |
|
|
foreach my $key (keys(%{$checkallowed})) { |
foreach my $key (keys(%{$checkallowed})) { |
if ($key =~ /_section$/) { next; } |
if ($key =~ /_section$/) { next; } |
Line 586 sub display_actions_box {
|
Line 705 sub display_actions_box {
|
|
|
foreach my $item (@actionorder) { |
foreach my $item (@actionorder) { |
unless ($item eq 'coursenormalmail' || $item eq 'coursecritmail' || |
unless ($item eq 'coursenormalmail' || $item eq 'coursecritmail' || |
$item eq 'newroles' || $item eq 'oldroles') { |
$item eq 'newroles' || $item eq 'oldroles' || |
|
$item eq 'crslogin' || $item eq 'sessions') { |
if ($show{$item}) { |
if ($show{$item}) { |
$needitems = 1; |
$needitems = 1; |
last; |
last; |
Line 596 sub display_actions_box {
|
Line 716 sub display_actions_box {
|
|
|
my $itemserror; |
my $itemserror; |
if ($needitems) { |
if ($needitems) { |
$itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread); |
$itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread,$checkallowed); |
} |
} |
my $classlist; |
my $classlist; |
if ($show{'oldroles'} || $show{'newroles'} || $show{'crslogin'}) { |
if ($show{'oldroles'} || $show{'newroles'} || $show{'crslogin'} || $show{'sessions'}) { |
$classlist = &Apache::loncoursedata::get_classlist(); |
$classlist = &Apache::loncoursedata::get_classlist(); |
} |
} |
if ($show{'coursenormalmail'}) { |
if ($show{'coursenormalmail'}) { |
Line 617 sub display_actions_box {
|
Line 737 sub display_actions_box {
|
if ($show{'crslogin'}) { |
if ($show{'crslogin'}) { |
$logincount = &getloggedin($cdom,$crs,\%loggedin,$crsloginstart); |
$logincount = &getloggedin($cdom,$crs,\%loggedin,$crsloginstart); |
} |
} |
$r->print(qq|<a href="javascript:changeAll('hide');">$lt{'hial'}</a> |
if ($show{'sessions'}) { |
<a href="javascript:changeAll('show');">$lt{'shal'}</a> |
$sessioncount = &getsessions($cdom,$crs,\%sessions,$timediff{'sessions'},$classlist); |
<form method="post" name="visible" action="/adm/whatsnew">\n|); |
} |
|
my $showhideall = <<"END"; |
|
<span class="LC_nobreak"><a href="javascript:changeAll('hide');">$lt{'hial'}</a> |
|
<a href="javascript:changeAll('show');">$lt{'shal'}</a></span> |
|
END |
|
$r->print(&Apache::loncommon::head_subbox($showhideall)); |
|
$r->print(qq|<form method="post" name="visible" action="/adm/whatsnew">\n|); |
|
|
foreach my $item (keys(%{$checkallowed})) { |
foreach my $item (keys(%{$checkallowed})) { |
if ($item =~ /_section$/) { next; } |
if ($item =~ /_section$/) { next; } |
if ($$checkallowed{$item}) { |
if ($$checkallowed{$item}) { |
Line 627 sub display_actions_box {
|
Line 754 sub display_actions_box {
|
} |
} |
} |
} |
|
|
$r->print('<input type="hidden" name="refpage" value="'.$refpage.'" /><table class="LC_double_column"><tr><td class="LC_left_col">'); |
$r->print('<input type="hidden" name="refpage" value="'.$refpage.'" />'."\n". |
|
'<div class=" LC_landmark" style="clear: both; width: 100%">'."\n". |
|
'<div class="LC_floatleft LC_landmark" style="width: 48%">'); |
|
|
my $displayed = 0; |
my $displayed = 0; |
my $totalboxes = 0; |
my $totalboxes = 0; |
Line 638 sub display_actions_box {
|
Line 767 sub display_actions_box {
|
$totalboxes ++; |
$totalboxes ++; |
} |
} |
} |
} |
my $halfway = 4; |
my $currcolumn = 'left'; |
# my $halfway = int($totalboxes/2) + $totalboxes%2; |
# my $halfway = int($totalboxes/2) + $totalboxes%2; |
foreach my $actionitem (@actionorder) { |
foreach my $actionitem (@actionorder) { |
if ($$checkallowed{$actionitem}) { |
if ($checkallowed->{$actionitem}) { |
if ($displayed == $halfway) { |
if (($actioncolumn{$actionitem} eq 'right') && ($currcolumn eq 'left')) { |
$r->print('</td><td> </td><td class="LC_right_col" >'); |
$r->print('</div><div class="LC_floatright LC_landmark" style="width: 48%">'); |
|
$currcolumn = 'right'; |
} |
} |
&display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror,\%loggedin,$logincount,$classlist); |
&display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror,\%loggedin,$logincount,\%sessions,$sessioncount,$classlist); |
$displayed ++; |
$displayed ++; |
} |
} |
} |
} |
$r->print(' |
$r->print('</div></div><div style="padding:0;clear:both;margin:0;border:0"></div> |
</td> |
|
</tr> |
|
</table> |
|
</form> |
</form> |
'); |
'); |
} |
} |
Line 695 sub display_threshold_config {
|
Line 822 sub display_threshold_config {
|
my $onchange = 'onfocus="javascript:window.document.forms'. |
my $onchange = 'onfocus="javascript:window.document.forms'. |
"['thresholdform'].elements['".$parameter."_setparmval']". |
"['thresholdform'].elements['".$parameter."_setparmval']". |
'.checked=true;"'; |
'.checked=true;"'; |
|
my $aria_textbox = ' aria-label="'.&mt('Threshold value for [_1]', |
|
$threshold_titles{$type}).'"'; |
|
my $aria_checkbox = ' aria-label="'.&mt('Change threshold value for [_1]', |
|
$threshold_titles{$type}).'"'; |
$r->print(&Apache::loncommon::start_data_table_row()."\n". |
$r->print(&Apache::loncommon::start_data_table_row()."\n". |
'<td>'.$threshold_titles{$type}.'</td>'."\n". |
'<td>'.$threshold_titles{$type}.'</td>'."\n". |
'<td>'.&Apache::lonhtmlcommon::textbox($parameter.'_value', |
'<td>'.&Apache::lonhtmlcommon::textbox($parameter.'_value', |
$threshold{$type}, |
$threshold{$type}, |
10,$onchange).'</td>'."\n". |
10,$onchange.$aria_textbox).'</td>'."\n". |
'<td>'. |
'<td>'. |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval', |
|
'','',$aria_checkbox). |
'</td>'."\n". |
'</td>'."\n". |
&Apache::loncommon::end_data_table_row()); |
&Apache::loncommon::end_data_table_row()); |
} |
} |
Line 726 sub display_interval_config {
|
Line 858 sub display_interval_config {
|
$setting = 'oldroleinterval'; |
$setting = 'oldroleinterval'; |
} elsif ($context eq 'newroles') { |
} elsif ($context eq 'newroles') { |
$setting = 'newroleinterval'; |
$setting = 'newroleinterval'; |
|
} elsif ($context eq 'sessions') { |
|
$setting = 'sessionactivity'; |
} |
} |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $current = &get_current($env{'user.name'},$env{'user.domain'}, |
my $current = &get_current($env{'user.name'},$env{'user.domain'}, |
Line 736 sub display_interval_config {
|
Line 870 sub display_interval_config {
|
$r->print('<br />'.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' became available.').'<br />'); |
$r->print('<br />'.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' became available.').'<br />'); |
} elsif ($context eq 'crslogin') { |
} elsif ($context eq 'crslogin') { |
$r->print('<br />'.&mt('Choose the time window to use to display the last login by a user in the '.$lctype).'<br />'); |
$r->print('<br />'.&mt('Choose the time window to use to display the last login by a user in the '.$lctype).'<br />'); |
|
} elsif ($context eq 'sessions') { |
|
$r->print('<br />'.&mt('Choose the time limit to use to display active user sessions in the '.$lctype.'.').'<br />'); |
} else { |
} else { |
$r->print('<br />'.&mt('Choose the time window to use to display resources in the '.$lctype.' with version changes.').'<br />'); |
$r->print('<br />'.&mt('Choose the time window to use to display resources in the '.$lctype.' with version changes.').'<br />'); |
} |
} |
Line 751 sub display_interval_config {
|
Line 887 sub display_interval_config {
|
<input type="hidden" name="intervaltype" value="'.$context.'" /> |
<input type="hidden" name="intervaltype" value="'.$context.'" /> |
<input type="hidden" name="refpage" value="'.$refpage.'" />'. |
<input type="hidden" name="refpage" value="'.$refpage.'" />'. |
&mt('Display:').' |
&mt('Display:').' |
<select name="interval"> |
<select name="interval" aria-label="'.&mt('Choose time window').'"> |
<option value="" selected="selected">'.&mt('Select').'</option> |
<option value="" selected="selected">'.&mt('Select').'</option> |
'); |
'); |
if (ref($interval_titles) eq 'HASH') { |
if (ref($interval_titles) eq 'HASH') { |
if (ref($interval_titles->{$context}) eq 'HASH') { |
if (ref($interval_titles->{$context}) eq 'HASH') { |
foreach my $key (reverse sort ({$a cmp $b} (keys(%{$interval_titles->{$context}})))) { |
my @sorted; |
|
if ($context eq 'sessions') { |
|
@sorted = sort { $a <=> $b } (keys(%{$interval_titles->{$context}})); |
|
push(@sorted,shift(@sorted)); |
|
} else { |
|
@sorted = reverse sort ({$a cmp $b} (keys(%{$interval_titles->{$context}}))); |
|
} |
|
foreach my $key (@sorted) { |
$r->print('<option value="'.$key.'">'.&mt($interval_titles->{$context}->{$key}). |
$r->print('<option value="'.$key.'">'.&mt($interval_titles->{$context}->{$key}). |
'</option>'."\n"); |
'</option>'."\n"); |
} |
} |
Line 832 sub courseinit_config {
|
Line 975 sub courseinit_config {
|
my ($control,$current) = &curr_courseinit(); |
my ($control,$current) = &curr_courseinit(); |
my @chgstate = ('userpref','coursespecific'); |
my @chgstate = ('userpref','coursespecific'); |
my @chgentry = ('firstres','whatsnew'); |
my @chgentry = ('firstres','whatsnew'); |
|
my $courseinitsty = 'display:none;'; |
|
if ($control eq 'coursespecific') { |
|
$courseinitsty = 'display:inline;'; |
|
} |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'chwp' => "Choose which page will be displayed when you enter this $lctype after selecting a role.", |
'chwp' => "Choose which page will be displayed when you enter this $lctype after selecting a role.", |
'cuva' => 'Current value is determined by', |
|
'anis' => 'and is set to display', |
|
'padc' => 'Page display controlled by', |
'padc' => 'Page display controlled by', |
'chce' => 'Choose '.$lctype.' entry', |
'chce' => "Choose $lctype entry", |
'moce' => 'Save', |
'moce' => 'Save', |
); |
); |
$r->print(<<"END"); |
$lt{'cuva'} = &mt('Current value is determined by[_1]'.$initpage->{$control}.'[_2] and is set to display[_1]'.$initpage->{$current}.'[_2].', |
|
': <span class="LC_cusr_emph">','</span>'); |
|
$r->print(<<"END"); |
<br />$lt{'chwp'} |
<br />$lt{'chwp'} |
<br />$lt{'cuva'}: <b> |
<br />$lt{'cuva'} |
$$initpage{$control}</b> $lt{'anis'} <b> |
<br /><br /> |
$$initpage{$current}</b>.<br /><br /> |
|
<form method="post" name="courseinitswitch" action="/adm/whatsnew"> |
<form method="post" name="courseinitswitch" action="/adm/whatsnew"> |
<input type="hidden" name="command" value="newcourseinit" /> |
<input type="hidden" name="command" value="newcourseinit" /> |
<input type="hidden" name="refpage" value="$refpage" /> |
<input type="hidden" name="refpage" value="$refpage" /> |
$lt{'padc'}: |
<fieldset style="display:inline"><legend>$lt{'padc'}</legend> |
END |
END |
foreach my $choice (@chgstate) { |
foreach my $choice (@chgstate) { |
my $chkstring; |
my $chkstring; |
if ($choice eq $control) { |
if ($choice eq $control) { |
$chkstring = ' checked="checked" '; |
$chkstring = ' checked="checked" '; |
} |
} |
$r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_control" value="'. |
$r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_control" value="'. |
$choice.'"'.$chkstring.'/>'.$$initpage{$choice}. |
$choice.'"'.$chkstring.' onclick="toggleCourseInit(this.form);" />'.&mt($initpage->{$choice}). |
' </label></span>'); |
' </label></span>'); |
} |
} |
$r->print('<br /><br />'.&mt('If').' '.$$initpage{'coursespecific'}. |
$r->print('</fieldset><fieldset id="courseinit_by_course" style="'.$courseinitsty.'">'. |
' - <br />'.$lt{'chce'}.": \n"); |
'<legend>'.$lt{'chce'}.'</legend>'."\n"); |
foreach my $choice (@chgentry) { |
foreach my $choice (@chgentry) { |
my $chkstring; |
my $chkstring; |
if (($choice eq $current) && ($control eq 'coursespecific')) { |
if (($choice eq $current) && ($control eq 'coursespecific')) { |
$chkstring = ' checked="checked" '; |
$chkstring = ' checked="checked" '; |
} |
} |
$r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_page" value="'. |
$r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_page" value="'. |
$choice.'"'.$chkstring.'/>'.$$initpage{$choice}. |
$choice.'"'.$chkstring.'/>'.&mt($initpage->{$choice}). |
' </label></span>'); |
' </label></span> '); |
} |
} |
$r->print('<br /><br /><input type="submit" name="display" value="'. |
$r->print('</fieldset><br /><br /><input type="submit" name="display" value="'. |
$lt{'moce'}.'" /></form>'); |
$lt{'moce'}.'" /></form>'); |
return; |
return; |
} |
} |
Line 901 sub display_launcher {
|
Line 1047 sub display_launcher {
|
$tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered, |
$tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered, |
$newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs, |
$newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs, |
$interval,$countunread,$expired,$expirecount,$activated,$activecount, |
$interval,$countunread,$expired,$expirecount,$activated,$activecount, |
$crstype,$itemserror,$loggedin,$logincount,$classlist) = @_; |
$crstype,$itemserror,$loggedin,$logincount,$sessions,$sessioncount, |
|
$classlist) = @_; |
|
|
if ($$checkallowed{$action}) { |
if ($$checkallowed{$action}) { |
&start_box($r,$show,$headings,$action,$refpage); |
&start_box($r,$show,$headings,$action,$refpage); |
Line 914 sub display_launcher {
|
Line 1061 sub display_launcher {
|
&display_versionchanges($r,$changed,$res_title,$interval->{'versions'},$itemserror); |
&display_versionchanges($r,$changed,$res_title,$interval->{'versions'},$itemserror); |
} elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS |
} elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS |
&display_abovethreshold($r,$refpage,$warnings,$triggered, |
&display_abovethreshold($r,$refpage,$warnings,$triggered, |
$res_title,$itemserror); |
$res_title,$itemserror,$checkallowed); |
} elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION |
} elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION |
&display_coursediscussion($r,$newdiscussions,$unread, |
&display_coursediscussion($r,$newdiscussions,$unread, |
$countunread,$res_title,$itemserror); |
$countunread,$res_title,$itemserror); |
Line 929 sub display_launcher {
|
Line 1076 sub display_launcher {
|
&display_rolechanges($r,$expirecount,$expired,$interval->{'oldroles'}, |
&display_rolechanges($r,$expirecount,$expired,$interval->{'oldroles'}, |
$crstype,$classlist); |
$crstype,$classlist); |
} elsif ($action eq 'crslogin') { #LAST LOGIN |
} elsif ($action eq 'crslogin') { #LAST LOGIN |
&display_crslogins($r,$logincount,$loggedin,$interval->{'crslogin'}, |
&display_activity($r,'logins',$logincount,$loggedin,$interval->{'crslogin'}, |
$crstype,$classlist); |
$crstype,$classlist); |
|
} elsif ($action eq 'sessions') { #ACTIVE SESSIONS |
|
&display_activity($r,'sessions',$sessioncount,$sessions,$interval->{'sessions'}, |
|
$crstype,$classlist); |
} |
} |
} |
} |
&end_box($r); |
&end_box($r); |
Line 941 sub display_launcher {
|
Line 1091 sub display_launcher {
|
sub getitems { |
sub getitems { |
my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions, |
my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions, |
$tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show, |
$tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show, |
$starttime,$countunread) = @_; |
$starttime,$countunread,$checkallowed) = @_; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
if (!defined($navmap)) { |
if (!defined($navmap)) { |
my $itemserror = '<span class="LC_warning">'.&mt('An error occurred retrieving information about the course.').'<br />'.&mt('It is recommended that you [_1]re-select the course[_2].','<a href="/adm/roles">','</a>').'</span>'; |
my $itemserror = '<span class="LC_warning">'.&mt('An error occurred retrieving information about the course.').'<br />'.&mt('It is recommended that you [_1]re-select the course[_2].','<a href="/adm/roles">','</a>').'</span>'; |
Line 1001 sub getitems {
|
Line 1151 sub getitems {
|
# Maxtries and degree of difficulty for problem parts, unless handgradeable |
# Maxtries and degree of difficulty for problem parts, unless handgradeable |
if ($$show{'abovethreshold'}) { |
if ($$show{'abovethreshold'}) { |
&check_thresholds($resource,$symb,\%resourcetracker, |
&check_thresholds($resource,$symb,\%resourcetracker, |
$triggered,$threshold,$warnings); |
$triggered,$threshold,$warnings, |
|
$checkallowed); |
} |
} |
|
|
} |
} |
return; |
return; |
} |
} |
Line 1034 sub check_discussions {
|
Line 1184 sub check_discussions {
|
sub check_handgraded { |
sub check_handgraded { |
my ($resource,$symb,$title,$cdom,$cnum,$ungraded,$tograde) = @_; |
my ($resource,$symb,$title,$cdom,$cnum,$ungraded,$tograde) = @_; |
if ($resource->is_problem()) { |
if ($resource->is_problem()) { |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
my ($handgradeable,$is_task); |
my $partlist=$resource->parts(); |
my $partlist=$resource->parts(); |
my $handgradeable; |
if ($resource->is_task()) { |
foreach my $part (@$partlist) { |
$is_task = 1; |
if ($resource->handgrade($part) eq 'yes') { |
foreach my $part (@$partlist) { |
$handgradeable=1; last; |
if ($resource->handgrade($part) eq 'yes') { |
|
$handgradeable=1; |
|
last; |
|
} |
|
} |
|
} else { |
|
foreach my $part (@$partlist) { |
|
my @types = $resource->responseType($part); |
|
if (grep(/^essay$/,@types)) { |
|
$handgradeable=1; |
|
last; |
|
} elsif (grep(/^custom$/,@types)) { |
|
if ($resource->handgrade($part) eq 'yes') { |
|
$handgradeable=1; |
|
last; |
|
} |
|
} |
} |
} |
} |
} |
if ($handgradeable) { |
if ($handgradeable) { |
Line 1048 sub check_handgraded {
|
Line 1214 sub check_handgraded {
|
if (@ungraded > 0) { |
if (@ungraded > 0) { |
$$ungraded{$symb}{count} = scalar(@ungraded); |
$$ungraded{$symb}{count} = scalar(@ungraded); |
$$ungraded{$symb}{title} = $title; |
$$ungraded{$symb}{title} = $title; |
|
$$ungraded{$symb}{is_task} = $is_task; |
if ($resource->encrypted()) { |
if ($resource->encrypted()) { |
$$ungraded{$symb}{'enclink'} = $resource->link(); |
$$ungraded{$symb}{'enclink'} = $resource->link(); |
$$ungraded{$symb}{'encsymb'} = $resource->shown_symb(); |
$$ungraded{$symb}{'encsymb'} = $resource->shown_symb(); |
Line 1075 sub check_bombed {
|
Line 1242 sub check_bombed {
|
} |
} |
|
|
sub check_thresholds { |
sub check_thresholds { |
my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_; |
my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings, |
|
$checkallowed) = @_; |
# Compile maxtries and degree of difficulty for problem parts, unless handgradeable |
# Compile maxtries and degree of difficulty for problem parts, unless handgradeable |
my @parts = @{$resource->parts()}; |
my @parts = @{$resource->parts()}; |
my %stats; |
my %stats; |
Line 1141 sub check_thresholds {
|
Line 1309 sub check_thresholds {
|
<td>'.$stats{$part}{users}.'</td> |
<td>'.$stats{$part}{users}.'</td> |
<td>'.$stats{$part}{attempts}.'</td> |
<td>'.$stats{$part}{attempts}.'</td> |
<td>'.$stats{$part}{degdiff}.'</td> |
<td>'.$stats{$part}{degdiff}.'</td> |
<td>'.$lastreset{$part}.'</td> |
<td>'.$lastreset{$part}.'</td>'; |
<td><input type="checkbox" name="'.$resetname.'" /><input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>'; |
if ($checkallowed->{'resetcounters'}) { |
|
my $aria = ' aria-label="'.&mt('Reset counter for [_1] (part [_2])', |
|
$$triggered{$symb}{title},$part).'"'; |
|
$$triggered{$symb}{text}[$partcount] .= |
|
'<td><input type="checkbox" name="'.$resetname.'"'.$aria.' />'. |
|
'<input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>'; |
|
} |
$partcount ++; |
$partcount ++; |
} |
} |
$$triggered{$symb}{numparts} = $partcount; |
$$triggered{$symb}{numparts} = $partcount; |
Line 1204 sub get_current {
|
Line 1378 sub get_current {
|
} |
} |
|
|
sub process_reset { |
sub process_reset { |
my ($dom,$crs) = @_; |
my ($dom,$crs,$checkallowed) = @_; |
|
if (!$checkallowed->{'resetcounters'}) { |
|
return '<b>'.&mt('You do not have the required privileges to reset counters'). |
|
'</b><br />'; |
|
} |
my $result = '<b>'.&mt('Counters reset for following problems (and parts):'). |
my $result = '<b>'.&mt('Counters reset for following problems (and parts):'). |
'</b><br />'; |
'</b><br />'; |
my @agg_types = ('attempts','users','correct'); |
my @agg_types = ('attempts','users','correct'); |
Line 1286 sub getnormalmail {
|
Line 1464 sub getnormalmail {
|
if ($emailstatus{$msgid} eq 'new') { |
if ($emailstatus{$msgid} eq 'new') { |
$skipstatus = 1; |
$skipstatus = 1; |
} |
} |
|
my $esc_msgid = &escape($msgid); |
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
&Apache::lonmsg::unpackmsgid($msgid,undef,$skipstatus,undef, |
&Apache::lonmsg::unpackmsgid($esc_msgid,undef,$skipstatus,undef, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
if (defined($sendtime) && $sendtime!~/error/) { |
if (defined($sendtime) && $sendtime!~/error/) { |
Line 1298 sub getnormalmail {
|
Line 1477 sub getnormalmail {
|
$shortsubj = &mt('No subject'); |
$shortsubj = &mt('No subject'); |
} |
} |
push(@{$newmsgs}, { |
push(@{$newmsgs}, { |
msgid => $msgid, |
msgid => $esc_msgid, |
sendtime => $sendtime, |
sendtime => $sendtime, |
shortsub => $shortsubj, |
shortsub => $shortsubj, |
from => $fromname, |
from => $fromname, |
Line 1319 sub getcritmail {
|
Line 1498 sub getcritmail {
|
my $result = ''; |
my $result = ''; |
my $critmsgcount = 0; |
my $critmsgcount = 0; |
foreach my $msgid (sort(keys(%what))) { |
foreach my $msgid (sort(keys(%what))) { |
|
my $esc_msgid = &escape($msgid); |
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
&Apache::lonmsg::unpackmsgid($msgid,undef,1,undef, |
&Apache::lonmsg::unpackmsgid($esc_msgid,undef,1,undef, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
if (defined($sendtime) && $sendtime!~/error/) { |
if (defined($sendtime) && $sendtime!~/error/) { |
Line 1330 sub getcritmail {
|
Line 1510 sub getcritmail {
|
$shortsubj = &mt('No subject'); |
$shortsubj = &mt('No subject'); |
} |
} |
push(@{$critmsgs}, { |
push(@{$critmsgs}, { |
msgid => $msgid, |
msgid => $esc_msgid, |
sendtime => $sendtime, |
sendtime => $sendtime, |
shortsub => $shortsubj, |
shortsub => $shortsubj, |
from => $fromname, |
from => $fromname, |
Line 1575 sub getloggedin {
|
Line 1755 sub getloggedin {
|
return $logincount; |
return $logincount; |
} |
} |
|
|
|
sub getsessions { |
|
my ($cdom,$cnum,$sessions,$lastactive,$classlist) = @_; |
|
my $context = 'course'; |
|
my ($permission,$allowed) = |
|
&Apache::lonuserutils::get_permission($context); |
|
my %crs_sessions = &Apache::lonnet::get_course_sessions($cnum,$cdom,$lastactive); |
|
my $sessioncount = 0; |
|
if (keys(%crs_sessions) > 0) { |
|
if (ref($classlist) eq 'HASH') { |
|
my $viewablesec = &Apache::lonuserutils::viewable_section($permission); |
|
my $secidx = &Apache::loncoursedata::CL_SECTION(); |
|
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'_'.$cnum,1); |
|
my %personnel; |
|
foreach my $role (sort(keys(%coursepersonnel))) { |
|
my ($rolecode,$section); |
|
if ($role =~ /:/) { |
|
($rolecode,$section) = split(/:/,$role); |
|
} else { |
|
$rolecode = $role; |
|
} |
|
if ($viewablesec ne '') { |
|
next if ($viewablesec ne $section); |
|
} |
|
foreach my $user (split(/\,/,$coursepersonnel{$role})) { |
|
push(@{$personnel{$user}{$rolecode}},$section); |
|
} |
|
} |
|
foreach my $key (keys(%crs_sessions)) { |
|
if (exists($classlist->{$key})) { |
|
my $student = $classlist->{$key}; |
|
my $section = $student->[$secidx]; |
|
my $lastaccess = $crs_sessions{$key}; |
|
if ($viewablesec ne '') { |
|
next if ($viewablesec ne $section); |
|
} |
|
my ($stuname,$studom) = split(/:/,$key); |
|
my %info = ( |
|
'section' => $section, |
|
'role' => 'st', |
|
'uname' => $stuname, |
|
'udom' => $studom, |
|
); |
|
$sessioncount ++; |
|
push(@{$sessions->{$lastaccess}},\%info); |
|
} elsif (exists($personnel{$key})) { |
|
my $lastaccess = $crs_sessions{$key}; |
|
my ($uname,$udom) = split(/:/,$key); |
|
if (ref($personnel{$key}) eq 'HASH') { |
|
my ($showrole,$showsec); |
|
foreach my $possrole ('cc','co','in','ta','ep','ad','st') { |
|
if (exists($personnel{$key}{$possrole})) { |
|
$showrole = $possrole; |
|
$showsec = join(', ',@{$personnel{$key}{$possrole}}); |
|
last; |
|
} |
|
} |
|
my %info = ( |
|
'section' => $showsec, |
|
'role' => $showrole, |
|
'uname' => $uname, |
|
'udom' => $udom, |
|
); |
|
$sessioncount ++; |
|
push(@{$sessions->{$lastaccess}},\%info); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return $sessioncount; |
|
} |
|
|
sub checkversions { |
sub checkversions { |
my ($cdom,$crs,$navmap,$changed,$starttime) = @_; |
my ($cdom,$crs,$navmap,$changed,$starttime) = @_; |
my %changes=&Apache::lonnet::dump('versionupdate',$cdom,$crs); |
my %changes=&Apache::lonnet::dump('versionupdate',$cdom,$crs); |
Line 1623 sub display_handgrade {
|
Line 1875 sub display_handgrade {
|
'nopr' => 'No problems require handgrading', |
'nopr' => 'No problems require handgrading', |
); |
); |
if (@{$tograde} > 0) { |
if (@{$tograde} > 0) { |
$r->print('<tr class="LC_info_row"><td class="LC_left_item">'. |
$r->print('<tr class="LC_info_row"><th class="LC_left_item">'. |
$lt{'prna'}.'</td><td class="LC_right_item">'. |
$lt{'prna'}.'</th><th class="LC_right_item">'. |
$lt{'nmun'}.'</td></tr>'); |
$lt{'nmun'}.'</th></tr>'); |
my $rowNum = 0; |
my $rowNum = 0; |
|
my $usediv; |
|
if (@{$tograde} > 1) { |
|
$usediv = 1; |
|
} |
foreach my $res (@{$tograde}) { |
foreach my $res (@{$tograde}) { |
$rowNum ++; |
$rowNum ++; |
my $css_class = $rowNum%2?' class="LC_odd_row"':''; |
my $css_class = $rowNum%2?' class="LC_odd_row"':''; |
my $linkurl='/adm/grades'; |
my $linkurl; |
if ($$ungraded{$res}{'enclink'}) { |
if ($$ungraded{$res}{'is_task'}) { |
$linkurl.='?symb='.$$ungraded{$res}{'encsymb'}; |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($res); |
|
$linkurl=&Apache::lonnet::clutter($url); |
|
$linkurl .= '?symb='.&escape($res); |
|
if ($$ungraded{$res}{'enclink'}) { |
|
$linkurl = |
|
$$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'}; |
|
} |
} else { |
} else { |
$linkurl.='?symb='.&escape($res); |
$linkurl='/adm/grades'; |
|
if ($$ungraded{$res}{'enclink'}) { |
|
$linkurl.='?symb='.$$ungraded{$res}{'encsymb'}; |
|
} else { |
|
$linkurl.='?symb='.&escape($res); |
|
} |
|
$linkurl.='&command=ungraded'; |
|
} |
|
$r->print('<tr'.$css_class.'><td>'); |
|
if ($usediv) { |
|
$r->print('<div class="LC_minheight">'); |
|
} |
|
$r->print('<a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a>'); |
|
if ($usediv) { |
|
$r->print('</div>'); |
} |
} |
$linkurl.='&command=ungraded'; |
$r->print('</td>'. |
$r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>'); |
'<td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>'); |
} |
} |
} elsif ($itemserror) { |
} elsif ($itemserror) { |
$r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><th>'.$itemserror.'</th></tr>'); |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><th>'.$lt{'nopr'}.'</th></tr>'); |
} |
} |
} |
} |
|
|
Line 1655 sub display_haserrors {
|
Line 1931 sub display_haserrors {
|
noer => 'No problems with errors', |
noer => 'No problems with errors', |
); |
); |
if (@{$bombs} > 0) { |
if (@{$bombs} > 0) { |
$r->print('<tr class="LC_info_row"><td class="LC_left_item">'. |
$r->print('<tr class="LC_info_row"><th class="LC_left_item">'. |
$lt{'reso'}.'</td><td class="LC_right_item">'. |
$lt{'reso'}.'</th><th class="LC_right_item">'. |
$lt{'nmer'}.'</td></tr>'); |
$lt{'nmer'}.'</th></tr>'); |
@{$bombs} = sort { &cmp_title($a,$b,$res_title) } @{$bombs}; |
@{$bombs} = sort { &cmp_title($a,$b,$res_title) } @{$bombs}; |
|
my $usediv; |
|
if (@{$bombs} > 1) { |
|
$usediv = 1; |
|
} |
foreach my $bomb (@{$bombs}) { |
foreach my $bomb (@{$bombs}) { |
$bombnum ++; |
$bombnum ++; |
my $css_class = $bombnum%2?' class="LC_odd_row"':''; |
my $css_class = $bombnum%2?' class="LC_odd_row"':''; |
$r->print('<tr'.$css_class.'><td>'.$$bombed{$bomb}{errorlink}. |
$r->print('<tr'.$css_class.'><td style="vertical-align:middle;">'); |
'</td><td class="LC_right_item">'. |
if ($usediv) { |
|
$r->print('<div class="LC_minheight">'); |
|
} |
|
$r->print($$bombed{$bomb}{errorlink}); |
|
if ($usediv) { |
|
$r->print('</div>'); |
|
} |
|
$r->print('</td><td class="LC_right_item" style="vertical-align:middle;">'. |
$$bombed{$bomb}{errorcount}.'</td></tr>'); |
$$bombed{$bomb}{errorcount}.'</td></tr>'); |
} |
} |
} elsif ($itemserror) { |
} elsif ($itemserror) { |
$r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><th>'.$itemserror.'</th></tr>'); |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>'.$lt{'noer'}.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><th>'.$lt{'noer'}.'</th></tr>'); |
} |
} |
return; |
return; |
} |
} |
|
|
sub display_abovethreshold { |
sub display_abovethreshold { |
my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_; |
my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror,$checkallowed) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
reso => 'Resource', |
reso => 'Resource', |
part => 'Part', |
part => 'Part', |
Line 1690 sub display_abovethreshold {
|
Line 1977 sub display_abovethreshold {
|
if (@{$warnings} > 0) { |
if (@{$warnings} > 0) { |
@{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings}; |
@{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings}; |
$r->print('<tr class="LC_info_row">'. |
$r->print('<tr class="LC_info_row">'. |
'<td class="LC_left_item">'.$lt{'reso'}. |
'<th class="LC_left_item">'.$lt{'reso'}. |
'<input type="hidden" name="command" value="" /></td>'. |
'<input type="hidden" name="command" value="" /></th>'. |
'<td>'.$lt{'part'}.'</td><td>'.$lt{'nust'}.'</td>'. |
'<th>'.$lt{'part'}.'</th><th>'.$lt{'nust'}.'</th>'. |
'<td>'.$lt{'avat'}.'</td><td>'.$lt{'dedi'}.'</td>'. |
'<th>'.$lt{'avat'}.'</th><th>'.$lt{'dedi'}.'</th>'. |
'<td>'.$lt{'lare'}.'</td><td class="LC_right_item">'. |
'<th>'.$lt{'lare'}.'</th>'); |
$lt{'reco'}.'</td></tr>'); |
if ($checkallowed->{'resetcounters'}) { |
my $row; |
$r->print('<th class="LC_right_item">'.$lt{'reco'}.'</th>'); |
|
} |
|
$r->print('</tr>'); |
|
my ($usediv,$row); |
|
if (@{$warnings} > 1) { |
|
$usediv = 1; |
|
} |
foreach my $res (@{$warnings}) { |
foreach my $res (@{$warnings}) { |
$row++; |
$row++; |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($res); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($res); |
Line 1712 sub display_abovethreshold {
|
Line 2005 sub display_abovethreshold {
|
} |
} |
my $css_class = $row%2?' class="LC_odd_row"':''; |
my $css_class = $row%2?' class="LC_odd_row"':''; |
$r->print('<tr'.$css_class.'>'. |
$r->print('<tr'.$css_class.'>'. |
'<td class="LC_first_item" '.$rowspan.'><a href="'.$linkurl.'">'. |
'<td class="LC_first_item" '.$rowspan.'>'); |
$$triggered{$res}{title}.'</a></td>'); |
if ($usediv) { |
if (ref($$triggered{$res}{text}) eq 'ARRAY') { |
$r->print('<div class="LC_minheight">'); |
$r->print($$triggered{$res}{text}[0]); |
} |
} |
$r->print('<a href="'.$linkurl.'">'. |
$r->print('</tr>'); |
$$triggered{$res}{title}.'</a>'); |
|
if ($usediv) { |
|
$r->print('</div>'); |
|
} |
|
$r->print('</td>'); |
|
if (ref($$triggered{$res}{text}) eq 'ARRAY') { |
|
$r->print($$triggered{$res}{text}[0]); |
|
} |
|
$r->print('</tr>'); |
if (ref($$triggered{$res}{text}) eq 'ARRAY') { |
if (ref($$triggered{$res}{text}) eq 'ARRAY') { |
if (@{$$triggered{$res}{text}} > 1) { |
if (@{$$triggered{$res}{text}} > 1) { |
for (my $i=1; $i<@{$$triggered{$res}{text}}; $i++) { |
for (my $i=1; $i<@{$$triggered{$res}{text}}; $i++) { |
Line 1727 sub display_abovethreshold {
|
Line 2028 sub display_abovethreshold {
|
} |
} |
} |
} |
} |
} |
$r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="button" name="counters" value="'.$lt{'rese'}.'" onclick="javascript:thresholdreset();" /></td></tr>'); |
if ($checkallowed->{'resetcounters'}) { |
|
$r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="button" name="counters" value="'.$lt{'rese'}.'" onclick="javascript:thresholdreset();" /></td></tr>'); |
|
} |
} elsif ($itemserror) { |
} elsif ($itemserror) { |
$r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><th>'.$itemserror.'</th></tr>'); |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><th>'.$lt{'nopr'}.'</th></tr>'); |
} |
} |
} |
} |
|
|
Line 1744 sub display_versionchanges {
|
Line 2047 sub display_versionchanges {
|
'veru' => 'Version used', |
'veru' => 'Version used', |
); |
); |
if (keys(%{$changed}) > 0) { |
if (keys(%{$changed}) > 0) { |
$r->print('<tr class="LC_info_row"><td class="LC_left_item">'. |
$r->print('<tr class="LC_info_row">'. |
$lt{'reso'}.'</td><td>'.$lt{'revd'}.'</td><td>'. |
'<th class="LC_left_item LC_nobreak">'.$lt{'reso'}.'</th>'. |
$lt{'newv'}.'</td><td class="LC_right_item">'. |
'<th class="LC_left_item LC_nobreak">'.$lt{'revd'}.'</th>'. |
$lt{'veru'}.'</td></tr>'); |
'<th class="LC_left_item LC_nobreak">'.$lt{'newv'}.'</th>'. |
|
'<th class="LC_left_item LC_nobreak">'.$lt{'veru'}.'</th>'. |
|
'</tr>'); |
my @changes = sort { &cmp_title($a,$b,$res_title) } keys(%{$changed}); |
my @changes = sort { &cmp_title($a,$b,$res_title) } keys(%{$changed}); |
my $changenum = 0; |
my $changenum = 0; |
|
my $usediv; |
|
if (@changes > 1) { |
|
$usediv = 1; |
|
} |
foreach my $item (@changes) { |
foreach my $item (@changes) { |
$changenum ++; |
$changenum ++; |
my $css_class = $changenum%2?' class="LC_odd_row"':''; |
my $css_class = $changenum%2?' class="LC_odd_row"':''; |
Line 1757 sub display_versionchanges {
|
Line 2066 sub display_versionchanges {
|
my $linkurl=&Apache::lonnet::clutter($url); |
my $linkurl=&Apache::lonnet::clutter($url); |
$linkurl .= '?symb='.&escape($item); |
$linkurl .= '?symb='.&escape($item); |
|
|
$r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'. |
$r->print('<tr'.$css_class.'><td>'); |
$$res_title{$item}.'</a></td><td>'. |
if ($usediv) { |
|
$r->print('<div class="LC_minheight">'); |
|
} |
|
$r->print('<a href="'.$linkurl.'">'. |
|
$$res_title{$item}.'</a>'); |
|
if ($usediv) { |
|
$r->print('</div>'); |
|
} |
|
$r->print('</td><td>'. |
$$changed{$item}{'revdate'}.'</td><td>'. |
$$changed{$item}{'revdate'}.'</td><td>'. |
$$changed{$item}{'current'}.'</td><td>'. |
$$changed{$item}{'current'}.'</td><td>'. |
$$changed{$item}{'version'}.'</td></tr>'); |
$$changed{$item}{'version'}.'</td></tr>'); |
} |
} |
} elsif ($itemserror) { |
} elsif ($itemserror) { |
$r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><th>'.$itemserror.'</th></tr>'); |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>' |
$r->print('<tr class="LC_empty_row"><th>' |
.&mt('No '.$interval).'</td></tr>'); |
.&mt('No '.$interval).'</th></tr>'); |
} |
} |
return; |
return; |
} |
} |
Line 1784 sub display_rolechanges {
|
Line 2101 sub display_rolechanges {
|
); |
); |
if ($chgcount) { |
if ($chgcount) { |
$r->print('<tr class="LC_info_row">'. |
$r->print('<tr class="LC_info_row">'. |
'<td class="LC_left_item">'.$lt{'tich'}.'</td>'. |
'<th class="LC_left_item">'.$lt{'tich'}.'</th>'. |
'<td class="LC_left_item">'.$lt{'user'}.'</td>'. |
'<th class="LC_left_item">'.$lt{'user'}.'</th>'. |
'<td class="LC_left_item">'.$lt{'role'}.'</td>'. |
'<th class="LC_left_item">'.$lt{'role'}.'</th>'. |
'<td class="LC_left_item">'.$lt{'sec'}.'</td>'. |
'<th class="LC_left_item">'.$lt{'sec'}.'</th>'. |
'<td class="LC_left_item">'.$lt{'status'}.'</td></tr>'); |
'<th class="LC_left_item">'.$lt{'status'}.'</th></tr>'); |
if (ref($changed) eq 'HASH') { |
if (ref($changed) eq 'HASH') { |
my @changes = sort { $b <=> $a } (keys(%{$changed})); |
my @changes = sort { $b <=> $a } (keys(%{$changed})); |
my $changenum = 0; |
my $changenum = 0; |
my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME(); |
my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME(); |
|
my $usediv; |
|
if ($chgcount > 1) { |
|
$usediv = 1; |
|
} |
foreach my $item (@changes) { |
foreach my $item (@changes) { |
if (ref($changed->{$item}) eq 'ARRAY') { |
if (ref($changed->{$item}) eq 'ARRAY') { |
foreach my $chg (@{$changed->{$item}}) { |
foreach my $chg (@{$changed->{$item}}) { |
Line 1820 sub display_rolechanges {
|
Line 2141 sub display_rolechanges {
|
&Apache::loncommon::aboutmewrapper($fullname,$uname,$udom); |
&Apache::loncommon::aboutmewrapper($fullname,$uname,$udom); |
$r->print('<tr'.$css_class.'>'. |
$r->print('<tr'.$css_class.'>'. |
'<td>'.&Apache::lonlocal::locallocaltime($item).'</td>'. |
'<td>'.&Apache::lonlocal::locallocaltime($item).'</td>'. |
'<td>'.$link.'</td>'. |
'<td>'); |
|
if ($usediv) { |
|
$r->print('<div class="LC_minheight">'); |
|
} |
|
$r->print($link); |
|
if ($usediv) { |
|
$r->print('</div>'); |
|
} |
|
$r->print('</td>'. |
'<td>'.$role.'</td>'. |
'<td>'.$role.'</td>'. |
'<td>'.$section.'</td>'. |
'<td>'.$section.'</td>'. |
'<td>'.$status.'</td></tr>'); |
'<td>'.$status.'</td></tr>'); |
Line 1830 sub display_rolechanges {
|
Line 2159 sub display_rolechanges {
|
} |
} |
} |
} |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>' |
$r->print('<tr class="LC_empty_row"><th>' |
.&mt('There are no '.$interval).'</td></tr>'); |
.&mt('There are no '.$interval).'</th></tr>'); |
} |
} |
return; |
return; |
} |
} |
|
|
sub display_crslogins { |
sub display_activity { |
my ($r,$logincount,$loggedin,$interval,$crstype,$classlist) = @_; |
my ($r,$context,$count,$details,$interval,$crstype,$classlist) = @_; |
return unless (ref($classlist) eq 'HASH'); |
return unless (ref($classlist) eq 'HASH'); |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'user' => 'User', |
'user' => 'User', |
Line 1845 sub display_crslogins {
|
Line 2174 sub display_crslogins {
|
'sec' => 'Section', |
'sec' => 'Section', |
'number' => 'Total number of logins', |
'number' => 'Total number of logins', |
); |
); |
if ($logincount) { |
my $prefix = 'login'; |
|
if ($context eq 'sessions') { |
my $hdr = '<tr class="LC_info_row" style="display:none" id="logintitledet">'. |
$lt{'number'} = &mt('Total number of active user sessions'); |
'<td class="LC_left_item">'.$lt{'user'}.'</td>'. |
$lt{'active'} = &mt('Last active'); |
'<td class="LC_left_item">'.$lt{'role'}.'</td>'. |
$prefix = 'session'; |
'<td class="LC_left_item">'.$lt{'sec'}.'</td></tr>'. |
} |
'<tr class="LC_info_row" id="logintitlesum">'. |
if ($count) { |
'<td class="LC_left_item">'.$lt{'number'}.'</td>'. |
|
'<td class="LC_left_item">'.$lt{'role'}.'</td>'. |
my $hdr = '<tr class="LC_info_row" style="display:none" id="'.$prefix.'titledet">'. |
'<td class="LC_left_item">'.$lt{'sec'}; |
'<th class="LC_left_item">'.$lt{'user'}.'</th>'. |
|
'<th class="LC_left_item">'.$lt{'role'}.'</th>'. |
|
'<th class="LC_left_item">'.$lt{'sec'}.'</th>'; |
|
if ($context eq 'sessions') { |
|
$hdr .= '<th class="LC_left_item">'.$lt{'active'}.'</th>'; |
|
} |
|
$hdr .= '</tr>'."\n". |
|
'<tr class="LC_info_row" id="'.$prefix.'titlesum">'. |
|
'<th class="LC_left_item">'.$lt{'number'}.'</th>'. |
|
'<th class="LC_left_item">'.$lt{'role'}.'</th>'. |
|
'<th class="LC_left_item">'.$lt{'sec'}; |
my (%bylastname,%counts); |
my (%bylastname,%counts); |
if (ref($loggedin) eq 'HASH') { |
if (ref($details) eq 'HASH') { |
my @logins = sort { $b <=> $a } (keys(%{$loggedin})); |
my @items = sort { $b <=> $a } (keys(%{$details})); |
my $numlogin = 0; |
my $num = 0; |
my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME(); |
my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME(); |
foreach my $item (@logins) { |
my $usediv; |
if (ref($loggedin->{$item}) eq 'ARRAY') { |
if ($count > 1) { |
foreach my $user (@{$loggedin->{$item}}) { |
$usediv = 1; |
|
} |
|
foreach my $item (@items) { |
|
if (ref($details->{$item}) eq 'ARRAY') { |
|
foreach my $user (@{$details->{$item}}) { |
if (ref($user) eq 'HASH') { |
if (ref($user) eq 'HASH') { |
my $section; |
my $section; |
my $role = |
my $role = |
&Apache::lonnet::plaintext($user->{'role'},$crstype); |
&Apache::lonnet::plaintext($user->{'role'},$crstype); |
my $status = &mt($user->{'status'}); |
|
if ($user->{'section'} eq '') { |
if ($user->{'section'} eq '') { |
$section = &mt('none'); |
$section = &mt('none'); |
} else { |
} else { |
Line 1884 sub display_crslogins {
|
Line 2226 sub display_crslogins {
|
} |
} |
my $link = |
my $link = |
&Apache::loncommon::aboutmewrapper($fullname,$uname,$udom); |
&Apache::loncommon::aboutmewrapper($fullname,$uname,$udom); |
push(@{$bylastname{$fullname}}, |
my $entry = '<td>'; |
'<td>'.$link.'</td>'. |
if ($usediv) { |
'<td>'.$role.'</td>'. |
$entry .= '<div class="LC_minheight">'; |
'<td>'.$section.'</td>'); |
} |
|
$entry .= $link; |
|
if ($usediv) { |
|
$entry .= '</div>'; |
|
} |
|
$entry .= '</td>'. |
|
'<td>'.$role.'</td>'. |
|
'<td>'.$section.'</td>'; |
|
if ($context eq 'sessions') { |
|
$entry .= '<td>'.&Apache::lonlocal::locallocaltime($item).'</td>'; |
|
} |
|
push(@{$bylastname{$fullname}},$entry); |
} |
} |
} |
} |
} |
} |
Line 1896 sub display_crslogins {
|
Line 2249 sub display_crslogins {
|
foreach my $person (sort(keys(%bylastname))) { |
foreach my $person (sort(keys(%bylastname))) { |
if (ref($bylastname{$person}) eq 'ARRAY') { |
if (ref($bylastname{$person}) eq 'ARRAY') { |
foreach my $item (@{$bylastname{$person}}) { |
foreach my $item (@{$bylastname{$person}}) { |
$numlogin ++; |
$num ++; |
my $css_class = $numlogin%2?' class="LC_odd_row"':''; |
my $css_class = $num%2?' class="LC_odd_row"':''; |
$table .= '<tr'.$css_class.' style="display:none;" id="logindet_'.$numlogin.'">'.$item.'</tr>'; |
$table .= '<tr'.$css_class.' style="display:none;" id="'.$prefix.'det_'.$num.'">'.$item.'</tr>'; |
} |
} |
} |
} |
} |
} |
Line 1909 sub display_crslogins {
|
Line 2262 sub display_crslogins {
|
foreach my $sec (sort { $b <=> $a } (keys(%{$counts{$role}}))) { |
foreach my $sec (sort { $b <=> $a } (keys(%{$counts{$role}}))) { |
$numrow ++; |
$numrow ++; |
my $css_class = $numrow%2?' class="LC_odd_row"':''; |
my $css_class = $numrow%2?' class="LC_odd_row"':''; |
$table .= '<tr '.$css_class.' id="loginsum_'.$numrow.'">'. |
$table .= '<tr '.$css_class.' id="'.$prefix.'sum_'.$numrow.'">'. |
'<td>'.$counts{$role}{$sec}.'</td>'. |
'<td>'.$counts{$role}{$sec}.'</td>'. |
'<td>'.$showrole.'</td>'. |
'<td>'.$showrole.'</td>'. |
'<td>'.$sec.'</td></tr>'; |
'<td>'.$sec.'</td></tr>'; |
} |
} |
} |
} |
} |
} |
$r->print($hdr.'<input type="hidden" name="logincount" value="'.$numlogin. |
$r->print($hdr.'<input type="hidden" name="'.$prefix.'count" value="'.$num. |
'" /><input type="hidden" name="loginrow" value="'.$numrow. |
'" /><input type="hidden" name="'.$prefix.'row" value="'.$numrow. |
'" /></td></tr>'.$table); |
'" /></th></tr>'.$table); |
} |
} |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>'. |
$r->print('<tr class="LC_empty_row"><th>'. |
&mt('There are no '.$interval). |
&mt('There are no '.$interval). |
'<input type="hidden" name="logincount" value="'.$logincount. |
'<input type="hidden" name="'.$prefix.'count" value="'.$count. |
'." /></td></tr>'); |
'." /></th></tr>'); |
} |
} |
return; |
return; |
} |
} |
|
|
sub display_coursediscussion { |
sub display_coursediscussion { |
my ($r,$newdiscussions,$unread,$countunread,$res_title,$itemserror) = @_; |
my ($r,$newdiscussions,$unread,$countunread,$res_title,$itemserror) = @_; |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'loca' => 'Location', |
'loca' => 'Location', |
'type' => 'Type', |
'type' => 'Type', |
'numn' => 'Number of new posts', |
'numn' => 'New posts', |
'noun' => 'No unread posts in '.$lctype.' discussions', |
'noun' => 'No unread posts in '.$lctype.' discussions', |
'tmlp' => 'Time of last post', |
'tmlp' => 'Time of last post', |
); |
); |
if (@{$newdiscussions} > 0) { |
if (@{$newdiscussions} > 0) { |
$r->print('<tr class="LC_info_row"><td class="LC_left_item">'. |
$r->print('<tr class="LC_info_row">'. |
$lt{'loca'}.'</td><td>'. |
'<th class="LC_left_item LC_nobreak">'.$lt{'loca'}.'</th>'. |
$lt{'type'}.'</td>'); |
'<th class="LC_left_item LC_nobreak">'.$lt{'type'}.'</th>'); |
if ($countunread eq 'on') { |
if ($countunread eq 'on') { |
$r->print('<td>'.$lt{'tmlp'}.'</td>'. |
$r->print('<th class="LC_left_item LC_nobreak">'.$lt{'tmlp'}.'</th>'. |
'<td class="LC_right_item">'.$lt{'numn'}.'</td>'); |
'<th class="LC_left_item LC_nobreak">'.$lt{'numn'}.'</th>'); |
} else { |
} else { |
$r->print('<td class="LC_right_item">'.$lt{'tmlp'}.'</td>'); |
$r->print('<th class="LC_left_item">'.$lt{'tmlp'}.'</th>'); |
} |
} |
$r->print("</tr>\n"); |
$r->print("</tr>\n"); |
@{$newdiscussions} = sort { &cmp_title($a,$b,$res_title) } |
@{$newdiscussions} = sort { &cmp_title($a,$b,$res_title) } |
@{$newdiscussions}; |
@{$newdiscussions}; |
my $rowNum = 0; |
my $rowNum = 0; |
|
my $usediv; |
|
if (@{$newdiscussions} > 1) { |
|
$usediv = 1; |
|
} |
foreach my $ressymb (@{$newdiscussions}) { |
foreach my $ressymb (@{$newdiscussions}) { |
$rowNum ++; |
$rowNum ++; |
my $forum_title = $$unread{$ressymb}{'title'}; |
my $forum_title = $$unread{$ressymb}{'title'}; |
Line 1968 sub display_coursediscussion {
|
Line 2325 sub display_coursediscussion {
|
my $css_class = $rowNum%2?' class="LC_odd_row"':''; |
my $css_class = $rowNum%2?' class="LC_odd_row"':''; |
my $lastpost = &Apache::lonnavmaps::timeToHumanString( |
my $lastpost = &Apache::lonnavmaps::timeToHumanString( |
$$unread{$ressymb}{'lastpost'}); |
$$unread{$ressymb}{'lastpost'}); |
$r->print('<tr'.$css_class.'><td><a href="'.$disclink.'">'.$forum_title.'</a> </td><td>'.&mt($type).' </td>'); |
$r->print('<tr'.$css_class.'><td>'); |
|
if ($usediv) { |
|
$r->print('<div class="LC_minheight">'); |
|
} |
|
$r->print('<a href="'.$disclink.'">'.$forum_title.'</a> '); |
|
if ($usediv) { |
|
$r->print('</div>'); |
|
} |
|
$r->print('</td>'. |
|
'<td>'.&mt($type).' </td>'); |
if ($countunread eq 'on') { |
if ($countunread eq 'on') { |
my $unreadnum = $$unread{$ressymb}{'unreadcount'}; |
my $unreadnum = $$unread{$ressymb}{'unreadcount'}; |
$r->print('<td>'.$lastpost.'</td><td class="LC_right_item">'. |
$r->print('<td>'.$lastpost.'</td><td class="LC_left_item">'. |
$unreadnum.' </td>'); |
$unreadnum.'</td>'); |
} else { |
} else { |
$r->print('<td class="LC_right_item">'.$lastpost.'</td>'); |
$r->print('<td class="LC_left_item">'.$lastpost.'</td>'); |
} |
} |
$r->print("</tr>\n"); |
$r->print("</tr>\n"); |
} |
} |
} elsif ($itemserror) { |
} elsif ($itemserror) { |
$r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><th>'.$itemserror.'</th></tr>'); |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>'.$lt{'noun'}.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><th>'.$lt{'noun'}.'</th></tr>'); |
} |
} |
} |
} |
|
|
Line 1989 sub display_coursenormalmail {
|
Line 2355 sub display_coursenormalmail {
|
my ($r,$msgcount,$newmsgs) = @_; |
my ($r,$msgcount,$newmsgs) = @_; |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
if ($msgcount > 0) { |
if ($msgcount > 0) { |
$r->print('<tr class="LC_info_row"><td class="LC_left_item">'. |
$r->print('<tr class="LC_info_row"><th class="LC_left_item">'. |
&mt('Number').'</td><td>'.&mt('Subject').'</td><td>'. |
&mt('Number').' </th><th class="LC_left_item">'. |
&mt('Sender').'</td><td class="LC_right_item">'. |
&mt('Subject').'</th><th class="LC_left_item">'. |
&mt('Date/Time').'</td></tr>'); |
&mt('Sender').'</th><th class="LC_left_item">'. |
|
&mt('Date/Time').'</th></tr>'); |
my $mailcount = 0; |
my $mailcount = 0; |
|
my $usediv; |
|
if (@{$newmsgs}) { |
|
$usediv = 1; |
|
} |
foreach my $msg (@{$newmsgs}) { |
foreach my $msg (@{$newmsgs}) { |
$mailcount ++; |
$mailcount ++; |
my $css_class = $mailcount%2?' class="LC_odd_row"':''; |
my $css_class = $mailcount%2?' class="LC_odd_row"':''; |
$r->print('<tr'.$css_class.'><td>'.$mailcount |
$r->print('<tr'.$css_class.'><td>'.$mailcount |
.'. </td><td><a href="/adm/email?display=' |
.'. </td><td>'); |
|
if ($usediv) { |
|
$r->print('<div class="LC_minheight">'); |
|
} |
|
$r->print('<a href="/adm/email?display=' |
.$msg->{'msgid'}.'">' |
.$msg->{'msgid'}.'">' |
.$msg->{'shortsub'}.'</a> </td><td> ' |
.$msg->{'shortsub'}.'</a> '); |
.$msg->{'from'}.':'.$msg->{'fromdom'}.' </td><td>' |
if ($usediv) { |
|
$r->print('</div>'); |
|
} |
|
$r->print('</td><td>' |
|
.$msg->{'from'}.':'.$msg->{'fromdom'}.' </td><td>' |
.$msg->{'sendtime'}.'</td></tr>'); |
.$msg->{'sendtime'}.'</td></tr>'); |
} |
} |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>'. |
$r->print('<tr class="LC_empty_row"><th>'. |
&mt('No new '.$lctype.' messages').'</td></tr>'); |
&mt('No new '.$lctype.' messages').'</th></tr>'); |
} |
} |
} |
} |
|
|
Line 2014 sub display_coursecritmail {
|
Line 2393 sub display_coursecritmail {
|
my ($r,$critmsgcount,$critmsgs) = @_; |
my ($r,$critmsgcount,$critmsgs) = @_; |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
if ($critmsgcount > 0) { |
if ($critmsgcount > 0) { |
$r->print('<tr class="LC_info_row"><td class="LC_left_item">'. |
$r->print('<tr class="LC_info_row"><th class="LC_left_item">'. |
&mt('Number').'</td><td>'.&mt('Subject').'</td><td>'. |
&mt('Number').'</th><th>'.&mt('Subject').'</th><th>'. |
&mt('Sender').'</td><td class="LC_right_item">'. |
&mt('Sender').'</th><th class="LC_right_item">'. |
&mt('Date/Time').'</td></tr>'); |
&mt('Date/Time').'</th></tr>'); |
my $mailcount = 0; |
my $mailcount = 0; |
|
my $usediv; |
|
if (@{$critmsgs} > 1) { |
|
$usediv = 1; |
|
} |
foreach my $msg (@{$critmsgs}) { |
foreach my $msg (@{$critmsgs}) { |
$mailcount ++; |
$mailcount ++; |
my $css_class = $mailcount%2?' class="LC_odd_row"':''; |
my $css_class = $mailcount%2?' class="LC_odd_row"':''; |
$r->print('<tr'.$css_class.'><td>'.$mailcount. |
$r->print('<tr'.$css_class.'><td>'.$mailcount. |
'. </td><td><a href="/adm/email?folder=critical">'. |
'. </td>'. |
$msg->{'shortsub'}.'</a> </td><td> '. |
'<td>'); |
|
if ($usediv) { |
|
$r->print('<div class="LC_minheight">'); |
|
} |
|
$r->print('<a href="/adm/email?folder=critical">'. |
|
$msg->{'shortsub'}.'</a> '); |
|
if ($usediv) { |
|
$r->print('</div>'); |
|
} |
|
$r->print('</td><td> '. |
$msg->{'from'}.':'.$msg->{'fromdom'}.' </td><td>'. |
$msg->{'from'}.':'.$msg->{'fromdom'}.' </td><td>'. |
$msg->{'sendtime'}.'</td></tr>'); |
$msg->{'sendtime'}.'</td></tr>'); |
} |
} |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>'. |
$r->print('<tr class="LC_empty_row"><th>'. |
&mt('No unread critical messages in '.$lctype). |
&mt('No unread critical messages in '.$lctype). |
'</td></tr>'); |
'</th></tr>'); |
} |
} |
} |
} |
|
|
Line 2091 sub store_interval_setting {
|
Line 2483 sub store_interval_setting {
|
$interval_settings{$cid.':newroleinterval'} = $env{'form.interval'}; |
$interval_settings{$cid.':newroleinterval'} = $env{'form.interval'}; |
} elsif ($context eq 'crslogin') { |
} elsif ($context eq 'crslogin') { |
$interval_settings{$cid.':crslogininterval'} = $env{'form.interval'}; |
$interval_settings{$cid.':crslogininterval'} = $env{'form.interval'}; |
|
} elsif ($context eq 'sessions') { |
|
$interval_settings{$cid.':sessionactivity'} = $env{'form.interval'}; |
} else { |
} else { |
$interval_settings{$cid.':interval'} = $env{'form.interval'}; |
$interval_settings{$cid.':interval'} = $env{'form.interval'}; |
} |
} |
Line 2163 sub store_courseinit_setting {
|
Line 2557 sub store_courseinit_setting {
|
$result = &Apache::lonhtmlcommon::confirm_success(&mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>')); |
$result = &Apache::lonhtmlcommon::confirm_success(&mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>')); |
} else { |
} else { |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Page displayed after role selection in this '.$lctype.' set to [_1].' |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Page displayed after role selection in this '.$lctype.' set to [_1].' |
,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>')); |
,'<b>'.&mt($initpage->{$env{'form.courseinit_page'}}).'</b>')); |
} |
} |
} else { |
} else { |
&Apache::lonnet::logthis('Error saving whatsnew courseinit '. |
&Apache::lonnet::logthis('Error saving whatsnew courseinit '. |
Line 2176 sub store_courseinit_setting {
|
Line 2570 sub store_courseinit_setting {
|
'<tt>'.$outcome.'</tt>'),1); |
'<tt>'.$outcome.'</tt>'),1); |
} else { |
} else { |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].' |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].' |
,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>' |
,'<b>'.&mt($initpage->{$env{'form.courseinit_page'}}).'</b>' |
,'<tt>'.$outcome.'</tt>'),1); |
,'<tt>'.$outcome.'</tt>'),1); |
} |
} |
} |
} |
Line 2249 sub start_box {
|
Line 2643 sub start_box {
|
if ($$show{$caller}) { |
if ($$show{$caller}) { |
$r->print(' |
$r->print(' |
<tr> |
<tr> |
<td class="LC_subheader" align="left"><span class="LC_nobreak"><label><input type="radio" name="logindetails" value="0" checked="checked" onclick="javascript:togglelogins();" /> '.&mt('Summary').'</label><label><input type="radio" name="logindetails" value="1" onclick="javascript:togglelogins();" /> '.&mt('Details').'</label></span></td><td class="LC_subheader"><a href="/adm/whatsnew?command=chgcrslogininterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td> |
<td class="LC_subheader" align="left"><fieldset class="LC_landmark"><legend><span class="LC_visually_hidden">'.&mt('Go').'</span></legend><span class="LC_nobreak"><label><input type="radio" name="logindetails" value="0" checked="checked" onclick="javascript:toggledetails('."'login'".');" /> '.&mt('Summary').'</label><label><input type="radio" name="logindetails" value="1" onclick="javascript:toggledetails('."'login'".');" /> '.&mt('Details').'</label></span></fieldset></td><td class="LC_subheader"><a href="/adm/whatsnew?command=chgcrslogininterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td> |
|
</tr>'); |
|
} |
|
} elsif (($caller eq 'sessions') && ($$show{$caller})) { |
|
if ($$show{$caller}) { |
|
$r->print(' |
|
<tr> |
|
<td class="LC_subheader" align="left"><fieldset class="LC_landmark"><legend><span class="LC_visually_hidden">'.&mt('Leave').'</span></legend><span class="LC_nobreak"><label><input type="radio" name="sessiondetails" value="0" checked="checked" onclick="javascript:toggledetails('."'session'".');" /> '.&mt('Summary').'</label><label><input type="radio" name="sessiondetails" value="1" onclick="javascript:toggledetails('."'session'".');" /> '.&mt('Details').'</label></span></td><td class="LC_subheader"><a href="/adm/whatsnew?command=chgsessionlimit&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td> |
</tr>'); |
</tr>'); |
} |
} |
} |
} |
|
|
$r->print(' |
$r->print(' |
<tr> |
<tr> |
<td colspan="2"> |
<td colspan="2"> |