Diff for /loncom/interface/lonfeedback.pm between versions 1.333 and 1.336

version 1.333, 2012/01/10 14:52:57 version 1.336, 2012/03/06 18:10:23
Line 1071  sub build_posting_display { Line 1071  sub build_posting_display {
                 my %subjects = ();                  my %subjects = ();
                 my %attachtxt = ();                  my %attachtxt = ();
                 my %allattachments = ();                  my %allattachments = ();
                 my ($screenname,$plainname);                  my ($screenname,$plainname,$showaboutme);
                 my $sender = &mt('Anonymous');                  my $sender = &mt('Anonymous');
 # Anonymous users getting number within a discussion  # Anonymous users getting number within a discussion
 # Since idx is in static order, this should give the same sequence every time.   # Since idx is in static order, this should give the same sequence every time. 
Line 1081  sub build_posting_display { Line 1081  sub build_posting_display {
     $$anonhash{$key}=&mt('Anonymous').' '.$anoncnt;      $$anonhash{$key}=&mt('Anonymous').' '.$anoncnt;
  }   }
                 my ($message,$subject,$vgrlink,$ctlink);                  my ($message,$subject,$vgrlink,$ctlink);
                 &get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,$numoldver);                  &get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,\$showaboutme,$numoldver);
   
   
 # Set up for sorting by subject  # Set up for sorting by subject
Line 1111  sub build_posting_display { Line 1111  sub build_posting_display {
                             }                              }
                         }                          }
         if (!$contrib{$idx.':anonymous'} || $see_anonymous) {          if (!$contrib{$idx.':anonymous'} || $see_anonymous) {
     $sender=&Apache::loncommon::aboutmewrapper(                              if ($showaboutme) {
  $plainname,                                  $sender = &Apache::loncommon::aboutmewrapper(
  $contrib{$idx.':sendername'},                                                $plainname,
  $contrib{$idx.':senderdomain'}).' ('.                                                $contrib{$idx.':sendername'},
  $contrib{$idx.':sendername'}.':'.                                                $contrib{$idx.':senderdomain'});
  $contrib{$idx.':senderdomain'}.')';                              } else {
                                   $sender = $plainname;
                               }
                               if ($see_anonymous) {
                                   $sender .= ' ('.$contrib{$idx.':sendername'}.':'.
      $contrib{$idx.':senderdomain'}.')';
                               }
                             $sender = '<b>'.$sender.'</b>';                              $sender = '<b>'.$sender.'</b>';
     if ($contrib{$idx.':anonymous'}) {      if ($contrib{$idx.':anonymous'}) {
         $sender.=' <font color="red"><b>['.$$anonhash{$key}.']</b></font> '.          $sender.=' <font color="red"><b>['.$$anonhash{$key}.']</b></font> '.
Line 1155  sub build_posting_display { Line 1161  sub build_posting_display {
                                 @{$$namesort{$lastname}{$firstname}} = ("$idx");                                  @{$$namesort{$lastname}{$firstname}} = ("$idx");
                             }                              }
                             if ($outputtarget ne 'tex') {                              if ($outputtarget ne 'tex') {
   # Add karma stars
                                 my $karma=&userkarma($contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'});                                  my $karma=&userkarma($contrib{$idx.':sendername'},$contrib{$idx.':senderdomain'});
                                 for (my $i=1;$i<=$karma;$i++) {                                  for (my $i=1;$i<=$karma;$i++) {
                                     $sender.='<img border="0" src="/res/adm/pages/star.gif" alt="'.&mt('Contributor Kudos').'" />';                                      $sender.='<img border="0" src="/res/adm/pages/star.gif" alt="'.&mt('Contributor Kudos').'" />';
                                 }                                  }
                                 unless ($likes{$symb.':'.$idx.':likers'}=~/\,\Q$thisuser\E\,/) {  # Can people edit this?
                                     $sender.='&nbsp;'.&discussion_link($symb,'<img border="0" src="/res/adm/pages/thumbsup.png" alt="'.&mt('Like').'" />','like',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Like this posting"));  
                                 }  
                                 unless ($likes{$symb.':'.$idx.':unlikers'}=~/\,\Q$thisuser\E\,/) {  
                                     $sender.='&nbsp;'.&discussion_link($symb,'<img border="0" src="/res/adm/pages/thumbsdown.png" alt="'.&mt('Unlike').'" />',,'unlike',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Unlike this posting"));  
                                 }  
                                 my $thislikes=$likes{$symb.':'.$idx.':likes'};  
                                 if ($thislikes>0) {   
                                     $sender.='&nbsp;('.&mt("[_1] likes",$thislikes).')';  
                                 } elsif ($thislikes<0) {  
                                     $sender.='&nbsp;('.&mt("[_1] unlikes",abs($thislikes)).')';  
                                 }  
                                 if (&editing_allowed($escsymb.':::'.$idx,$group)) {                                  if (&editing_allowed($escsymb.':::'.$idx,$group)) {
                                     if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {                                      if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
                                         $sender.=' '.                                          $sender.=' '.
Line 1366  sub build_posting_display { Line 1362  sub build_posting_display {
                             } elsif ($thislikes<$oneminus) {                              } elsif ($thislikes<$oneminus) {
                                 $likesize="75";                                  $likesize="75";
                             }                              }
   # Actually glue in the message itself
                             $$discussionitems[$idx].= '<br /><blockquote>'.                              $$discussionitems[$idx].= '<br /><blockquote>'.
                                     "<div style='font-size:$likesize%'>".                                      "<div style='font-size:$likesize%'>".
                                     $message.                                      $message.
                                     '</div></blockquote>';                                      '</div></blockquote>';
   # Put in the like and unlike buttons
                               unless ($likes{$symb.':'.$idx.':likers'}=~/\,\Q$thisuser\E\,/) {
                                   $$discussionitems[$idx].='&nbsp;'.&discussion_link($symb,'<img border="0" src="/res/adm/pages/thumbsup.png" alt="'.&mt('Like').'" />','like',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Like this posting"));
                               } else {
                                   $$discussionitems[$idx].='<img border="0" src="/res/adm/pages/thumbsup_gray.png" alt="'.&mt('You like this posting').'" />';
                               }
                               unless ($likes{$symb.':'.$idx.':unlikers'}=~/\,\Q$thisuser\E\,/) {
                                   $$discussionitems[$idx].='&nbsp;'.&discussion_link($symb,'<img border="0" src="/res/adm/pages/thumbsdown.png" alt="'.&mt('Unlike').'" />',,'unlike',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Unlike this posting"));
                               } else {
                                   $$discussionitems[$idx].='<img border="0" src="/res/adm/pages/thumbsdown_gray.png" alt="'.&mt('You unlike this posting').'" />';
                               }
                               my $thislikes=$likes{$symb.':'.$idx.':likes'};
                               if ($thislikes>0) {
                                   $$discussionitems[$idx].='&nbsp;('.&mt("[_1] likes",$thislikes).')';
                               } elsif ($thislikes<0) {
                                   $$discussionitems[$idx].='&nbsp;('.&mt("[_1] unlikes",abs($thislikes)).')';
                               }
   # If there is any history to this post, inform the reader
                             if ($contrib{$idx.':history'}) {                              if ($contrib{$idx.':history'}) {
                                 my @postversions = ();                                  my @postversions = ();
                                 $$discussionitems[$idx] .= &mt('This post has been edited by the author.');                                  $$discussionitems[$idx] .= '&nbsp;&nbsp;'.&mt('This post has been edited by the author.');
                                 if ($seeid) {                                  if ($seeid) {
                                     $$discussionitems[$idx] .= '&nbsp;&nbsp;'.                                      $$discussionitems[$idx] .= '&nbsp;&nbsp;'.
                                          &discussion_link($symb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group));                                           &discussion_link($symb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group));
Line 1459  sub filter_regexp { Line 1474  sub filter_regexp {
   
   
 sub get_post_contents {  sub get_post_contents {
     my ($contrib,$idx,$seeid,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$numver) = @_;      my ($contrib,$idx,$seeid,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$showaboutme,$numver) = @_;
     my $discussion = '';      my $discussion = '';
     my $start=$numver;      my $start=$numver;
     my $end=$numver + 1;      my $end=$numver + 1;
Line 1477  sub get_post_contents { Line 1492  sub get_post_contents {
                                         $$contrib{$idx.':sendername'},                                          $$contrib{$idx.':sendername'},
                                         $$contrib{$idx.':senderdomain'});                                          $$contrib{$idx.':senderdomain'});
     $$screenname=$$contrib{$idx.':screenname'};      $$screenname=$$contrib{$idx.':screenname'};
       $$showaboutme = &Apache::lonnet::usertools_access($$contrib{$idx.':sendername'},
     my $sender=&Apache::loncommon::aboutmewrapper(                                                        $$contrib{$idx.':senderdomain'},
                                                         'aboutme');
       my $sender = $$plainname;
       if ($$showaboutme) {
           $sender = &Apache::loncommon::aboutmewrapper(
                                  $$plainname,                                   $$plainname,
                                  $$contrib{$idx.':sendername'},                                   $$contrib{$idx.':sendername'},
                                  $$contrib{$idx.':senderdomain'}).' ('.                                   $$contrib{$idx.':senderdomain'});
                                  $$contrib{$idx.':sendername'}.':'.      }
                                  $$contrib{$idx.':senderdomain'}.')';      if ($seeid) {
           $sender .= ' ('.$$contrib{$idx.':sendername'}.':'.
                      $$contrib{$idx.':senderdomain'}.')';
       }
     my $attachmenturls = $$contrib{$idx.':attachmenturl'};      my $attachmenturls = $$contrib{$idx.':attachmenturl'};
     my @postversions = ();      my @postversions = ();
     if ($type eq 'allversions' || $type eq 'export') {      if ($type eq 'allversions' || $type eq 'export') {
Line 3465  sub generate_attachments_button { Line 3487  sub generate_attachments_button {
     my ($idx,$attachnum,$ressymb,$now,$currnewattach,$deloldattach,      my ($idx,$attachnum,$ressymb,$now,$currnewattach,$deloldattach,
         $numoldver,$mode,$blockblog) = @_;          $numoldver,$mode,$blockblog) = @_;
     my $origpage = $ENV{'REQUEST_URI'};      my $origpage = $ENV{'REQUEST_URI'};
     my $att=$attachnum.' '.&mt("attachments");  
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                 'clic' => 'Click to add/remove attachments',                  'clic' => 'Add/remove attachments',
     );       ); 
     my $response = (<<END);      my $response = (<<END);
 <br />  <br />
 <form name="attachment" action="/adm/feedback?attach=$ressymb" method="post">  <form name="attachment" action="/adm/feedback?attach=$ressymb" method="post">
 $lt{'clic'}:&nbsp;<input type="button" value="$att"  <input type="button" value="$lt{'clic'}"
 onclick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=escape(document.mailform.comment.value);this.form.subject.value=escape(document.mailform.subject.value);  onclick="if (typeof(document.mailform.onsubmit)=='function') {document.mailform.onsubmit();};this.form.comment.value=escape(document.mailform.comment.value);this.form.subject.value=escape(document.mailform.subject.value);
 END  END
     if (!$blockblog) {      if (!$blockblog) {
Line 3790  sub handler { Line 3811  sub handler {
           my %attachmsgs = ();            my %attachmsgs = ();
           my %allattachments = ();            my %allattachments = ();
           my %imsfiles = ();            my %imsfiles = ();
           my ($screenname,$plainname);            my ($screenname,$plainname,$showaboutme);
           my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'},            my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'},
                            $env{'course.'.$env{'request.course.id'}.'.domain'},                             $env{'course.'.$env{'request.course.id'}.'.domain'},
                            $env{'course.'.$env{'request.course.id'}.'.num'});                             $env{'course.'.$env{'request.course.id'}.'.num'});
           $r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname));            $r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname,\$showaboutme));
       }        }
       $r->print(&Apache::loncommon::end_page());        $r->print(&Apache::loncommon::end_page());
       return OK;        return OK;

Removed from v.1.333  
changed lines
  Added in v.1.336


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>