From a2ca9d96d202d2acd4210fceec1a394f82f635ce Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 8 Jun 2009 18:55:23 +0000 Subject: Temporary workaround for silenting mysterious 200 OK error for XHR notice posts. The bug is sometimes reproduceable by sending a notice that includes "@someusernamethatdoesntexist". This patch doesn't throw alerts to user if server doesn't return with an XHR response but HTTP is one of 20x, 30x. --- js/util.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 3f14bc61c..763c7d7ee 100644 --- a/js/util.js +++ b/js/util.js @@ -178,7 +178,10 @@ $(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 = new Array(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."); + } } } }, -- cgit v1.2.3-54-g00ecf From b20ac7a1fefe40e82b086df3128f06770c8b550d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 8 Jun 2009 20:45:44 +0000 Subject: Clearing notice_data-test and resetting notice_text-count if the notice XHR response is empty and have a 20x,30x HTTP status --- js/util.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 763c7d7ee..b59018fe5 100644 --- a/js/util.js +++ b/js/util.js @@ -167,6 +167,7 @@ $(document).ready(function(){ return true; }, timeout: '60000', + url: 'http://dev.controlyourself.ca/csarven/asdfasdfasdfasdf', error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing"); $("#notice_action-submit").removeAttr("disabled"); $("#notice_action-submit").removeClass("disabled"); @@ -178,10 +179,14 @@ $(document).ready(function(){ $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true)); } else { - var HTTP20x30x = new Array(200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307); + var HTTP20x30x = [200, 404, 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(); + } } } }, -- cgit v1.2.3-54-g00ecf From c5378beb8355b0d5773d8464077fce70dd778026 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 8 Jun 2009 20:50:13 +0000 Subject: Revert "Clearing notice_data-test and resetting notice_text-count if the notice XHR" This reverts commit b20ac7a1fefe40e82b086df3128f06770c8b550d. --- js/util.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/js/util.js b/js/util.js index b59018fe5..763c7d7ee 100644 --- a/js/util.js +++ b/js/util.js @@ -167,7 +167,6 @@ $(document).ready(function(){ return true; }, timeout: '60000', - url: 'http://dev.controlyourself.ca/csarven/asdfasdfasdfasdf', error: function (xhr, textStatus, errorThrown) { $("#form_notice").removeClass("processing"); $("#notice_action-submit").removeAttr("disabled"); $("#notice_action-submit").removeClass("disabled"); @@ -179,14 +178,10 @@ $(document).ready(function(){ $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true)); } else { - var HTTP20x30x = [200, 404, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307]; + var HTTP20x30x = new Array(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(); - } } } }, -- cgit v1.2.3-54-g00ecf From 67cb99c4428f71a19187ccc0b8ac6ad0f129b325 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 8 Jun 2009 20:52:27 +0000 Subject: Clearing notice_data-test and resetting notice_text-count if the notice XHR. Removed hanging text URL from previous commit. --- js/util.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 763c7d7ee..44c3002cd 100644 --- a/js/util.js +++ b/js/util.js @@ -178,10 +178,14 @@ $(document).ready(function(){ $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true)); } else { - var HTTP20x30x = new Array(200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307); + var HTTP20x30x = [200, 404, 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(); + } } } }, -- cgit v1.2.3-54-g00ecf From d9e5cda35d466ac1a428fffb72cc142922d4c211 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Tue, 9 Jun 2009 00:09:44 +0000 Subject: Removed 404 test --- js/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index 44c3002cd..23abba6c2 100644 --- a/js/util.js +++ b/js/util.js @@ -178,7 +178,7 @@ $(document).ready(function(){ $('#form_notice').append(document._importNode($(".error", xhr.responseXML).get(0), true)); } else { - var HTTP20x30x = [200, 404, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307]; + 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."); } -- cgit v1.2.3-54-g00ecf From f4a1cd75ab6ee5cdc86491b5dc4f652fdd2ffa13 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 10 Jun 2009 08:47:46 -0700 Subject: Remove FIXME-marked Opera links until they actually work --- actions/all.php | 11 ----------- actions/favorited.php | 11 ----------- actions/groupmembers.php | 11 ----------- actions/groups.php | 11 ----------- actions/inbox.php | 21 +++++---------------- actions/outbox.php | 13 +------------ actions/public.php | 11 ----------- actions/replies.php | 11 ----------- actions/showfavorites.php | 12 ------------ actions/showgroup.php | 11 ----------- actions/showstream.php | 11 ----------- actions/tag.php | 12 ------------ lib/action.php | 46 ---------------------------------------------- 13 files changed, 6 insertions(+), 186 deletions(-) diff --git a/actions/all.php b/actions/all.php index a53bbea07..03179a246 100644 --- a/actions/all.php +++ b/actions/all.php @@ -69,17 +69,6 @@ class AllAction extends ProfileAction sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))); } - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'all', array('nickname' => $this->user->nickname)); - } - function showLocalNav() { $nav = new PersonalGroupNav($this); diff --git a/actions/favorited.php b/actions/favorited.php index 7e31303e3..c902d80f5 100644 --- a/actions/favorited.php +++ b/actions/favorited.php @@ -221,15 +221,4 @@ class FavoritedAction extends Action $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, $this->page, 'favorited'); } - - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'favorited'); - } } diff --git a/actions/groupmembers.php b/actions/groupmembers.php index 909935bec..21e5ebbaa 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -137,15 +137,4 @@ class GroupmembersAction extends Action $this->page, 'groupmembers', array('nickname' => $this->group->nickname)); } - - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'groupmembers', array('nickname' => $this->group->nickname)); - } } diff --git a/actions/groups.php b/actions/groups.php index e20acce70..26b52a5fc 100644 --- a/actions/groups.php +++ b/actions/groups.php @@ -129,15 +129,4 @@ class GroupsAction extends Action $gbm = new GroupsByMembersSection($this); $gbm->show(); } - - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'groups', array('nickname' => $this->group->nickname)); - } } diff --git a/actions/inbox.php b/actions/inbox.php index 7b5cf2d20..f14ba631f 100644 --- a/actions/inbox.php +++ b/actions/inbox.php @@ -46,15 +46,15 @@ require_once INSTALLDIR.'/lib/mailbox.php'; class InboxAction extends MailboxAction { - + /** * Title of the page * * @return string page title */ - + function title() - { + { if ($this->page > 1) { return sprintf(_("Inbox for %s - page %d"), $this->user->nickname, $this->page); @@ -63,22 +63,11 @@ class InboxAction extends MailboxAction } } - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'inbox', array('nickname' => $this->user->nickname)); - } - /** * Retrieve the messages for this user and this page * * Does a query for the right messages - * + * * @return Message data object with stream for messages * * @see MailboxAction::getMessages() @@ -95,7 +84,7 @@ class InboxAction extends MailboxAction if ($message->find()) { return $message; - } else { + } else { return null; } } diff --git a/actions/outbox.php b/actions/outbox.php index deef1cc87..a875e9ad9 100644 --- a/actions/outbox.php +++ b/actions/outbox.php @@ -62,22 +62,11 @@ class OutboxAction extends MailboxAction } } - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'outbox', array('nickname' => $this->user->nickname)); - } - /** * retrieve the messages for this user and this page * * Does a query for the right messages - * + * * @return Message data object with stream for messages * * @see MailboxAction::getMessages() diff --git a/actions/public.php b/actions/public.php index d2f9da646..27153f131 100644 --- a/actions/public.php +++ b/actions/public.php @@ -135,17 +135,6 @@ class PublicAction extends Action _('Public Stream Feed (Atom)'))); } - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'public'); - } - /** * Extra head elements * diff --git a/actions/replies.php b/actions/replies.php index dfb520d64..eac4d0a3a 100644 --- a/actions/replies.php +++ b/actions/replies.php @@ -138,17 +138,6 @@ class RepliesAction extends Action return array(new Feed(Feed::RSS1, $rssurl, $rsstitle)); } - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'replies', array('nickname' => $this->user->nickname)); - } - /** * show the personal group nav * diff --git a/actions/showfavorites.php b/actions/showfavorites.php index eed62a2ab..865045337 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -150,18 +150,6 @@ class ShowfavoritesAction extends Action return array(new Feed(Feed::RSS1, $feedurl, $feedtitle)); } - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'showfavorites', array('nickname' => $this->user->nickname)); - } - - /** * show the personal group nav * diff --git a/actions/showgroup.php b/actions/showgroup.php index a7df39727..29b6fa1e6 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -311,17 +311,6 @@ class ShowgroupAction extends Action $this->group->nickname))); } - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'showgroup', array('nickname' => $this->group->nickname)); - } - /** * Fill in the sidebar. * diff --git a/actions/showstream.php b/actions/showstream.php index 82665e5b8..c1a2c337a 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -135,17 +135,6 @@ class ShowstreamAction extends ProfileAction 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. diff --git a/actions/tag.php b/actions/tag.php index 02f3e3522..f5ca06f05 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -51,7 +51,6 @@ class TagAction extends Action $pop->show(); } - function title() { if ($this->page == 1) { @@ -77,17 +76,6 @@ class TagAction extends Action sprintf(_('Feed for tag %s'), $this->tag))); } - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - $this->sequenceRelationships($this->page > 1, $this->count > NOTICES_PER_PAGE, // FIXME - $this->page, 'tag', array('tag' => $this->tag)); - } - function showPageNotice() { return sprintf(_('Messages tagged "%s", most recent first'), $this->tag); diff --git a/lib/action.php b/lib/action.php index 6b130b6d5..7c7c52c2c 100644 --- a/lib/action.php +++ b/lib/action.php @@ -124,7 +124,6 @@ class Action extends HTMLOutputter // lawsuit $this->showShortcutIcon(); $this->showStylesheets(); $this->showScripts(); - $this->showRelationshipLinks(); $this->showOpenSearch(); $this->showFeeds(); $this->showDescription(); @@ -261,19 +260,6 @@ class Action extends HTMLOutputter // lawsuit } } - /** - * 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 * @@ -1055,36 +1041,4 @@ class Action extends HTMLOutputter // lawsuit { 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'))); - } - } } -- cgit v1.2.3-54-g00ecf