'.
- ''.
+ my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_;
+ my $discussion = ' '.
+ ''.
'';
my $escsymb=&escape($ressymb);
if ($visible) {
@@ -887,36 +806,28 @@ sub action_links_bar {
$discussion .= '&previous='.$prevread;
}
$discussion .= &group_args($group);
- $discussion .='">'.&mt('Chronological View').'
- '.&mt('Chronological View').' ';
+
+ my $otherviewurl='/adm/feedback?cmd=sortfilter&symb='.$escsymb.'&inhibitmenu=yes&modal=yes';
if ($newpostsflag) {
- $discussion .= '&previous='.$prevread;
+ $otherviewurl .= '&previous='.$prevread;
}
- $discussion .= &group_args($group);
- $discussion .='">'.&mt('Sorting/Filtering options').''.(' ' x2);
+ $otherviewurl .= &group_args($group);
+ $discussion .= &Apache::loncommon::modal_link($otherviewurl,&mt('Other Views ...'),800,340);
+ $discussion .= ' ';
}
$discussion .=''.&mt('Export').'';
- if ($seehidden) {
- $discussion .= ' ';
- $discussion .=''.&mt('Undelete all deleted entries').'';
- }
- $discussion.=' | ';
+ $discussion .= '">'.&mt('Export').'';
if ($newpostsflag) {
if (!$markondisp) {
$discussion .=''.
- &mt('Preferences on what is marked as NEW').
+ &mt('My general preferences on what is marked as NEW').
' '.&mt('Mark NEW posts no longer new').' | ';
@@ -985,22 +896,22 @@ ENDDISCUSS
}
$postingform .= "\n";
$postingform .= &generate_attachments_button('',$attachnum,$ressymb,
- $now,$currnewattach,
- $currdelold,'',$mode,
- $blockblog);
+ $now,$currnewattach,
+ $currdelold,'',$mode,
+ $blockblog);
if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {
$newattachmsg = ' '.$lt{'newa'}.' ';
if (@{$currnewattach} > 1) {
- $newattachmsg .= '';
- foreach my $item (@{$currnewattach}) {
+ $newattachmsg .= '';
+ foreach my $item (@{$currnewattach}) {
$item =~ m#.*/([^/]+)$#;
$newattachmsg .= '- '.$1.'
'."\n";
- }
- $newattachmsg .= ' '."\n";
- } else {
- $$currnewattach[0] =~ m#.*/([^/]+)$#;
- $newattachmsg .= ''.$1.' '."\n";
- }
+ }
+ $newattachmsg .= ' '."\n";
+ } else {
+ $$currnewattach[0] =~ m#.*/([^/]+)$#;
+ $newattachmsg .= ''.$1.' '."\n";
+ }
}
$postingform .= $newattachmsg;
$postingform .= &generate_preview_button();
@@ -1008,31 +919,16 @@ 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,$seehidden,$canvote,$prevread,$sortposts,$ressymb,$target,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_;
+ 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,$readkey,$showunmark,$showonlyunread,$totposters,$rolefilter,$sectionpick,$grouppick,$classgroups,$statusfilter,$toggkey,$outputtarget,$anonhash,$anoncnt,$group) = @_;
my @original=();
my @index=();
my $skip_group_check = 0;
my $symb=&Apache::lonenc::check_decrypt($ressymb);
my $escsymb=&escape($ressymb);
-# These are the discussion contributions
my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'},
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'});
- my (%likes,%userlikes,%userunlikes,@theselikes,$oneplus,$twoplus,$oneminus,$twominus);
-# And these are the likes/unlikes
- my $thisuser=$env{'user.name'}.':'.$env{'user.domain'};
- if ($seeid || $canvote) {
- %likes=&Apache::lonnet::dump('disclikes',
- $env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'},
- '^'.$symb.':');
-# Array with likes to figure out averages, etc.
- @theselikes=();
-# Hashes containing likes and unlikes for this user.
- %userlikes=();
- %userunlikes=();
- }
-# Is the user allowed to see the real name behind anonymous postings?
+
my $see_anonymous =
&Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
@@ -1062,56 +958,7 @@ sub build_posting_display {
($skiptest,$roleregexp,$secregexp,$statusregexp) =
&filter_regexp($rolefilter,$sectionpick,$statusfilter);
$rolematch = $roleregexp.':'.$secregexp.':'.$statusregexp;
- }
- if ($seeid || $canvote) {
-# We need to go through this twice, first to get the likes/dislikes, then to actually build the display
- for (my $id=1;$id<=$contrib{'version'};$id++) {
- my $idx=$id;
- next if ($contrib{$idx.':deleted'});
- next if ($contrib{$idx.':hidden'});
- unless ((($hiddens{$idx}) && (!$seehidden)) || ($deletions{$idx}) || (!$contrib{$idx.':message'})) {
- push(@theselikes,$likes{$symb.':'.$idx.':likes'});
- if ($likes{$symb.':'.$idx.':likes'} ne '') {
- if (ref($likes{$symb.':'.$idx.':likers'}) eq 'HASH') {
- if (exists($likes{$symb.':'.$idx.':likers'}{$thisuser})) {
- $userlikes{$idx} = 1;
- }
- }
- if (ref($likes{$symb.':'.$idx.':unlikers'}) eq 'HASH') {
- if (exists($likes{$symb.':'.$idx.':unlikers'}{$thisuser})) {
- $userunlikes{$idx} = 1;
- }
- }
- }
- }
- }
-# Figure out average likes and standard deviation if there are enough
-# discussions to warrant that
- my $ave=0;
- my $stddev=10000;
- if ($#theselikes>1) {
- my $sum=0;
- my $num=$#theselikes+1;
- foreach my $thislike (@theselikes) {
- $sum+=$thislike;
- }
- $ave=$sum/$num;
- my $sumsq=0;
- foreach my $thislike (@theselikes) {
- $sumsq+=($thislike-$ave)*($thislike-$ave);
- }
- $stddev=sqrt($sumsq/$num);
- }
-# Now we know the average likes $ave and the standard deviation $stddev
-# Get the boundaries for markup
- $oneplus=$ave+$stddev;
- $twoplus=$ave+2.*$stddev;
- $oneminus=$ave-$stddev;
- $twominus=$ave-2.*$stddev;
- }
-#
-# This is now the real loop. Go through all entries, pick up what we need
-#
+ }
for (my $id=1;$id<=$contrib{'version'};$id++) {
my $idx=$id;
next if ($contrib{$idx.':deleted'});
@@ -1144,7 +991,7 @@ sub build_posting_display {
} else {
$$replies[$$depth[$idx]]=1;
}
- unless ((($hiddens{$idx}) && (!$seehidden)) || ($deletions{$idx})) {
+ unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx})) {
$$visible++;
if ($contrib{$idx.':history'}) {
if ($contrib{$idx.':history'} =~ /:/) {
@@ -1159,7 +1006,7 @@ sub build_posting_display {
my %subjects = ();
my %attachtxt = ();
my %allattachments = ();
- my ($screenname,$plainname,$showaboutme);
+ 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.
@@ -1169,7 +1016,7 @@ sub build_posting_display {
$$anonhash{$key}=&mt('Anonymous').' '.$anoncnt;
}
my ($message,$subject,$vgrlink,$ctlink);
- &get_post_contents(\%contrib,$idx,$seeid,$seehidden,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,\$showaboutme,$numoldver);
+ &get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,$numoldver);
# Set up for sorting by subject
@@ -1199,18 +1046,12 @@ sub build_posting_display {
}
}
if (!$contrib{$idx.':anonymous'} || $see_anonymous) {
- if ($showaboutme) {
- $sender = &Apache::loncommon::aboutmewrapper(
- $plainname,
- $contrib{$idx.':sendername'},
- $contrib{$idx.':senderdomain'});
- } else {
- $sender = $plainname;
- }
- if ($see_anonymous) {
- $sender .= ' ('.$contrib{$idx.':sendername'}.':'.
- $contrib{$idx.':senderdomain'}.')';
- }
+ $sender=&Apache::loncommon::aboutmewrapper(
+ $plainname,
+ $contrib{$idx.':sendername'},
+ $contrib{$idx.':senderdomain'}).' ('.
+ $contrib{$idx.':sendername'}.':'.
+ $contrib{$idx.':senderdomain'}.')';
$sender = ''.$sender.'';
if ($contrib{$idx.':anonymous'}) {
$sender.=' ['.$$anonhash{$key}.'] '.
@@ -1251,39 +1092,24 @@ sub build_posting_display {
if ($outputtarget ne 'tex') {
if (&editing_allowed($escsymb.':::'.$idx,$group)) {
if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
- $sender.=' '.&mt('Edit').'';
-
- unless ($seehidden) {
+ $sender.=' '.
+ &discussion_link($symb,&mt('Edit'),'editdisc',$idx,$$newpostsflag,$prevread,&group_args($group));
+ unless ($seeid) {
my $grpargs = &group_args($group);
$sender.=" ';
}
}
}
- if ($seehidden) {
+ if ($seeid) {
if ($hiddens{$idx}) {
unless ($studenthidden) {
- $sender.=' '.&mt('Make Visible').'';
+ $sender.=' '.
+ &discussion_link($symb,&mt('Make Visible'),'unhide',$idx,$$newpostsflag,$prevread,&group_args($group));
}
} else {
- $sender.=' '.&mt('Hide').'';
+ $sender.=' '.
+ &discussion_link($symb,&mt('Hide'),'hide',$idx,$$newpostsflag,$prevread,&group_args($group));
}
my $grpargs = &group_args($group);
$sender.=
@@ -1291,7 +1117,7 @@ sub build_posting_display {
$sender .= &mt('Delete').'';
}
}
- } else {
+ } else {
if ($screenname) {
$sender=''.$screenname.'';
} else {
@@ -1318,33 +1144,24 @@ sub build_posting_display {
}
}
if ($outputtarget ne 'tex') {
- if (&discussion_open($status)) {
+ if (&discussion_open($status)) {
if (($group ne '') &&
(&check_group_priv($group,'pgd') eq 'ok')) {
- $sender.=' '.&mt('Reply').'';
+ $sender.=' '.
+ &discussion_link($symb,&mt('Reply'),'replydisc',$idx,$$newpostsflag,$prevread,&group_args($group));
} elsif (&Apache::lonnet::allowed('pch',
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.
$env{'request.course.sec'}:''))) {
- $sender.=' '.&mt('Reply').'';
+ $sender.=' '.
+ &discussion_link($symb,&mt('Reply'),'replydisc',$idx,$$newpostsflag,$prevread);
}
}
- if ($viewgrades) {
+ if ($viewgrades) {
$vgrlink=&Apache::loncommon::submlink(&mt('Submissions'),
$contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'},$ressymb);
}
- if ($$dischash{$readkey}=~/\.$idx\./) {
+ if ($$dischash{$readkey}=~/\.$idx\./) {
$ctlink = '';
} else {
$ctlink = '';
@@ -1387,15 +1204,14 @@ sub build_posting_display {
} else {
if ($message) {
my $spansize = 2;
- my ($uname,$udom);
if ($showonlyunread && $prevread > $posttime) {
$$notshown{$idx} = 1;
} elsif ($showunmark && $$dischash{$readkey}=~/\.$idx\./) {
$$notshown{$idx} = 1;
} else {
# apply filters
- $uname = $contrib{$idx.':sendername'};
- $udom = $contrib{$idx.':senderdomain'};
+ my $uname = $contrib{$idx.':sendername'};
+ my $udom = $contrib{$idx.':senderdomain'};
my $poster = $uname.':'.$udom;
if ($env{'form.totposters'} ne '') {
if ($totposters == 0) {
@@ -1446,90 +1262,24 @@ sub build_posting_display {
unless ($$notshown{$idx} == 1) {
if ($prevread > 0 && $prevread <= $posttime) {
$$newitem{$idx} = 1;
- $$discussionitems[$idx] .= '
-
- '.&mt('NEW').' | ';
+ $$discussionitems[$idx] .= ''.&mt('NEW').' ';
} else {
$$newitem{$idx} = 0;
- $$discussionitems[$idx] .= '
-
- | ';
}
- $$discussionitems[$idx] .= ' '.
- ''.$subject.' '.
+ $$discussionitems[$idx] .= ''.$subject.' '.
$sender.' '.$vgrlink.' ('.
- &Apache::lonlocal::locallocaltime($posttime).') | ';
+ &Apache::lonlocal::locallocaltime($posttime).')';
if ($$dischash{$toggkey}) {
- $$discussionitems[$idx].=' '.
- $ctlink.' | ';
- }
- my $likesize="100";
- if ($seeid || $canvote) {
-# Figure out size based on likes
- my $thislikes=$likes{$symb.':'.$idx.':likes'};
- if ($thislikes>$twoplus) {
- $likesize="200";
- } elsif ($thislikes>$oneplus) {
- $likesize="150";
- }
- if ($thislikes<$twominus) {
- $likesize="50";
- } elsif ($thislikes<$oneminus) {
- $likesize="75";
- }
- }
-# Actually glue in the message itself
- $$discussionitems[$idx].= ' '.
- "".
- $message.
- ' ';
- if ($canvote) {
- my $ownpost;
- if (($uname eq $env{'user.name'}) &&
- ($udom eq $env{'user.domain'})) {
- $ownpost = 1;
- }
-# Put in the like and unlike buttons
- if ($ownpost || (($hiddens{$idx}) && ($seehidden))) {
- my $novote;
- if ($ownpost) {
- $novote = &mt('No voting for your own posts.');
- } else {
- $novote = &mt('No voting for hidden posts.');
- }
- $$discussionitems[$idx].=
- ''.
- ' '.
- '';
- } else {
- if ($userlikes{$idx}) {
- $$discussionitems[$idx].='';
- } else {
- $$discussionitems[$idx].=' '.&discussion_link($symb,'','like',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Like this posting"));
- }
- if ($userunlikes{$idx}) {
- $$discussionitems[$idx].='';
- } else {
- $$discussionitems[$idx].=' '.&discussion_link($symb,'','unlike',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Unlike this posting"));
- }
- }
- }
- if ($seeid || $canvote) {
- my $thislikes=$likes{$symb.':'.$idx.':likes'};
- if ($thislikes>0) {
- $$discussionitems[$idx].=' ('.&mt("[_1] likes",$thislikes).')';
- } elsif ($thislikes<0) {
- $$discussionitems[$idx].=' ('.&mt("[_1] unlikes",abs($thislikes)).')';
- }
+ $$discussionitems[$idx].=' '.$ctlink;
}
-# If there is any history to this post, inform the reader
+ $$discussionitems[$idx].= '
'.
+ $message.' ';
if ($contrib{$idx.':history'}) {
my @postversions = ();
$$discussionitems[$idx] .= &mt('This post has been edited by the author.');
- if ($seehidden) {
- $$discussionitems[$idx] .= ' '.&mt('Display all versions').'';
+ if ($seeid) {
+ $$discussionitems[$idx] .= ' '.
+ &discussion_link($symb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group));
}
$$discussionitems[$idx].=' '.&mt('Earlier version(s) were posted on: ');
if ($contrib{$idx.':history'} =~ m/:/) {
@@ -1606,13 +1356,13 @@ sub filter_regexp {
sub get_post_contents {
- my ($contrib,$idx,$seeid,$seehidden,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$showaboutme,$numver) = @_;
+ my ($contrib,$idx,$seeid,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$numver) = @_;
my $discussion = '';
my $start=$numver;
my $end=$numver + 1;
%{$$imsfiles{$idx}}=();
if ($type eq 'allversions') {
- unless($seehidden) {
+ unless($seeid) {
$discussion=&mt('You do not have privileges to view all versions of posts.').' '.&mt('Please select a different role.');
return $discussion;
}
@@ -1624,20 +1374,13 @@ sub get_post_contents {
$$contrib{$idx.':sendername'},
$$contrib{$idx.':senderdomain'});
$$screenname=$$contrib{$idx.':screenname'};
- $$showaboutme = &Apache::lonnet::usertools_access($$contrib{$idx.':sendername'},
- $$contrib{$idx.':senderdomain'},
- 'aboutme');
- my $sender = $$plainname;
- if ($$showaboutme) {
- $sender = &Apache::loncommon::aboutmewrapper(
+
+ my $sender=&Apache::loncommon::aboutmewrapper(
$$plainname,
$$contrib{$idx.':sendername'},
- $$contrib{$idx.':senderdomain'});
- }
- if ($seeid) {
- $sender .= ' ('.$$contrib{$idx.':sendername'}.':'.
- $$contrib{$idx.':senderdomain'}.')';
- }
+ $$contrib{$idx.':senderdomain'}).' ('.
+ $$contrib{$idx.':sendername'}.':'.
+ $$contrib{$idx.':senderdomain'}.')';
my $attachmenturls = $$contrib{$idx.':attachmenturl'};
my @postversions = ();
if ($type eq 'allversions' || $type eq 'export') {
@@ -1822,7 +1565,6 @@ END
$env{'course.'.$env{'request.course.id'}.'.domain'},
$env{'course.'.$env{'request.course.id'}.'.num'});
unless (($contrib{'hidden'}=~/\.$idx\./) || ($contrib{'deleted'}=~/\.$idx\./)) {
- my $numoldver = 0;
if ($contrib{$idx.':history'}) {
if ($contrib{$idx.':history'} =~ /:/) {
my @oldversions = split(/:/,$contrib{$idx.':history'});
@@ -1831,25 +1573,36 @@ END
$numoldver = 1;
}
}
- if ($idx > 0) {
- my (%msgversions,%subversions,$htmldecode);
- $htmldecode = 0;
- if ($env{'form.replydisc'}) {
- $htmldecode = 1;
+ if ($env{'form.replydisc'}) {
+ if ($contrib{$idx.':history'}) {
+ if ($contrib{$idx.':history'} =~ /:/) {
+ my @oldversions = split(/:/,$contrib{$idx.':history'});
+ $numoldver = @oldversions;
+ } else {
+ $numoldver = 1;
+ }
}
- &get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver);
- &get_post_versions(\%subversions,$contrib{$idx.':subject'},$htmldecode,
- $numoldver);
- $subject = $subversions{$numoldver};
- if ($env{'form.replydisc'}) {
+ if ($idx > 0) {
+ my %msgversions = ();
+ &get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver);
$quote = $msgversions{$numoldver};
- $subject = &HTML::Entities::encode(&mt('Re: ').$subject,'<>&"');
- } else {
- $comment = $msgversions{$numoldver};
}
- }
- if ($env{'form.editdisc'}) {
+ if ($idx > 0) {
+ my %subversions = ();
+ &get_post_versions(\%subversions,$contrib{$idx.':subject'},1,$numoldver);
+ $subject = &mt('Re: ').$subversions{$numoldver};
+ }
+ $subject = &HTML::Entities::encode($subject,'<>&"');
+ } else {
$attachmenturls = $contrib{$idx.':attachmenturl'};
+ if ($idx > 0) {
+ my %msgversions = ();
+ &get_post_versions(\%msgversions,$contrib{$idx.':message'},0,$numoldver);
+ $comment = $msgversions{$numoldver};
+ my %subversions = ();
+ &get_post_versions(\%subversions,$contrib{$idx.':subject'},0,$numoldver);
+ $subject = $subversions{$numoldver};
+ }
if (defined($contrib{$idx.':replyto'})) {
$parentmsg = $contrib{$idx.':replyto'};
}
@@ -1882,7 +1635,7 @@ END
$comment = &unescape($env{'form.comment'});
&process_attachments(\@currnewattach,\@currdelold,\@keepold);
}
- my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1);
+ my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1,($env{'form.modal'}?'popup':0));
my $send=&mt('Send');
my $alert = &mt('Please select a feedback type.');
my $js= < 'Resource Feedback and Discussion'}];
my %onload = ('onload' => 'window.focus();setposttype();');
+ my %parms=('add_entries' => \%onload);
+ if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum }
my $start_page=
- &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,
- {'add_entries' => \%onload,
- 'bread_crumbs' => $brcrum,});
+ &Apache::loncommon::start_page('Resource Feedback and Discussion',$js,\%parms);
if ($quote ne '') {
$quote = &HTML::Entities::decode($quote);
@@ -1952,14 +1705,18 @@ END
}
$quote=''.&Apache::lontexconvert::msgtexconverted($quote).' ';
}
-
+ my $header='';
+ unless ($env{'form.modal'}) {
+ $header="$restitle";
+ }
$r->print(<$restitle
+$header
|
|