r114165 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114164‎ | r114165 | r114166 >
Date:18:41, 19 March 2012
Author:rsterbin
Status:ok
Tags:
Comment:
Name the no-link option X rather than -, and keep track of the link ID optionally added to the page (floatingLinkId)
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -131,15 +131,24 @@
132132 $.articleFeedbackv5.selectedLinks = [];
133133
134134 /**
135 - * The link ID indicates where the user clicked (or not) to get to the
136 - * feedback form. Options are "-" or A-H
 135+ * The floating link ID indicates the trigger link chosen to be added to the
 136+ * page, in addition to the toolbox link. Options are "X" or A-H.
137137 *
138138 * @see $wgArticleFeedbackv5LinkBuckets
139139 * @see http://www.mediawiki.org/wiki/Article_feedback/Version_5/Feature_Requirements#Feedback_links_on_article_pages
140140 */
141 - $.articleFeedbackv5.linkId = '-';
 141+ $.articleFeedbackv5.floatingLinkId = 'X';
142142
143143 /**
 144+ * The submitted link ID indicates where the user clicked (or not) to get to
 145+ * the feedback form. Options are "X" or A-H
 146+ *
 147+ * @see $wgArticleFeedbackv5LinkBuckets
 148+ * @see http://www.mediawiki.org/wiki/Article_feedback/Version_5/Feature_Requirements#Feedback_links_on_article_pages
 149+ */
 150+ $.articleFeedbackv5.submittedLinkId = 'X';
 151+
 152+ /**
144153 * Use the mediawiki util resource's config method to find the correct url to
145154 * call for all ajax requests.
146155 */
@@ -2823,13 +2832,13 @@
28242833 // 1. Display buckets 0 or 5? Always no link.
28252834 // 2. Requested in query string (debug only)
28262835 // 3. Random bucketing
2827 - var bucketedLink = '-';
 2836+ var bucketedLink = 'X';
28282837 if ( '5' != $.articleFeedbackv5.bucketId && '0' != $.articleFeedbackv5.bucketId ) {
28292838 var cfg = mw.config.get( 'wgArticleFeedbackv5LinkBuckets' );
28302839 if ( 'buckets' in cfg ) {
28312840 var knownBuckets = cfg.buckets;
28322841 var requested = mw.util.getParamValue( 'aftv5_link' );
2833 - if ( $.articleFeedbackv5.inDebug() && requested in knownBuckets ) {
 2842+ if ( $.articleFeedbackv5.inDebug() && ( requested in knownBuckets || requested == 'X' ) ) {
28342843 bucketedLink = requested;
28352844 } else {
28362845 bucketedLink = mw.user.bucket( 'ext.articleFeedbackv5-links', cfg );
@@ -2839,7 +2848,8 @@
28402849 if ( $.articleFeedbackv5.inDebug() ) {
28412850 aft5_debug( 'Using link option ' + bucketedLink );
28422851 }
2843 - if ('-' != bucketedLink) {
 2852+ $.articleFeedbackv5.floatingLinkId = bucketedLink;
 2853+ if ('X' != bucketedLink) {
28442854 $.articleFeedbackv5.selectedLinks.push(bucketedLink);
28452855 }
28462856 // Always add the toolbox link
@@ -3056,7 +3066,7 @@
30573067 params.articleFeedbackv5_ct_token = $.cookie( 'clicktracking-session' );
30583068 params.articleFeedbackv5_bucket_id = $.articleFeedbackv5.bucketId;
30593069 params.articleFeedbackv5_cta_id = $.articleFeedbackv5.ctaId;
3060 - params.articleFeedbackv5_link_id = $.articleFeedbackv5.linkId;
 3070+ params.articleFeedbackv5_link_id = $.articleFeedbackv5.submittedLinkId;
30613071 params.articleFeedbackv5_location = $.articleFeedbackv5.inDialog ? 'overlay' : 'bottom';
30623072 }
30633073 var url = mw.config.get( 'wgScript' ) + '?' + $.param( params );
@@ -3276,7 +3286,7 @@
32773287 'pageid': $.articleFeedbackv5.pageId,
32783288 'revid': $.articleFeedbackv5.revisionId,
32793289 'bucket': $.articleFeedbackv5.bucketId,
3280 - 'link': $.articleFeedbackv5.linkId
 3290+ 'link': $.articleFeedbackv5.submittedLinkId
32813291 } );
32823292
32833293 // Send off the ajax request
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php
@@ -597,7 +597,7 @@
598598 $revId = $title->getLatestRevID();
599599 }
600600
601 - // Find the link ID using the order of the link buckets ('-' = 0, 'A' = 1,
 601+ // Find the link ID using the order of the link buckets ('X' = 0, 'A' = 1,
602602 // 'B' = 2, etc.)
603603 $links = array_flip( array_keys( $wgArticleFeedbackv5LinkBuckets['buckets'] ) );
604604 $linkId = isset( $links[$linkName] ) ? $links[$linkName] : 0;

Status & tagging log