[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm
www
lon-capa-cvs@mail.lon-capa.org
Thu, 10 Nov 2005 11:31:06 -0000
This is a MIME encoded message
--www1131622266
Content-Type: text/plain
www Thu Nov 10 06:31:06 2005 EDT
Modified files:
/loncom/interface lonfeedback.pm
Log:
Bug #4413: Anonymous not talking to Anonymous (number participants)
Links to appropriate preferences
Deal with "+" in filenames (need to escape symb in links)
--www1131622266
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20051110063106.txt"
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.172 loncom/interface/lonfeedback.pm:1.173
--- loncom/interface/lonfeedback.pm:1.172 Wed Nov 9 06:41:02 2005
+++ loncom/interface/lonfeedback.pm Thu Nov 10 06:31:04 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.172 2005/11/09 11:41:02 www Exp $
+# $Id: lonfeedback.pm,v 1.173 2005/11/10 11:31:04 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -237,7 +237,8 @@
my %notshown = ();
my %newitem = ();
my $maxdepth=0;
-
+ my %anonhash=();
+ my $anoncnt=0;
my $target='';
unless ($env{'browser.interface'} eq 'textual' ||
$env{'environment.remote'} eq 'off' ) {
@@ -248,7 +249,7 @@
$discinfo{$visitkey} = $visit;
&Apache::lonnet::put('nohist_'.$cid.'_discuss',\%discinfo,$env{'user.domain'},$env{'user.name'});
- &build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,$statusfilter,$toggkey,$outputtarget);
+ &build_posting_display(\%usernamesort,\%subjectsort,\%namesort,\%notshown,\%newitem,\%dischash,\%shown,\%alldiscussion,\%imsitems,\%imsfiles,\%roleinfo,\@discussionitems,\@replies,\@depth,\@posters,\$maxdepth,\$visible,\$newpostsflag,\$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$encsymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,\@rolefilter,\@sectionpick,$statusfilter,$toggkey,$outputtarget,\%anonhash,$anoncnt);
my $discussion='';
my $manifestfile;
@@ -392,19 +393,20 @@
$discussion.='<form name="readchoices" method="post" action="/adm/feedback?chgreads='.$ressymb.'" ><table bgcolor="#AAAAAA" cellpadding="2" cellspacing="2" border="0">';
$discussion .='<tr><td bgcolor="#DDDDBB" colspan="'.$colspan.'">'.
'<table border="0" width="100%" bgcolor="#DDDDBB"><tr>';
+ my $escsymb=&Apache::lonnet::escape($ressymb);
if ($visible>2) {
$discussion.='<td align="left">'.
- '<a href="/adm/feedback?cmd=threadedon&symb='.$ressymb;
+ '<a href="/adm/feedback?cmd=threadedon&symb='.$escsymb;
if ($newpostsflag) {
$discussion .= '&previous='.$prevread;
}
$discussion .='">'.&mt('Threaded View').'</a> '.
- '<a href="/adm/feedback?cmd=threadedoff&symb='.$ressymb;
+ '<a href="/adm/feedback?cmd=threadedoff&symb='.$escsymb;
if ($newpostsflag) {
$discussion .= '&previous='.$prevread;
}
$discussion .='">'.&mt('Chronological View').'</a>
- <a href= "/adm/feedback?cmd=sortfilter&symb='.$ressymb;
+ <a href= "/adm/feedback?cmd=sortfilter&symb='.$escsymb;
if ($newpostsflag) {
$discussion .= '&previous='.$prevread;
}
@@ -412,14 +414,16 @@
} else {
$discussion .= '<td align="left">';
}
- $discussion .='<a href= "/adm/feedback?export='.$ressymb;
+ $discussion .='<a href= "/adm/feedback?export='.$escsymb;
if ($newpostsflag) {
$discussion .= '&previous='.$prevread;
}
$discussion .= '">'.&mt('Export').'?</a> </td>';
if ($newpostsflag) {
if (!$markondisp) {
- $discussion .='<td align="right"><a href="/adm/feedback?markread=1&symb='.$ressymb.'">'.&mt('Mark NEW posts no longer new').'</a> ';
+ $discussion .='<td align="right"><a href="/adm/preferences?action=changediscussions">'.
+ &mt('Preferences on what is marked as NEW').
+ '</a><br /><a href="/adm/feedback?markread=1&symb='.$escsymb.'">'.&mt('Mark NEW posts no longer new').'</a>';
} else {
$discussion .= '<td> </td>';
}
@@ -432,7 +436,7 @@
if ($numhidden > 0) {
my $colspan = $maxdepth+1;
$discussion.="\n".'<tr><td bgcolor="#CCCCCC" colspan="'.$colspan.'">'.
- '<a href="/adm/feedback?allposts=1&symb='.$ressymb;
+ '<a href="/adm/feedback?allposts=1&symb='.$escsymb;
if ($newpostsflag) {
$discussion .= '&previous='.$prevread;
}
@@ -745,7 +749,7 @@
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
if ($outputtarget ne 'tex') {
$discussion.='<table bgcolor="#BBBBBB"><tr><td><a href="/adm/feedback?replydisc='.
- $ressymb.':::" '.$target.'>'.
+ &Apache::lonnet::escape($ressymb).':::" '.$target.'>'.
'<img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" border="0" />'.
&mt('Post Discussion').'</a></td></tr></table>';
}
@@ -755,10 +759,11 @@
}
sub build_posting_display {
- my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$statusfilter,$toggkey,$outputtarget) = @_;
+ my ($usernamesort,$subjectsort,$namesort,$notshown,$newitem,$dischash,$shown,$alldiscussion,$imsitems,$imsfiles,$roleinfo,$discussionitems,$replies,$depth,$posters,$maxdepth,$visible,$newpostsflag,$current,$status,$viewgrades,$seeid,$prevread,$sortposts,$ressymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt) = @_;
my @original=();
my @index=();
my $symb=&Apache::lonenc::check_decrypt($ressymb);
+ my $escsymb=&Apache::lonnet::escape($ressymb);
my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'},
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'});
@@ -822,6 +827,13 @@
my %allattachments = ();
my ($screenname,$plainname);
my $sender = &mt('Anonymous');
+# Anonymous users getting number within a discussion
+# Since idx is in static order, this should give the same sequence every time.
+ my $key=$contrib{$idx.':sendername'}.'@'.$contrib{$idx.':senderdomain'};
+ unless ($$anonhash{$key}) {
+ $anoncnt++;
+ $$anonhash{$key}=&mt('Anonymous').' '.$anoncnt;
+ }
my ($message,$subject,$vgrlink,$ctlink);
&get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,$numoldver);
@@ -860,7 +872,7 @@
$contrib{$idx.':sendername'}.' at '.
$contrib{$idx.':senderdomain'}.')';
if ($contrib{$idx.':anonymous'}) {
- $sender.=' <font color="red"><b>['.&mt('anonymous').']</b></font> '.
+ $sender.=' <font color="red"><b>['.$$anonhash{$key}.']</b></font> '.
$screenname;
}
@@ -896,13 +908,13 @@
if ($env{'course.'.$env{'request.course.id'}.'.allow_discussion_post_editing'} =~ m/yes/i) {
if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
$sender.=' <a href="/adm/feedback?editdisc='.
- $ressymb.':::'.$idx;
+ $escsymb.':::'.$idx;
if ($newpostsflag) {
$sender .= '&previous='.$prevread;
}
$sender .= '" '.$target.'>'.&mt('Edit').'</a>';
unless ($seeid) {
- $sender.=" <a href=\"javascript:studentdelete('$ressymb','$idx','$newpostsflag','$prevread')";
+ $sender.=" <a href=\"javascript:studentdelete('$escsymb','$idx','$newpostsflag','$prevread')";
$sender .= '">'.&mt('Delete').'</a>';
}
}
@@ -911,7 +923,7 @@
if ($hidden) {
unless ($studenthidden) {
$sender.=' <a href="/adm/feedback?unhide='.
- $ressymb.':::'.$idx;
+ $escsymb.':::'.$idx;
if ($newpostsflag) {
$sender .= '&previous='.$prevread;
}
@@ -919,14 +931,14 @@
}
} else {
$sender.=' <a href="/adm/feedback?hide='.
- $ressymb.':::'.$idx;
+ $escsymb.':::'.$idx;
if ($newpostsflag) {
$sender .= '&previous='.$prevread;
}
$sender .= '">'.&mt('Hide').'</a>';
}
$sender.=' <a href="/adm/feedback?deldisc='.
- $ressymb.':::'.$idx;
+ $escsymb.':::'.$idx;
if ($newpostsflag) {
$sender .= '&previous='.$prevread;
}
@@ -935,6 +947,8 @@
} else {
if ($screenname) {
$sender='<i>'.$screenname.'</i>';
+ } else {
+ $sender='<i>'.$$anonhash{$key}.'</i>';
}
# Set up for sorting by domain, then username for anonymous
unless (defined($$usernamesort{'__anon'})) {
@@ -960,7 +974,7 @@
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
$sender.=' <a href="/adm/feedback?replydisc='.
- $ressymb.':::'.$idx;
+ $escsymb.':::'.$idx;
if ($newpostsflag) {
$sender .= '&previous='.$prevread;
}
@@ -1076,7 +1090,7 @@
my @postversions = ();
$$discussionitems[$idx] .= &mt('This post has been edited by the author.');
if ($seeid) {
- $$discussionitems[$idx] .= ' <a href="/adm/feedback?allversions='.$ressymb.':::'.$idx.'">'.&mt('Display all versions').'</a>';
+ $$discussionitems[$idx] .= ' <a href="/adm/feedback?allversions='.$escsymb.':::'.$idx.'">'.&mt('Display all versions').'</a>';
}
$$discussionitems[$idx].='<br/>'.&mt('Earlier version(s) were posted on: ');
if ($contrib{$idx.':history'} =~ m/:/) {
@@ -2294,7 +2308,8 @@
&mt('Contribution to course discussion of resource');
$discussoptions.='</label><br /><label><input type="checkbox" name="anondiscuss" onClick="this.form.discuss.checked=false;" /> '.
&mt('Anonymous contribution to course discussion of resource').
- ' <i>('.&mt('name only visible to course faculty').')</i></label>';
+ ' <i>('.&mt('name only visible to course faculty').')</i></label> '.
+ '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
}
}
if ($msgoptions) { $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/feedback.gif').'" />'.&mt('Sending Messages').'</h2>'.$msgoptions; }
--www1131622266--