r110019 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110018‎ | r110019 | r110020 >
Date:19:34, 25 January 2012
Author:catrope
Status:ok
Tags:
Comment:
1.18wmf1: MFT r109875, r109933, r109943
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5 (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/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -28,6 +28,9 @@
2929 'articlefeedbackv5-cta2-confirmation-title' => 'Help improve Wikipedia',
3030 'articlefeedbackv5-cta2-confirmation-call' => 'This website is created by people like you. Can you give us a hand?',
3131 'articlefeedbackv5-cta2-button-text' => 'Learn more',
 32+ 'articlefeedbackv5-cta3-confirmation-title' => 'Please take a quick survey',
 33+ 'articlefeedbackv5-cta3-confirmation-call' => 'It only takes a minute and will help improve Wikipedia.',
 34+ 'articlefeedbackv5-cta3-button-text' => 'Start the survey',
3235
3336 // error messages
3437 'articlefeedbackv5-error' => 'An error has occured. Please try again later.',
@@ -302,6 +305,9 @@
303306 'articlefeedbackv5-cta2-confirmation-title' => 'The title of the learn more CTA',
304307 'articlefeedbackv5-cta2-confirmation-call' => 'The explanatory text of the learn more CTA',
305308 'articlefeedbackv5-cta2-button-text' => 'The text for the button on the learn more CTA',
 309+ 'articlefeedbackv5-cta3-confirmation-title' => 'The title of the survey CTA',
 310+ 'articlefeedbackv5-cta3-confirmation-call' => 'The explanatory text of the survey CTA',
 311+ 'articlefeedbackv5-cta3-button-text' => 'The text for the button on the survey CTA',
306312 'articlefeedbackv5-error' => 'This error message will be displayed in a grey box replacing the form if there was an unrecoverable error.',
307313 'articlefeedbackv5-error-nofeedback' => 'This error message will be displayed above the form (but below the title) if the user has attempted to submit a blank form.',
308314 'articlefeedbackv5-special-filter-all' => '{{Identical|All}}',
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css
@@ -1013,6 +1013,11 @@
10141014 margin-top: 50px !important;
10151015 }
10161016
 1017+.articleFeedbackv5-ui.articleFeedbackv5-cta-3 .articleFeedbackv5-cta-button {
 1018+ margin-top: 50px !important;
 1019+}
 1020+
 1021+
10171022 /* Skin-specific styles */
10181023 body.skin-vector .articleFeedbackv5-dialog.ui-dialog .ui-dialog-content a,
10191024 body.skin-monobook .articleFeedbackv5-dialog.ui-dialog .ui-dialog-content a {
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -1992,10 +1992,147 @@
19931993
19941994 // }}}
19951995
1996 - }
 1996+ },
19971997
19981998 // }}}
 1999+ // {{{ CTA 3: Take a survey
19992000
 2001+ '3': {
 2002+
 2003+ // {{{ templates
 2004+
 2005+ /**
 2006+ * Pull out the markup so it's easy to find
 2007+ */
 2008+ templates: {
 2009+
 2010+ /**
 2011+ * The template for the whole block
 2012+ */
 2013+ block: '\
 2014+ <div class="clear"></div>\
 2015+ <div class="articleFeedbackv5-confirmation-panel">\
 2016+ <div class="articleFeedbackv5-panel-leftContent">\
 2017+ <h3 class="articleFeedbackv5-confirmation-title"><html:msg key="cta3-confirmation-title" /></h3>\
 2018+ <p class="articleFeedbackv5-confirmation-call"><html:msg key="cta3-confirmation-call" /></p>\
 2019+ </div>\
 2020+ <a href="#" class="articleFeedbackv5-cta-button" target="_blank"><span class="ui-button-text"><html:msg key="cta3-button-text" /></span></a>\
 2021+ <div class="clear"></div>\
 2022+ </div>\
 2023+ '
 2024+
 2025+ },
 2026+
 2027+ // }}}
 2028+ // {{{ verify
 2029+
 2030+ /**
 2031+ * Verifies that this CTA can be displayed
 2032+ *
 2033+ * @return bool whether the CTA can be displayed
 2034+ */
 2035+ verify: function () {
 2036+ return $.articleFeedbackv5.ctas['3'].getSurveyUrl() !== false;
 2037+ },
 2038+
 2039+ // }}}
 2040+ // {{{ build
 2041+
 2042+ /**
 2043+ * Builds the CTA
 2044+ *
 2045+ * @return Element the form
 2046+ */
 2047+ build: function () {
 2048+
 2049+ // Start up the block to return
 2050+ var $block = $( $.articleFeedbackv5.currentCTA().templates.block );
 2051+
 2052+ // Fill in the go-to-survey link
 2053+ var survey_url = $.articleFeedbackv5.currentCTA().getSurveyUrl();
 2054+ if ( survey_url ) {
 2055+ var survey_track_id = $.articleFeedbackv5.bucketName() + '-' +
 2056+ $.articleFeedbackv5.ctaName() + '-button_click-' +
 2057+ ( $.articleFeedbackv5.inDialog ? 'overlay': 'bottom' );
 2058+ $block.find( '.articleFeedbackv5-cta-button' )
 2059+ .attr( 'href', $.articleFeedbackv5.trackingUrl(
 2060+ survey_url + '?c=' + $.articleFeedbackv5.feedbackId,
 2061+ survey_track_id
 2062+ ) );
 2063+ }
 2064+
 2065+ return $block;
 2066+ },
 2067+
 2068+ // }}}
 2069+ // {{{ getSurveyUrl
 2070+
 2071+ /**
 2072+ * Gets the appropriate survey url, or returns false if none was
 2073+ * found
 2074+ *
 2075+ * @return mixed the url, if one is availabe, or false if not
 2076+ */
 2077+ getSurveyUrl: function () {
 2078+ var base = mw.config.get( 'wgArticleFeedbackv5SurveyUrls' );
 2079+ aft5_debug( base );
 2080+ aft5_debug( $.articleFeedbackv5.bucketId );
 2081+ if ( typeof base != 'object' || !( $.articleFeedbackv5.bucketId in base ) ) {
 2082+ return false;
 2083+ }
 2084+ return base[$.articleFeedbackv5.bucketId];
 2085+ },
 2086+
 2087+ // }}}
 2088+ // {{{ bindEvents
 2089+
 2090+ /**
 2091+ * Binds any events
 2092+ *
 2093+ * @param $block element the form block
 2094+ */
 2095+ bindEvents: function ( $block ) {
 2096+
 2097+ // Make the link work as a popup
 2098+ $block.find( '.articleFeedbackv5-cta-button' )
 2099+ .click( function ( e ) {
 2100+ e.preventDefault();
 2101+ var link = $( this ).attr( 'href' );
 2102+ var params = 'status=0,\
 2103+ toolbar=0,\
 2104+ location=0,\
 2105+ menubar=0,\
 2106+ directories=0,\
 2107+ resizable=1,\
 2108+ scrollbars=1,\
 2109+ height=800,\
 2110+ width=600';
 2111+ var survey = window.open( link, 'survey', params );
 2112+ if ( $.articleFeedbackv5.inDialog ) {
 2113+ $.articleFeedbackv5.closeAsModal();
 2114+ } else {
 2115+ $.articleFeedbackv5.clear();
 2116+ }
 2117+ } );
 2118+
 2119+ },
 2120+
 2121+ // }}}
 2122+ // {{{ afterBuild
 2123+
 2124+ /**
 2125+ * Perform adjustments after build
 2126+ */
 2127+ afterBuild: function() {
 2128+ $( '.articleFeedbackv5-tooltip-trigger' ).remove();
 2129+ }
 2130+
 2131+ // }}}
 2132+
 2133+ },
 2134+
 2135+ // }}}
 2136+
20002137 };
20012138
20022139 // }}}
@@ -2260,6 +2397,8 @@
22612398 return 'cta_edit';
22622399 } else if ( '2' == $.articleFeedbackv5.ctaId ) {
22632400 return 'cta_learn_more';
 2401+ } else if ( '3' == $.articleFeedbackv5.ctaId ) {
 2402+ return 'cta_survey';
22642403 } else {
22652404 return 'cta_unknown';
22662405 }
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php
@@ -10,9 +10,6 @@
1111 * @version 0.1.0
1212 */
1313
14 -/* XXX: Survey setup */
15 -require_once( dirname( dirname( __FILE__ ) ) . '/SimpleSurvey/SimpleSurvey.php' );
16 -
1714 /* Configuration */
1815
1916 // How long text-based feedback is allowed to be before returning an error.
@@ -173,40 +170,16 @@
174171 */
175172 $wgArticleFeedbackv5LearnToEdit = "//en.wikipedia.org/wiki/Wikipedia:Tutorial";
176173
177 -// Would ordinarily call this articlefeedback but survey names are 16 chars max
178 -$wgPrefSwitchSurveys['articlerating'] = array(
179 - 'updatable' => false,
180 - 'submit-msg' => 'articlefeedbackv5-survey-submit',
181 - 'questions' => array(
182 - 'origin' => array(
183 - 'visibility' => 'hidden',
184 - 'question' => 'articlefeedbackv5-survey-question-origin',
185 - 'type' => 'text',
186 - ),
187 - 'whyrated' => array(
188 - 'question' => 'articlefeedbackv5-survey-question-whyrated',
189 - 'type' => 'checks',
190 - 'answers' => array(
191 - 'contribute-rating' => 'articlefeedbackv5-survey-answer-whyrated-contribute-rating',
192 - 'development' => 'articlefeedbackv5-survey-answer-whyrated-development',
193 - 'contribute-wiki' => 'articlefeedbackv5-survey-answer-whyrated-contribute-wiki',
194 - 'sharing-opinion' => 'articlefeedbackv5-survey-answer-whyrated-sharing-opinion',
195 - 'didntrate' => 'articlefeedbackv5-survey-answer-whyrated-didntrate',
196 - ),
197 - 'other' => 'articlefeedbackv5-survey-answer-whyrated-other',
198 - ),
199 - 'useful' => array(
200 - 'question' => 'articlefeedbackv5-survey-question-useful',
201 - 'type' => 'boolean',
202 - 'iffalse' => 'articlefeedbackv5-survey-question-useful-iffalse',
203 - ),
204 - 'comments' => array(
205 - 'question' => 'articlefeedbackv5-survey-question-comments',
206 - 'type' => 'text',
207 - ),
208 - ),
 174+/**
 175+ * The full URL for the survey link
 176+ *
 177+ * @var string
 178+ */
 179+$wgArticleFeedbackv5SurveyUrls = array(
 180+ '1' => 'https://www.surveymonkey.com/s/aft5-1',
 181+ '2' => 'https://www.surveymonkey.com/s/aft5-2',
 182+ '3' => 'https://www.surveymonkey.com/s/aft5-3',
209183 );
210 -$wgValidSurveys[] = 'articlerating';
211184
212185 // Replace default emailcapture message
213186 $wgEmailCaptureAutoResponse['body-msg'] = 'articlefeedbackv5-emailcapture-response-body';
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php
@@ -615,7 +615,7 @@
616616 * @return int the cta id
617617 */
618618 public function getCTAId( $answers, $bucket ) {
619 - return 1; # Hard-code this for now.
 619+ return 3; # Hard-code this for now.
620620 }
621621
622622 /**
Property changes on: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php
___________________________________________________________________
Modified: svn:mergeinfo
623623 Merged /trunk/extensions/ArticleFeedbackv5/api/ApiArticleFeedbackv5.php:r109875,109933,109943
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -71,6 +71,9 @@
7272 'articlefeedbackv5-cta2-confirmation-title',
7373 'articlefeedbackv5-cta2-confirmation-call',
7474 'articlefeedbackv5-cta2-button-text',
 75+ 'articlefeedbackv5-cta3-confirmation-title',
 76+ 'articlefeedbackv5-cta3-confirmation-call',
 77+ 'articlefeedbackv5-cta3-button-text',
7578 'articlefeedbackv5-bucket1-title',
7679 'articlefeedbackv5-bucket1-question-toggle',
7780 'articlefeedbackv5-bucket1-toggle-found-yes',
@@ -255,7 +258,8 @@
256259 $wgArticleFeedbackv5Options,
257260 $wgArticleFeedbackv5LinkBuckets,
258261 $wgArticleFeedbackv5Namespaces,
259 - $wgArticleFeedbackv5LearnToEdit;
 262+ $wgArticleFeedbackv5LearnToEdit,
 263+ $wgArticleFeedbackv5SurveyUrls;
260264 $vars['wgArticleFeedbackv5SMaxage'] = $wgArticleFeedbackv5SMaxage;
261265 $vars['wgArticleFeedbackv5Categories'] = $wgArticleFeedbackv5Categories;
262266 $vars['wgArticleFeedbackv5BlacklistCategories'] = $wgArticleFeedbackv5BlacklistCategories;
@@ -271,6 +275,7 @@
272276 $vars['wgArticleFeedbackv5LearnToEdit'] = $wgArticleFeedbackv5LearnToEdit;
273277 $vars['wgArticleFeedbackv5WhatsThisPage'] = wfMsgForContent( 'articlefeedbackv5-bucket5-form-panel-explanation-link' );
274278 $vars['wgArticleFeedbackv5TermsPage'] = wfMsgForContent( 'articlefeedbackv5-transparency-terms-url' );
 279+ $vars['wgArticleFeedbackv5SurveyUrls'] = $wgArticleFeedbackv5SurveyUrls;
275280 return true;
276281 }
277282
Property changes on: branches/wmf/1.18wmf1/extensions/ArticleFeedbackv5
___________________________________________________________________
Modified: svn:mergeinfo
278283 Merged /trunk/extensions/ArticleFeedbackv5:r109875,109933,109943

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109875Added survey CTA:...rsterbin23:40, 23 January 2012
r109933Updated survey CTA to use different links for options 1, 2, and 3:...rsterbin17:29, 24 January 2012
r109943Swapped the dimensions of the survey window and made it close the CTA as soon...rsterbin19:58, 24 January 2012

Status & tagging log