[LON-CAPA-cvs] cvs: loncom /interface courseprefs.pm loncommon.pm lonfeedback.pm
raeburn
raeburn at source.lon-capa.org
Mon Oct 18 18:29:20 EDT 2021
raeburn Mon Oct 18 22:29:20 2021 EDT
Modified files:
/loncom/interface courseprefs.pm loncommon.pm lonfeedback.pm
Log:
- Bug 6907
Configuration for a numbered menu collection includes option to hide
footer shown below a resource, and/or hide Discussion or Feedback links.
-------------- next part --------------
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.93 loncom/interface/courseprefs.pm:1.94
--- loncom/interface/courseprefs.pm:1.93 Wed Aug 4 19:59:10 2021
+++ loncom/interface/courseprefs.pm Mon Oct 18 22:29:20 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set configuration settings for a course
#
-# $Id: courseprefs.pm,v 1.93 2021/08/04 19:59:10 raeburn Exp $
+# $Id: courseprefs.pm,v 1.94 2021/10/18 22:29:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -995,8 +995,8 @@
}
}
}
-
}
+
foreach my $idx (@items) {
my $itemid = $itemids{$idx};
next unless ($itemid);
@@ -4076,8 +4076,8 @@
}
if ($position eq 'top') {
my $includeempty = 0;
- $datatable .= '</td><td align="right">'.
- &user_table($cdom,$item,\@sections,
+ $datatable .= '</td><td align="right">'.
+ &user_table($cdom,$item,\@sections,
$settings->{$item},\%lt,$noedit);
} else {
$datatable .= &Apache::lonhtmlcommon::textbox($item.'.text',
@@ -4300,8 +4300,8 @@
'<table>'.&role_checkboxes($cdom,$cnum,$item,$settings,undef,undef,$noedit).
'</table>';
} elsif ($item eq 'plc.users.denied') {
- $datatable .= '</td><td align="right">'.
- &user_table($cdom,$item,undef,
+ $datatable .= '</td><td align="right">'.
+ &user_table($cdom,$item,undef,
$settings->{$item},\%lt,$noedit);
} elsif ($item eq 'pch.roles.denied') {
$datatable .= '</td><td align="right">'.
@@ -5064,7 +5064,7 @@
my %checked;
my $on = ' checked="checked"';
foreach my $key (keys(%{$menu{$num}})) {
- if (($key eq 'top') || ($key eq 'inline') || ($key eq 'main')) {
+ if (($key eq 'top') || ($key eq 'inline') || ($key eq 'foot') || ($key eq 'main')) {
if ($menu{$num}{$key} eq 'y') {
$checked{$key} = $on;
}
@@ -5081,7 +5081,13 @@
foreach my $category (@order) {
if ((ref($categories{$category}) eq 'ARRAY') && (@{$categories{$category}} > 0)) {
$datatable .= '<fieldset style="vertical-align:top; display:inline-block"><legend>'.$menutitles{$category}.'</legend>'."\n";
+ if ($category eq 'text') {
+ $datatable .= '<i>'.&mt('Header').'</i><br />';
+ }
foreach my $field (@{$categories{$category}}) {
+ if ($field eq 'disc') {
+ $datatable .= '<br /><i>'.&mt('Footer').'</i><br />';
+ }
$datatable .= '<label><input type="checkbox" name="menucollections_'.$num.'" value="'.$field.'"'.$checked{$field}.$disabled.' />'.
$menufields{$field}.'</label><br />';
}
@@ -5131,8 +5137,8 @@
sub menuitems_categories {
my @order = ('shown','text','links','list','inline');
my %categories = (
- shown => ['top','inline','main'],
- text => ['name','role','crs'],
+ shown => ['top','inline','foot','main'],
+ text => ['name','role','crs','disc','fdbk'],
links => ['pers','logo','menu','comm','roles','help','logout'],
list => ['about','prefs','port','wish','anno','rss'],
inline => ['cont','grades','chat','people','groups','resv','syll','feeds'],
@@ -5143,7 +5149,7 @@
sub menuitems_titles {
return &Apache::lonlocal::texthash (
shown => 'Hierarchy',
- text => 'Header text',
+ text => 'Text',
links => 'Header links',
list => 'Drop-down list',
inline => 'Inline links',
@@ -5154,6 +5160,7 @@
return &Apache::lonlocal::texthash (
top => 'Display header',
inline => 'Display inline menu',
+ foot => 'Display footer',
main => 'Access to main menu',
pers => 'Personal',
logo => 'LON-CAPA',
@@ -5165,6 +5172,8 @@
name => 'Fullname',
crs => 'Course Title',
role => 'Current Role',
+ disc => 'Discussion',
+ fdbk => 'Feedback',
about => 'Information',
prefs => 'Preferences',
port => 'Portfolio',
@@ -5206,7 +5215,7 @@
foreach my $num (@current) {
my %checked;
foreach my $key (keys(%{$menu{$num}})) {
- if (($key eq 'top') || ($key eq 'inline') || ($key eq 'main')) {
+ if (($key eq 'top') || ($key eq 'inline') || ($key eq 'foot') || ($key eq 'main')) {
if ($menu{$num}{$key} eq 'y') {
$checked{$key} = 1;
}
@@ -5224,7 +5233,13 @@
if ((ref($categories{$category}) eq 'ARRAY') && (@{$categories{$category}} > 0)) {
$output .= '<fieldset style="vertical-align:top; display:inline-block">'.
'<legend>'.$menutitles{$category}.'</legend>'."\n";
+ if ($category eq 'text') {
+ $output .= '<b>'.&mt('Header Text').'</b><br /><br />';
+ }
foreach my $field (@{$categories{$category}}) {
+ if ($field eq 'disc') {
+ $output .= '<br /><b>'.&mt('Footer Text').'</b><br /><br />';
+ }
if ($checked{$field}) {
$output .= &Apache::lonhtmlcommon::confirm_success($menufields{$field});
} else {
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1367 loncom/interface/loncommon.pm:1.1368
--- loncom/interface/loncommon.pm:1.1367 Sat Sep 25 20:35:26 2021
+++ loncom/interface/loncommon.pm Mon Oct 18 22:29:20 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1367 2021/09/25 20:35:26 raeburn Exp $
+# $Id: loncommon.pm,v 1.1368 2021/10/18 22:29:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -18839,7 +18839,7 @@
my @entries = split(/\&/,$value);
foreach my $entry (@entries) {
my ($name,$fields) = split(/=/,$entry);
- if (($name eq 'top') || ($name eq 'inline') || ($name eq 'main')) {
+ if (($name eq 'top') || ($name eq 'inline') || ($name eq 'foot') || ($name eq 'main')) {
$menu{$name} = $fields;
} else {
my @shown;
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.384 loncom/interface/lonfeedback.pm:1.385
--- loncom/interface/lonfeedback.pm:1.384 Fri Dec 18 15:23:02 2020
+++ loncom/interface/lonfeedback.pm Mon Oct 18 22:29:20 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.384 2020/12/18 15:23:02 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.385 2021/10/18 22:29:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -118,10 +118,16 @@
$outputtarget = 'export';
}
}
+ my ($nofooter,$nodisclink,$nofdbklink);
if (not &discussion_visible($status)) {
if ($mode ne 'board') {
- &Apache::lonenc::check_encrypt(\$ressymb);
- return '<br /><div class="LC_feedback_link">'.&send_message_link($ressymb)."</div>";
+ ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll();
+ if ($nofooter || $nofdbklink) {
+ return '<br />';
+ } else {
+ &Apache::lonenc::check_encrypt(\$ressymb);
+ return '<br /><div class="LC_feedback_link">'.&send_message_link($ressymb)."</div>";
+ }
}
}
if ($group ne '' && $mode eq 'board') {
@@ -136,13 +142,21 @@
$blocktext = '<br /><div class="LC_feedback_link"><span class="LC_feedback_link">'.$blocktext."</span>";
&Apache::lonenc::check_encrypt(\$ressymb);
if ($mode ne 'board') {
- $blocktext.=&send_message_link($ressymb).'</div>';
+ ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll();
+ unless ($nofooter || $nofdbklink) {
+ $blocktext.=&send_message_link($ressymb);
+ }
+ $blocktext.='</div>';
}else{
$blocktext.="</div>";
}
return $blocktext;
}
+ unless ($outputtarget eq 'export') {
+ ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll();
+ }
+
my @bgcols = ("LC_disc_old_item","LC_disc_new_item");
my $discussiononly=0;
if ($mode eq 'board') { $discussiononly=1; }
@@ -774,33 +788,60 @@
&mt('This discussion is closed.').'</span>';
}
} elsif ($outputtarget ne 'tex') {
- $discussion.='<div class="LC_feedback_link">';
- if (&discussion_open($status) &&
- &Apache::lonnet::allowed('pch',
- $env{'request.course.id'}.
- ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
- $discussion.= &send_feedback_link($ressymb);
- if ($env{'request.role.adv'}) {
- my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
- my $canvote = &Apache::lonnet::EXT('resource.0.discussvote',$ressymb);
- if (defined($close) && $close ne '' && $close < time) {
- if ($canvote eq 'notended') {
- $discussion .= ' '.&mt('(Posting and voting closed for [_1] roles)',
- &Apache::lonnet::plaintext('st',$crstype));
- } else {
- $discussion .= ' '.&mt('(Closed for [_1] roles)',
- &Apache::lonnet::plaintext('st',$crstype));
+ unless ($nofooter) {
+ $discussion.='<div class="LC_feedback_link">';
+ unless ($nodisclink) {
+ if (&discussion_open($status) &&
+ &Apache::lonnet::allowed('pch',
+ $env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
+ $discussion.= &send_feedback_link($ressymb);
+ if ($env{'request.role.adv'}) {
+ my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
+ my $canvote = &Apache::lonnet::EXT('resource.0.discussvote',$ressymb);
+ if (defined($close) && $close ne '' && $close < time) {
+ if ($canvote eq 'notended') {
+ $discussion .= ' '.&mt('(Posting and voting closed for [_1] roles)',
+ &Apache::lonnet::plaintext('st',$crstype));
+ } else {
+ $discussion .= ' '.&mt('(Closed for [_1] roles)',
+ &Apache::lonnet::plaintext('st',$crstype));
+ }
+ }
}
+ } else {
+ $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';
}
}
- } else {
- $discussion.= '<span class="LC_feedback_link">'.&mt('This discussion is closed.').'</span>';
+ unless ($nofdbklink) {
+ $discussion.= &send_message_link($ressymb);
+ }
+ $discussion.='</div>';
}
- $discussion.= &send_message_link($ressymb).'</div>';
}
return $discussion;
}
+sub check_menucoll {
+ my ($nofooter,$nodisclink,$nofdbklink);
+ my ($menucoll,$deeplinkmenu,$menuref) = &Apache::loncommon::menucoll_in_effect();
+ if ($menucoll) {
+ if (ref($menuref) eq 'HASH') {
+ if ($menuref->{'foot'} eq 'n') {
+ $nofooter = 1;
+ } else {
+ unless ($menuref->{'disc'}) {
+ $nodisclink = 1;
+ }
+ unless ($menuref->{'fdbk'}) {
+ $nofdbklink = 1;
+ }
+ }
+ }
+ }
+ return ($nofooter,$nodisclink,$nofdbklink);
+}
+
sub can_see_hidden {
my ($mode,$ressymb,$feedurl,$group,$cdom,$cnum,$crs) = @_;
my $seehidden;
More information about the LON-CAPA-cvs
mailing list