version 1.121, 2016/11/05 13:37:49
|
version 1.130, 2024/09/11 05:20:52
|
Line 1
|
Line 1
|
|
# The LearningOnline Network |
|
# What's New in a course |
# |
# |
# $Id$ |
# $Id$ |
# |
# |
Line 87 sub handler {
|
Line 89 sub handler {
|
['mgr','handgrading',1], |
['mgr','handgrading',1], |
['vgr','abovethreshold',1], |
['vgr','abovethreshold',1], |
['vgr','haserrors',1], |
['vgr','haserrors',1], |
['whn','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], |
['mgr','resetcounters',1], |
) { |
) { |
my ($perm,$key,$check_section) = @{ $perm_check }; |
my ($perm,$key,$check_section) = @{ $perm_check }; |
Line 170 sub handler {
|
Line 173 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' |
Line 221 sub display_main_box {
|
Line 231 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 = &Apache::lonlocal::texthash ( |
firstres => "first resource in the $lctype", |
firstres => "first resource in the $lctype", |
Line 254 sub display_main_box {
|
Line 272 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); |
Line 298 END
|
Line 319 END
|
"\n"; |
"\n"; |
} |
} |
} |
} |
$scripttag.='document.visible.submit(); |
$scripttag.=<<"ENDTOGG"; |
|
document.visible.submit(); |
} |
} |
|
|
function thresholdreset() { |
function thresholdreset() { |
Line 306 function thresholdreset() {
|
Line 328 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 352 function togglelogins() {
|
Line 374 function togglelogins() {
|
} |
} |
// ]]> |
// ]]> |
</script> |
</script> |
'; |
ENDTOGG |
} |
} |
my $course_type=&Apache::loncommon::course_type(); |
my $course_type=&Apache::loncommon::course_type(); |
return &Apache::loncommon::start_page("What's New?", |
return &Apache::loncommon::start_page("What's New?", |
Line 404 sub display_actions_box {
|
Line 426 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 548 sub display_actions_box {
|
Line 572 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 588 sub display_actions_box {
|
Line 628 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 = ( |
my %actioncolumn = ( |
handgrading => 'left', |
handgrading => 'left', |
haserrors => 'left', |
haserrors => 'left', |
Line 600 sub display_actions_box {
|
Line 640 sub display_actions_box {
|
newroles => 'right', |
newroles => 'right', |
oldroles => 'right', |
oldroles => 'right', |
crslogin => 'right', |
crslogin => 'right', |
|
sessions => 'right', |
); |
); |
|
|
foreach my $key (keys(%{$checkallowed})) { |
foreach my $key (keys(%{$checkallowed})) { |
Line 614 sub display_actions_box {
|
Line 655 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 627 sub display_actions_box {
|
Line 669 sub display_actions_box {
|
$itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread,$checkallowed); |
$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 645 sub display_actions_box {
|
Line 687 sub display_actions_box {
|
if ($show{'crslogin'}) { |
if ($show{'crslogin'}) { |
$logincount = &getloggedin($cdom,$crs,\%loggedin,$crsloginstart); |
$logincount = &getloggedin($cdom,$crs,\%loggedin,$crsloginstart); |
} |
} |
|
if ($show{'sessions'}) { |
|
$sessioncount = &getsessions($cdom,$crs,\%sessions,$timediff{'sessions'},$classlist); |
|
} |
$r->print(qq|<a href="javascript:changeAll('hide');">$lt{'hial'}</a> |
$r->print(qq|<a href="javascript:changeAll('hide');">$lt{'hial'}</a> |
<a href="javascript:changeAll('show');">$lt{'shal'}</a> |
<a href="javascript:changeAll('show');">$lt{'shal'}</a> |
<form method="post" name="visible" action="/adm/whatsnew">\n|); |
<form method="post" name="visible" action="/adm/whatsnew">\n|); |
Line 674 sub display_actions_box {
|
Line 719 sub display_actions_box {
|
$r->print('</td><td> </td><td class="LC_right_col" >'); |
$r->print('</td><td> </td><td class="LC_right_col" >'); |
$currcolumn = 'right'; |
$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 ++; |
} |
} |
} |
} |
Line 724 sub display_threshold_config {
|
Line 769 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 755 sub display_interval_config {
|
Line 805 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 765 sub display_interval_config {
|
Line 817 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 780 sub display_interval_config {
|
Line 834 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 930 sub display_launcher {
|
Line 991 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 958 sub display_launcher {
|
Line 1020 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 1033 sub getitems {
|
Line 1098 sub getitems {
|
$triggered,$threshold,$warnings, |
$triggered,$threshold,$warnings, |
$checkallowed); |
$checkallowed); |
} |
} |
|
|
} |
} |
return; |
return; |
} |
} |
Line 1064 sub check_discussions {
|
Line 1128 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 1078 sub check_handgraded {
|
Line 1158 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 1174 sub check_thresholds {
|
Line 1255 sub check_thresholds {
|
<td>'.$stats{$part}{degdiff}.'</td> |
<td>'.$stats{$part}{degdiff}.'</td> |
<td>'.$lastreset{$part}.'</td>'; |
<td>'.$lastreset{$part}.'</td>'; |
if ($checkallowed->{'resetcounters'}) { |
if ($checkallowed->{'resetcounters'}) { |
|
my $aria = ' aria-label="'.&mt('Reset counter for [_1] (part [_2])', |
|
$$triggered{$symb}{title},$part).'"'; |
$$triggered{$symb}{text}[$partcount] .= |
$$triggered{$symb}{text}[$partcount] .= |
'<td><input type="checkbox" name="'.$resetname.'" />'. |
'<td><input type="checkbox" name="'.$resetname.'"'.$aria.' />'. |
'<input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>'; |
'<input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>'; |
} |
} |
$partcount ++; |
$partcount ++; |
Line 1241 sub get_current {
|
Line 1324 sub get_current {
|
sub process_reset { |
sub process_reset { |
my ($dom,$crs,$checkallowed) = @_; |
my ($dom,$crs,$checkallowed) = @_; |
if (!$checkallowed->{'resetcounters'}) { |
if (!$checkallowed->{'resetcounters'}) { |
return '<b>'.&mt('You do not the required privileges to reset counters'). |
return '<b>'.&mt('You do not have the required privileges to reset counters'). |
'</b><br />'; |
'</b><br />'; |
} |
} |
my $result = '<b>'.&mt('Counters reset for following problems (and parts):'). |
my $result = '<b>'.&mt('Counters reset for following problems (and parts):'). |
Line 1325 sub getnormalmail {
|
Line 1408 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 1337 sub getnormalmail {
|
Line 1421 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 1358 sub getcritmail {
|
Line 1442 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 1369 sub getcritmail {
|
Line 1454 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 1614 sub getloggedin {
|
Line 1699 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 1669 sub display_handgrade {
|
Line 1826 sub display_handgrade {
|
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'; |
} |
} |
$linkurl.='&command=ungraded'; |
|
$r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>'); |
$r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>'); |
} |
} |
} elsif ($itemserror) { |
} elsif ($itemserror) { |
Line 1880 sub display_rolechanges {
|
Line 2048 sub display_rolechanges {
|
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 1889 sub display_crslogins {
|
Line 2057 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') { |
|
$lt{'number'} = &mt('Total number of active user sessions'); |
|
$lt{'active'} = &mt('Last active'); |
|
$prefix = 'session'; |
|
} |
|
if ($count) { |
|
|
my $hdr = '<tr class="LC_info_row" style="display:none" id="logintitledet">'. |
my $hdr = '<tr class="LC_info_row" style="display:none" id="'.$prefix.'titledet">'. |
'<td class="LC_left_item">'.$lt{'user'}.'</td>'. |
'<td class="LC_left_item">'.$lt{'user'}.'</td>'. |
'<td class="LC_left_item">'.$lt{'role'}.'</td>'. |
'<td class="LC_left_item">'.$lt{'role'}.'</td>'. |
'<td class="LC_left_item">'.$lt{'sec'}.'</td></tr>'. |
'<td class="LC_left_item">'.$lt{'sec'}.'</td>'; |
'<tr class="LC_info_row" id="logintitlesum">'. |
if ($context eq 'sessions') { |
'<td class="LC_left_item">'.$lt{'number'}.'</td>'. |
$hdr .= '<td class="LC_left_item">'.$lt{'active'}.'</td>'; |
'<td class="LC_left_item">'.$lt{'role'}.'</td>'. |
} |
'<td class="LC_left_item">'.$lt{'sec'}; |
$hdr .= '</tr>'."\n". |
|
'<tr class="LC_info_row" id="'.$prefix.'titlesum">'. |
|
'<td class="LC_left_item">'.$lt{'number'}.'</td>'. |
|
'<td class="LC_left_item">'.$lt{'role'}.'</td>'. |
|
'<td 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) { |
foreach my $item (@items) { |
if (ref($loggedin->{$item}) eq 'ARRAY') { |
if (ref($details->{$item}) eq 'ARRAY') { |
foreach my $user (@{$loggedin->{$item}}) { |
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 1928 sub display_crslogins {
|
Line 2105 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>'.$link.'</td>'. |
'<td>'.$link.'</td>'. |
'<td>'.$role.'</td>'. |
'<td>'.$role.'</td>'. |
'<td>'.$section.'</td>'; |
'<td>'.$section.'</td>'); |
if ($context eq 'sessions') { |
|
$entry .= '<td>'.&Apache::lonlocal::locallocaltime($item).'</td>'; |
|
} |
|
push(@{$bylastname{$fullname}},$entry); |
} |
} |
} |
} |
} |
} |
Line 1940 sub display_crslogins {
|
Line 2120 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 1953 sub display_crslogins {
|
Line 2133 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); |
'" /></td></tr>'.$table); |
} |
} |
} else { |
} else { |
$r->print('<tr class="LC_empty_row"><td>'. |
$r->print('<tr class="LC_empty_row"><td>'. |
&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>'); |
'." /></td></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()); |
Line 2135 sub store_interval_setting {
|
Line 2315 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 2293 sub start_box {
|
Line 2475 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"><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></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"><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"> |