return true;
}
+ $base = $action->selfUrl();
+ if (mb_strstr($base, '?')) {
+ $url = $base . '&realtime=1';
+ } else {
+ $url = $base . '?realtime=1';
+ }
+
$scripts = $this->_getScripts();
foreach ($scripts as $script) {
$user_id = 0;
}
+ if ($action->boolean('realtime')) {
+ $realtimeUI = ' RealtimeUpdate.initPopupWindow();';
+ }
+ else {
+ $iconurl = common_path('plugins/Realtime/icon_external.gif');
+ $realtimeUI = ' RealtimeUpdate.addPopup("'.$url.'", "'.$timeline.'", "'. $iconurl .'");';
+ }
+
$action->elementStart('script', array('type' => 'text/javascript'));
$script = ' $(document).ready(function() { '.
+ $realtimeUI.
$this->_updateInitialize($timeline, $user_id).
'}); ';
-
$action->raw($script);
$action->elementEnd('script');
return true;
}
- function onStartShowPageNotice($action)
- {
- $timeline = $this->_getTimeline($action);
- if (!empty($timeline)) {
- $base = $action->selfUrl();
- if (mb_strstr($url, '?')) {
- $url = $base . '&realtime=1';
- } else {
- $url = $base . '?realtime=1';
- }
- $title = $action->title();
- $code = "window.open('$url', '$title', 'toolbar=no,resizable=yes,scrollbars=yes,status=yes,height=640,width=575');";
- $action->element('a', array('href' => $base,
- 'onclick' => $code,
- 'id' => 'realtime_timeline',
- 'title' => _('Pop up')),
- 'Pop up');
-
- }
- return true;
- }
-
function onStartShowBody($action)
{
$realtime = $action->boolean('realtime');
(common_current_user()) ? array('id' => $action->trimmed('action'),
'class' => 'user_in')
: array('id' => $action->trimmed('action')));
+
+ // XXX hack to deal with JS that tries to get the
+ // root url from page output
+
+ $action->elementStart('address');
+ $action->element('a', array('class' => 'url',
+ 'href' => common_local_url('public')),
+ '');
+ $action->elementEnd('address');
+
if (common_logged_in()) {
$action->showNoticeForm();
}
- $action->showContent();
+
+ $action->showContentBlock();
+ $action->showScripts();
$action->elementEnd('body');
return false; // No default processing
}
// FIXME: this code should be abstracted to a neutral third
// party, like Notice::asJson(). I'm not sure of the ethics
// of refactoring from within a plugin, so I'm just abusing
- // the TwitterApiAction method. Don't do this unless you're me!
+ // the ApiAction method. Don't do this unless you're me!
- require_once(INSTALLDIR.'/lib/twitterapi.php');
+ require_once(INSTALLDIR.'/lib/api.php');
- $act = new TwitterApiAction('/dev/null');
+ $act = new ApiAction('/dev/null');
- $arr = $act->twitter_status_array($notice, true);
+ $arr = $act->twitterStatusArray($notice, true);
$arr['url'] = $notice->bestUrl();
$arr['html'] = htmlspecialchars($notice->rendered);
$arr['source'] = htmlspecialchars($arr['source']);