-
-
-
-
-
-
-
-
-
- Threshold Name |
- Current value |
- Change? |
- ');
- my $rowNum =0;
+ $r->print('
| |
-
+ $r->print(&Apache::loncommon::end_data_table()."\n".
+ '
');
@@ -537,10 +514,10 @@ sub display_interval_config {
my $lctype = lc(&Apache::loncommon::course_type());
my $current = &get_current($env{'user.name'},$env{'user.domain'},
$env{'request.course.id'},'interval');
- $r->print(' '.&mt('Choose the time window to use for display of version changes for resources in the '.$lctype.'.'));
+ $r->print(' '.&mt('Choose the time window to use for display of version changes for resources in the '.$lctype.'.').' ');
unless ($current eq '') {
- $r->print(' '.&mt('Current value is [_1]',''.
- $$interval_titles{$current}.'.'));
+ $r->print(' '.&mt('Current value is [_1].',''.
+ $$interval_titles{$current}.''));
}
$r->print('
');
@@ -681,36 +658,30 @@ sub curr_courseinit {
}
sub display_launcher {
- my ($r,$action,$refpage,$checkallowed,$tabbg,$rowColor1,$rowColor2,$show,
- $headings,$res_title,$tograde,$ungraded,$bombs,$bombed,$changed,
- $warnings,$triggered,$newdiscussions,$unread,$msgcount,$newmsgs,
- $critmsgcount,$critmsgs,$interval,$countunread) = @_;
+ my ($r,$action,$refpage,$checkallowed,$show,$headings,$res_title,
+ $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered,
+ $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs,
+ $interval,$countunread) = @_;
if ($$checkallowed{$action}) {
- &start_box($r,$tabbg,$show,$headings,$action,$refpage);
+ &start_box($r,$show,$headings,$action,$refpage,$action);
if ($$show{$action}) {
if ($action eq 'handgrading') { # UNGRADED ITEMS
- &display_handgrade($r,$tograde,$rowColor1,$rowColor2,
- $ungraded);
+ &display_handgrade($r,$tograde,$ungraded);
} elsif ($action eq 'haserrors') { # BOMBS
- &display_haserrors($r,$bombs,$rowColor1,$rowColor2,$bombed,
- $res_title);
+ &display_haserrors($r,$bombs,$bombed,$res_title);
} elsif ($action eq 'versionchanges') { # VERSION CHANGES
- &display_versionchanges($r,$changed,$res_title,$rowColor1,
- $rowColor2,$interval);
-
+ &display_versionchanges($r,$changed,$res_title,$interval);
} elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS
&display_abovethreshold($r,$refpage,$warnings,$triggered,
- $res_title);
+ $res_title);
} elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION
&display_coursediscussion($r,$newdiscussions,$unread,
- $countunread,$res_title,$rowColor1,$rowColor2);
+ $countunread,$res_title);
} elsif ($action eq 'coursenormalmail') { # NORMAL MESSAGES
- &display_coursenormalmail($r,$msgcount,$newmsgs,$rowColor1,
- $rowColor2);
+ &display_coursenormalmail($r,$msgcount,$newmsgs);
} elsif ($action eq 'coursecritmail') { # CRITICAL MESSAGES
- &display_coursecritmail($r,$critmsgcount,$critmsgs,$rowColor1,
- $rowColor2);
+ &display_coursecritmail($r,$critmsgcount,$critmsgs);
}
}
&end_box($r);
@@ -720,8 +691,8 @@ sub display_launcher {
sub getitems {
my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions,
- $tograde,$bombs,$warnings,$rowColor1,$rowColor2,$threshold,$cdom,$crs,
- $res_title,$show,$starttime,$countunread) = @_;
+ $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show,
+ $starttime,$countunread) = @_;
my $navmap = Apache::lonnavmaps::navmap->new();
# force retrieve Resource to seed the part id cache we'll need it later
my @allres=$navmap->retrieveResources(undef,
@@ -739,7 +710,6 @@ sub getitems {
$cdom,$crs);
}
- my $warningnum = 0;
foreach my $resource (@allres) {
my $result = '';
my $applies = 0;
@@ -748,6 +718,10 @@ sub getitems {
%{$$ungraded{$symb}} = ();
%{$$triggered{$symb}} = ();
$$triggered{$symb}{numparts} = 0;
+ if ($resource->encrypted()) {
+ $$triggered{$symb}{'enclink'} = $resource->link();
+ $$triggered{$symb}{'encsymb'} = $resource->shown_symb();
+ }
my $title = $resource->compTitle();
$$res_title{$symb} = $title;
my $ressymb = $resource->wrap_symb();
@@ -773,9 +747,8 @@ sub getitems {
# Maxtries and degree of difficulty for problem parts, unless handgradeable
if ($$show{'abovethreshold'}) {
- $warningnum = &check_thresholds($resource,$symb,\%resourcetracker,
- $triggered,$threshold,$warnings,
- $warningnum,$rowColor1,$rowColor2);
+ &check_thresholds($resource,$symb,\%resourcetracker,
+ $triggered,$threshold,$warnings);
}
}
@@ -790,12 +763,17 @@ sub check_discussions {
%{$$unread{$ressymb}} = ();
$$unread{$ressymb}{'title'} = $title;
$$unread{$ressymb}{'symb'} = $symb;
+ if ($resource->encrypted()) {
+ $$unread{$ressymb}{'enclink'} = $resource->link();
+ $$unread{$ressymb}{'encsymb'} = $resource->shown_symb();
+ }
push(@{$newdiscussions}, $ressymb);
$$unread{$ressymb}{'lastpost'} = $resource->last_post_time();
if ($countunread eq 'on') {
- $$unread{$ressymb}{'unreadcount'} = $resource->unread_discussion();
+ $$unread{$ressymb}{'unreadcount'} =
+ $resource->discussion_info('unread');
}
}
@@ -816,7 +794,11 @@ sub check_handgraded {
if (@ungraded > 0) {
$$ungraded{$symb}{count} = scalar(@ungraded);
$$ungraded{$symb}{title} = $title;
- push(@{$tograde}, $symb);
+ if ($resource->encrypted()) {
+ $$ungraded{$symb}{'enclink'} = $resource->link();
+ $$ungraded{$symb}{'encsymb'} = $resource->shown_symb();
+ }
+ push(@{$tograde},$symb);
}
}
}
@@ -839,14 +821,12 @@ sub check_bombed {
}
sub check_thresholds {
- my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings,
- $warningnum,$rowColor1,$rowColor2) = @_;
+ my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_;
# Compile maxtries and degree of difficulty for problem parts, unless handgradeable
my @parts = @{$resource->parts()};
my %stats;
my %lastreset = ();
my $warning = 0;
- my $rowColor;
foreach my $part (@parts) {
if ($resource->handgrade($part) eq 'yes') {
next;
@@ -885,46 +865,42 @@ sub check_thresholds {
}
}
if ($warning) {
- if ($warningnum%2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
- $$triggered{$symb}{rowColor} = $rowColor;
$$triggered{$symb}{title} = $resource->title;
+ my $partcount = 0;
+ @{$$triggered{$symb}{text}} = ();
foreach my $part (@parts) {
if (exists($stats{$part}{users})) {
my $resetname = 'reset_'.&escape($symb."\0".$part);
my $resettitle = 'title_'.&escape($symb."\0".$part);
- if ($$triggered{$symb}{numparts}) {
- $$triggered{$symb}{text} .= ' |
');
+ $r->print('
| ');
} else {
- $r->print(' '.$lt{'nopr'}.'
| ');
+ $r->print(''.$lt{'nopr'}.' | ');
}
}
sub display_versionchanges {
- my ($r,$changed,$res_title,$rowColor1,$rowColor2,$interval) = @_;
+ my ($r,$changed,$res_title,$interval) = @_;
my %lt = &Apache::lonlocal::texthash(
'reso' => 'Resource',
'revd' => 'Last revised',
@@ -1240,35 +1241,35 @@ sub display_versionchanges {
'veru' => 'Version used',
'noup' => 'No updated versions',
);
- my $rowColor;
if (keys(%{$changed}) > 0) {
- $r->print(''.$lt{'reso'}.' | '.$lt{'revd'}.' | '.$lt{'newv'}.' | '.$lt{'veru'}.' | ');
-
-
+ $r->print(''.
+ $lt{'reso'}.' | '.$lt{'revd'}.' | '.
+ $lt{'newv'}.' | '.
+ $lt{'veru'}.' | ');
my @changes = sort { &cmp_title($a,$b,$res_title) } keys(%{$changed});
my $changenum = 0;
foreach my $item (@changes) {
- if ($changenum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
+ $changenum ++;
+ my $css_class = $changenum%2?' class="LC_odd_row"':'';
my ($map,$id,$url)=&Apache::lonnet::decode_symb($item);
my $linkurl=&Apache::lonnet::clutter($url);
$linkurl .= '?symb='.&escape($item);
- $r->print(''.$$res_title{$item}.' | '.$$changed{$item}{'revdate'}.' | '.$$changed{$item}{'current'}.' | '.$$changed{$item}{'version'}.' | ');
- $changenum ++;
+ $r->print(''.
+ $$res_title{$item}.' | '.
+ $$changed{$item}{'revdate'}.' | '.
+ $$changed{$item}{'current'}.' | '.
+ $$changed{$item}{'version'}.' | ');
}
} else {
- $r->print(' '.$lt{'noup'}.' '.$interval.'
| ');
+ $r->print(''.$lt{'noup'}.
+ ' '.$interval.' | ');
}
return;
}
sub display_coursediscussion {
- my ($r,$newdiscussions,$unread,$countunread,$res_title,$rowColor1,
- $rowColor2) = @_;
+ my ($r,$newdiscussions,$unread,$countunread,$res_title) = @_;
my $lctype = lc(&Apache::loncommon::course_type());
my %lt = &Apache::lonlocal::texthash(
'loca' => 'Location',
@@ -1277,97 +1278,96 @@ sub display_coursediscussion {
'noun' => 'No unread posts in '.$lctype.' discussions',
'tmlp' => 'Time of last post',
);
- my $rowColor;
if (@{$newdiscussions} > 0) {
- $r->print(''.$lt{'loca'}.
- ' | '.$lt{'type'}.
- '');
+ $r->print(' | '.
+ $lt{'loca'}.' | '.
+ $lt{'type'}.' | ');
if ($countunread eq 'on') {
- $r->print(''.$lt{'tmlp'}.' | '.
- ''.$lt{'numn'}.
- ' | ');
+ $r->print(''.$lt{'tmlp'}.' | '.
+ ''.$lt{'numn'}.' | ');
} else {
- $r->print(''.$lt{'tmlp'}.
- ' | ');
+ $r->print(''.$lt{'tmlp'}.' | ');
}
$r->print(" \n");
@{$newdiscussions} = sort { &cmp_title($a,$b,$res_title) }
@{$newdiscussions};
my $rowNum = 0;
foreach my $ressymb (@{$newdiscussions}) {
+ $rowNum ++;
my $forum_title = $$unread{$ressymb}{'title'};
my $type = 'Resource';
my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);
+ my $disclink = $feedurl.'?symb='.$$unread{$ressymb}{symb};
if ($feedurl =~ /bulletinboard/) {
$type = 'Bulletin Board';
}
- if ($rowNum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
+ if ($$unread{$ressymb}{'enclink'}) {
+ $disclink = $$unread{$ressymb}{'enclink'}.'?symb='.$$unread{$ressymb}{'encsymb'};
}
+ my $css_class = $rowNum%2?' class="LC_odd_row"':'';
my $lastpost = &Apache::lonnavmaps::timeToHumanString(
$$unread{$ressymb}{'lastpost'});
- $r->print(''.$forum_title.' | '.$type.' | ');
+ $r->print(' '.$forum_title.' | '.&mt($type).' | ');
if ($countunread eq 'on') {
my $unreadnum = $$unread{$ressymb}{'unreadcount'};
- $r->print(''.$lastpost.' | '.
- '',$unreadnum.' | ');
+ $r->print(''.$lastpost.' | '.
+ $unreadnum.' | ');
} else {
- $r->print(''.$lastpost.' | ');
+ $r->print(''.$lastpost.' | ');
}
$r->print(" \n");
- $rowNum ++;
}
} else {
- $r->print(' '.
- $lt{'noun'}.'
| ');
+ $r->print(''.$lt{'noun'}.' | ');
}
}
sub display_coursenormalmail {
- my ($r,$msgcount,$newmsgs,$rowColor1,$rowColor2) = @_;
- my $rowColor;
+ my ($r,$msgcount,$newmsgs) = @_;
my $lctype = lc(&Apache::loncommon::course_type());
if ($msgcount > 0) {
- $r->print(''.&mt('Number').' | '.&mt('Subject').' | '.&mt('Sender').' | '.&mt('Date/Time').' | ');
- my $rowNum = 0;
- my $mailcount = 1;
+ $r->print(''.
+ &mt('Number').' | '.&mt('Subject').' | '.
+ &mt('Sender').' | '.
+ &mt('Date/Time').' | ');
+ my $mailcount = 0;
foreach my $msg (@{$newmsgs}) {
- if ($rowNum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
- $r->print(''.$mailcount.'. | '.$msg->{'shortsub'}.' | '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' | '.$msg->{'sendtime'}.' | ');
- $rowNum ++;
$mailcount ++;
+ my $css_class = $mailcount%2?' class="LC_odd_row"':'';
+ $r->print(''.$mailcount.
+ '. | '.
+ $msg->{'shortsub'}.' | '.
+ $msg->{'from'}.':'.$msg->{'fromdom'}.' | '.
+ $msg->{'sendtime'}.' | ');
}
} else {
- $r->print(' '.&mt('No new '.$lctype.' messages').'
| ');
+ $r->print(''.
+ &mt('No new '.$lctype.' messages').' | ');
}
}
sub display_coursecritmail {
- my ($r,$critmsgcount,$critmsgs,$rowColor1,$rowColor2) = @_;
- my $rowColor;
+ my ($r,$critmsgcount,$critmsgs) = @_;
my $lctype = lc(&Apache::loncommon::course_type());
if ($critmsgcount > 0) {
- $r->print(''.&mt('Number').' | '.&mt('Subject').' | '.&mt('Sender').' | '.&mt('Date/Time').' | ');
- my $rowNum = 0;
- my $mailcount = 1;
+ $r->print(''.
+ &mt('Number').' | '.&mt('Subject').' | '.
+ &mt('Sender').' | '.
+ &mt('Date/Time').' | ');
+ my $mailcount = 0;
foreach my $msg (@{$critmsgs}) {
- if ($rowNum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
- $r->print(''.$mailcount.'. | '.$msg->{'shortsub'}.' | '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' | '.$msg->{'sendtime'}.' | ');
- $rowNum ++;
$mailcount ++;
+ my $css_class = $mailcount%2?' class="LC_odd_row"':'';
+ $r->print(''.$mailcount.
+ '. | '.
+ $msg->{'shortsub'}.' | '.
+ $msg->{'from'}.':'.$msg->{'fromdom'}.' | '.
+ $msg->{'sendtime'}.' | ');
}
} else {
- $r->print(' '.&mt('No unread critical messages in '.$lctype).'
| ');
+ $r->print(''.
+ &mt('No unread critical messages in '.$lctype).
+ ' | ');
}
}
@@ -1425,11 +1425,11 @@ sub store_interval_setting {
\%interval_settings,$udom,$uname);
if ($outcome eq 'ok') {
$result = &mt('Interval set to version changes [_1]',
- ''.$$interval_titles{$env{'form.interval'}}.' ');
+ ''.$$interval_titles{$env{'form.interval'}}.'').' ';
} else {
my $lctype = lc(&Apache::loncommon::course_type());
- &Apache::lonnet::logthis('Error storing whatsnew interval setting'.
+ &Apache::lonnet::logthis('Error saving whatsnew interval setting'.
' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
$result = &mt('Unable to set interval to [_1] due to [_2].',
''.$$interval_titles{$env{'form.interval'}}.'',
@@ -1449,15 +1449,15 @@ sub store_discussion_setting {
\%discussion_settings,$udom,$uname);
if ($outcome eq 'ok') {
$result = &mt('Count unread posts in discussions display set to [_1]',
- ''.$env{'form.countunread'}.' ');
+ ''.&mt($env{'form.countunread'}).'').' ';
} else {
my $lctype = lc(&Apache::loncommon::course_type());
- &Apache::lonnet::logthis('Error storing whatsnew countunread setting'.
+ &Apache::lonnet::logthis('Error saving whatsnew countunread setting'.
' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
$result = &mt('Unable to set "number unread posts display" to [_1]'.
' due to [_2].',
- ''.$env{'form.countunread'}.'',
+ ''.&mt($env{'form.countunread'}).'',
''.$outcome.'. ');
}
}
@@ -1491,7 +1491,7 @@ sub store_courseinit_setting {
$result = &mt('Page displayed after role selection in this '.$lctype.' set to [_2]',$lctype,$$initpage{$env{'form.courseinit_page'}});
}
} else {
- &Apache::lonnet::logthis('Error storing whatsnew courseinit '.
+ &Apache::lonnet::logthis('Error saving whatsnew courseinit '.
'setting: '.$outcome.' for '.$uname.
':'.$udom.' in '.$lctype.' '.$cid);
if ($page_control eq 'global preferences') {
@@ -1510,7 +1510,7 @@ sub store_courseinit_setting {
}
sub start_box {
- my ($r,$tabbg,$show,$heading,$caller,$refpage) = @_;
+ my ($r,$show,$heading,$caller,$refpage) = @_;
my %lt = &Apache::lonlocal::texthash(
chth => 'Change thresholds?',
chin => 'Change interval?',
@@ -1519,54 +1519,47 @@ sub start_box {
my $showhide;
if ($$show{$caller}) {
$showhide = 'Hide';
+ 'display_'.$caller.",'hide'".');">'.
+ &mt('Hide').'';
} else {
$showhide = 'Show';
+ 'display_'.$caller.",'show'".');">'.
+ &mt('Show').'';
}
$r->print('
-
+
-
-
-
-
-
-
- '.$$heading{$caller}.' |
- '.$showhide.' |
-
-
- |
- ');
+ '.$$heading{$caller}.' |
+ '.$showhide.' |
+ ');
if (($caller eq 'abovethreshold') && ($$show{$caller})) {
if ($$show{$caller}) {
$r->print('
- '.$lt{'chth'}.' |
+
');
}
} elsif (($caller eq 'versionchanges') && ($$show{$caller})) {
if ($$show{$caller}) {
$r->print('
- '.$lt{'chin'}.' |
+
');
}
} elsif ($caller eq 'coursediscussion') {
if ($$show{$caller}) {
$r->print('
- '.$lt{'chop'}.' |
+
');
}
}
- $r->print('
+ $r->print('
-
-
+
+
');
return;
}
@@ -1574,9 +1567,6 @@ sub start_box {
sub end_box {
my ($r) = shift;
$r->print('
-
- |
-
|
| |