summaryrefslogtreecommitdiff
path: root/plugins/AnonymousFave
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-09-29 14:08:31 -0700
committerZach Copley <zach@status.net>2010-09-29 16:35:15 -0700
commit0fe0f421731ee3cfa5e0bafd08559cc9bfc44422 (patch)
tree598521765bd4ee3292ab1e38486f046e72e16788 /plugins/AnonymousFave
parent0ac333ec801b8df68da69fa38a13d07960bd9649 (diff)
Ajax update notice tally
Diffstat (limited to 'plugins/AnonymousFave')
-rw-r--r--plugins/AnonymousFave/AnonymousFavePlugin.php48
1 files changed, 27 insertions, 21 deletions
diff --git a/plugins/AnonymousFave/AnonymousFavePlugin.php b/plugins/AnonymousFave/AnonymousFavePlugin.php
index 984625a88..41542c849 100644
--- a/plugins/AnonymousFave/AnonymousFavePlugin.php
+++ b/plugins/AnonymousFave/AnonymousFavePlugin.php
@@ -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);