Index: trunk/extensions/UsabilityInitiative/OptIn/OptIn.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | $wgOptInAlwaysShowPersonalLink = false; |
30 | 30 | $wgOptInNeverShowPersonalLink = false; |
31 | 31 | |
32 | | -$wgOptInStyleVersion = 6; |
| 32 | +$wgOptInStyleVersion = 7; |
33 | 33 | |
34 | 34 | // Preferences to set when users opt in |
35 | 35 | // array( prefname => value ) |
— | — | @@ -36,75 +36,85 @@ |
37 | 37 | |
38 | 38 | // Survey questions to ask when users opt out |
39 | 39 | $wgOptInSurvey = array( |
40 | | - array( 'question' => 'optin-survey-question-likedislike', |
| 40 | + 'likedislike' => array( |
| 41 | + 'question' => 'optin-survey-question-likedislike', |
41 | 42 | 'type' => 'textarea' ), |
42 | | - array( 'question' => 'optin-survey-question-whyoptout', |
| 43 | + 'whyoptout' => array( |
| 44 | + 'question' => 'optin-survey-question-whyoptout', |
43 | 45 | 'type' => 'checkboxes', |
44 | 46 | 'answers' => array( |
45 | | - 'optin-survey-answer-whyoptout-hard', |
46 | | - 'optin-survey-answer-whyoptout-didntwork', |
47 | | - 'optin-survey-answer-whyoptout-notpredictable', |
48 | | - 'optin-survey-answer-whyoptout-didntlike-look', |
49 | | - 'optin-survey-answer-whyoptout-didntlike-layout', |
50 | | - 'optin-survey-answer-whyoptout-didntlike-toolbar' ), |
| 47 | + 'hard' => 'optin-survey-answer-whyoptout-hard', |
| 48 | + 'didntwork' => 'optin-survey-answer-whyoptout-didntwork', |
| 49 | + 'notpredictable' => 'optin-survey-answer-whyoptout-notpredictable', |
| 50 | + 'look' => 'optin-survey-answer-whyoptout-didntlike-look', |
| 51 | + 'layout' => 'optin-survey-answer-whyoptout-didntlike-layout', |
| 52 | + 'toolbar' => 'optin-survey-answer-whyoptout-didntlike-toolbar' ), |
51 | 53 | 'other' => 'optin-survey-answer-whyoptout-other' ), |
52 | | - array( 'question' => 'optin-survey-question-explain', |
| 54 | + 'explainwhyoptout' => array( |
| 55 | + 'question' => 'optin-survey-question-explain', |
53 | 56 | 'type' => 'textarea' ), |
54 | | - array( 'question' => 'optin-survey-question-techfail', |
| 57 | + 'techfail' => array( |
| 58 | + 'question' => 'optin-survey-question-techfail', |
55 | 59 | 'type' => 'yesno', |
56 | 60 | 'ifyes' => 'optin-survey-question-techfail-ifyes' ), |
57 | | - array( 'question' => 'optin-survey-question-usedtoolbar', |
| 61 | + 'usedtoolbar' => array( |
| 62 | + 'question' => 'optin-survey-question-usedtoolbar', |
58 | 63 | 'type' => 'yesno', |
59 | 64 | 'ifyes' => 'optin-survey-question-usedtoolbar-ifyes' ), |
60 | | - array( 'question' => 'optin-survey-question-different', |
| 65 | + 'different' => array( |
| 66 | + 'question' => 'optin-survey-question-different', |
61 | 67 | 'type' => 'textarea' ), |
62 | | - array( 'question' => 'optin-survey-question-feedback', |
| 68 | + 'feedback' => array( |
| 69 | + 'question' => 'optin-survey-question-feedback', |
63 | 70 | 'type' => 'textarea' ), |
64 | | - array( 'question' => 'optin-survey-question-browser', |
| 71 | + 'browser' => array( |
| 72 | + 'question' => 'optin-survey-question-browser', |
65 | 73 | 'type' => 'dropdown', |
66 | 74 | 'answers' => array( |
67 | | - 'optin-survey-answer-browser-ie5', |
68 | | - 'optin-survey-answer-browser-ie6', |
69 | | - 'optin-survey-answer-browser-ie7', |
70 | | - 'optin-survey-answer-browser-ie8', |
71 | | - 'optin-survey-answer-browser-ff1', |
72 | | - 'optin-survey-answer-browser-ff2', |
73 | | - 'optin-survey-answer-browser-ff3', |
74 | | - 'optin-survey-answer-browser-cb', |
75 | | - 'optin-survey-answer-browser-c1', |
76 | | - 'optin-survey-answer-browser-c2', |
77 | | - 'optin-survey-answer-browser-s3', |
78 | | - 'optin-survey-answer-browser-s4', |
79 | | - 'optin-survey-answer-browser-o9', |
80 | | - 'optin-survey-answer-browser-o9.5', |
81 | | - 'optin-survey-answer-browser-o10' ), |
| 75 | + 'ie5' => 'optin-survey-answer-browser-ie5', |
| 76 | + 'ie6' => 'optin-survey-answer-browser-ie6', |
| 77 | + 'ie7' => 'optin-survey-answer-browser-ie7', |
| 78 | + 'ie8' => 'optin-survey-answer-browser-ie8', |
| 79 | + 'ff1' => 'optin-survey-answer-browser-ff1', |
| 80 | + 'ff2' => 'optin-survey-answer-browser-ff2', |
| 81 | + 'ff3'=> 'optin-survey-answer-browser-ff3', |
| 82 | + 'cb' => 'optin-survey-answer-browser-cb', |
| 83 | + 'c1' => 'optin-survey-answer-browser-c1', |
| 84 | + 'c2' => 'optin-survey-answer-browser-c2', |
| 85 | + 's3' => 'optin-survey-answer-browser-s3', |
| 86 | + 's4' => 'optin-survey-answer-browser-s4', |
| 87 | + 'o9' => 'optin-survey-answer-browser-o9', |
| 88 | + 'o9.5' => 'optin-survey-answer-browser-o9.5', |
| 89 | + 'o10' => 'optin-survey-answer-browser-o10' ), |
82 | 90 | 'other' => 'optin-survey-answer-browser-other' ), |
83 | | - array( 'question' => 'optin-survey-question-os', |
| 91 | + 'os' => array( |
| 92 | + 'question' => 'optin-survey-question-os', |
84 | 93 | 'type' => 'dropdown', |
85 | 94 | 'answers' => array( |
86 | | - 'optin-survey-answer-os-windows', |
87 | | - 'optin-survey-answer-os-macos', |
88 | | - 'optin-survey-answer-os-linux' ), |
| 95 | + 'windows' => 'optin-survey-answer-os-windows', |
| 96 | + 'macos' => 'optin-survey-answer-os-macos', |
| 97 | + 'linux' => 'optin-survey-answer-os-linux' ), |
89 | 98 | 'other' => 'optin-survey-answer-os-other' ), |
90 | | - array( 'question' => 'optin-survey-question-res', |
| 99 | + 'res' => array( |
| 100 | + 'question' => 'optin-survey-question-res', |
91 | 101 | 'type' => 'resolution' ), |
92 | 102 | ); |
93 | 103 | |
94 | 104 | $wgOptInFeedBackSurvey = $wgOptInSurvey; |
95 | | -unset( $wgOptInFeedBackSurvey[1] ); |
96 | | -unset( $wgOptInFeedBackSurvey[2] ); |
97 | | -$wgOptInFeedBackSurvey[4]['ifno'] = 'optin-survey-question-usedtoolbar-ifno'; |
98 | | -$wgOptInFeedBackSurvey[5] = array( |
| 105 | +unset( $wgOptInFeedBackSurvey['whyoptout'] ); |
| 106 | +unset( $wgOptInFeedBackSurvey['explainwhyoptout'] ); |
| 107 | +$wgOptInFeedBackSurvey['usedtoolbar']['ifno'] = 'optin-survey-question-usedtoolbar-ifno'; |
| 108 | +$wgOptInFeedBackSurvey['changes'] = array( |
99 | 109 | 'question' => 'optin-survey-question-changes', |
100 | 110 | 'type' => 'checkboxes', |
101 | 111 | 'answers' => array( |
102 | | - 'optin-survey-answer-changes-nav', |
103 | | - 'optin-survey-answer-changes-edittools', |
104 | | - 'optin-survey-answer-changes-upload', |
105 | | - 'optin-survey-answer-changes-richtext', |
106 | | - 'optin-survey-answer-changes-lookfeel', |
107 | | - 'optin-survey-answer-changes-predictability', |
108 | | - 'optin-survey-answer-changes-custom' ), |
| 112 | + 'nav' => 'optin-survey-answer-changes-nav', |
| 113 | + 'edittools' => 'optin-survey-answer-changes-edittools', |
| 114 | + 'upload' => 'optin-survey-answer-changes-upload', |
| 115 | + 'richtext' => 'optin-survey-answer-changes-richtext', |
| 116 | + 'lookfeel' => 'optin-survey-answer-changes-lookfeel', |
| 117 | + 'predictability' => 'optin-survey-answer-changes-predictability', |
| 118 | + 'custom' => 'optin-survey-answer-changes-custom' ), |
109 | 119 | 'other' => 'optin-survey-answer-changes-other' |
110 | 120 | ); |
111 | 121 | |
— | — | @@ -141,4 +151,3 @@ |
142 | 152 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'OptInHooks::schema'; |
143 | 153 | |
144 | 154 | $wgHooks['PersonalUrls'][] = 'OptInHooks::personalUrls'; |
145 | | - |
Index: trunk/extensions/UsabilityInitiative/OptIn/SpecialOptIn.php |
— | — | @@ -81,6 +81,9 @@ |
82 | 82 | else if ( $wgRequest->getVal( 'opt' ) == 'feedback' ) |
83 | 83 | // Giving feedback |
84 | 84 | $wgOut->setPageTitle( wfMsg( 'optin-title-feedback' ) ); |
| 85 | + else if ( $wgRequest->getVal( 'opt' ) == 'in' ) |
| 86 | + // Just opted in and reloaded... or something |
| 87 | + $wgOut->setPagetitle( wfMsg( 'optin-title-justoptedin' ) ); |
85 | 88 | else |
86 | 89 | // About to opt out |
87 | 90 | $wgOut->setPageTitle( wfMsg( 'optin-title-optedin' ) ); |
Index: trunk/extensions/UsabilityInitiative/OptIn/OptIn.hooks.php |
— | — | @@ -21,6 +21,11 @@ |
22 | 22 | 'ois_type', |
23 | 23 | dirname( __FILE__ ) . '/OptIn.patch.ois_type.sql' |
24 | 24 | ); |
| 25 | + $wgExtNewFields[] = array( |
| 26 | + 'optin_survey', |
| 27 | + 'ois_question', |
| 28 | + dirname( __FILE__ ) . '/patch-ois_question.sql' |
| 29 | + ); |
25 | 30 | |
26 | 31 | return true; |
27 | 32 | } |
— | — | @@ -73,4 +78,4 @@ |
74 | 79 | $personal_urls = array_merge( $addLinks, $personal_urls ); |
75 | 80 | return true; |
76 | 81 | } |
77 | | -} |
\ No newline at end of file |
| 82 | +} |
Index: trunk/extensions/UsabilityInitiative/OptIn/OptIn.js |
— | — | @@ -36,51 +36,44 @@ |
37 | 37 | } |
38 | 38 | // Detect browser and version |
39 | 39 | // BEWARE: this depends on the order of browsers in $wgOptInSurvey |
40 | | - var browserIndex = -1; |
| 40 | + var browserIndex = 'other'; |
41 | 41 | switch ( $.browser.name ) { |
42 | 42 | case 'msie': |
43 | | - browserIndex = $.browser.versionNumber - 5; |
| 43 | + browserIndex = 'ie'+ parseInt( $.browser.versionNumber ); |
44 | 44 | break; |
45 | 45 | case 'firefox': |
46 | | - browserIndex = $.browser.versionNumber + 3; |
| 46 | + browserIndex = 'ff' + parseInt( $.browser.versionNumber ); |
47 | 47 | break; |
48 | 48 | case 'chrome': |
49 | | - browserIndex = $.browser.versionNumber + 7; |
| 49 | + browserIndex = 'c' + parseInt( $.browser.versionNumber ); // FIXME: Chrome Beta? |
50 | 50 | break; |
51 | 51 | case 'safari': |
52 | | - browserIndex = $.browser.versionNumber + 7; |
| 52 | + browserIndex = 's' + parseInt( $.browser.versionNumber ); |
53 | 53 | break; |
54 | 54 | case 'opera': |
55 | 55 | if ( parseInt( $.browser.versionNumber ) == 9 ) { |
56 | 56 | if ( $.browser.version.substr( 0, 3 ) == '9.5' ) |
57 | | - browserIndex = 13; |
| 57 | + browserIndex = 'o9.5'; |
58 | 58 | else |
59 | | - browserIndex = 12; |
| 59 | + browserIndex = 'o9'; |
60 | 60 | } else if ( parseInt( $.browser.versionNumber ) == 10 ) |
61 | | - browserIndex = 14; |
| 61 | + browserIndex = 'o10'; |
62 | 62 | break; |
63 | 63 | } |
64 | 64 | |
65 | | - var osIndex = -1; |
| 65 | + var osIndex = 'other'; |
66 | 66 | switch ( $.os.name ) { |
67 | 67 | case 'win': |
68 | | - osIndex = 0; |
| 68 | + osIndex = 'windows'; |
69 | 69 | break; |
70 | 70 | case 'mac': |
71 | | - osIndex = 1; |
| 71 | + osIndex = 'macos'; |
72 | 72 | break; |
73 | 73 | case 'linux': |
74 | | - osIndex = 2; |
| 74 | + osIndex = 'linux'; |
75 | 75 | break; |
76 | 76 | } |
77 | 77 | |
78 | | - if ( browserIndex == -1 ) |
79 | | - $( '#survey-7' ).val( 'other' ); |
80 | | - else |
81 | | - $( '#survey-7' ).val( parseInt( browserIndex ) ); |
82 | | - if ( osIndex == -1 ) |
83 | | - $( '#survey-8' ).val( 'other' ); |
84 | | - else |
85 | | - $( '#survey-8' ).val( osIndex ); |
86 | | - |
| 78 | + $( '#survey-browser' ).val( browserIndex ); |
| 79 | + $( '#survey-os' ).val( osIndex ); |
87 | 80 | }); |
Index: trunk/extensions/UsabilityInitiative/OptIn/OptIn.sql |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | ois_type varchar(16) NOT NULL, |
15 | 15 | |
16 | 16 | -- Question ID (key in $wgOptInSurvey) |
17 | | - ois_question int unsigned NOT NULL, |
| 17 | + ois_question varchar(16) NOT NULL, |
18 | 18 | |
19 | 19 | -- Answer ID (key in $wgOptInSurvey[ois_question]['answers']) |
20 | 20 | ois_answer text NULL, |
Index: trunk/extensions/UsabilityInitiative/OptIn/patch-ois_question.sql |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +--
|
| 3 | +-- Schema patch for OptIn
|
| 4 | +--
|
| 5 | +
|
| 6 | +ALTER TABLE /*_*/optin_survey modify ois_type varchar(16) NOT NULL; |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/PrefStats/getstats.sql |
— | — | @@ -1,42 +0,0 @@ |
2 | | - |
3 | | - |
4 | | -UPDATE prefstats |
5 | | -SET ps_end = IF(ISNULL( |
6 | | - (SELECT up_user |
7 | | - FROM enwiki_p.user_properties |
8 | | - WHERE up_user=ps_user AND up_property='skin' AND up_value='vector' |
9 | | - )), NOW(), NULL), |
10 | | -ps_duration = TIMESTAMPDIFF(DAY, NOW(), ps_start) |
11 | | -WHERE ps_pref='vector' AND ps_end IS NULL; |
12 | | - |
13 | | -INSERT IGNORE INTO prefstats (ps_user, ps_pref, ps_start, ps_end, ps_duration) |
14 | | -SELECT up_user, up_value, NOW(), NULL, 0 |
15 | | -FROM enwiki_p.user_properties |
16 | | -WHERE up_property='skin' AND up_value='vector'; |
17 | | - |
18 | | - |
19 | | -UPDATE prefstats |
20 | | -SET ps_end = IF(ISNULL( |
21 | | - (SELECT up_user |
22 | | - FROM enwiki_p.user_properties |
23 | | - WHERE up_user=ps_user AND up_property='usebetatoolbar' AND up_value='1' |
24 | | - )), NOW(), NULL), |
25 | | -ps_duration = TIMESTAMPDIFF(DAY, NOW(), ps_start) |
26 | | -WHERE ps_pref='vector' AND ps_end IS NULL; |
27 | | - |
28 | | -INSERT IGNORE INTO prefstats (ps_user, ps_pref, ps_start, ps_end, ps_duration) |
29 | | -SELECT up_user, up_value, NOW(), NULL, 0 |
30 | | -FROM enwiki_p.user_properties |
31 | | -WHERE up_property='usebetatoolbar' AND up_value='1'; |