]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.7.x' into 0.8.x
authorEvan Prodromou <evan@controlyourself.ca>
Wed, 10 Jun 2009 16:09:57 +0000 (09:09 -0700)
committerEvan Prodromou <evan@controlyourself.ca>
Wed, 10 Jun 2009 16:09:57 +0000 (09:09 -0700)
1  2 
actions/showstream.php
js/util.js
lib/action.php

diff --combined actions/showstream.php
index 678a3174c151800a482b35c41bfdb71f6245a691,c1a2c337a0da3ab070c05a75ddb5bca728226c17..e2f4e24d435ea7476132f7a22a16fc9cbed6743e
@@@ -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;
  
      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)),
                                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.
  
      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 b712ba8e2be9bd24a8962d8b2dce2f933d52d5ea,23abba6c2604b48bd18db8fa48b3af437fa59de0..786b763eeecb599c2df1fa8f327396b951cad090
@@@ -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();
+                                                                                                                                                               }
                                                                                                                                                        }
                                                                                                                                                }
                                                                                                                                          },
                                                                $("#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");
        $("#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('<button>&#215;</button>');
 +            $('#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 6a69d26518170eed18f04a7a76ebdb15b4bbd9ce,7c7c52c2c19d5b8baf702d3502021e8851ff8fd7..7643e5afb872907ba41b798b629611bbc4255f60
@@@ -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();
                  $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))) {
          }
      }
  
-     /**
-      * Show document relationship links
-      *
-      * SHOULD overload
-      *
-      * @return nothing
-      */
-     function showRelationshipLinks()
-     {
-         // output <link> elements with appropriate HTML4.01 link types:
-         // http://www.w3.org/TR/html401/types.html#type-links
-     }
      /**
       * Show OpenSearch headers
       *
          }
          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)) {
      {
          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 <link> 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')));
-         }
-     }
  }