From: Evan Prodromou Date: Wed, 10 Jun 2009 16:09:57 +0000 (-0700) Subject: Merge branch '0.7.x' into 0.8.x X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c0853e304051a3b8ceacb95d6977ca62df5e25a6;hp=-c;p=quix0rs-gnu-social.git Merge branch '0.7.x' into 0.8.x --- c0853e304051a3b8ceacb95d6977ca62df5e25a6 diff --combined actions/showstream.php index 678a3174c1,c1a2c337a0..e2f4e24d43 --- a/actions/showstream.php +++ b/actions/showstream.php @@@ -68,9 -68,6 +68,9 @@@ class ShowstreamAction extends ProfileA } else { $base = $this->user->nickname; } + if (!empty($this->tag)) { + $base .= sprintf(_(' tagged %s'), $this->tag); + } if ($this->page == 1) { return $base; @@@ -113,15 -110,6 +113,15 @@@ function getFeeds() { + if (!empty($this->tag)) { + return array(new Feed(Feed::RSS1, + common_local_url('userrss', + array('nickname' => $this->user->nickname, + 'tag' => $this->tag)), + sprintf(_('Notice feed for %s tagged %s (RSS 1.0)'), + $this->user->nickname, $this->tag))); + } + return array(new Feed(Feed::RSS1, common_local_url('userrss', array('nickname' => $this->user->nickname)), @@@ -147,17 -135,6 +147,6 @@@ sprintf(_('FOAF for %s'), $this->user->nickname))); } - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'showstream', array('nickname' => $this->user->nickname)); - } - function extraHead() { // for remote subscriptions etc. @@@ -375,9 -352,7 +364,9 @@@ function showNotices() { - $notice = $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); + $notice = empty($this->tag) + ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) + : $this->user->getTaggedNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null, $this->tag); $pnl = new ProfileNoticeList($notice, $this); $cnt = $pnl->show(); diff --combined js/util.js index b712ba8e2b,23abba6c26..786b763eee --- a/js/util.js +++ b/js/util.js @@@ -178,7 -178,14 +178,14 @@@ $(document).ready(function() $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true)); } else { - alert("Sorry! We had trouble sending your notice ("+xhr.status+" "+xhr.statusText+"). Please report the problem to the site administrator if this happens again."); + var HTTP20x30x = [200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307]; + if(jQuery.inArray(parseInt(xhr.status), HTTP20x30x) < 0) { + alert("Sorry! We had trouble sending your notice ("+xhr.status+" "+xhr.statusText+"). Please report the problem to the site administrator if this happens again."); + } + else { + $("#notice_data-text").val(""); + counter(); + } } } }, @@@ -199,11 -206,11 +206,11 @@@ $("#notices_primary .notices").prepend(document._importNode(li, true)); $("#notices_primary .notice:first").css({display:"none"}); $("#notices_primary .notice:first").fadeIn(2500); - NoticeHover(); NoticeReply(); } } $("#notice_data-text").val(""); + $("#notice_data-attach").val(""); counter(); } $("#form_notice").removeClass("processing"); @@@ -215,26 -222,26 +222,26 @@@ $("#form_notice").each(addAjaxHidden); NoticeHover(); NoticeReply(); + NoticeAttachments(); }); + function NoticeHover() { - $("#content .notice").hover( - function () { - $(this).addClass('hover'); - }, - function () { - $(this).removeClass('hover'); - } - ); + function mouseHandler(e) { + $(e.target).closest('li.hentry')[(e.type === 'mouseover') ? 'addClass' : 'removeClass']('hover'); + }; + $('#content .notices').mouseover(mouseHandler); + $('#content .notices').mouseout(mouseHandler); } + function NoticeReply() { if ($('#notice_data-text').length > 0) { $('#content .notice').each(function() { - var notice = $(this); - $('.notice_reply', $(this)).click(function() { - var nickname = ($('.author .nickname', notice).length > 0) ? $('.author .nickname', notice) : $('.author .nickname'); - NoticeReplySet(nickname.text(), $('.notice_id', notice).text()); + var notice = $(this)[0]; + $($('.notice_reply', notice)[0]).click(function() { + var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname'); + NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text()); return false; }); }); @@@ -254,53 -261,3 +261,53 @@@ function NoticeReplySet(nick,id) } return true; } + +function NoticeAttachments() { + $.fn.jOverlay.options = { + method : 'GET', + data : '', + url : '', + color : '#000', + opacity : '0.6', + zIndex : 99, + center : true, + 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 + }; + + $('a.attachment').click(function() { + $().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); + return false; + }); + + var t; + $("body:not(#shownotice) 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 --combined lib/action.php index 6a69d26518,7c7c52c2c1..7643e5afb8 --- a/lib/action.php +++ b/lib/action.php @@@ -124,7 -124,6 +124,6 @@@ class Action extends HTMLOutputter // l $this->showShortcutIcon(); $this->showStylesheets(); $this->showScripts(); - $this->showRelationshipLinks(); $this->showOpenSearch(); $this->showFeeds(); $this->showDescription(); @@@ -243,12 -242,6 +242,12 @@@ $this->element('script', array('type' => 'text/javascript', 'src' => common_path('js/jquery.form.js')), ' '); + + $this->element('script', array('type' => 'text/javascript', + 'src' => common_path('js/jquery.joverlay.min.js')), + ' '); + + Event::handle('EndShowJQueryScripts', array($this)); } if (Event::handle('StartShowLaconicaScripts', array($this))) { @@@ -267,19 -260,6 +266,6 @@@ } } - /** - * Show document relationship links - * - * SHOULD overload - * - * @return nothing - */ - function showRelationshipLinks() - { - // output elements with appropriate HTML4.01 link types: - // http://www.w3.org/TR/html401/types.html#type-links - } - /** * Show OpenSearch headers * @@@ -867,12 -847,10 +853,12 @@@ } if ($lm) { header('Last-Modified: ' . date(DATE_RFC1123, $lm)); - if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { - $ims = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']); + if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) { + $if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE']; + $ims = strtotime($if_modified_since); if ($lm <= $ims) { - $if_none_match = $_SERVER['HTTP_IF_NONE_MATCH']; + $if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ? + $_SERVER['HTTP_IF_NONE_MATCH'] : null; if (!$if_none_match || !$etag || $this->_hasEtag($etag, $if_none_match)) { @@@ -1063,36 -1041,4 +1049,4 @@@ { return null; } - - /** - * Generate document metadata for sequential navigation - * - * @param boolean $have_before is there something before? - * @param boolean $have_after is there something after? - * @param integer $page current page - * @param string $action current action - * @param array $args rest of query arguments - * - * @return nothing - */ - function sequenceRelationships($have_next, $have_previous, $page, $action, $args=null) - { - // Outputs machine-readable pagination in elements. - // Pattern taken from $this->pagination() method. - - // "next" is equivalent to "after" - if ($have_next) { - $pargs = array('page' => $page-1); - $this->element('link', array('rel' => 'next', - 'href' => common_local_url($action, $args, $pargs), - 'title' => _('Next'))); - } - // "previous" is equivalent to "before" - if ($have_previous=true) { // FIXME - $pargs = array('page' => $page+1); - $this->element('link', array('rel' => 'prev', - 'href' => common_local_url($action, $args, $pargs), - 'title' => _('Previous'))); - } - } }