summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/InfiniteScroll/infinitescroll.js2
-rw-r--r--plugins/Mapstraction/MapstractionPlugin.php68
-rw-r--r--plugins/Meteor/meteorupdater.js2
-rw-r--r--plugins/MobileProfile/MobileProfilePlugin.php7
-rw-r--r--plugins/Realtime/realtimeupdate.js2
-rw-r--r--plugins/UserFlag/UserFlagPlugin.php2
-rw-r--r--plugins/UserFlag/flagprofile.php26
-rw-r--r--plugins/UserFlag/flagprofileform.php12
8 files changed, 113 insertions, 8 deletions
diff --git a/plugins/InfiniteScroll/infinitescroll.js b/plugins/InfiniteScroll/infinitescroll.js
index 0dafef6d5..0c8edce2b 100644
--- a/plugins/InfiniteScroll/infinitescroll.js
+++ b/plugins/InfiniteScroll/infinitescroll.js
@@ -1,6 +1,6 @@
jQuery(document).ready(function($){
$('notices_primary').infinitescroll({
- debug: true,
+ debug: false,
infiniteScroll : false,
nextSelector : 'body#public li.nav_next a,'+
'body#all li.nav_next a,'+
diff --git a/plugins/Mapstraction/MapstractionPlugin.php b/plugins/Mapstraction/MapstractionPlugin.php
index 37306a23c..c0c2c5b8e 100644
--- a/plugins/Mapstraction/MapstractionPlugin.php
+++ b/plugins/Mapstraction/MapstractionPlugin.php
@@ -110,6 +110,11 @@ class MapstractionPlugin extends Plugin
function onEndShowScripts($action)
{
$actionName = $action->trimmed('action');
+ // These are the ones that have maps on 'em
+ if (!in_array($actionName,
+ array('showstream', 'all', 'allmap', 'usermap'))) {
+ return true;
+ }
switch ($this->provider)
{
@@ -146,6 +151,39 @@ class MapstractionPlugin extends Plugin
$action->raw(sprintf('var _provider = "%s";', $this->provider));
$action->elementEnd('script');
+ switch ($actionName) {
+ case 'usermap':
+ case 'showstream':
+ $notice = empty($action->tag)
+ ? $action->user->getNotices(($action->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1)
+ : $action->user->getTaggedNotices($action->tag, ($action->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null);
+ break;
+ case 'all':
+ case 'allmap':
+ $cur = common_current_user();
+ if (!empty($cur) && $cur->id == $action->user->id) {
+ $notice = $action->user->noticeInbox(($action->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+ } else {
+ $notice = $action->user->noticesWithFriends(($action->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+ }
+ break;
+ }
+
+ $jsonArray = array();
+
+ while ($notice->fetch()) {
+ if (!empty($notice->lat) && !empty($notice->lon)) {
+ $jsonNotice = $this->noticeAsJson($notice);
+ $jsonArray[] = $jsonNotice;
+ }
+ }
+
+ $action->elementStart('script', array('type' => 'text/javascript'));
+ $action->raw('/*<![CDATA[*/'); // XHTML compat for Safari
+ $action->raw('var _notices = ' . json_encode($jsonArray));
+ $action->raw('/*]]>*/'); // XHTML compat for Safari
+ $action->elementEnd('script');
+
return true;
}
@@ -176,4 +214,34 @@ class MapstractionPlugin extends Plugin
$action->elementEnd('div');
}
+
+ function noticeAsJson($notice)
+ {
+ // 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 ApiAction method. Don't do this unless you're me!
+
+ require_once(INSTALLDIR.'/lib/api.php');
+
+ $act = new ApiAction('/dev/null');
+
+ $arr = $act->twitterStatusArray($notice, true);
+ $arr['url'] = $notice->bestUrl();
+ $arr['html'] = $notice->rendered;
+ $arr['source'] = $arr['source'];
+
+ if (!empty($notice->reply_to)) {
+ $reply_to = Notice::staticGet('id', $notice->reply_to);
+ if (!empty($reply_to)) {
+ $arr['in_reply_to_status_url'] = $reply_to->bestUrl();
+ }
+ $reply_to = null;
+ }
+
+ $profile = $notice->getProfile();
+ $arr['user']['profile_url'] = $profile->profileurl;
+
+ return $arr;
+ }
}
diff --git a/plugins/Meteor/meteorupdater.js b/plugins/Meteor/meteorupdater.js
index 9ce68775b..cdd1d63fa 100644
--- a/plugins/Meteor/meteorupdater.js
+++ b/plugins/Meteor/meteorupdater.js
@@ -1,6 +1,4 @@
// Update the local timeline from a Meteor server
-// XXX: If @a is subscribed to @b, @a should get @b's notices in @a's Personal timeline.
-// Do Replies timeline.
var MeteorUpdater = function()
{
diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php
index fd6057550..0b1e4de28 100644
--- a/plugins/MobileProfile/MobileProfilePlugin.php
+++ b/plugins/MobileProfile/MobileProfilePlugin.php
@@ -31,7 +31,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
-define('PAGE_TYPE_PREFS',
+define('PAGE_TYPE_PREFS_MOBILEPROFILE',
'application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html;q=0.9');
require_once INSTALLDIR.'/plugins/Mobile/WAP20Plugin.php';
@@ -159,8 +159,7 @@ class MobileProfilePlugin extends WAP20Plugin
common_config('site', 'server'))) {
// FIXME: Redirect to equivalent page on mobile site instead
- header("Location: ".$this->_common_path(''));
- exit();
+ common_redirect($this->_common_path(''), 302);
}
}
@@ -173,7 +172,7 @@ class MobileProfilePlugin extends WAP20Plugin
$_SERVER['HTTP_ACCEPT'] : null;
$cp = common_accept_to_prefs($httpaccept);
- $sp = common_accept_to_prefs(PAGE_TYPE_PREFS);
+ $sp = common_accept_to_prefs(PAGE_TYPE_PREFS_MOBILEPROFILE);
$type = common_negotiate_type($cp, $sp);
diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js
index 9ea5c3bce..ce0297339 100644
--- a/plugins/Realtime/realtimeupdate.js
+++ b/plugins/Realtime/realtimeupdate.js
@@ -281,6 +281,8 @@ RealtimeUpdate = {
return false;
});
+
+ $('#showstream .entity_profile').css({'width':'69%'});
}
}
diff --git a/plugins/UserFlag/UserFlagPlugin.php b/plugins/UserFlag/UserFlagPlugin.php
index 4717a63dd..60c0c2c0a 100644
--- a/plugins/UserFlag/UserFlagPlugin.php
+++ b/plugins/UserFlag/UserFlagPlugin.php
@@ -97,7 +97,7 @@ class UserFlagPlugin extends Plugin
{
$user = common_current_user();
- if (!empty($user)) {
+ if (!empty($user) && ($user->id != $profile->id)) {
$action->elementStart('li', 'entity_flag');
diff --git a/plugins/UserFlag/flagprofile.php b/plugins/UserFlag/flagprofile.php
index 8ff2f1f72..9bce7865b 100644
--- a/plugins/UserFlag/flagprofile.php
+++ b/plugins/UserFlag/flagprofile.php
@@ -72,6 +72,28 @@ class FlagprofileAction extends ProfileFormAction
return true;
}
+
+ /**
+ * Handle request
+ *
+ * Overriding the base Action's handle() here to deal check
+ * for Ajax and return an HXR response if necessary
+ *
+ * @param array $args $_REQUEST args; handled in prepare()
+ *
+ * @return void
+ */
+
+ function handle($args)
+ {
+ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ $this->handlePost();
+ if (!$this->boolean('ajax')) {
+ $this->returnToArgs();
+ }
+ }
+ }
+
/**
* Handle POST
*
@@ -97,6 +119,10 @@ class FlagprofileAction extends ProfileFormAction
}
$ufp->free();
+
+ if ($this->boolean('ajax')) {
+ $this->ajaxResults();
+ }
}
function ajaxResults() {
diff --git a/plugins/UserFlag/flagprofileform.php b/plugins/UserFlag/flagprofileform.php
index 262dad4a7..c20929a20 100644
--- a/plugins/UserFlag/flagprofileform.php
+++ b/plugins/UserFlag/flagprofileform.php
@@ -48,6 +48,18 @@ require_once INSTALLDIR.'/lib/form.php';
class FlagProfileForm extends ProfileActionForm
{
/**
+ * class of the form
+ * Action this form provides
+ *
+ * @return string class of the form
+ */
+
+ function formClass()
+ {
+ return 'form_entity_flag';
+ }
+
+ /**
* Action this form provides
*
* @return string Name of the action, lowercased.