]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Ajax update notice tally
authorZach Copley <zach@status.net>
Wed, 29 Sep 2010 21:08:31 +0000 (14:08 -0700)
committerZach Copley <zach@status.net>
Wed, 29 Sep 2010 21:08:31 +0000 (14:08 -0700)
plugins/AnonymousFave/AnonymousFavePlugin.php

index 984625a8811f9238f3e29233df41aed819175dd4..41542c8493777a11e794a83f697cd75747ad0a5f 100644 (file)
@@ -136,27 +136,6 @@ class AnonymousFavePlugin extends Plugin {
         return true;
     }
 
-
-    function onEndShowNoticeInfo($item)
-    {
-        common_debug("XXXXXXXXXXX onEndShowNoticeInfo");
-
-        $tally = Fave_tally::ensureTally($item->notice->id);
-
-        if (!empty($tally)) {
-            $item->out->elementStart(
-                'div',
-                array(
-                    'id' => 'notice-' . $item->notice->id . '-tally',
-                    'class' => 'notice-tally'
-                )
-            );
-            $item->out->raw(sprintf(_m("favored %d times"), $tally->count));
-            $item->out->elementEnd('div');
-        }
-        return true;
-    }
-
     function onStartShowNoticeOptions($item) {
 
         if (!common_logged_in()) {
@@ -187,6 +166,33 @@ class AnonymousFavePlugin extends Plugin {
         return true;
     }
 
+    function onEndFavorNoticeForm($form, $notice)
+    {
+        $this->showTally($form->out, $notice);
+    }
+
+    function onEndDisFavorNoticeForm($form, $notice)
+    {
+        $this->showTally($form->out, $notice);
+    }
+
+    function showTally($out, $notice)
+    {
+        $tally = Fave_tally::ensureTally($notice->id);
+
+        if (!empty($tally)) {
+            $out->elementStart(
+                'div',
+                array(
+                    'id' => 'notice-' . $notice->id . '-tally',
+                    'class' => 'notice-tally'
+                )
+            );
+            $out->raw(sprintf(_m("favored %d times"), $tally->count));
+            $out->elementEnd('div');
+        }
+    }
+
     function onEndFavorNotice($profile, $notice)
     {
         $tally = Fave_tally::increment($notice->id);