"+
+ ""+
+ "a few seconds ago"+
+ " "+
+ ""+
+ "from "+
""+source+""+ // may have a link
- "";
- if (data['in_reply_to_status_id']) {
- ni = ni+" in context";
- }
+ "";
+ if (data['in_reply_to_status_id']) {
+ ni = ni+" in context";
+ }
- ni = ni+"
"+
+ ni = ni+"
"+
"
";
- if (RealtimeUpdate._userid != 0) {
- var input = $("form#form_notice fieldset input#token");
- var session_key = input.val();
- ni = ni+RealtimeUpdate.makeFavoriteForm(data['id'], session_key);
- ni = ni+RealtimeUpdate.makeReplyLink(data['id'], data['user']['screen_name']);
- if (RealtimeUpdate._userid == data['user']['id']) {
+ if (RealtimeUpdate._userid != 0) {
+ var input = $("form#form_notice fieldset input#token");
+ var session_key = input.val();
+ ni = ni+RealtimeUpdate.makeFavoriteForm(data['id'], session_key);
+ ni = ni+RealtimeUpdate.makeReplyLink(data['id'], data['user']['screen_name']);
+ if (RealtimeUpdate._userid == data['user']['id']) {
ni = ni+RealtimeUpdate.makeDeleteLink(data['id']);
- }
- }
+ }
+ }
- ni = ni+"
"+
- "
";
- return ni;
- },
+ ni = ni+""+
+ "";
+ return ni;
+ },
- makeFavoriteForm: function(id, session_key)
- {
- var ff;
+ makeFavoriteForm: function(id, session_key)
+ {
+ var ff;
- ff = "";
- return ff;
+ "";
+ return ff;
+ },
+
+ makeReplyLink: function(id, nickname)
+ {
+ var rl;
+ rl = "Reply "+id+"";
+ return rl;
},
- makeReplyLink: function(id, nickname)
- {
- var rl;
- rl = "Reply "+id+"";
- return rl;
- },
-
- makeDeleteLink: function(id)
- {
- var dl, delurl;
- delurl = RealtimeUpdate._deleteurl.replace("0000000000", id);
-
- dl = "Delete";
+ makeDeleteLink: function(id)
+ {
+ var dl, delurl;
+ delurl = RealtimeUpdate._deleteurl.replace("0000000000", id);
- return dl;
- }
- }
+ dl = "Delete";
-});
+ return dl;
+ }
+}
--
cgit v1.2.3-54-g00ecf
From 5152d31d2a4199306d656480ca5ff8d0978d8984 Mon Sep 17 00:00:00 2001
From: Evan Prodromou
Date: Wed, 23 Sep 2009 17:28:14 -0400
Subject: Add some more realtime feeds
---
plugins/Realtime/RealtimePlugin.php | 67 +++++++++++++++++++++++++++++++++++--
1 file changed, 64 insertions(+), 3 deletions(-)
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index 22851a6c1..0f3e31071 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -107,13 +107,23 @@ class RealtimePlugin extends Plugin
{
$paths = array();
- // XXX: Add other timelines; this is just for the public one
+ // Add to the author's timeline
+
+ $user = User::staticGet('id', $notice->profile_id);
+
+ if (!empty($user)) {
+ $paths[] = array('showstream', $user->nickname);
+ }
+
+ // Add to the public timeline
if ($notice->is_local ||
($notice->is_local == 0 && !common_config('public', 'localonly'))) {
$paths[] = array('public');
}
+ // Add to the tags timeline
+
$tags = $this->getNoticeTags($notice);
if (!empty($tags)) {
@@ -122,6 +132,46 @@ class RealtimePlugin extends Plugin
}
}
+ // Add to inbox timelines
+ // XXX: do a join
+
+ $inbox = new Notice_inbox();
+ $inbox->notice_id = $notice->id;
+
+ if ($inbox->find()) {
+ while ($inbox->fetch()) {
+ $user = User::staticGet('id', $inbox->user_id);
+ $paths[] = array('all', $user->nickname);
+ }
+ }
+
+ // Add to the replies timeline
+
+ $reply = new Reply();
+ $reply->notice_id = $notice->id;
+
+ if ($reply->find()) {
+ while ($reply->fetch()) {
+ $user = User::staticGet('id', $reply->profile_id);
+ if (!empty($user)) {
+ $paths[] = array('replies', $user->nickname);
+ }
+ }
+ }
+
+ // Add to the group timeline
+ // XXX: join
+
+ $gi = new Group_inbox();
+ $gi->notice_id = $notice->id;
+
+ if ($gi->find()) {
+ while ($gi->fetch()) {
+ $ug = User_group::staticGet('id', $gi->group_id);
+ $paths[] = array('showgroup', $ug->nickname);
+ }
+ }
+
if (count($paths) > 0) {
$json = $this->noticeAsJson($notice);
@@ -270,7 +320,9 @@ class RealtimePlugin extends Plugin
$path = null;
$timeline = null;
- switch ($action->trimmed('action')) {
+ $action_name = $action->trimmed('action');
+
+ switch ($action_name) {
case 'public':
$path = array('public');
break;
@@ -280,11 +332,20 @@ class RealtimePlugin extends Plugin
$path = array('tag', $tag);
}
break;
+ case 'showstream':
+ case 'all':
+ case 'replies':
+ case 'showgroup':
+ $nickname = common_canonical_nickname($action->trimmed('nickname'));
+ if (!empty($nickname)) {
+ $path = array($action_name, $nickname);
+ }
+ break;
default:
break;
}
- if (!is_null($path)) {
+ if (!empty($path)) {
$timeline = $this->_pathToChannel($path);
}
--
cgit v1.2.3-54-g00ecf
From 36e009349d68d8f34fc50d77c26e6e3307116b2c Mon Sep 17 00:00:00 2001
From: Evan Prodromou
Date: Wed, 23 Sep 2009 14:58:42 -0400
Subject: hack around address hack in util.js
---
plugins/Realtime/RealtimePlugin.php | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index 0f3e31071..c41c9ce4a 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -222,6 +222,16 @@ class RealtimePlugin extends Plugin
(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();
}
--
cgit v1.2.3-54-g00ecf
From bdbc2cb8de370eef6d5d06412746f52797ea0458 Mon Sep 17 00:00:00 2001
From: Evan Prodromou
Date: Wed, 23 Sep 2009 15:24:12 -0400
Subject: move some stuff around for realtime
---
plugins/Realtime/RealtimePlugin.php | 32 ++++++++++----------------------
plugins/Realtime/realtimeupdate.js | 5 +++++
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index c41c9ce4a..fde306021 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -76,6 +76,15 @@ class RealtimePlugin extends Plugin
return true;
}
+ $base = $action->selfUrl();
+ if (mb_strstr($url, '?')) {
+ $url = $base . '&realtime=1';
+ } else {
+ $url = $base . '?realtime=1';
+ }
+
+ $title = $action->title();
+
$scripts = $this->_getScripts();
foreach ($scripts as $script) {
@@ -94,6 +103,7 @@ class RealtimePlugin extends Plugin
$script = ' $(document).ready(function() { '.
$this->_updateInitialize($timeline, $user_id).
+ ' RealtimeUpdate.addPopup("'.$url.'", "'.$title.'"); '.
'}); ';
$action->raw($script);
@@ -189,28 +199,6 @@ class RealtimePlugin extends Plugin
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');
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js
index 3293ef6e9..04e07956d 100644
--- a/plugins/Realtime/realtimeupdate.js
+++ b/plugins/Realtime/realtimeupdate.js
@@ -109,6 +109,11 @@ RealtimeUpdate = {
dl = "Delete";
return dl;
+ },
+
+ addPopup: function(url, title)
+ {
+ // FIXME: need to add the realtime popup button here
}
}
--
cgit v1.2.3-54-g00ecf
From 4d4bb089a5e3addfd4be2f82e5e4e257070f4058 Mon Sep 17 00:00:00 2001
From: Sarven Capadisli
Date: Wed, 23 Sep 2009 21:58:35 +0000
Subject: Created addPop() for Realtime plugin and added param to include
iconurl
---
plugins/Realtime/RealtimePlugin.php | 4 +++-
plugins/Realtime/realtimeupdate.js | 25 +++++++++++++++++++++++--
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index fde306021..157c800d9 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -99,11 +99,13 @@ class RealtimePlugin extends Plugin
$user_id = 0;
}
+ $iconurl = $base.'plugins/Realtime/icon_external.gif';
+
$action->elementStart('script', array('type' => 'text/javascript'));
$script = ' $(document).ready(function() { '.
$this->_updateInitialize($timeline, $user_id).
- ' RealtimeUpdate.addPopup("'.$url.'", "'.$title.'"); '.
+ ' RealtimeUpdate.addPopup("'.$url.'", "'.$title.'", "'. $iconurl .'");'
'}); ';
$action->raw($script);
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js
index 04e07956d..2910e4a80 100644
--- a/plugins/Realtime/realtimeupdate.js
+++ b/plugins/Realtime/realtimeupdate.js
@@ -111,9 +111,30 @@ RealtimeUpdate = {
return dl;
},
- addPopup: function(url, title)
+ addPopup: function(url, title, iconurl)
{
- // FIXME: need to add the realtime popup button here
+ $('#site_nav_local_views .current a').append('');
+
+ $('#realtime_timeline').css({
+ 'margin':'2px 0 0 11px',
+ 'background':'transparent url('+ iconurl + ') no-repeat 45% 45%',
+ 'text-indent':'-9999px',
+ 'width':'16px',
+ 'height':'16px',
+ 'padding':'0',
+ 'display':'block',
+ 'float':'right',
+ 'border':'none',
+ 'cursor':'pointer'
+ });
+
+ $('#realtime_timeline').click(function() {
+ window.open(url,
+ title,
+ 'toolbar=no,resizable=yes,scrollbars=yes,status=yes');
+
+ return false;
+ });
}
}
--
cgit v1.2.3-54-g00ecf
From ddb9518c9949989f99c3e7b0323c9bbd01c1d5ee Mon Sep 17 00:00:00 2001
From: Sarven Capadisli
Date: Wed, 23 Sep 2009 22:00:22 +0000
Subject: Some layout and rendering adjustment for Realtime plugin
---
plugins/Realtime/RealtimePlugin.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index 157c800d9..f211c01f9 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -213,9 +213,9 @@ class RealtimePlugin extends Plugin
'class' => 'user_in')
: array('id' => $action->trimmed('action')));
+ $action->elementStart('div', array('id' => 'header'));
// 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')),
@@ -225,7 +225,9 @@ class RealtimePlugin extends Plugin
if (common_logged_in()) {
$action->showNoticeForm();
}
- $action->showContent();
+ $action->elementEnd('div');
+
+ $action->showContentBlock();
$action->elementEnd('body');
return false; // No default processing
}
--
cgit v1.2.3-54-g00ecf
From 1f12993a4ddad8eba29c604c55f6b82d08dc0127 Mon Sep 17 00:00:00 2001
From: Sarven Capadisli
Date: Wed, 23 Sep 2009 22:02:42 +0000
Subject: Added JavaScript to initialize the poped Window
---
plugins/Realtime/RealtimePlugin.php | 13 ++++++++++---
plugins/Realtime/realtimeupdate.js | 7 +++++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index f211c01f9..4fb8bf84e 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -99,15 +99,22 @@ class RealtimePlugin extends Plugin
$user_id = 0;
}
- $iconurl = $base.'plugins/Realtime/icon_external.gif';
+ // FIXME: Need to check if the current URL is a poped realtime window
+ if (1==2) {
+ $realtimeUI = ' RealtimeUpdate.initPopupWindow();';
+ }
+ else {
+ // FIXME: This icon URL is no good if fancy URLs are off.
+ $iconurl = $base.'plugins/Realtime/icon_external.gif';
+ $realtimeUI = ' RealtimeUpdate.addPopup("'.$url.'", "'.$title.'", "'. $iconurl .'");';
+ }
$action->elementStart('script', array('type' => 'text/javascript'));
$script = ' $(document).ready(function() { '.
$this->_updateInitialize($timeline, $user_id).
- ' RealtimeUpdate.addPopup("'.$url.'", "'.$title.'", "'. $iconurl .'");'
+ $realtimeUI.
'}); ';
-
$action->raw($script);
$action->elementEnd('script');
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js
index 2910e4a80..4fda5079d 100644
--- a/plugins/Realtime/realtimeupdate.js
+++ b/plugins/Realtime/realtimeupdate.js
@@ -135,6 +135,13 @@ RealtimeUpdate = {
return false;
});
+ },
+
+ initPopupWindow: function()
+ {
+ window.resizeTo(575, 640);
+ $('address').hide();
+ $('#content').css({'width':'92%'});
}
}
--
cgit v1.2.3-54-g00ecf
From d86155ad943032918c2fab070ca49f0a3586f25d Mon Sep 17 00:00:00 2001
From: Sarven Capadisli
Date: Wed, 23 Sep 2009 22:04:39 +0000
Subject: Using timeline string instead of title for WindowName because IE
doesn't like names with whitespace.
---
plugins/Realtime/RealtimePlugin.php | 4 +---
plugins/Realtime/realtimeupdate.js | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index 4fb8bf84e..7334f5657 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -83,8 +83,6 @@ class RealtimePlugin extends Plugin
$url = $base . '?realtime=1';
}
- $title = $action->title();
-
$scripts = $this->_getScripts();
foreach ($scripts as $script) {
@@ -106,7 +104,7 @@ class RealtimePlugin extends Plugin
else {
// FIXME: This icon URL is no good if fancy URLs are off.
$iconurl = $base.'plugins/Realtime/icon_external.gif';
- $realtimeUI = ' RealtimeUpdate.addPopup("'.$url.'", "'.$title.'", "'. $iconurl .'");';
+ $realtimeUI = ' RealtimeUpdate.addPopup("'.$url.'", "'.$timeline.'", "'. $iconurl .'");';
}
$action->elementStart('script', array('type' => 'text/javascript'));
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js
index 4fda5079d..57fe0a843 100644
--- a/plugins/Realtime/realtimeupdate.js
+++ b/plugins/Realtime/realtimeupdate.js
@@ -111,7 +111,7 @@ RealtimeUpdate = {
return dl;
},
- addPopup: function(url, title, iconurl)
+ addPopup: function(url, timeline, iconurl)
{
$('#site_nav_local_views .current a').append('');
@@ -130,7 +130,7 @@ RealtimeUpdate = {
$('#realtime_timeline').click(function() {
window.open(url,
- title,
+ timeline,
'toolbar=no,resizable=yes,scrollbars=yes,status=yes');
return false;
--
cgit v1.2.3-54-g00ecf
From 543e3e797277526ac0f0c6ac99be64897955258a Mon Sep 17 00:00:00 2001
From: Evan Prodromou
Date: Wed, 23 Sep 2009 23:04:25 -0400
Subject: some UI fixes
---
plugins/Realtime/RealtimePlugin.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index 7334f5657..e30c41156 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -77,7 +77,7 @@ class RealtimePlugin extends Plugin
}
$base = $action->selfUrl();
- if (mb_strstr($url, '?')) {
+ if (mb_strstr($base, '?')) {
$url = $base . '&realtime=1';
} else {
$url = $base . '?realtime=1';
@@ -97,21 +97,19 @@ class RealtimePlugin extends Plugin
$user_id = 0;
}
- // FIXME: Need to check if the current URL is a poped realtime window
- if (1==2) {
+ if ($action->boolean('realtime')) {
$realtimeUI = ' RealtimeUpdate.initPopupWindow();';
}
else {
- // FIXME: This icon URL is no good if fancy URLs are off.
- $iconurl = $base.'plugins/Realtime/icon_external.gif';
+ $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() { '.
- $this->_updateInitialize($timeline, $user_id).
$realtimeUI.
+ $this->_updateInitialize($timeline, $user_id).
'}); ';
$action->raw($script);
@@ -219,8 +217,10 @@ class RealtimePlugin extends Plugin
: array('id' => $action->trimmed('action')));
$action->elementStart('div', array('id' => 'header'));
+
// 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')),
--
cgit v1.2.3-54-g00ecf
From a5ed805aeabab3930d066b2777dbab9663bc487f Mon Sep 17 00:00:00 2001
From: Evan Prodromou
Date: Wed, 23 Sep 2009 23:23:13 -0400
Subject: move scripts to just before
, add event for scripts that need
to be in
---
EVENTS.txt | 6 ++++++
lib/action.php | 19 +++++++++++--------
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/EVENTS.txt b/EVENTS.txt
index 68cb28603..dfaf34a66 100644
--- a/EVENTS.txt
+++ b/EVENTS.txt
@@ -134,3 +134,9 @@ StartAddressData: Allows the site owner to provide additional information about
EndAddressData: At the end of
- $action: the current action
+
+StartShowHeadElements: Right after the tag
+- $action: the current action
+
+EndShowHeadElements: Right before the tag; put