add live updating for tag pages

This commit is contained in:
Evan Prodromou 2009-04-26 18:00:06 -04:00
parent 781341d91f
commit e438334c00

View File

@ -62,6 +62,14 @@ class CometPlugin extends Plugin
case 'public': case 'public':
$timeline = '/timelines/public'; $timeline = '/timelines/public';
break; break;
case 'tag':
$tag = $action->trimmed('tag');
if (!empty($tag)) {
$timeline = '/timelines/tag/'.$tag;
} else {
return true;
}
break;
default: default:
return true; return true;
} }
@ -94,6 +102,14 @@ class CometPlugin extends Plugin
$timelines[] = '/timelines/public'; $timelines[] = '/timelines/public';
} }
$tags = $this->getNoticeTags($notice);
if (!empty($tags)) {
foreach ($tags as $tag) {
$timelines[] = '/timelines/tag/' . $tag;
}
}
if (count($timelines) > 0) { if (count($timelines) > 0) {
// Require this, since we need it // Require this, since we need it
require_once(INSTALLDIR.'/plugins/Comet/bayeux.class.inc.php'); require_once(INSTALLDIR.'/plugins/Comet/bayeux.class.inc.php');
@ -134,6 +150,26 @@ class CometPlugin extends Plugin
return $arr; return $arr;
} }
function getNoticeTags($notice)
{
$tags = null;
$nt = new Notice_tag();
$nt->notice_id = $notice->id;
if ($nt->find()) {
$tags = array();
while ($nt->fetch()) {
$tags[] = $nt->tag;
}
}
$nt->free();
$nt = null;
return $tags;
}
// Push this up to Plugin // Push this up to Plugin
function log($level, $msg) function log($level, $msg)