Diff for /loncom/interface/lonfeedback.pm between versions 1.338 and 1.340

version 1.338, 2012/03/09 15:02:31 version 1.340, 2012/03/15 12:45:21
Line 955  sub build_posting_display { Line 955  sub build_posting_display {
     my $thisuser=$env{'user.name'}.':'.$env{'user.domain'};      my $thisuser=$env{'user.name'}.':'.$env{'user.domain'};
 # Array with likes to figure out averages, etc.  # Array with likes to figure out averages, etc.
     my @theselikes=();      my @theselikes=();
 # Hashes containing likes and unlikes for this user.  
     my %userlikes=();  
     my %userunlikes=();  
 # Is the user allowed to see the real name behind anonymous postings?  # Is the user allowed to see the real name behind anonymous postings?
     my $see_anonymous =       my $see_anonymous = 
  &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));   &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
Line 997  sub build_posting_display { Line 994  sub build_posting_display {
             next if ($contrib{$idx.':deleted'});              next if ($contrib{$idx.':deleted'});
             next if ($contrib{$idx.':hidden'});              next if ($contrib{$idx.':hidden'});
             unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx}) || (!$contrib{$idx.':message'})) {              unless ((($hiddens{$idx}) && (!$seeid)) || ($deletions{$idx}) || (!$contrib{$idx.':message'})) {
                 if ($likes{$symb.':'.$idx.':likes'} ne '') {                  push(@theselikes,$likes{$symb.':'.$idx.':likes'});
                     push(@theselikes,$likes{$symb.':'.$idx.':likes'});  
                     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   # Figure out average likes and standard deviation if there are enough discussions to warrant that
 # discussions to warrant that  
         my $ave=0;          my $ave=0;
         my $stddev=10000;          my $stddev=10000;
         if ($#theselikes>1) {          if ($#theselikes>1) {
Line 1037  sub build_posting_display { Line 1021  sub build_posting_display {
         my $twominus=$ave-2.*$stddev;          my $twominus=$ave-2.*$stddev;
 #  #
 # This is now the real loop. Go through all entries, pick up what we need  # This is now the real loop. Go through all entries, pick up what we need
 #  # 
  for (my $id=1;$id<=$contrib{'version'};$id++) {   for (my $id=1;$id<=$contrib{'version'};$id++) {
     my $idx=$id;      my $idx=$id;
             next if ($contrib{$idx.':deleted'});              next if ($contrib{$idx.':deleted'});
Line 1087  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,$showaboutme);                  my ($screenname,$plainname);
                 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 1097  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,\$showaboutme,$numoldver);                  &get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,$numoldver);
   
   
 # Set up for sorting by subject  # Set up for sorting by subject
Line 1127  sub build_posting_display { Line 1111  sub build_posting_display {
                             }                              }
                         }                          }
         if (!$contrib{$idx.':anonymous'} || $see_anonymous) {          if (!$contrib{$idx.':anonymous'} || $see_anonymous) {
                             if ($showaboutme) {      $sender=&Apache::loncommon::aboutmewrapper(
                                 $sender = &Apache::loncommon::aboutmewrapper(   $plainname,
                                               $plainname,   $contrib{$idx.':sendername'},
                                               $contrib{$idx.':sendername'},   $contrib{$idx.':senderdomain'}).' ('.
                                               $contrib{$idx.':senderdomain'});   $contrib{$idx.':sendername'}.':'.
                             } else {   $contrib{$idx.':senderdomain'}.')';
                                 $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 1384  sub build_posting_display { Line 1362  sub build_posting_display {
                                     $message.                                      $message.
                                     '</div></blockquote>';                                      '</div></blockquote>';
 # Put in the like and unlike buttons  # Put in the like and unlike buttons
                             if ($userlikes{$idx}) {                              unless ($likes{$symb.':'.$idx.':likers'}=~/\,\Q$thisuser\E\,/) {
                                 $$discussionitems[$idx].='<img border="0" src="/res/adm/pages/thumbsup_gray.png" alt="'.&mt('You like this posting').'" />';  
                             } else {  
                                 $$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"));                                  $$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').'" />';
                             }                              }
                             if ($userunlikes{$idx}) {                              unless ($likes{$symb.':'.$idx.':unlikers'}=~/\,\Q$thisuser\E\,/) {
                                 $$discussionitems[$idx].='<img border="0" src="/res/adm/pages/thumbsdown_gray.png" alt="'.&mt('You unlike this posting').'" />';                                  $$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 {                              } else {
                                 $$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"));                                  $$discussionitems[$idx].='<img border="0" src="/res/adm/pages/thumbsdown_gray.png" alt="'.&mt('You unlike this posting').'" />';
                             }                              }
                             my $thislikes=$likes{$symb.':'.$idx.':likes'};                              my $thislikes=$likes{$symb.':'.$idx.':likes'};
                             if ($thislikes>0) {                              if ($thislikes>0) {
Line 1490  sub filter_regexp { Line 1468  sub filter_regexp {
   
   
 sub get_post_contents {  sub get_post_contents {
     my ($contrib,$idx,$seeid,$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 $discussion = '';
     my $start=$numver;      my $start=$numver;
     my $end=$numver + 1;      my $end=$numver + 1;
Line 1508  sub get_post_contents { Line 1486  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'},  
                                                       $$contrib{$idx.':senderdomain'},      my $sender=&Apache::loncommon::aboutmewrapper(
                                                       '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'}.':'.
     if ($seeid) {                                   $$contrib{$idx.':senderdomain'}.')';
         $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 1637  sub mail_screen { Line 1608  sub mail_screen {
   }    }
   
   my %lt = &Apache::lonlocal::texthash(    my %lt = &Apache::lonlocal::texthash(
             'myqu' => 'My question/comment/feedback:',              'myqu' => 'Question/comment/feedback:',
             'title' => 'Title',              'title' => 'Title',
             'reta' => 'Retained attachments',              'reta' => 'Retained attachments',
             'atta' => 'Attachment',              'atta' => 'Attachment',
            );             );
     if($env{'form.editdisc'} || $env{'form.replydisc'}){
       %lt = &Apache::lonlocal::texthash(
               'myqu' => 'Post Discussion',
       );
     }
   my $restitle = &get_resource_title($caller_symb,$feedurl);    my $restitle = &get_resource_title($caller_symb,$feedurl);
   my $quote='';    my $quote='';
   my $subject = '';    my $subject = '';
Line 1852  END Line 1828  END
   }    }
   $r->print(<<END);    $r->print(<<END);
 $start_page  $start_page
   <h1>$lt{'myqu'}</h1>
 $header  $header
 <form action="/adm/feedback" method="post" name="mailform"  <form action="/adm/feedback" method="post" name="mailform"
 enctype="multipart/form-data">  enctype="multipart/form-data">
Line 1872  END Line 1849  END
   $r->print(<<END);    $r->print(<<END);
 $options  $options
 $quote  $quote
 <p>$lt{'myqu'}  <p>
 $textareaheader  $textareaheader
 </p>  </p>
   <br>
 <p>  <p>
 $latexHelp  $latexHelp
 </p>  </p>
 <p>  <p>
 $lt{'title'}: <input type="text" name="subject" size="30" value="$subject" /></p>  
 <p>  
 <textarea name="comment" id="comment" cols="60" rows="10" $textareaclass>$comment  
 </textarea></p>  
 END  END
   
   $r->print(&Apache::lonhtmlcommon::start_pick_box());
   $r->print(&Apache::lonhtmlcommon::row_title(&mt('Subject')));
   $r->print('<input type="text" name="subject" size="30" value="'."$subject".'" /></p>');
   $r->print(&Apache::lonhtmlcommon::row_closure());
   $r->print(&Apache::lonhtmlcommon::row_title(&mt('Message')));
   $r->print('<textarea name="comment" id="comment" cols="60" rows="10" $textareaclass>'."$comment".
   '</textarea>');
   $r->print(&Apache::lonhtmlcommon::row_closure(1));
   $r->print(&Apache::lonhtmlcommon::end_pick_box());
   
     if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {      if ( ($env{'form.editdisc'}) || ($env{'form.replydisc'}) ) {
         if ($env{'form.origpage'}) {          if ($env{'form.origpage'}) {
             foreach my $attach (@currnewattach) {              foreach my $attach (@currnewattach) {
Line 3363  sub modify_attachments { Line 3348  sub modify_attachments {
   
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                'subj' => 'Subject',                 'subj' => 'Subject',
                'thfo' => 'The following attachments were part of the most recent saved version of this posting.',  
                'chth' => 'Check the checkboxes for any you wish to remove.',                 'chth' => 'Check the checkboxes for any you wish to remove.',
                'thef' => 'The following attachments have been uploaded for inclusion with this posting.',                 'thef' => 'The following attachments have been uploaded for inclusion with this posting.',
                'adda' => 'Add a new attachment to this post.',                 'adda' => 'Add a new attachment to this post',
                'stch' => 'Save Changes',                 'stch' => 'Save Changes',
                  'clic' => 'Add/remove attachments',
              );               );
     my $js = <<END;      my $js = <<END;
 <script type="text/javascript">  <script type="text/javascript">
Line 3381  END Line 3366  END
     # Breadcrumbs      # Breadcrumbs
     my $brcrum = [{'href' => '',      my $brcrum = [{'href' => '',
                    'text' => 'Discussion Post Attachments'}];                     'text' => 'Discussion Post Attachments'}];
     my %parms=();      my %parms=('only_body' => 1);
     if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum }      if ($env{'form.modal'} ne 'yes') { 'bread_crumbs' => $brcrum }
   
     my $start_page =       my $start_page = 
Line 3410  $start_page Line 3395  $start_page
 $toolarge  $toolarge
 <form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb">  <form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb">
  <br />   <br />
  <table class="LC_data_table">   <h1>$lt{'clic'}</h1>
   <tr>  
    <td colspan="2">  
     <b>Subject:</b> <b>$subject</b><br /><br />  
 END  END
     if ($idx) {      $r->print(&Apache::lonhtmlcommon::start_pick_box());
         if ($attachmenturls) {      $r->print(&Apache::lonhtmlcommon::row_title(&mt('Subject')));
             my @currold = keys(%currattach);      $r->print('<b>'.$subject.'</b>');
             if (@currold > 0) {      $r->print(&Apache::lonhtmlcommon::row_closure());
                 $r->print($lt{'thfo'}.'<br />'.$lt{'chth'}.'<br />'."\n");        $r->print(&Apache::lonhtmlcommon::row_title($lt{'adda'}));
                 foreach my $id (@currold) {      $r->print('<input type="file" name="addnewattach" /><input type="button" name="upload" value="Upload" onclick="this.form.submit()" />  '.$attachmaxtext);
                     my $attachurl = &HTML::Entities::decode($attachments{$id}{'filename'});   
                     $attachurl =~ m#/([^/]+)$#;      if(($idx)||(ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)){
                     $r->print('<label><input type="checkbox" name="deloldattach" value="'.$id.'" />&nbsp;'.$1.'</label><br />'."\n");          $r->print(&Apache::lonhtmlcommon::row_closure());
           $r->print(&Apache::lonhtmlcommon::row_title(&mt('Attachments')));
           if ($idx) {
               if ($attachmenturls) {
                   my @currold = keys(%currattach);
                   if (@currold > 0) {
                       $r->print($lt{'thfo'}.'<br />'.$lt{'chth'}.'<br />'."\n");  
                       foreach my $id (@currold) {
                           my $attachurl = &HTML::Entities::decode($attachments{$id}{'filename'}); 
                           $attachurl =~ m#/([^/]+)$#;
                           $r->print('<label><input type="checkbox" name="deloldattach" value="'.$id.'" />&nbsp;'.$1.'</label><br />'."\n");
                       }
                       $r->print("<br />");
                 }                  }
                 $r->print("<br />");  
             }              }
         }          }
     }          if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {
     if ((ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)) {              $r->print($lt{'chth'}.'<br />'."\n");
         $r->print($lt{'thef'}.'<br />'.$lt{'chth'}.'<br />'."\n");              foreach my $attach (@{$currnewattach}) {
         foreach my $attach (@{$currnewattach}) {                  $attach =~ m#/([^/]+)$#;
             $attach =~ m#/([^/]+)$#;                  $r->print('<label><input type="checkbox" name="delnewattach" value="'.$attach.'" />&nbsp;'.$1.'</label><br />'."\n");
             $r->print('<label><input type="checkbox" name="delnewattach" value="'.$attach.'" />&nbsp;'.$1.'</label><br />'."\n");              }
         }          }
         $r->print("<br />");   
     }      }
       $r->print(&Apache::lonhtmlcommon::row_closure(1));
       $r->print(&Apache::lonhtmlcommon::end_pick_box());
     $r->print(<<END);      $r->print(<<END);
    </td></tr>  
    <tr>  
     <td>  
    $lt{'adda'}</td><td><input type="file" name="addnewattach" /><input type="button" name="upload" value="Upload" onclick="this.form.submit()" />      
    </td>  
   </tr>  
   <tr>  
    <td colspan="2">$attachmaxtext</td>  
   </tr>  
  </table>  
 <input type="hidden" name="subject" value="$env{'form.subject'}" />  <input type="hidden" name="subject" value="$env{'form.subject'}" />
 <input type="hidden" name="comment" value="$env{'form.comment'}" />  <input type="hidden" name="comment" value="$env{'form.comment'}" />
 <input type="hidden" name="timestamp" value="$env{'form.timestamp'}" />  <input type="hidden" name="timestamp" value="$env{'form.timestamp'}" />
Line 3503  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' => 'Add/remove attachments',                  'clic' => 'Add/remove attachments',
     );       ); 
Line 3827  sub handler { Line 3812  sub handler {
           my %attachmsgs = ();            my %attachmsgs = ();
           my %allattachments = ();            my %allattachments = ();
           my %imsfiles = ();            my %imsfiles = ();
           my ($screenname,$plainname,$showaboutme);            my ($screenname,$plainname);
           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,\$showaboutme));            $r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname));
       }        }
       $r->print(&Apache::loncommon::end_page());        $r->print(&Apache::loncommon::end_page());
       return OK;        return OK;
Line 4035  ENDREDIR Line 4020  ENDREDIR
                                         $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'},
                                         '^'.$prefix);                                          '^'.$prefix);
   # Get all who like or unlike this
 # Get current like or unlike status for the $idx for this user.        my $currentlikers=$contrib{$prefix.'likers'};
       my $thisuser=$env{'user.name'}.':'.$env{'user.domain'};        my $currentunlikers=$contrib{$prefix.'unlikers'};
       my ($userlikes,$userunlikes);  
       if (ref($contrib{$prefix.'likers'}) eq 'HASH') {  
           if (exists($contrib{$prefix.'likers'}{$thisuser})) {  
               $userlikes = 1;  
           }  
       }  
       if (ref($contrib{$prefix.'unlikers'}) eq 'HASH') {  
           if (exists($contrib{$prefix.'unlikers'}{$thisuser})) {  
               $userunlikes = 1;  
           }  
       }  
 # Get the current "likes" count  # Get the current "likes" count
       my $likes=$contrib{$prefix.'likes'};        my $likes=$contrib{$prefix.'likes'};
 # Find out if they already voted  # Find out if they already voted
 # Users cannot like a post twice, or unlike it twice.  # Users cannot like a post twice, or unlike it twice. They can change their mind, though
 # They can change their mind, though.  
       my $alreadyflag=0;        my $alreadyflag=0;
       my $thisuser=$env{'user.name'}.':'.$env{'user.domain'};        my $thisuser=$env{'user.name'}.':'.$env{'user.domain'};
       if ($env{'form.like'}) {        if ($env{'form.like'}) {
           if ($userlikes) {            if ($currentlikers=~/\,\Q$thisuser\E\,/) {
               $alreadyflag=1;                $alreadyflag=1;
           } elsif ($userunlikes) {  
               delete($contrib{$prefix.'unlikers'}{$thisuser});  
               $likes++;  
           } else {            } else {
               if (ref($contrib{$prefix.'likers'}) eq 'HASH') {                if ($currentunlikers=~/\,\Q$thisuser\E\,/) {
                   $contrib{$prefix.'likers'}{$thisuser} = 1;                    $currentunlikers=~s/\,\Q$thisuser\E\,//g;
               } else {                } else {
                   $contrib{$prefix.'likers'} = {$thisuser => 1};                    $currentlikers.=','.$thisuser.',';
               }                }
               $likes++;                $likes++;
           }            } 
       } else {        } else {
           if ($userunlikes) {            if ($currentunlikers=~/\,\Q$thisuser\E\,/) {
               $alreadyflag=1;                $alreadyflag=1;
           } elsif ($userlikes) {  
               delete($contrib{$prefix.'likers'}{$thisuser});  
               $likes--;  
           } else {            } else {
               if (ref($contrib{$prefix.'unlikers'}) eq 'HASH') {                if ($currentlikers=~/\,\Q$thisuser\E\,/) {
                   $contrib{$prefix.'unlikers'}{$thisuser} = 1;                    $currentlikers=~s/\,\Q$thisuser\E\,//g;
               } else {                } else {
                   $contrib{$prefix.'unlikers'} = {$thisuser => 1};                    $currentunlikers.=','.$thisuser.',';
               }                }
               $likes--;                $likes--;
           }            } 
       }        }
       my $result;        my $result;
 # $alreadyflag would be 1 if they tried to double-like or double-unlike  # $alreadyflag would be 1 if they tried to double-like or double-unlike
       unless ($alreadyflag) {        unless ($alreadyflag) {
           my %newhash=($prefix.'likes'    => $likes,            my %newhash=($prefix.'likes'    => $likes,
                        $prefix.'likers'   => $contrib{$prefix.'likers'},                         $prefix.'likers'   => $currentlikers,
                        $prefix.'unlikers' => $contrib{$prefix.'unlikers'});                         $prefix.'unlikers' => $currentunlikers);
 # Store data in db-file "disclikes"  # Store data in db-file "disclikes"
           if (&Apache::lonnet::put('disclikes',            if (&Apache::lonnet::put('disclikes',
                                    \%newhash,                                     \%newhash,

Removed from v.1.338  
changed lines
  Added in v.1.340


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