diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/LilUrl/LilUrlPlugin.php | 2 | ||||
-rw-r--r-- | plugins/Mapstraction/usermap.js | 77 | ||||
-rw-r--r-- | plugins/MobileProfile/mp-screen.css | 45 | ||||
-rw-r--r-- | plugins/PtitUrl/PtitUrlPlugin.php | 9 | ||||
-rw-r--r-- | plugins/Realtime/RealtimePlugin.php | 5 | ||||
-rw-r--r-- | plugins/Realtime/realtimeupdate.css | 37 | ||||
-rw-r--r-- | plugins/Realtime/realtimeupdate.js | 32 | ||||
-rw-r--r-- | plugins/TightUrl/TightUrlPlugin.php | 9 | ||||
-rw-r--r-- | plugins/UrlShortener/UrlShortenerPlugin.php | 8 | ||||
-rw-r--r-- | plugins/UserFlag/UserFlagPlugin.php | 10 | ||||
-rw-r--r-- | plugins/UserFlag/adminprofileflag.php | 5 | ||||
-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 |
13 files changed, 172 insertions, 71 deletions
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/usermap.js b/plugins/Mapstraction/usermap.js index 270b7efea..e667dd579 100644 --- a/plugins/Mapstraction/usermap.js +++ b/plugins/Mapstraction/usermap.js @@ -1,14 +1,83 @@ $(document).ready(function() { - var mapstraction = new mxn.Mapstraction("map_canvas", _provider); + var notices = []; + $(".notice").each(function(){ + var notice = getNoticeFromElement($(this)); + if(notice['geo']) + notices.push(notice); + }); + if($("#map_canvas").length && notices.length>0) + { + showMapstraction($("#map_canvas"), notices); + } + + $('.geo').click(function(){ + var noticeElement = $(this).closest(".notice"); + notice = getNoticeFromElement(noticeElement); + + $.fn.jOverlay.options = { + color : '#000', + opacity : '0.6', + zIndex : 99, + center : false, + bgClickToClose : true, + autoHide : true, + css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'} + }; + var html="<div id='map_canvas_popup' class='gray smallmap' style='width: 542px; height: 500px' />"; + html+="<button class='close'>×</button>"; + html+=$("<div/>").append($(this).clone()).html(); + $().jOverlay({ "html": html }); + $('#jOverlayContent').show(); + $('#jOverlayContent button').click($.closeOverlay); + + showMapstraction($("#map_canvas_popup"), notice); + + return false; + }); +}); + +function getMicroformatValue(element) +{ + if(element[0].tagName.toLowerCase() == 'abbr'){ + return element.attr('title'); + }else{ + return element.text(); + } +} + +function getNoticeFromElement(noticeElement) +{ + var notice = {}; + if(noticeElement.find(".geo").length){ + var latlon = noticeElement.find(".geo").attr('title').split(";"); + notice['geo']={'coordinates': [ + parseFloat(latlon[0]), + parseFloat(latlon[1])] }; + } + notice['user']={ + 'profile_image_url': noticeElement.find("img.avatar").attr('src'), + 'profile_url': noticeElement.find(".author a.url").attr('href'), + 'screen_name': noticeElement.find(".author .nickname").text() + }; + notice['html']=noticeElement.find(".entry-content").html(); + notice['url']=noticeElement.find("a.timestamp").attr('href'); + notice['created_at']=noticeElement.find("abbr.published").text(); + return notice; +} + +function showMapstraction(element, notices) { + if(element instanceof jQuery) element = element[0]; + if(! $.isArray(notices)) notices = [notices]; + var mapstraction = new mxn.Mapstraction(element, _provider); var minLat = 181.0; var maxLat = -181.0; var minLon = 181.0; var maxLon = -181.0; - for (var i in _notices) + for (var i in notices) { - var n = _notices[i]; + var n = notices[i]; var lat = n['geo']['coordinates'][0]; var lon = n['geo']['coordinates'][1]; @@ -42,4 +111,4 @@ $(document).ready(function() { bounds = new mxn.BoundingBox(minLat, minLon, maxLat, maxLon); mapstraction.setBounds(bounds); -}); +} 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/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index b737e442a..cbfa6bae0 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -220,8 +220,9 @@ class RealtimePlugin extends Plugin $action->elementStart('body', (common_current_user()) ? array('id' => $action->trimmed('action'), - 'class' => 'user_in') - : array('id' => $action->trimmed('action'))); + 'class' => 'user_in realtime-popup') + : array('id' => $action->trimmed('action'), + 'class'=> 'realtime-popup')); // XXX hack to deal with JS that tries to get the // root url from page output diff --git a/plugins/Realtime/realtimeupdate.css b/plugins/Realtime/realtimeupdate.css index 0ab5dd32b..56f869354 100644 --- a/plugins/Realtime/realtimeupdate.css +++ b/plugins/Realtime/realtimeupdate.css @@ -1,3 +1,40 @@ +.realtime-popup address { +display:none; +} + +.realtime-popup #content { +width:93.5%; +} + +.realtime-popup #form_notice { +margin:18px 0 18px 1.795%; +width:93%; +max-width:451px; +} + +.realtime-popup #form_notice label[for=notice_data-text], +.realtime-popup h1 { +display:none; +} + +.realtime-popup #form_notice label[for=notice_data-attach], +.realtime-popup #form_notice #notice_data-attach { +top:0; +} + +.realtime-popup #form_notice #notice_data-attach { +left:auto; +right:0; +} + +.realtime-popup .entity_profile { +width:70%; +} +.realtime-popup .entity_actions { +margin-left:1%; +} + + #notices_primary { position:relative; } diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index f383dc3fb..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(); } }, @@ -268,7 +268,7 @@ RealtimeUpdate = { PP.bind('click', function() { window.open(url, '', - 'toolbar=no,resizable=yes,scrollbars=yes,status=yes,width=500,height=550'); + 'toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550'); return false; }); @@ -276,26 +276,6 @@ RealtimeUpdate = { initPopupWindow: function() { - $('address').hide(); - $('#content').css({'width':'93.5%'}); - - $('#form_notice').css({ - 'margin':'18px 0 18px 1.795%', - 'width':'93%', - 'max-width':'451px' - }); - - $('#form_notice label[for=notice_data-text], h1').css({'display': 'none'}); - - $('.notices li:first-child').css({'border-top-color':'transparent'}); - - $('#form_notice label[for="notice_data-attach"], #form_notice #notice_data-attach').css({'top':'0'}); - - $('#form_notice #notice_data-attach').css({ - 'left':'auto', - 'right':'0' - }); - $('.notices .entry-title a, .notices .entry-content a').bind('click', function() { window.open(this.href, ''); 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 1f1f19957..60c0c2c0a 100644 --- a/plugins/UserFlag/UserFlagPlugin.php +++ b/plugins/UserFlag/UserFlagPlugin.php @@ -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/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; +} |