diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/InfiniteScroll/infinitescroll.js | 2 | ||||
-rw-r--r-- | plugins/LilUrl/LilUrlPlugin.php | 2 | ||||
-rw-r--r-- | plugins/Mapstraction/MapstractionPlugin.php | 68 | ||||
-rw-r--r-- | plugins/Meteor/meteorupdater.js | 2 | ||||
-rw-r--r-- | plugins/MobileProfile/MobileProfilePlugin.php | 10 | ||||
-rw-r--r-- | plugins/MobileProfile/mp-screen.css | 45 | ||||
-rw-r--r-- | plugins/PtitUrl/PtitUrlPlugin.php | 9 | ||||
-rw-r--r-- | plugins/Realtime/realtimeupdate.js | 12 | ||||
-rw-r--r-- | plugins/TightUrl/TightUrlPlugin.php | 9 | ||||
-rw-r--r-- | plugins/UrlShortener/UrlShortenerPlugin.php | 8 | ||||
-rw-r--r-- | plugins/UserFlag/UserFlagPlugin.php | 12 | ||||
-rw-r--r-- | plugins/UserFlag/adminprofileflag.php | 5 | ||||
-rw-r--r-- | plugins/UserFlag/flagprofile.php | 26 | ||||
-rw-r--r-- | plugins/UserFlag/flagprofileform.php | 12 | ||||
-rw-r--r-- | plugins/UserFlag/icon_flag.gif (renamed from plugins/UserFlag/flag.gif) | bin | 80 -> 80 bytes | |||
-rw-r--r-- | plugins/UserFlag/userflag.css | 4 |
16 files changed, 171 insertions, 55 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/LilUrl/LilUrlPlugin.php b/plugins/LilUrl/LilUrlPlugin.php index e906751e8..4a6f1cdc7 100644 --- a/plugins/LilUrl/LilUrlPlugin.php +++ b/plugins/LilUrl/LilUrlPlugin.php @@ -54,7 +54,7 @@ class LilUrlPlugin extends UrlShortenerPlugin if (!isset($y->body)) return; $x = $y->body->p[0]->a->attributes(); if (isset($x['href'])) { - return $x['href']; + return strval($x['href']); } } } 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 9f8923396..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'; @@ -63,9 +63,6 @@ class MobileProfilePlugin extends WAP20Plugin function onStartShowHTML($action) { - - - // XXX: This should probably graduate to WAP20Plugin // If they are on the mobile site, serve them MP @@ -162,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); } } @@ -176,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/MobileProfile/mp-screen.css b/plugins/MobileProfile/mp-screen.css index 1bb0248ec..e05adeb83 100644 --- a/plugins/MobileProfile/mp-screen.css +++ b/plugins/MobileProfile/mp-screen.css @@ -1,3 +1,12 @@ +/** theme: mobile profile screen + * + * @package StatusNet + * @author Sarven Capadisli <csarven@status.net> + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + @import url(../../theme/base/css/display.css); @import url(../../theme/identica/css/display.css); @@ -64,8 +73,6 @@ width:auto; margin-left:0; } - - #site_nav_global_primary { margin:0; width:100%; @@ -81,7 +88,6 @@ float:left; font-size:0.9em; } - #form_notice { width:100%; } @@ -106,13 +112,16 @@ iPhone/iPod Touch, Android, Opera Mini Simulator display:none; } #form_notice #notice_data-attach { -top:auto; -bottom:0; -left:0; -right:auto; -opacity:1; -z-index:9; +position:static; +clear:both; width:65%; +height:auto; +display:block; +z-index:9; +padding:0; +margin:0; +background:none; +opacity:1; } #form_notice #notice_action-submit { @@ -168,9 +177,6 @@ margin-bottom:0; padding-top:4px; padding-bottom:4px; } -.notice .entry-title { - -} .notice div.entry-content { margin-left:0; width:65%; @@ -180,14 +186,21 @@ width:30%; margin-right:2%; } - +.notice-options form { +width:16px; +height:16px; +} +.notice-options a, +.notice-options input { +box-shadow:none; +-moz-box-shadow:none; +-webkit-box-shadow:none; +} .entity_profile { width:auto; } - - .entity_actions { margin-right:0; margin-left:0; @@ -239,8 +252,6 @@ height:auto; margin-right:5%; } - - #footer { width:96%; padding:2%; diff --git a/plugins/PtitUrl/PtitUrlPlugin.php b/plugins/PtitUrl/PtitUrlPlugin.php index ef453e96d..76a438dd5 100644 --- a/plugins/PtitUrl/PtitUrlPlugin.php +++ b/plugins/PtitUrl/PtitUrlPlugin.php @@ -47,11 +47,14 @@ class PtitUrlPlugin extends UrlShortenerPlugin { $response = $this->http_get(sprintf($this->serviceUrl,urlencode($url))); if (!$response) return; - $response = $this->tidy($response); - $y = @simplexml_load_string($response); + $dom = new DOMDocument(); + @$dom->loadHTML($response); + $y = @simplexml_import_dom($dom); if (!isset($y->body)) return; $xml = $y->body->center->table->tr->td->pre->a->attributes(); - if (isset($xml['href'])) return $xml['href']; + if (isset($xml['href'])) { + return strval($xml['href']); + } } } diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 4ed95ff26..ce0297339 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -87,19 +87,19 @@ RealtimeUpdate = { } var noticeItem = RealtimeUpdate.makeNoticeItem(data); + var noticeItemID = $(noticeItem).attr('id'); + $("#notices_primary .notices").prepend(noticeItem); $("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").fadeIn(1000); - SN.U.NoticeReply(); - SN.U.NoticeFavor(); + SN.U.FormXHR($('#'+noticeItemID+' .form_favor')); + SN.U.NoticeReplyTo($('#'+noticeItemID)); + SN.U.NoticeWithAttachment($('#'+noticeItemID)); }, purgeLastNoticeItem: function() { if ($('#notices_primary .notice').length > RealtimeUpdate._maxnotices) { - $("#notices_primary .notice:last .form_disfavor").unbind('submit'); - $("#notices_primary .notice:last .form_favor").unbind('submit'); - $("#notices_primary .notice:last .notice_reply").unbind('click'); $("#notices_primary .notice:last").remove(); } }, @@ -281,6 +281,8 @@ RealtimeUpdate = { return false; }); + + $('#showstream .entity_profile').css({'width':'69%'}); } } diff --git a/plugins/TightUrl/TightUrlPlugin.php b/plugins/TightUrl/TightUrlPlugin.php index 56414c8c8..6ced9afdc 100644 --- a/plugins/TightUrl/TightUrlPlugin.php +++ b/plugins/TightUrl/TightUrlPlugin.php @@ -48,10 +48,13 @@ class TightUrlPlugin extends UrlShortenerPlugin { $response = $this->http_get(sprintf($this->serviceUrl,urlencode($url))); if (!$response) return; - $response = $this->tidy($response); - $y = @simplexml_load_string($response); + $dom = new DOMDocument(); + @$dom->loadHTML($response); + $y = @simplexml_import_dom($dom); if (!isset($y->body)) return; $xml = $y->body->p[0]->code[0]->a->attributes(); - if (isset($xml['href'])) return $xml['href']; + if (isset($xml['href'])) { + return strval($xml['href']); + } } } diff --git a/plugins/UrlShortener/UrlShortenerPlugin.php b/plugins/UrlShortener/UrlShortenerPlugin.php index 37206aa89..027624b7a 100644 --- a/plugins/UrlShortener/UrlShortenerPlugin.php +++ b/plugins/UrlShortener/UrlShortenerPlugin.php @@ -68,14 +68,6 @@ abstract class UrlShortenerPlugin extends Plugin return $response->getBody(); } - protected function tidy($response) { - $response = str_replace(' ', ' ', $response); - $config = array('output-xhtml' => true); - $tidy = new tidy; - $tidy->parseString($response, $config, 'utf8'); - $tidy->cleanRepair(); - return (string)$tidy; - } //------------Below are the methods that connect StatusNet to the implementing Url Shortener plugin------------\\ function onInitializePlugin(){ diff --git a/plugins/UserFlag/UserFlagPlugin.php b/plugins/UserFlag/UserFlagPlugin.php index 1a3ef3777..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'); @@ -138,19 +138,15 @@ class UserFlagPlugin extends Plugin function onEndShowStatusNetStyles($action) { - $action->elementStart('style', array('type' => 'text/css')); - $action->raw('.entity_flag input, .entity_flag p {'. - ' background:url('.common_path('plugins/UserFlag/flag.gif').') 5px 5px no-repeat;'. - ' }'); - $action->elementEnd('style'); - + $action->cssLink(common_path('plugins/UserFlag/userflag.css'), + null, 'screen, projection, tv'); return true; } function onEndShowScripts($action) { $action->elementStart('script', array('type' => 'text/javascript')); - $action->raw('/*<![CDATA[*/ SN.U.FormXHR($(".form_entity_flag")); /*]]>*/'); + $action->raw('/*<![CDATA[*/ if ($(".form_entity_flag").length > 0) { SN.U.FormXHR($(".form_entity_flag")); } /*]]>*/'); $action->elementEnd('script'); return true; } diff --git a/plugins/UserFlag/adminprofileflag.php b/plugins/UserFlag/adminprofileflag.php index 1ac76b506..20b808637 100644 --- a/plugins/UserFlag/adminprofileflag.php +++ b/plugins/UserFlag/adminprofileflag.php @@ -145,10 +145,15 @@ class FlaggedProfileListItem extends ProfileListItem $this->startActions(); if (Event::handle('StartProfileListItemActionElements', array($this))) { + $this->out->elementStart('li', 'entity_moderation'); + $this->out->element('p', null, _('Moderate')); + $this->out->elementStart('ul'); $this->showSandboxButton(); $this->showSilenceButton(); $this->showDeleteButton(); $this->showClearButton(); + $this->out->elementEnd('ul'); + $this->out->elementEnd('li'); Event::handle('EndProfileListItemActionElements', array($this)); } $this->endActions(); 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. diff --git a/plugins/UserFlag/flag.gif b/plugins/UserFlag/icon_flag.gif Binary files differindex 68c8aee25..68c8aee25 100644 --- a/plugins/UserFlag/flag.gif +++ b/plugins/UserFlag/icon_flag.gif diff --git a/plugins/UserFlag/userflag.css b/plugins/UserFlag/userflag.css new file mode 100644 index 000000000..98da24cc9 --- /dev/null +++ b/plugins/UserFlag/userflag.css @@ -0,0 +1,4 @@ +.entity_flag input.submit, +.entity_flag p { +background:url(icon_flag.gif) 5px 5px no-repeat; +} |