Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -185,9 +185,10 @@ |
186 | 186 | 'articlefeedbackv5-transparency-terms' => 'By posting, you agree to transparency under these $1.', |
187 | 187 | 'articlefeedbackv5-transparency-terms-linktext' => 'terms', |
188 | 188 | 'articlefeedbackv5-transparency-terms-url' => '//wikimediafoundation.org/wiki/Feedback_privacy_statement', |
189 | | - 'articlefeedbackv5-section-linktext' => 'feedback', |
| 189 | + 'articlefeedbackv5-sitesub-linktext' => 'Improve this page', |
190 | 190 | 'articlefeedbackv5-titlebar-linktext' => 'Help improve this page >>', |
191 | 191 | 'articlefeedbackv5-fixedtab-linktext' => 'Improve this page', |
| 192 | + 'articlefeedbackv5-section-linktext' => 'feedback', |
192 | 193 | 'articlefeedbackv5-toolbox-linktext' => 'Improve this page', |
193 | 194 | |
194 | 195 | /* --- copied from AFTv4 and possibly not used --- */ |
— | — | @@ -373,10 +374,11 @@ |
374 | 375 | 'articlefeedbackv5-transparency-terms' => "This is the bottom line of the small text that goes beside the submit button and tells the user about the terms they're agreeing to by posting a comment. $1 will hold the link to the terms page, with the text from {{msg-mw|Articlefeedbackv5-transparency-terms-linktext}}", |
375 | 376 | 'articlefeedbackv5-transparency-terms-linktext' => 'The text for the terms link (see {{msg-mw|articlefeedbackv5-transparency-terms}})', |
376 | 377 | 'articlefeedbackv5-transparency-terms-url' => 'The URL for the terms (can be translated; defaults to Project:Privacy_policy; Do not translate "Project:")', |
| 378 | + 'articlefeedbackv5-sitesub-linktext' => 'When a link to pop up the feedback tool appears just below the title bar to the far left, this will be the link text.', |
| 379 | + 'articlefeedbackv5-titlebar-linktext' => 'When a link to pop up the feedback tool appears just below the title bar to the far right, this will be the link text.', |
| 380 | + 'articlefeedbackv5-fixedtab-linktext' => 'When a link to pop up the feedback tool appears as a fixed-positioned tab, this will be the link text', |
377 | 381 | 'articlefeedbackv5-section-linktext' => 'When a link to pop up the feedback tool appears on the article section headers, next to [edit], this will be the text inside the brackets immediately following (e.g. "[edit] [feedback]"). |
378 | 382 | {{Identical|Feedback}}', |
379 | | - 'articlefeedbackv5-titlebar-linktext' => 'When a link to pop up the feedback tool appears just below the title bar to the far right, this will be the link text.', |
380 | | - 'articlefeedbackv5-fixedtab-linktext' => 'When a link to pop up the feedback tool appears as a fixed-positioned tab, this will be the link text', |
381 | 383 | 'articlefeedbackv5-toolbox-linktext' => 'When a link to pop up the feedback tool appears at the bottom of the toolbox area in the sidebar, this will be the link text.', |
382 | 384 | 'articlefeedbackv5-survey-question-whyrated' => 'This is a question in the survey with checkboxes for the answers. The user can check multiple answers.', |
383 | 385 | 'articlefeedbackv5-survey-answer-whyrated-contribute-rating' => 'This is a possible answer for the "Why did you rate this article today?" survey question.', |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js |
— | — | @@ -105,16 +105,12 @@ |
106 | 106 | |
107 | 107 | /** |
108 | 108 | * The link ID indicates where the user clicked (or not) to get to the |
109 | | - * feedback form. Options are: |
110 | | - * 0: No link; user scrolled to the bottom of the page |
111 | | - * 1: Section bars |
112 | | - * 2: Title bar |
113 | | - * 3: Vertical button |
114 | | - * 4: Toolbox (bottom of left nav) |
| 109 | + * feedback form. Options are "-" or A-H |
115 | 110 | * |
116 | | - * @see http://www.mediawiki.org/wiki/Article_feedback/Version_5/Feature_Requirements#Placement |
| 111 | + * @see $wgArticleFeedbackv5LinkBuckets |
| 112 | + * @see http://www.mediawiki.org/wiki/Article_feedback/Version_5/Feature_Requirements#Feedback_links_on_article_pages |
117 | 113 | */ |
118 | | - $.articleFeedbackv5.linkId = '0'; |
| 114 | + $.articleFeedbackv5.linkId = '-'; |
119 | 115 | |
120 | 116 | /** |
121 | 117 | * Use the mediawiki util resource's config method to find the correct url to |
— | — | @@ -2828,10 +2824,7 @@ |
2829 | 2825 | * @param int linkId the link ID |
2830 | 2826 | */ |
2831 | 2827 | $.articleFeedbackv5.setLinkId = function ( linkId ) { |
2832 | | - var knownLinks = { '0': true, '1': true, '2': true, '3': true, '4': true }; |
2833 | | - if ( linkId in knownLinks ) { |
2834 | | - $.articleFeedbackv5.linkId = linkId + ''; |
2835 | | - } |
| 2828 | + $.articleFeedbackv5.linkId = linkId; |
2836 | 2829 | }; |
2837 | 2830 | |
2838 | 2831 | // }}} |
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js |
— | — | @@ -20,10 +20,11 @@ |
21 | 21 | |
22 | 22 | // Info about each of the links |
23 | 23 | var linkInfo = { |
24 | | - '1': { trackId: 'section-link' }, |
25 | | - '2': { trackId: 'titlebar-link' }, |
26 | | - '3': { trackId: 'vertical-link' }, |
27 | | - '4': { trackId: 'toolbox-link' } |
| 24 | + 'A': { trackId: 'sitesub-link' }, |
| 25 | + 'B': { trackId: 'titlebar-link' }, |
| 26 | + 'C': { trackId: 'vertical-link' }, |
| 27 | + 'H': { trackId: 'section-link' }, |
| 28 | + 'tbx': { trackId: 'toolbox-link' } |
28 | 29 | }; |
29 | 30 | |
30 | 31 | // Click event |
— | — | @@ -37,64 +38,79 @@ |
38 | 39 | // Bucketing |
39 | 40 | var linkBucket = function () { |
40 | 41 | // Find out which link bucket they go in: |
41 | | - // 1. Display buckets 0 or 5? Always zero. |
| 42 | + // 1. Display buckets 0 or 5? Always no link. |
42 | 43 | // 2. Requested in query string (debug only) |
43 | 44 | // 3. Random bucketing |
44 | 45 | var displayBucket = $aftDiv.articleFeedbackv5( 'getBucketId' ); |
45 | 46 | if ( '5' == displayBucket || '0' == displayBucket ) { |
46 | | - return '0'; |
| 47 | + return '-'; |
47 | 48 | } |
48 | | - var knownBuckets = { '0': true, '1': true, '2': true, '3': true }; |
49 | | - var requested = mw.util.getParamValue( 'aft_link' ); |
| 49 | + var cfg = mw.config.get( 'wgArticleFeedbackv5LinkBuckets' ); |
| 50 | + if ( !( 'buckets' in cfg ) ) { |
| 51 | + return '-'; |
| 52 | + } |
| 53 | + var knownBuckets = cfg.buckets; |
| 54 | + var requested = mw.util.getParamValue( 'aftv5_link' ); |
50 | 55 | if ( $aftDiv.articleFeedbackv5( 'inDebug' ) && requested in knownBuckets ) { |
51 | 56 | return requested; |
52 | | - } else { |
53 | | - var bucketName = mw.user.bucket( 'ext.articleFeedbackv5-links', |
54 | | - mw.config.get( 'wgArticleFeedbackv5LinkBuckets' ) |
55 | | - ); |
56 | | - var nameMap = { '-': '0', 'A': '1', 'B': '2', 'C': '3' }; |
57 | | - aft5_debug('Links option: ' + bucketName + ' - ' + nameMap[bucketName]); |
58 | | - return nameMap[bucketName]; |
59 | 57 | } |
| 58 | + return mw.user.bucket( 'ext.articleFeedbackv5-links', cfg ); |
60 | 59 | }(); |
61 | 60 | if ( $aftDiv.articleFeedbackv5( 'inDebug' ) ) { |
62 | | - aft5_debug( 'Using link option #' + linkBucket ); |
| 61 | + aft5_debug( 'Using link option ' + linkBucket ); |
63 | 62 | } |
64 | 63 | |
65 | 64 | /*** REMOVING FEEDBACK LINK FOR 1.0 PER ERIK's REQUEST ***/ |
66 | | -/*** TO RESTORE FUNCTIONALITY REMOVE THE FOLLOWING LINE ***/ |
67 | | -linkBucket = '0'; |
| 65 | +/*** TO RESTORE FUNCTIONALITY REMOVE THE FOLLOWING LINES ***/ |
| 66 | +if ( $aftDiv.articleFeedbackv5( 'inDebug' ) && mw.util.getParamValue( 'aftv5_show_link' ) == 'true' ) { |
| 67 | + // Allow feedback link |
| 68 | +} else { |
| 69 | + // Always turn off |
| 70 | + linkBucket = '-'; |
| 71 | +} |
68 | 72 | |
69 | | -/* Add section links */ |
70 | | -if ( '1' == linkBucket ) { |
71 | | - var $wrp = $( '<span class="articleFeedbackv5-sectionlink-wrap"></span>' ) |
72 | | - .html( ' [<a href="#mw-articlefeedbackv5" class="articleFeedbackv5-sectionlink"></a>]' ); |
73 | | - $wrp.find( 'a.articleFeedbackv5-sectionlink' ) |
74 | | - .data( 'linkId', 1 ) |
75 | | - .text( mw.msg( 'articlefeedbackv5-section-linktext' ) ) |
| 73 | +// A: After the site tagline (below the article title) |
| 74 | +if ( 'A' == linkBucket ) { |
| 75 | + var $sub = $( '<a href="#mw-articleFeedbackv5" id="articleFeedbackv5-sitesublink"></a>' ) |
| 76 | + .data( 'linkId', 'A' ) |
| 77 | + .text( mw.msg( 'articlefeedbackv5-sitesub-linktext' ) ) |
76 | 78 | .click( function ( e ) { |
77 | 79 | e.preventDefault(); |
78 | 80 | clickFeedbackLink( $( e.target ) ); |
79 | | - } ); |
80 | | - $( 'span.editsection' ).append( $wrp ); |
81 | | - $aftDiv.articleFeedbackv5( 'addToRemovalQueue', $wrp ); |
| 81 | + } ) |
| 82 | + // The link is going to be at different markup locations on different skins, |
| 83 | + // and it needs to show up if the site subhead (e.g., "From Wikipedia, the free |
| 84 | + // encyclopedia") is not visible for any reason. |
| 85 | + if ( $( '#siteSub' ).filter( ':visible' ).length ) { |
| 86 | + $( '#siteSub' ).append( ' ' ).append( $sub ); |
| 87 | + } else if ( $( 'h1.pagetitle + p.subtitle' ).filter( ':visible' ).length ) { |
| 88 | + $( 'h1.pagetitle + p.subtitle' ).append( ' ' ).append( $sub ); |
| 89 | + } else if ( $( '#mw_contentholder .mw-topboxes' ).length ) { |
| 90 | + $( '#mw_contentholder .mw-topboxes' ).after( $sub ); |
| 91 | + } else if ( $( '#bodyContent' ).length ) { |
| 92 | + $( '#bodyContent' ).prepend( $sub ); |
| 93 | + } |
| 94 | + $aftDiv.articleFeedbackv5( 'addToRemovalQueue', $sub ); |
82 | 95 | } |
83 | 96 | |
84 | | -/* Add titlebar link */ |
85 | | -if ( '2' == linkBucket ) { |
| 97 | +// B: Below the titlebar on the right |
| 98 | +if ( 'B' == linkBucket ) { |
86 | 99 | var $tlk = $( '<a href="#mw-articleFeedbackv5" id="articleFeedbackv5-titlebarlink"></a>' ) |
87 | | - .data( 'linkId', 2 ) |
| 100 | + .data( 'linkId', 'B' ) |
88 | 101 | .text( mw.msg( 'articlefeedbackv5-titlebar-linktext' ) ) |
89 | 102 | .click( function ( e ) { |
90 | 103 | e.preventDefault(); |
91 | 104 | clickFeedbackLink( $( e.target ) ); |
92 | | - } ) |
93 | | - .insertBefore( $aftDiv ); |
| 105 | + } ); |
| 106 | + if ( $( '#coordinates' ).length ) { |
| 107 | + $tlk.css( 'margin-top: 2.5em' ); |
| 108 | + } |
| 109 | + $tlk.insertBefore( $aftDiv ); |
94 | 110 | $aftDiv.articleFeedbackv5( 'addToRemovalQueue', $tlk ); |
95 | 111 | } |
96 | 112 | |
97 | | -/* Add fixed tab link */ |
98 | | -if( '3' == linkBucket ) { |
| 113 | +// C: Button fixed to right side |
| 114 | +if ( 'C' == linkBucket ) { |
99 | 115 | var $fixedTab = $( '\ |
100 | 116 | <div id="articleFeedbackv5-fixedtab">\ |
101 | 117 | <div id="articleFeedbackv5-fixedtabbox">\ |
— | — | @@ -102,7 +118,7 @@ |
103 | 119 | </div>\ |
104 | 120 | </div>' ); |
105 | 121 | $fixedTab.find( '#articleFeedbackv5-fixedtablink' ) |
106 | | - .data( 'linkId', 3 ) |
| 122 | + .data( 'linkId', 'C' ) |
107 | 123 | .attr( 'title', mw.msg( 'articlefeedbackv5-fixedtab-linktext' ) ) |
108 | 124 | .click( function( e ) { |
109 | 125 | e.preventDefault(); |
— | — | @@ -115,19 +131,47 @@ |
116 | 132 | $aftDiv.articleFeedbackv5( 'addToRemovalQueue', $fixedTab ); |
117 | 133 | } |
118 | 134 | |
119 | | -/* Add toolbox link */ |
| 135 | +// D: Button fixed to bottom right |
| 136 | +// NOT IMPLEMENTED |
| 137 | + |
| 138 | +// E: Button fixed to bottom center |
| 139 | +// NOT IMPLEMENTED |
| 140 | + |
| 141 | +// F: Button fixed to left side |
| 142 | +// NOT IMPLEMENTED |
| 143 | + |
| 144 | +// G: Button below logo |
| 145 | +// NOT IMPLEMENTED |
| 146 | + |
| 147 | +// H: Link on each section bar |
| 148 | +if ( 'H' == linkBucket ) { |
| 149 | + var $wrp = $( '<span class="articleFeedbackv5-sectionlink-wrap"></span>' ) |
| 150 | + .html( ' [<a href="#mw-articlefeedbackv5" class="articleFeedbackv5-sectionlink"></a>]' ); |
| 151 | + $wrp.find( 'a.articleFeedbackv5-sectionlink' ) |
| 152 | + .data( 'linkId', 'H' ) |
| 153 | + .text( mw.msg( 'articlefeedbackv5-section-linktext' ) ) |
| 154 | + .click( function ( e ) { |
| 155 | + e.preventDefault(); |
| 156 | + clickFeedbackLink( $( e.target ) ); |
| 157 | + } ); |
| 158 | + $( 'span.editsection' ).append( $wrp ); |
| 159 | + $aftDiv.articleFeedbackv5( 'addToRemovalQueue', $wrp ); |
| 160 | +} |
| 161 | + |
| 162 | +// Add toolbox link |
120 | 163 | if ( '5' == $aftDiv.articleFeedbackv5( 'getBucketId' ) ) { |
121 | 164 | var $tbx = $( '<li id="t-articlefeedbackv5"><a href="#mw-articlefeedbackv5"></a></li>' ) |
122 | 165 | .find( 'a' ) |
123 | 166 | .text( mw.msg( 'articlefeedbackv5-bucket5-toolbox-linktext' ) ) |
124 | 167 | .click( function ( e ) { |
125 | 168 | // Just set the link ID -- this should act just like AFTv4 |
126 | | - $aftDiv.articleFeedbackv5( 'setLinkId', 4 ); |
| 169 | + $aftDiv.articleFeedbackv5( 'setLinkId', 'tbx' ); |
127 | 170 | } ) |
128 | 171 | .end(); |
129 | 172 | $( '#p-tb' ).find( 'ul' ).append( $tbx ); |
130 | 173 | } else { |
131 | 174 | var $tbx = $( '<li id="t-articlefeedbackv5"><a href="#mw-articlefeedbackv5"></a></li>' ) |
| 175 | + .data( 'linkId', 'tbx' ) |
132 | 176 | .find( 'a' ) |
133 | 177 | .text( mw.msg( 'articlefeedbackv5-toolbox-linktext' ) ) |
134 | 178 | .click( function ( e ) { |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php |
— | — | @@ -119,14 +119,24 @@ |
120 | 120 | $wgArticleFeedbackv5LinkBuckets = array( |
121 | 121 | // Users can fall into one of several buckets for links. These are: |
122 | 122 | // -: No link; user must scroll to the bottom of the page |
123 | | - // A: Section bars |
124 | | - // B: Title bar |
125 | | - // C: Vertical button (fixed tab) |
| 123 | + // A: After the site tagline (below the article title) |
| 124 | + // B: Below the titlebar on the right |
| 125 | + // C: Button fixed to right side |
| 126 | + // D: Button fixed to bottom right |
| 127 | + // E: Button fixed to bottom center |
| 128 | + // F: Button fixed to left side |
| 129 | + // G: Button below logo |
| 130 | + // H: Link on each section bar |
126 | 131 | 'buckets' => array( |
127 | | - '-' => 0, |
128 | | - 'A' => 0, |
| 132 | + '-' => 34, |
| 133 | + 'A' => 33, |
129 | 134 | 'B' => 0, |
130 | | - 'C' => 100, |
| 135 | + 'C' => 0, |
| 136 | + 'D' => 33, |
| 137 | + 'E' => 0, |
| 138 | + 'F' => 0, |
| 139 | + 'G' => 0, |
| 140 | + 'H' => 0, |
131 | 141 | ), |
132 | 142 | // This version number is added to all tracking event names, so that |
133 | 143 | // changes in the software don't corrupt the data being collected. Bump |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php |
— | — | @@ -442,11 +442,11 @@ |
443 | 443 | * @return int the feedback id |
444 | 444 | */ |
445 | 445 | public function newFeedback( $params ) { |
446 | | - global $wgUser; |
| 446 | + global $wgUser, $wgArticleFeedbackv5LinkBuckets; |
447 | 447 | $dbw = wfGetDB( DB_MASTER ); |
448 | 448 | $revId = $params['revid']; |
449 | 449 | $bucket = $params['bucket']; |
450 | | - $link = $params['link']; |
| 450 | + $linkName = $params['link']; |
451 | 451 | $token = $this->getAnonToken( $params ); |
452 | 452 | $timestamp = $dbw->timestamp(); |
453 | 453 | $ip = null; |
— | — | @@ -465,7 +465,7 @@ |
466 | 466 | $this->dieUsage( 'Page ID is missing or invalid', 'invalidpageid' ); |
467 | 467 | } |
468 | 468 | |
469 | | - # Fetch this if it wasn't passed in |
| 469 | + // Fetch this if it wasn't passed in |
470 | 470 | if ( !$revId ) { |
471 | 471 | $title = Title::newFromID( $params['pageid'] ); |
472 | 472 | if ( !$title ) { |
— | — | @@ -474,6 +474,10 @@ |
475 | 475 | $revId = $title->getLatestRevID(); |
476 | 476 | } |
477 | 477 | |
| 478 | + // Get the link ID |
| 479 | + $links = array_flip( array_keys( $wgArticleFeedbackv5LinkBuckets['buckets'] ) ); |
| 480 | + $linkId = isset($links[$linkName]) ? $links[$linkName] : 0; |
| 481 | + |
478 | 482 | $dbw->insert( 'aft_article_feedback', array( |
479 | 483 | 'af_page_id' => $params['pageid'], |
480 | 484 | 'af_revision_id' => $revId, |
— | — | @@ -482,7 +486,7 @@ |
483 | 487 | 'af_user_ip' => $ip, |
484 | 488 | 'af_user_anon_token' => $token, |
485 | 489 | 'af_bucket_id' => $bucket, |
486 | | - 'af_link_id' => $link, |
| 490 | + 'af_link_id' => $linkId, |
487 | 491 | ) ); |
488 | 492 | |
489 | 493 | return $dbw->insertID(); |
— | — | @@ -513,10 +517,10 @@ |
514 | 518 | return $ctaId; |
515 | 519 | } |
516 | 520 | |
517 | | - /** |
518 | | - * Inserts or updates properties for a specific rating |
519 | | - * @param $revisionId int Revision ID |
520 | | - */ |
| 521 | + /** |
| 522 | + * Inserts or updates properties for a specific rating |
| 523 | + * @param $revisionId int Revision ID |
| 524 | + */ |
521 | 525 | private function saveUserProperties( $revisionId ) { |
522 | 526 | global $wgUser; |
523 | 527 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -530,11 +534,11 @@ |
531 | 535 | |
532 | 536 | // I'd really rather have this passed in, to save a query, |
533 | 537 | // and rule out consistency problems, but there doesn't seem |
534 | | - // to be a way to do 'RETUNING af_id' on the insert, or to |
| 538 | + // to be a way to do 'RETUNING af_id' on the insert, or to |
535 | 539 | // pre-increment the ID column (since it's a MySQL auto- |
536 | | - // increment, not a sequence) before the insert. So, fetch |
| 540 | + // increment, not a sequence) before the insert. So, fetch |
537 | 541 | // the most recent feedback ID for this user on this revision. |
538 | | - // This gets called imediately after saving, so it'll almost |
| 542 | + // This gets called imediately after saving, so it'll almost |
539 | 543 | // certainly be the right one. |
540 | 544 | $feedbackId = $dbr->selectField( |
541 | 545 | 'aft_article_feedback', |
— | — | @@ -557,7 +561,7 @@ |
558 | 562 | 'afp_value_int' => ( integer ) $wgUser->getEditCount() |
559 | 563 | ); |
560 | 564 | |
561 | | - // Use the UserDailyContribs extension if it's present. Get |
| 565 | + // Use the UserDailyContribs extension if it's present. Get |
562 | 566 | // edit counts for last 6 months, last 3 months, and last month. |
563 | 567 | if ( function_exists( 'getUserEditCountSince' ) ) { |
564 | 568 | $now = time(); |
— | — | @@ -644,9 +648,8 @@ |
645 | 649 | ApiBase::PARAM_MIN => 0 |
646 | 650 | ), |
647 | 651 | 'link' => array( |
648 | | - ApiBase::PARAM_TYPE => 'integer', |
| 652 | + ApiBase::PARAM_TYPE => 'string', |
649 | 653 | ApiBase::PARAM_REQUIRED => true, |
650 | | - ApiBase::PARAM_MIN => 0 |
651 | 654 | ), |
652 | 655 | 'email' => array( |
653 | 656 | ApiBase::PARAM_TYPE => 'string', |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -24,9 +24,10 @@ |
25 | 25 | 'scripts' => 'ext.articleFeedbackv5/ext.articleFeedbackv5.js', |
26 | 26 | 'styles' => 'ext.articleFeedbackv5/ext.articleFeedbackv5.css', |
27 | 27 | 'messages' => array( |
28 | | - 'articlefeedbackv5-section-linktext', |
| 28 | + 'articlefeedbackv5-sitesub-linktext', |
29 | 29 | 'articlefeedbackv5-titlebar-linktext', |
30 | 30 | 'articlefeedbackv5-fixedtab-linktext', |
| 31 | + 'articlefeedbackv5-section-linktext', |
31 | 32 | 'articlefeedbackv5-toolbox-linktext', |
32 | 33 | 'articlefeedbackv5-bucket5-toolbox-linktext', |
33 | 34 | ), |