From 321093886fd708696c28118893443aa598c6b97f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 13 Mar 2010 16:48:21 -0500 Subject: [PATCH 01/27] Assigned an identifier for the representative user and group profile --- actions/showgroup.php | 3 ++- lib/userprofile.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/actions/showgroup.php b/actions/showgroup.php index 5704b13d14..a0d05ba37a 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -221,7 +221,8 @@ class ShowgroupAction extends GroupDesignAction function showGroupProfile() { - $this->elementStart('div', 'entity_profile vcard author'); + $this->elementStart('div', array('id' => 'i', + 'class' => 'entity_profile vcard author')); $this->element('h2', null, _('Group profile')); diff --git a/lib/userprofile.php b/lib/userprofile.php index 2c3b1ea453..ca060842b6 100644 --- a/lib/userprofile.php +++ b/lib/userprofile.php @@ -71,7 +71,8 @@ class UserProfile extends Widget { if (Event::handle('StartProfilePageProfileSection', array(&$this->out, $this->profile))) { - $this->out->elementStart('div', 'entity_profile vcard author'); + $this->out->elementStart('div', array('id' => 'i', + 'class' => 'entity_profile vcard author')); $this->out->element('h2', null, _('User profile')); if (Event::handle('StartProfilePageProfileElements', array(&$this->out, $this->profile))) { From 9ea48298d507ca286e4d7f0dc44291438062782e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 14 Mar 2010 14:06:14 -0400 Subject: [PATCH 02/27] Updated plugin to open external links on a new window that are not attachments --- plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php index ebb0189e03..6756f19930 100644 --- a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php +++ b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php @@ -45,7 +45,7 @@ class OpenExternalLinkTargetPlugin extends Plugin { function onEndShowScripts($action) { - $action->inlineScript('$("a[rel~=external]").click(function(){ window.open(this.href); return false; });'); + $action->inlineScript('$("a[rel~=external]:not([class~=attachment])").live("click", function(){ window.open(this.href); return false; });'); return true; } From 53bed00f9028523ba003956ed88f9549ec203e3b Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 14 Mar 2010 14:11:21 -0400 Subject: [PATCH 03/27] Added rel=external to geo location link --- lib/noticelist.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/noticelist.php b/lib/noticelist.php index 811b7e4f10..0d4cd4dd91 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -443,7 +443,8 @@ class NoticeListItem extends Widget $name); } else { $xstr = new XMLStringer(false); - $xstr->elementStart('a', array('href' => $url)); + $xstr->elementStart('a', array('href' => $url, + 'rel' => 'external')); $xstr->element('abbr', array('class' => 'geo', 'title' => $latlon), $name); From 3c5586d4bd2b00a2c3a140830fcc7b3e15898242 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 14 Mar 2010 15:01:24 -0400 Subject: [PATCH 04/27] Using rel=external instead of class=external for jOverlay title link --- lib/attachmentlist.php | 6 ++---- theme/base/css/display.css | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index fe38281af9..b503bfb45e 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -248,9 +248,7 @@ class Attachment extends AttachmentListItem $this->out->elementStart('div', array('id' => 'attachment_view', 'class' => 'hentry')); $this->out->elementStart('div', 'entry-title'); - $this->out->elementStart('a', $this->linkAttr()); - $this->out->element('span', null, $this->linkTitle()); - $this->out->elementEnd('a'); + $this->out->element('a', $this->linkAttr(), $this->linkTitle()); $this->out->elementEnd('div'); $this->out->elementStart('div', 'entry-content'); @@ -296,7 +294,7 @@ class Attachment extends AttachmentListItem } function linkAttr() { - return array('class' => 'external', 'href' => $this->attachment->url); + return array('rel' => 'external', 'href' => $this->attachment->url); } function linkTitle() { diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 782d3dc714..a2e4cdf2af 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -1326,7 +1326,7 @@ margin-bottom:0; padding:11px; min-height:auto; } -#jOverlayContent .external span { +#jOverlayContent .entry-title { display:block; margin-bottom:11px; } From 56deca63d0d73b965bc7dba11ef025a7c1ad3234 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 16 Mar 2010 19:34:20 +0100 Subject: [PATCH 05/27] Removed dangling stylesheet --- theme/base/css/thickbox.css | 163 ------------------------------------ 1 file changed, 163 deletions(-) delete mode 100644 theme/base/css/thickbox.css diff --git a/theme/base/css/thickbox.css b/theme/base/css/thickbox.css deleted file mode 100644 index d24b9bedff..0000000000 --- a/theme/base/css/thickbox.css +++ /dev/null @@ -1,163 +0,0 @@ -/* ----------------------------------------------------------------------------------------------------------------*/ -/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/ -/* ----------------------------------------------------------------------------------------------------------------*/ -*{padding: 0; margin: 0;} - -/* ----------------------------------------------------------------------------------------------------------------*/ -/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/ -/* ----------------------------------------------------------------------------------------------------------------*/ -#TB_window { - font: 12px Arial, Helvetica, sans-serif; - color: #333333; -} - -#TB_secondLine { - font: 10px Arial, Helvetica, sans-serif; - color:#666666; -} - -#TB_window a:link {color: #666666;} -#TB_window a:visited {color: #666666;} -#TB_window a:hover {color: #000;} -#TB_window a:active {color: #666666;} -#TB_window a:focus{color: #666666;} - -/* ----------------------------------------------------------------------------------------------------------------*/ -/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/ -/* ----------------------------------------------------------------------------------------------------------------*/ -#TB_overlay { - position: fixed; - z-index:100; - top: 0px; - left: 0px; - height:100%; - width:100%; -} - -.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;} -.TB_overlayBG { - background-color:#000; - filter:alpha(opacity=75); - -moz-opacity: 0.75; - opacity: 0.75; -} - -* html #TB_overlay { /* ie6 hack */ - position: absolute; - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); -} - -#TB_window { - position: fixed; - background: #ffffff; - z-index: 102; - color:#000000; - display:none; - border: 4px solid #525252; - text-align:left; - top:50%; - left:50%; -} - -* html #TB_window { /* ie6 hack */ -position: absolute; -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); -} - -#TB_window img#TB_Image { - display:block; - margin: 15px 0 0 15px; - border-right: 1px solid #ccc; - border-bottom: 1px solid #ccc; - border-top: 1px solid #666; - border-left: 1px solid #666; -} - -#TB_caption{ - height:25px; - padding:7px 30px 10px 25px; - float:left; -} - -#TB_closeWindow{ - height:25px; - padding:11px 25px 10px 0; - float:right; -} - -#TB_closeAjaxWindow{ - padding:7px 10px 5px 0; - margin-bottom:1px; - text-align:right; - float:right; -} - -#TB_ajaxWindowTitle{ - float:left; - padding:7px 0 5px 10px; - margin-bottom:1px; -} - -#TB_title{ - background-color:#e8e8e8; - height:27px; -} - -#TB_ajaxContent{ - clear:both; - padding:2px 15px 15px 15px; - overflow:auto; - text-align:left; - line-height:1.4em; -} - -#TB_ajaxContent.TB_modal{ - padding:15px; -} - -#TB_ajaxContent p{ - padding:5px 0px 5px 0px; -} - -#TB_load{ - position: fixed; - display:none; - height:13px; - width:208px; - z-index:103; - top: 50%; - left: 50%; - margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */ -} - -* html #TB_load { /* ie6 hack */ -position: absolute; -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); -} - -#TB_HideSelect{ - z-index:99; - position:fixed; - top: 0; - left: 0; - background-color:#fff; - border:none; - filter:alpha(opacity=0); - -moz-opacity: 0; - opacity: 0; - height:100%; - width:100%; -} - -* html #TB_HideSelect { /* ie6 hack */ - position: absolute; - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); -} - -#TB_iframeContent{ - clear:both; - border:none; - margin-bottom:-1px; - margin-top:1px; - _margin-bottom:1px; -} From f4339ddb7d5ab6ae7a2ab78562990da1fcc2a8bd Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 16 Mar 2010 20:53:49 +0100 Subject: [PATCH 06/27] Added extra condition to focusing on notice form on page load. If the window location contains a fragument identifier, it will skip focus and do what the UA does natively. --- js/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 3efda0d7b9..2e0f6e57bc 100644 --- a/js/util.js +++ b/js/util.js @@ -86,7 +86,7 @@ var SN = { // StatusNet $('#'+form_id+' #'+SN.C.S.NoticeTextCount).text(jQuery.data(form[0], 'ElementData').MaxLength); } - if ($('body')[0].id != 'conversation') { + if ($('body')[0].id != 'conversation' && window.location.hash.length === 0) { $('#'+form_id+' textarea').focus(); } }, From 7fc8b6af4ae9a784b797d4f7aef49c820bb10bdf Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 16 Mar 2010 21:02:56 +0100 Subject: [PATCH 07/27] Removed unnecessary form_id. Using jQuery .find() instead of constructing the selector. --- js/util.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/js/util.js b/js/util.js index 2e0f6e57bc..f82ca992c6 100644 --- a/js/util.js +++ b/js/util.js @@ -61,10 +61,8 @@ var SN = { // StatusNet U: { // Utils FormNoticeEnhancements: function(form) { - form_id = form.attr('id'); - if (jQuery.data(form[0], 'ElementData') === undefined) { - MaxLength = $('#'+form_id+' #'+SN.C.S.NoticeTextCount).text(); + MaxLength = form.find('#'+SN.C.S.NoticeTextCount).text(); if (typeof(MaxLength) == 'undefined') { MaxLength = SN.C.I.MaxLength; } @@ -72,7 +70,7 @@ var SN = { // StatusNet SN.U.Counter(form); - NDT = $('#'+form_id+' #'+SN.C.S.NoticeDataText); + NDT = form.find('#'+SN.C.S.NoticeDataText); NDT.bind('keyup', function(e) { SN.U.Counter(form); @@ -83,11 +81,11 @@ var SN = { // StatusNet }); } else { - $('#'+form_id+' #'+SN.C.S.NoticeTextCount).text(jQuery.data(form[0], 'ElementData').MaxLength); + form.find('#'+SN.C.S.NoticeTextCount).text(jQuery.data(form[0], 'ElementData').MaxLength); } if ($('body')[0].id != 'conversation' && window.location.hash.length === 0) { - $('#'+form_id+' textarea').focus(); + form.find('textarea').focus(); } }, @@ -105,7 +103,6 @@ var SN = { // StatusNet Counter: function(form) { SN.C.I.FormNoticeCurrent = form; - form_id = form.attr('id'); var MaxLength = jQuery.data(form[0], 'ElementData').MaxLength; @@ -113,8 +110,8 @@ var SN = { // StatusNet return; } - var remaining = MaxLength - $('#'+form_id+' #'+SN.C.S.NoticeDataText).val().length; - var counter = $('#'+form_id+' #'+SN.C.S.NoticeTextCount); + var remaining = MaxLength - form.find('#'+SN.C.S.NoticeDataText).val().length; + var counter = form.find('#'+SN.C.S.NoticeTextCount); if (remaining.toString() != counter.text()) { if (!SN.C.I.CounterBlackout || remaining === 0) { @@ -174,7 +171,6 @@ var SN = { // StatusNet FormNoticeXHR: function(form) { SN.C.I.NoticeDataGeo = {}; - form_id = form.attr('id'); form.append(''); form.ajaxForm({ dataType: 'xml', From c11064a5398db824f2623c5763b3fdfdf8ae3c39 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 25 Mar 2010 14:15:54 -0700 Subject: [PATCH 08/27] Updated 'more' anchor for attachments to do an XHR GET Conflicts: lib/attachmentlist.php plugins/OStatus/classes/Ostatus_profile.php Merge tried to delete things that it seems it shouldn't, very confusing order. Hope rest of the cherry-picking isn't a problem. --- js/util.js | 108 +++++++++++--------- lib/attachmentlist.php | 53 ++++++++++ plugins/OStatus/classes/Ostatus_profile.php | 18 +++- theme/base/css/display.css | 9 +- theme/default/css/display.css | 3 +- theme/identica/css/display.css | 3 +- 6 files changed, 140 insertions(+), 54 deletions(-) diff --git a/js/util.js b/js/util.js index f82ca992c6..79fd40deba 100644 --- a/js/util.js +++ b/js/util.js @@ -399,58 +399,70 @@ var SN = { // StatusNet return; } - $.fn.jOverlay.options = { - method : 'GET', - data : '', - url : '', - color : '#000', - opacity : '0.6', - zIndex : 9999, - center : false, - imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif', - bgClickToClose : true, - success : function() { - $('#jOverlayContent').append(''); - $('#jOverlayContent button').click($.closeOverlay); - }, - timeout : 0, - autoHide : true, - css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'} - }; + var attachment_more = notice.find('.attachment.more'); + if (attachment_more.length > 0) { + attachment_more.click(function() { + $.get($(this).attr('href')+'/ajax', null, function(data) { + notice.find('.entry-title .entry-content').html($(data).find('#attachment_view .entry-content').html()); + }); - notice.find('a.attachment').click(function() { - var attachId = ($(this).attr('id').substring('attachment'.length + 1)); - if (attachId) { - $().jOverlay({url: $('address .url')[0].href+'attachment/' + attachId + '/ajax'}); return false; - } - }); - - if ($('#shownotice').length == 0) { - var t; - notice.find('a.thumbnail').hover( - function() { - var anchor = $(this); - $('a.thumbnail').children('img').hide(); - anchor.closest(".entry-title").addClass('ov'); - - if (anchor.children('img').length === 0) { - t = setTimeout(function() { - $.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { - anchor.append(data); - }); - }, 500); - } - else { - anchor.children('img').show(); - } + }); + } + else { + $.fn.jOverlay.options = { + method : 'GET', + data : '', + url : '', + color : '#000', + opacity : '0.6', + zIndex : 9999, + center : false, + imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif', + bgClickToClose : true, + success : function() { + $('#jOverlayContent').append(''); + $('#jOverlayContent button').click($.closeOverlay); }, - function() { - clearTimeout(t); - $('a.thumbnail').children('img').hide(); - $(this).closest('.entry-title').removeClass('ov'); + timeout : 0, + autoHide : true, + css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'} + }; + + notice.find('a.attachment').click(function() { + var attachId = ($(this).attr('id').substring('attachment'.length + 1)); + if (attachId) { + $().jOverlay({url: $('address .url')[0].href+'attachment/' + attachId + '/ajax'}); + return false; } - ); + }); + + if ($('#shownotice').length == 0) { + var t; + notice.find('a.thumbnail').hover( + function() { + var anchor = $(this); + $('a.thumbnail').children('img').hide(); + anchor.closest(".entry-title").addClass('ov'); + + if (anchor.children('img').length === 0) { + t = setTimeout(function() { + $.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) { + anchor.append(data); + }); + }, 500); + } + else { + anchor.children('img').show(); + } + }, + function() { + clearTimeout(t); + $('a.thumbnail').children('img').hide(); + $(this).closest('.entry-title').removeClass('ov'); + } + ); + } } }, diff --git a/lib/attachmentlist.php b/lib/attachmentlist.php index b503bfb45e..c6261dea59 100644 --- a/lib/attachmentlist.php +++ b/lib/attachmentlist.php @@ -359,6 +359,59 @@ class Attachment extends AttachmentListItem } } + protected function showHtmlFile(File $attachment) + { + $body = $this->scrubHtmlFile($attachment); + if ($body) { + $this->out->raw($body); + } + } + + /** + * @return mixed false on failure, HTML fragment string on success + */ + protected function scrubHtmlFile(File $attachment) + { + $path = File::path($attachment->filename); + if (!file_exists($path) || !is_readable($path)) { + common_log(LOG_ERR, "Missing local HTML attachment $path"); + return false; + } + $raw = file_get_contents($path); + + // Normalize... + $dom = new DOMDocument(); + if(!$dom->loadHTML($raw)) { + common_log(LOG_ERR, "Bad HTML in local HTML attachment $path"); + return false; + } + + // Remove