'.
'';
}
@@ -755,10 +760,11 @@ ENDDISCUSS
}
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 +828,13 @@ sub build_posting_display {
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 +873,7 @@ sub build_posting_display {
$contrib{$idx.':sendername'}.' at '.
$contrib{$idx.':senderdomain'}.')';
if ($contrib{$idx.':anonymous'}) {
- $sender.=' ['.&mt('anonymous').'] '.
+ $sender.=' ['.$$anonhash{$key}.'] '.
$screenname;
}
@@ -893,16 +906,16 @@ sub build_posting_display {
} else {
@{$$namesort{$lastname}{$firstname}} = ("$idx");
}
- if ($env{'course.'.$env{'request.course.id'}.'.allow_discussion_post_editing'} =~ m/yes/i) {
+ if (&editing_allowed()) {
if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
$sender.=' '.&mt('Edit').'';
unless ($seeid) {
- $sender.=" ';
}
}
@@ -911,23 +924,23 @@ sub build_posting_display {
if ($hidden) {
unless ($studenthidden) {
$sender.=' '.&mt('Make Visible').'';
}
} else {
$sender.=' '.&mt('Hide').'';
}
$sender.=' '.&mt('Delete').'';
@@ -935,6 +948,8 @@ sub build_posting_display {
} else {
if ($screenname) {
$sender=''.$screenname.'';
+ } else {
+ $sender=''.$$anonhash{$key}.'';
}
# Set up for sorting by domain, then username for anonymous
unless (defined($$usernamesort{'__anon'})) {
@@ -960,9 +975,9 @@ sub build_posting_display {
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
$sender.=' '.&mt('Reply').'';
}
@@ -1076,7 +1091,7 @@ sub build_posting_display {
my @postversions = ();
$$discussionitems[$idx] .= &mt('This post has been edited by the author.');
if ($seeid) {
- $$discussionitems[$idx] .= ' '.&mt('Display all versions').'';
+ $$discussionitems[$idx] .= ' '.&mt('Display all versions').'';
}
$$discussionitems[$idx].=' '.&mt('Earlier version(s) were posted on: ');
if ($contrib{$idx.':history'} =~ m/:/) {
@@ -1182,11 +1197,7 @@ sub get_post_contents {
if ($type eq 'allversions' || $type eq 'export') {
$start = 0;
if ($$contrib{$idx.':history'}) {
- if ($$contrib{$idx.':history'} =~ m/:/) {
- @postversions = split/:/,$$contrib{$idx.':history'};
- } else {
- @postversions = ("$$contrib{$idx.':history'}");
- }
+ @postversions = split(/:/,$$contrib{$idx.':history'});
}
&get_post_versions($messages,$$contrib{$idx.':message'},1);
&get_post_versions($subjects,$$contrib{$idx.':subject'},1);
@@ -1290,10 +1301,9 @@ sub replicate_attachments {
sub mail_screen {
my ($r,$feedurl,$options) = @_;
if (exists($env{'form.origpage'})) {
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss']);
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog']);
}
- my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion',
- '','onLoad="window.focus();setposttype();"');
+
my $title=&Apache::lonnet::gettitle($feedurl);
if (!$title) { $title = $feedurl; }
my $quote='';
@@ -1431,15 +1441,8 @@ END
&process_attachments(\@currnewattach,\@currdelold,\@keepold);
}
my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();
- my $htmlheader=&Apache::lonhtmlcommon::htmlareaheaders();
my $send=&mt('Send');
- my $html=&Apache::lonxml::xmlbegin();
- $r->print(<
-The LearningOnline Network with CAPA
-
-$htmlheader
+ my $js= <
//
-
-$bodytag
+END
+
+ my $onload = 'onLoad="window.focus();setposttype();"';
+ my $start_page=
+ &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,
+ {'add_entries' => $onload});
+
+ $r->print(<$title
|