[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm

www www at source.lon-capa.org
Fri Jan 6 15:05:59 EST 2012


www		Fri Jan  6 20:05:59 2012 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  Like/unlike working
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.325 loncom/interface/lonfeedback.pm:1.326
--- loncom/interface/lonfeedback.pm:1.325	Fri Jan  6 19:18:11 2012
+++ loncom/interface/lonfeedback.pm	Fri Jan  6 20:05:59 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.325 2012/01/06 19:18:11 www Exp $
+# $Id: lonfeedback.pm,v 1.326 2012/01/06 20:05:59 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1002,7 +1002,12 @@
             $stddev=sqrt($sumsq/$num);
         }
 # Now we know the average likes $ave and the standard deviation $stddev
-#            &Apache::lonnet::logthis(join(',', at theselikes)." Ave $ave StdDev $stddev");
+# Get the boundaries for markup
+        my $oneplus=$ave+$stddev;
+        my $twoplus=$ave+2.*$stddev;
+        my $oneminus=$ave-$stddev;
+        my $twominus=$ave-2.*$stddev;
+#            &Apache::lonnet::logthis(join(',', at theselikes)." Ave $ave StdDev $stddev $twominus $oneminus $oneplus $twoplus");
 #
 # This is now the real loop. Go through all entries, pick up what we need
 # 
@@ -1333,8 +1338,23 @@
                             if ($$dischash{$toggkey}) {
                                 $$discussionitems[$idx].='  '.$ctlink;
                             }
+# Figure out size based on likes
+                            my $thislikes=$likes{$symb.':'.$idx.':likes'};
+                            my $likesize="100";
+                            if ($thislikes>$twoplus) {
+                                $likesize="200";
+                            } elsif ($thislikes>$oneplus) {
+                                $likesize="150";
+                            }
+                            if ($thislikes<$twominus) {
+                                $likesize="50";
+                            } elsif ($thislikes<$oneminus) {
+                                $likesize="75";
+                            }
                             $$discussionitems[$idx].= '<br /><blockquote>'.
-                                    $message.'</blockquote>';
+                                    "<div style='font-size:$likesize%'>".
+                                    $message.
+                                    '</div></blockquote>';
                             if ($contrib{$idx.':history'}) {
                                 my @postversions = ();
                                 $$discussionitems[$idx] .= &mt('This post has been edited by the author.');




More information about the LON-CAPA-cvs mailing list