r106684 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106683‎ | r106684 | r106685 >
Date:20:16, 19 December 2011
Author:catrope
Status:ok
Tags:
Comment:
1.18wmf1: Update ArticleFeedbackv5 to trunk state
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5 (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.alias.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/sql/ArticleFeedbackv5.sql (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/sql/alter.sql (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/sql/ArticleFeedbackv5.sql
@@ -19,7 +19,7 @@
2020 af_page_id integer unsigned NOT NULL,
2121 -- User Id (0 if anon), and ip address
2222 af_user_id integer NOT NULL,
23 - af_user_ip varchar(32) NOT NULL,
 23+ af_user_ip varchar(32) NULL,
2424 -- Unique token for anonymous users (to facilitate ratings from multiple users on the same IP)
2525 af_user_anon_token varbinary(32) NOT NULL DEFAULT '',
2626 -- Foreign key to revision.rev_id
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/sql/alter.sql
@@ -45,3 +45,6 @@
4646 ALTER TABLE aft_article_revision_feedback_select_rollup ADD PRIMARY KEY (arfsr_page_id, arfsr_field_id, arfsr_revision_id, arfsr_option_id);
4747 ALTER TABLE aft_article_revision_feedback_ratings_rollup DROP PRIMARY KEY;
4848 ALTER TABLE aft_article_revision_feedback_ratings_rollup ADD PRIMARY KEY (afrr_page_id, afrr_field_id, afrr_revision_id);
 49+
 50+-- added 12/16 (Roan)
 51+ALTER TABLE aft_article_feedback MODIFY COLUMN af_user_ip varchar(32) NULL;
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.alias.php
@@ -12,103 +12,3 @@
1313 $specialPageAliases['en'] = array(
1414 'ArticleFeedbackv5' => array( 'ArticleFeedbackv5' ),
1515 );
16 -
17 -/** Arabic (العربية) */
18 -$specialPageAliases['ar'] = array(
19 - 'ArticleFeedbackv5' => array( 'تعليقات_المقالة' ),
20 -);
21 -
22 -/** Greek (Ελληνικά) */
23 -$specialPageAliases['el'] = array(
24 - 'ArticleFeedbackv5' => array( 'ΑνατροφοδότησηΆρθρου' ),
25 -);
26 -
27 -/** Persian (فارسی) */
28 -$specialPageAliases['fa'] = array(
29 - 'ArticleFeedbackv5' => array( 'بازخورد_مقاله' ),
30 -);
31 -
32 -/** Finnish (Suomi) */
33 -$specialPageAliases['fi'] = array(
34 - 'ArticleFeedbackv5' => array( 'Sivupalaute' ),
35 -);
36 -
37 -/** Franco-Provençal (Arpetan) */
38 -$specialPageAliases['frp'] = array(
39 - 'ArticleFeedbackv5' => array( 'Èstimacion_d\'articllo', 'ÈstimacionDArticllo' ),
40 -);
41 -
42 -/** Galician (Galego) */
43 -$specialPageAliases['gl'] = array(
44 - 'ArticleFeedbackv5' => array( 'Avaliación_de_artigos' ),
45 -);
46 -
47 -/** Hebrew (עברית) */
48 -$specialPageAliases['he'] = array(
49 - 'ArticleFeedbackv5' => array( 'משוב_על_דפים' ),
50 -);
51 -
52 -/** Interlingua (Interlingua) */
53 -$specialPageAliases['ia'] = array(
54 - 'ArticleFeedbackv5' => array( 'Commentar_articulos' ),
55 -);
56 -
57 -/** Indonesian (Bahasa Indonesia) */
58 -$specialPageAliases['id'] = array(
59 - 'ArticleFeedbackv5' => array( 'Umpan_balik_artikel' ),
60 -);
61 -
62 -/** Luxembourgish (Lëtzebuergesch) */
63 -$specialPageAliases['lb'] = array(
64 - 'ArticleFeedbackv5' => array( 'Artikel-Feedback' ),
65 -);
66 -
67 -/** Macedonian (Македонски) */
68 -$specialPageAliases['mk'] = array(
69 - 'ArticleFeedbackv5' => array( 'ОценувањеНаСтатија' ),
70 -);
71 -
72 -/** Malayalam (മലയാളം) */
73 -$specialPageAliases['ml'] = array(
74 - 'ArticleFeedbackv5' => array( 'ലേഖനാഭിപ്രായം' ),
75 -);
76 -
77 -/** Nedersaksisch (Nedersaksisch) */
78 -$specialPageAliases['nds-nl'] = array(
79 - 'ArticleFeedbackv5' => array( 'Terogkoppeling' ),
80 -);
81 -
82 -/** Dutch (Nederlands) */
83 -$specialPageAliases['nl'] = array(
84 - 'ArticleFeedbackv5' => array( 'Terugkoppeling' ),
85 -);
86 -
87 -/** Romanian (Română) */
88 -$specialPageAliases['ro'] = array(
89 - 'ArticleFeedbackv5' => array( 'Evaluare_articol' ),
90 -);
91 -
92 -/** Swedish (Svenska) */
93 -$specialPageAliases['sv'] = array(
94 - 'ArticleFeedbackv5' => array( 'Artikelbedömning' ),
95 -);
96 -
97 -/** Vietnamese (Tiếng Việt) */
98 -$specialPageAliases['vi'] = array(
99 - 'ArticleFeedbackv5' => array( 'Phản_hồi_bài' ),
100 -);
101 -
102 -/** Simplified Chinese (‪中文(简体)‬) */
103 -$specialPageAliases['zh-hans'] = array(
104 - 'ArticleFeedbackv5' => array( '条目反馈' ),
105 -);
106 -
107 -/** Traditional Chinese (‪中文(繁體)‬) */
108 -$specialPageAliases['zh-hant'] = array(
109 - 'ArticleFeedbackv5' => array( '文章回應' ),
110 -);
111 -
112 -/**
113 - * For backwards compatibility with MediaWiki 1.15 and earlier.
114 - */
115 -$aliases =& $specialPageAliases;
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -1,30 +1,38 @@
2 -<?php $messages = array();
 2+<?php
 3+/**
 4+ * Internationalisation file for extension ArticleFeedbackv5.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
39
 10+$messages = array();
411 /** English
512 * @author Nimish Gautam
613 * @author Sam Reed
714 * @author Brandon Harris
815 * @author Trevor Parscal
916 * @author Arthur Richards
 17+ * @author Siebrand Mazeland
1018 */
1119 $messages['en'] = array(
1220 // CTA translations
1321 'articlefeedbackv5-cta-thanks' => 'Thanks!',
1422 'articlefeedbackv5-cta-confirmation-followup' => 'Your feedback has been saved.',
1523 'articlefeedbackv5-cta1-confirmation-title' => 'Did you know that you can edit this page?',
16 - 'articlefeedbackv5-cta1-confirmation-call' => 'Wikipedia works because anyone can edit its articles. Go ahead, give it a try. Be bold!',
 24+ 'articlefeedbackv5-cta1-confirmation-call' => 'Wikipedia works because anyone can edit its pages. Go ahead, give it a try. Be bold!',
1725 'articlefeedbackv5-cta1-learn-how' => 'Learn how to edit',
1826 'articlefeedbackv5-cta1-learn-how-url' => 'http://en.wikipedia.org/wiki/Wikipedia:Article_Feedback_Tool/Tutorial',
1927 'articlefeedbackv5-cta1-edit-linktext' => 'Edit this page',
2028 'articlefeedbackv5-cta2-confirmation-title' => 'Help improve Wikipedia',
21 - 'articlefeedbackv5-cta2-confirmation-call' => 'This encyclopedia is created by people like you. Can you give us a hand?',
 29+ 'articlefeedbackv5-cta2-confirmation-call' => 'This website is created by people like you. Can you give us a hand?',
2230 'articlefeedbackv5-cta2-button-text' => 'Learn more',
2331
2432 // error messages
2533 'articlefeedbackv5-error' => 'An error has occured. Please try again later.',
26 - 'articlefeedbackv5-error-email' => 'That email address is not valid',
27 - 'articlefeedbackv5-error-validation' => 'Validation error',
28 - 'articlefeedbackv5-error-unknown' => 'Unknown error',
 34+ 'articlefeedbackv5-error-email' => 'That e-mail address is not valid.',
 35+ 'articlefeedbackv5-error-validation' => 'Validation error.',
 36+ 'articlefeedbackv5-error-unknown' => 'Unknown error.',
2937 'articlefeedbackv5-error-submit' => 'Form submission error.',
3038 'articlefeedbackv5-error-nofeedback' => 'Please enter your feedback.',
3139 'articlefeedbackv5-error-flagging' => 'Error flagging feedback.',
@@ -35,11 +43,11 @@
3644 'articlefeedbackv5-special-filter-all' => 'All',
3745 'articlefeedbackv5-special-sort-newest' => 'Newest first',
3846 'articlefeedbackv5-special-sort-oldest' => 'Oldest first',
39 - 'articlefeedbackv5-special-sort-label-before' => 'Order by: ',
 47+ 'articlefeedbackv5-special-sort-label-before' => 'Order by:',
4048 'articlefeedbackv5-special-sort-label-after' => '',
41 - 'articlefeedbackv5-special-filter-label-before' => 'Show only: ',
 49+ 'articlefeedbackv5-special-filter-label-before' => 'Show only:',
4250 'articlefeedbackv5-special-filter-label-after' => '',
43 - 'articlefeedbackv5-special-showing' => 'Showing $1 posts (of $2)',
 51+ 'articlefeedbackv5-special-showing' => 'Showing $1 posts (of $2)', // FIXME: Needs plural support on $1.
4452 'articlefeedbackv5-special-more' => 'More',
4553 'articlefeedbackv5-form-optionid' => 'Option $1',
4654 'articlefeedbackv5-form-hide' => 'Hide this ($1)',
@@ -70,45 +78,45 @@
7179
7280 /* Feedback forms */
7381 /* Option 1 ("Did you find what you were looking for?") */
74 - 'articlefeedbackv5-bucket1-title' => 'Help improve this article',
 82+ 'articlefeedbackv5-bucket1-title' => 'Help improve this page',
7583 'articlefeedbackv5-bucket1-question-toggle' => 'Did you find what you were looking for?',
7684 'articlefeedbackv5-bucket1-toggle-found-yes' => 'Yes',
7785 'articlefeedbackv5-bucket1-toggle-found-no' => 'No',
7886 'articlefeedbackv5-bucket1-toggle-found-yes-full' => 'Yes, I found what I was looking for.',
7987 'articlefeedbackv5-bucket1-toggle-found-no-full' => 'No, I did not find what I was looking for.',
80 - 'articlefeedbackv5-bucket1-question-comment-yes' => 'What was most useful to you? How could this article be improved?',
 88+ 'articlefeedbackv5-bucket1-question-comment-yes' => 'What was most useful to you? How could this page be improved?',
8189 'articlefeedbackv5-bucket1-question-comment-no' => 'What\'s missing? Any suggestions for improvement?',
8290 'articlefeedbackv5-bucket1-form-submit' => 'Post your feedback',
8391 /* Option 2 (getsatisfaction style) */
84 - 'articlefeedbackv5-bucket2-title' => 'Help improve this article',
 92+ 'articlefeedbackv5-bucket2-title' => 'Help improve this page',
8593 'articlefeedbackv5-bucket2-suggestion-label' => 'Suggestion',
8694 'articlefeedbackv5-bucket2-question-label' => 'Question',
8795 'articlefeedbackv5-bucket2-problem-label' => 'Problem',
8896 'articlefeedbackv5-bucket2-praise-label' => 'Praise',
89 - 'articlefeedbackv5-bucket2-suggestion-comment-default' => 'Make a suggestion! How can this article be improved?',
90 - 'articlefeedbackv5-bucket2-question-comment-default' => 'Ask a question about this article.',
91 - 'articlefeedbackv5-bucket2-problem-comment-default' => 'Report a problem. How can this article be improved?',
 97+ 'articlefeedbackv5-bucket2-suggestion-comment-default' => 'Make a suggestion! How can this page be improved?',
 98+ 'articlefeedbackv5-bucket2-question-comment-default' => 'Ask a question about this page.',
 99+ 'articlefeedbackv5-bucket2-problem-comment-default' => 'Report a problem. How can this page be improved?',
92100 'articlefeedbackv5-bucket2-praise-comment-default' => 'What do you like most? Share your praise with the editors.',
93101 'articlefeedbackv5-bucket2-form-submit' => 'Post your feedback',
94102 /* Option 3 (single rating) */
95 - 'articlefeedbackv5-bucket3-title' => 'Help improve this article',
96 - 'articlefeedbackv5-bucket3-rating-question' => 'Is this article helpful?',
 103+ 'articlefeedbackv5-bucket3-title' => 'Help improve this page',
 104+ 'articlefeedbackv5-bucket3-rating-question' => 'Is this page helpful?',
97105 'articlefeedbackv5-bucket3-rating-tooltip-1' => 'Not helpful at all',
98106 'articlefeedbackv5-bucket3-rating-tooltip-2' => 'Not very helpful',
99107 'articlefeedbackv5-bucket3-rating-tooltip-3' => 'Average',
100108 'articlefeedbackv5-bucket3-rating-tooltip-4' => 'Helpful',
101109 'articlefeedbackv5-bucket3-rating-tooltip-5' => 'Very helpful',
102110 'articlefeedbackv5-bucket3-clear-rating' => 'Remove this rating',
103 - 'articlefeedbackv5-bucket3-comment-default' => 'Add a comment. How can this article be improved?',
 111+ 'articlefeedbackv5-bucket3-comment-default' => 'Add a comment. How can this page be improved?',
104112 'articlefeedbackv5-bucket3-form-submit' => 'Post your feedback',
105113 /* Option 4 (just a big glossy edit button and some teaser text) */
106 - 'articlefeedbackv5-bucket4-title' => 'Help improve this article',
 114+ 'articlefeedbackv5-bucket4-title' => 'Help improve this page',
107115 'articlefeedbackv5-bucket4-subhead' => 'Did you know that you can edit this page?',
108 - 'articlefeedbackv5-bucket4-teaser-line1' => 'Wikipedia works because anyone can edit its articles.',
 116+ 'articlefeedbackv5-bucket4-teaser-line1' => 'Wikipedia works because anyone can edit its pages.',
109117 'articlefeedbackv5-bucket4-teaser-line2' => 'Go ahead, give it a try. Be bold!',
110118 'articlefeedbackv5-bucket4-learn-to-edit' => 'Learn how to edit',
111119 'articlefeedbackv5-bucket4-form-submit' => 'Edit this page',
112 - 'articlefeedbackv5-bucket4-help-tooltip-info' => 'Wikipedia wants to know what you think. Help improve this page by becoming an editor.',
 120+ 'articlefeedbackv5-bucket4-help-tooltip-info' => 'Wikipedia wants to know what you think. Help improve this page by becoming an editor.',
113121 /* Option 5 (just like AFTv4, but ported to work with v5) */
114122 'articlefeedbackv5-bucket5-form-switch-label' => 'Rate this page',
115123 'articlefeedbackv5-bucket5-form-panel-title' => 'Rate this page',
@@ -133,7 +141,7 @@
134142 'articlefeedbackv5-bucket5-report-panel-title' => 'Page ratings',
135143 'articlefeedbackv5-bucket5-report-panel-description' => 'Current average ratings.',
136144 'articlefeedbackv5-bucket5-report-empty' => 'No ratings',
137 - 'articlefeedbackv5-bucket5-report-ratings' => '$1 ratings',
 145+ 'articlefeedbackv5-bucket5-report-ratings' => '$1 ratings', // FIXME: Needs plural support for $1.
138146 'articlefeedbackv5-bucket5-trustworthy-label' => 'Trustworthy',
139147 'articlefeedbackv5-bucket5-trustworthy-tip' => 'Do you feel this page has sufficient citations and that those citations come from trustworthy sources?',
140148 'articlefeedbackv5-bucket5-trustworthy-tooltip-1' => 'Lacks reputable sources',
@@ -167,18 +175,19 @@
168176 'articlefeedbackv5-shared-on-feedback' => 'Your comment will be shared on this $1.',
169177 'articlefeedbackv5-shared-on-feedback-linktext' => 'feedback page',
170178 'articlefeedbackv5-help-tooltip-title' => 'What\'s this?',
171 - 'articlefeedbackv5-help-tooltip-info' => 'Wikipedia would like to hear what you think of this article. Share your feedback with the editors -- and help improve this page.',
 179+ 'articlefeedbackv5-help-tooltip-info' => 'Wikipedia would like to hear what you think of this page. Share your feedback with the editors -- and help improve this page.',
172180 'articlefeedbackv5-help-tooltip-linktext' => 'Learn more',
173181 'articlefeedbackv5-help-tooltip-linkurl' => 'http://en.wikipedia.org/wiki/Wikipedia:Article_Feedback_Tool/Version_5/Help',
174182 'articlefeedbackv5-transparency-terms' => 'By posting, you agree to transparency under these $1.',
175183 'articlefeedbackv5-transparency-terms-linktext' => 'terms',
176184 'articlefeedbackv5-transparency-terms-url' => 'http://wikimediafoundation.org/wiki/Feedback_privacy_statement',
177185 'articlefeedbackv5-section-linktext' => 'feedback',
178 - 'articlefeedbackv5-titlebar-linktext' => 'Help improve this article >>',
 186+ 'articlefeedbackv5-titlebar-linktext' => 'Help improve this page >>',
179187 'articlefeedbackv5-fixedtab-linktext' => 'Improve this page',
180188 'articlefeedbackv5-toolbox-linktext' => 'Improve this page',
181189
182190 /* --- copied from AFTv4 and possibly not used --- */
 191+ // FIXME: Can we get clarity on this? Translators may be wasting their time here (!!!)
183192 /* ArticleFeedback survey */
184193 'articlefeedbackv5-survey-question-origin' => 'What page were you on when you started this survey?',
185194 'articlefeedbackv5-survey-question-whyrated' => 'Please let us know why you rated this page today (check all that apply):',
@@ -223,10 +232,10 @@
224233 'articleFeedbackv5-table-heading-page' => 'Page',
225234 'articleFeedbackv5-table-heading-average' => 'Average',
226235 'articlefeedbackv5-table-noratings' => '-',
227 - 'articleFeedbackv5-copy-above-highlow-tables' => 'This is an experimental feature. Please provide feedback on the [$1 discussion page].',
228 - 'articlefeedbackv5-dashboard-bottom' => "'''Note''': We will continue to experiment with different ways of surfacing articles in these dashboards. At present, the dashboards include the following articles:
229 -* Pages with highest/lowest ratings: articles that have received at least 10 ratings within the last 24 hours. Averages are calculated by taking the mean of all ratings submitted within the last 24 hours.
230 -* Recent lows: articles that got 70% or more low (2 stars or lower) ratings in any category in the last 24 hours. Only articles that have received at least 10 ratings in the last 24 hours are included.",
 236+ 'articleFeedbackv5-copy-above-highlow-tables' => 'This is an experimental feature. Please provide feedback on the [$1 discussion page].',
 237+ 'articlefeedbackv5-dashboard-bottom' => "'''Note''': We will continue to experiment with different ways of surfacing pages in these dashboards. At present, the dashboards include the following pages:
 238+* Pages with highest/lowest ratings: pages that have received at least 10 ratings within the last 24 hours. Averages are calculated by taking the mean of all ratings submitted within the last 24 hours.
 239+* Recent lows: pages that got 70% or more low (2 stars or lower) ratings in any category in the last 24 hours. Only pages that have received at least 10 ratings in the last 24 hours are included.",
231240 /* Special:Preferences */
232241 'articlefeedbackv5-disable-preference' => "Don't show the Article feedback widget on pages",
233242 /* EmailCapture */
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -1128,7 +1128,7 @@
11291129 .attr( 'href', mw.config.get( 'wgArticleFeedbackv5LearnToEdit' ) );
11301130
11311131 // Fill in the edit link
1132 - var edit_track_id = $.articleFeedbackv5.buttonName() + '-button-click-' +
 1132+ var edit_track_id = $.articleFeedbackv5.bucketName() + '-button_click-' +
11331133 ( $.articleFeedbackv5.inDialog ? 'overlay' : 'bottom' );
11341134 $block.find( '.articleFeedbackv5-cta-button' )
11351135 .attr( 'href', $.articleFeedbackv5.editUrl( edit_track_id ) );
@@ -1903,7 +1903,7 @@
19041904
19051905 // Fill in the link
19061906 var edit_track_id = $.articleFeedbackv5.bucketName() + '-' +
1907 - $.articleFeedbackv5.ctaName() + '-button-click-' +
 1907+ $.articleFeedbackv5.ctaName() + '-button_click-' +
19081908 ( $.articleFeedbackv5.inDialog ? 'overlay': 'bottom' );
19091909 $block.find( '.articleFeedbackv5-cta-button' )
19101910 .attr( 'href', $.articleFeedbackv5.editUrl( edit_track_id ) );
@@ -1970,7 +1970,7 @@
19711971 // Fill in the button link
19721972 var learn_url = mw.msg( 'articlefeedbackv5-cta1-learn-how-url' );
19731973 var learn_track_id = $.articleFeedbackv5.bucketName() + '-' +
1974 - $.articleFeedbackv5.ctaName() + '-button-click-' +
 1974+ $.articleFeedbackv5.ctaName() + '-button_click-' +
19751975 ( $.articleFeedbackv5.inDialog ? 'overlay': 'bottom' );
19761976 $block.find( '.articleFeedbackv5-cta-button' )
19771977 .attr( 'href', $.articleFeedbackv5.trackingUrl( learn_url, learn_track_id ) );
@@ -2251,13 +2251,13 @@
22522252 */
22532253 $.articleFeedbackv5.ctaName = function () {
22542254 if ( '0' == $.articleFeedbackv5.ctaId ) {
2255 - return 'cta-none';
 2255+ return 'cta_none';
22562256 } else if ( '1' == $.articleFeedbackv5.ctaId ) {
2257 - return 'cta-edit';
 2257+ return 'cta_edit';
22582258 } else if ( '2' == $.articleFeedbackv5.ctaId ) {
2259 - return 'cta-learnmore';
 2259+ return 'cta_learn_more';
22602260 } else {
2261 - return 'cta-unknown';
 2261+ return 'cta_unknown';
22622262 }
22632263 };
22642264
@@ -2290,16 +2290,15 @@
22912291 var params = {
22922292 'title': mw.config.get( 'wgPageName' ),
22932293 'action': 'edit',
 2294+ 'articleFeedbackv5_click_tracking': $.articleFeedbackv5.clickTracking ? '1' : '0',
22942295 };
2295 - if ( $.articleFeedbackv5.bucketId ) {
 2296+ if ( $.articleFeedbackv5.clickTracking ) {
 2297+ params.articleFeedbackv5_ct_token = $.cookie( 'clicktracking-session' );
22962298 params.articleFeedbackv5_bucket_id = $.articleFeedbackv5.bucketId;
 2299+ params.articleFeedbackv5_cta_id = $.articleFeedbackv5.ctaId;
 2300+ params.articleFeedbackv5_link_id = $.articleFeedbackv5.linkId;
 2301+ params.articleFeedbackv5_location = $.articleFeedbackv5.inDialog ? 'overlay' : 'bottom';
22972302 }
2298 - if ( $.articleFeedbackv5.ctaId ) {
2299 - params.articleFeedbackv5_cta_id = $.articleFeedbackv5.ctaId;
2300 - }
2301 - if ( $.articleFeedbackv5.feedbackId ) {
2302 - params.articleFeedbackv5_feedback_id = $.articleFeedbackv5.feedbackId;
2303 - }
23042303 var url = mw.config.get( 'wgScript' ) + '?' + $.param( params );
23052304 if ( trackingId ) {
23062305 return $.articleFeedbackv5.trackingUrl( url, trackingId );
@@ -2463,10 +2462,10 @@
24642463
24652464 // Track the event
24662465 if ( $.articleFeedbackv5.inDialog ) {
2467 - $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-overlay-impression' );
 2466+ $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-impression-overlay' );
24682467 } else {
24692468 // Don't track bottom-of-the-page loads, at least for now
2470 - // $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-bottom-impression' );
 2469+ // $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-impression-bottom' );
24712470 }
24722471
24732472 $.articleFeedbackv5.nowShowing = 'form';
@@ -2912,10 +2911,10 @@
29132912 $.articleFeedbackv5.closeAsModal = function () {
29142913 if ( $.articleFeedbackv5.inDialog ) {
29152914 if ( 'form' == $.articleFeedbackv5.nowShowing ) {
2916 - $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-overlay-close' );
 2915+ $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-close-overlay' );
29172916 } else if ('cta' == $.articleFeedbackv5.nowShowing ) {
29182917 $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-' +
2919 - $.articleFeedbackv5.ctaName() + '-overlay-close' );
 2918+ $.articleFeedbackv5.ctaName() + '-close-overlay' );
29202919 }
29212920 $.articleFeedbackv5.setLinkId( '0' );
29222921 $.articleFeedbackv5.$dialog.find( '.articleFeedbackv5-tooltip' ).hide();
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.startup.js
@@ -16,7 +16,7 @@
1717 /*** Main entry point ***/
1818 jQuery( function( $ ) {
1919
20 - var ua = navigator.appVersion.toLowerCase();
 20+ var ua = navigator.userAgent.toLowerCase();
2121 // Rule out MSIE 6, iPhone, iPod, iPad, Android
2222 if(
2323 (ua.indexOf( 'msie 6' ) != -1) ||
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php
@@ -239,7 +239,8 @@
240240 $wgHooks['ResourceLoaderGetConfigVars'][] = 'ArticleFeedbackv5Hooks::resourceLoaderGetConfigVars';
241241 $wgHooks['GetPreferences'][] = 'ArticleFeedbackv5Hooks::getPreferences';
242242 $wgHooks['EditPage::showEditForm:fields'][] = 'ArticleFeedbackv5Hooks::pushTrackingFieldsToEdit';
243 -$wgHooks['ArticleSaveComplete'][] = 'ArticleFeedbackv5Hooks::trackEdit';
 243+$wgHooks['EditPage::attemptSave'][] = 'ArticleFeedbackv5Hooks::trackEditAttempt';
 244+$wgHooks['ArticleSaveComplete'][] = 'ArticleFeedbackv5Hooks::trackEditSuccess';
244245
245246 // API Registration
246247 //$wgAPIListModules['articlefeedbackv5-view-ratings'] = 'ApiViewRatingsArticleFeedbackv5';
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php
@@ -449,23 +449,25 @@
450450 $timestamp = $dbw->timestamp();
451451 $ip = null;
452452
 453+ if ( !$wgUser ) {
 454+ $this->dieUsage( 'User info is missing', 'missinguser' );
 455+ }
 456+
453457 // Only save IP address if the user isn't logged in.
454458 if ( !$wgUser->isLoggedIn() ) {
455459 $ip = wfGetIP();
456460 }
457461
458 - # make sure we have a page/user
459 - if ( !$params['pageid'] || !$wgUser) {
460 - if ( !$feedbackId ) {
461 - $this->dieUsage( 'Saving feedback requires a page ID', 'invalidpageid' );
462 - }
 462+ // Make sure we have a page ID
 463+ if ( !$params['pageid'] ) {
 464+ $this->dieUsage( 'Page ID is missing or invalid', 'invalidpageid' );
463465 }
464466
465467 # Fetch this if it wasn't passed in
466468 if ( !$revId ) {
467469 $title = Title::newFromID( $params['pageid'] );
468470 if ( !$title ) {
469 - $this->dieUsage( 'Page ID is invalid', 'invalidpageid' );
 471+ $this->dieUsage( 'Page ID is missing or invalid', 'invalidpageid' );
470472 }
471473 $revId = $title->getLatestRevID();
472474 }
@@ -631,6 +633,7 @@
632634 array( 'code' => 'invalidtoken', 'info' => 'The anontoken is not 32 characters' ),
633635 array( 'code' => 'invalidpage', 'info' => 'ArticleFeedback is not enabled on this page' ),
634636 array( 'code' => 'invalidpageid', 'info' => 'Page ID is missing or invalid' ),
 637+ array( 'code' => 'missinguser', 'info' => 'User info is missing' ),
635638 ) );
636639 }
637640
Property changes on: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php
___________________________________________________________________
Modified: svn:mergeinfo
638641 Merged /trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php:r106428-106682
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -286,33 +286,79 @@
287287 public static function pushTrackingFieldsToEdit( $editPage, $output ) {
288288 global $wgRequest;
289289
290 - $feedbackId = $wgRequest->getVal( 'articleFeedbackv5_feedback_id' );
291 - $ctaId = $wgRequest->getVal( 'articleFeedbackv5_cta_id' );
 290+ $tracking = $wgRequest->getVal( 'articleFeedbackv5_click_tracking' );
292291 $bucketId = $wgRequest->getVal( 'articleFeedbackv5_bucket_id' );
 292+ $ctaId = $wgRequest->getVal( 'articleFeedbackv5_cta_id' );
 293+ $location = $wgRequest->getVal( 'articleFeedbackv5_location' );
 294+ $token = $wgRequest->getVal( 'articleFeedbackv5_ct_token' );
293295
294 - $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_feedback_id', $feedbackId );
 296+ $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_click_tracking', $tracking );
 297+ $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_bucket_id', $bucketId );
295298 $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_cta_id', $ctaId );
296 - $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_bucket_id', $bucketId );
 299+ $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_location', $location );
 300+ $editPage->editFormTextAfterContent .= Html::hidden( 'articleFeedbackv5_ct_token', $token );
297301
298302 return true;
299303 }
300304
301305 /**
302 - * Tracks edits
 306+ * Tracks edit attempts
303307 *
 308+ * @see http://www.mediawiki.org/wiki/Manual:Hooks/EditPage::attemptSave
 309+ */
 310+ public static function trackEditAttempt( $editpage ) {
 311+ self::trackEvent( 'edit_attempt', $editpage->getTitle() );
 312+ return true;
 313+ }
 314+
 315+ /**
 316+ * Tracks successful edits
 317+ *
304318 * @see http://www.mediawiki.org/wiki/Manual:Hooks/ArticleSaveComplete
305319 */
306 - public static function trackEdit( $article, $user, $text, $summary, $minoredit,
307 - $watchthis, $sectionanchor, $flags, $revision, $baseRevId ) {
308 - global $wgRequest;
 320+ public static function trackEditSuccess( &$article, &$user, $text,
 321+ $summary, $minoredit, $watchthis, $sectionanchor, &$flags,
 322+ $revision, &$status, $baseRevId, &$redirect) {
 323+ self::trackEvent( 'edit_success', $article->getTitle() );
 324+ return true;
 325+ }
309326
310 - $feedbackId = $wgRequest->getVal( 'articleFeedbackv5_feedback_id' );
311 - $ctaId = $wgRequest->getVal( 'articleFeedbackv5_cta_id' );
 327+ /**
 328+ * Internal use: Tracks an event
 329+ *
 330+ * @param $event string the event name
 331+ */
 332+ private static function trackEvent( $event, $title ) {
 333+ global $wgRequest, $wgArticleFeedbackv5Tracking;
 334+ $ctas = array( 'none', 'edit', 'learn_more' );
 335+
 336+ $tracking = $wgRequest->getVal( 'articleFeedbackv5_click_tracking' );
 337+ if ( !$tracking ) {
 338+ return;
 339+ }
 340+
 341+ $version = $wgArticleFeedbackv5Tracking['version'];
312342 $bucketId = $wgRequest->getVal( 'articleFeedbackv5_bucket_id' );
 343+ $ctaId = $wgRequest->getVal( 'articleFeedbackv5_cta_id' );
 344+ $location = $wgRequest->getVal( 'articleFeedbackv5_location' );
 345+ $token = $wgRequest->getVal( 'articleFeedbackv5_ct_token' );
313346
314 - return true;
 347+ $trackingId = 'ext.articleFeedbackv5@' . $version
 348+ . '-option' . $bucketId
 349+ . '-cta_' . ( isset( $ctas[$ctaId] ) ? $ctas[$ctaId] : 'unknown' )
 350+ . '-' . $event
 351+ . '-' . $location;
 352+
 353+ $params = new FauxRequest( array(
 354+ 'action' => 'clicktracking',
 355+ 'eventid' => $trackingId,
 356+ 'token' => $token,
 357+ 'info' => $title->getText(),
 358+ 'namespacenumber' => $title->getNamespace()
 359+ ) );
 360+ $api = new ApiMain( $params, true );
 361+ $api->execute();
315362 }
316363
317 -
318364 }
319365
Property changes on: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5
___________________________________________________________________
Modified: svn:mergeinfo
320366 Merged /trunk/extensions/ArticleFeedbackv5:r106428-106682

Status & tagging log