Index: trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.classes.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | __METHOD__ |
31 | 31 | ); |
32 | 32 | foreach( $res as $row ) { |
33 | | - $loaded[$row->pss_field] = array( $row->pss_answer, $row->pss_answer_data ); |
| 33 | + $loaded[$row->pss_question] = array( $row->pss_answer, $row->pss_answer_data ); |
34 | 34 | } |
35 | 35 | } |
36 | 36 | $html = Xml::openElement( 'dl' ); |
— | — | @@ -45,11 +45,11 @@ |
46 | 46 | $html .= Xml::closeElement( 'dl' ); |
47 | 47 | return $html; |
48 | 48 | } |
49 | | - public static function save( $survey, $name ) { |
| 49 | + public static function save( $name, $survey ) { |
50 | 50 | global $wgRequest, $wgUser; |
51 | 51 | $dbw = wfGetDb( DB_MASTER ); |
52 | 52 | $now = $dbw->timestamp( wfTimestamp() ); |
53 | | - foreach ( $survey as $question => $config ) { |
| 53 | + foreach ( $survey['questions'] as $question => $config ) { |
54 | 54 | if ( in_array( 'PrefSwitchSurveyField', class_implements( self::$fieldTypes[$config['type']] ) ) ) { |
55 | 55 | $dbw->insert( |
56 | 56 | 'prefswitch_survey', |
Index: trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.i18n.php |
— | — | @@ -56,6 +56,8 @@ |
57 | 57 | 'prefswitch-survey-answer-os-linux' => 'Linux', |
58 | 58 | 'prefswitch-survey-answer-os-other' => 'Other operating system:', |
59 | 59 | 'prefswitch-survey-question-res' => 'What is the resolution of your screen?', |
| 60 | + 'prefswitch-return' => '<hr> |
| 61 | +Return to <span class="plainlinks">[$1 $2]</span>.', |
60 | 62 | 'prefswitch-main' => 'We\'ve been working hard to make things easier for our users. We\'re excited to share some improvements, including a new look and feel and simplified editing features. Improving the usability of the site is an ongoing effort here at Wikimedia and we\'ll be sharing more updates in the future. |
61 | 63 | |
62 | 64 | Here\'s what we\'ve recently launched: |
— | — | @@ -63,14 +65,15 @@ |
64 | 66 | * Editing toolbar improvements: We\'ve reorganized the editing toolbar to make easier to use. Now, formatting articles is simpler and more intuitive. |
65 | 67 | * Link wizard: An easy-to-use tool allows you to add links to other Wikipedia articles as well as links to external sites. |
66 | 68 | * Search improvements: We\'ve improved search suggestions to get you to the article you\'re looking for more quickly. |
67 | | -* Other new features: We\'ve also introduced a table wizard to make creating tables easier and find and a replace feature to simplify article editing. |
68 | | - |
69 | | -Return to [$1 $2].', |
| 69 | +* Other new features: We\'ve also introduced a table wizard to make creating tables easier and find and a replace feature to simplify article editing.', |
70 | 70 | 'prefswitch-main-on' => ' |
71 | 71 | ;Feedback? |
72 | | -We\'ve love to hear from you. Please visit our [$1 feedback page]. |
| 72 | +We\'ve love to hear from you. Please visit our <span class="plainlinks">[$1 feedback page]</span>. |
73 | 73 | ;Take me back! |
74 | | -If you would like to turn off the new features, please [$2 click here].', |
| 74 | +If you would like to turn off the new features, please <span class="plainlinks">[$2 click here]</span>.', |
| 75 | + 'prefswitch-main-off' => ' |
| 76 | +;Try them out! |
| 77 | +If you would like to turn on the new features, please <span class="plainlinks">[$1 click here]</span>.', |
75 | 78 | 'prefswitch-survey-intro-feedback' => 'We\'d love to hear from you. Please fill out the optional survey below.', |
76 | 79 | 'prefswitch-survey-intro-off' => 'Thanks for trying out our new features. To help us improve them, please fill out the optional survey below ', |
77 | 80 | ); |
Index: trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.php |
— | — | @@ -32,9 +32,9 @@ |
33 | 33 | 'usebetatoolbar-cgd'=> 0, |
34 | 34 | ), |
35 | 35 | 'on' => array( |
36 | | - 'skin' => null, |
37 | | - 'usebetatoolbar' => null, |
38 | | - 'usebetatoolbar-cgd' => null, |
| 36 | + 'skin' => 'vector', |
| 37 | + 'usebetatoolbar' => 1, |
| 38 | + 'usebetatoolbar-cgd' => 1, |
39 | 39 | ), |
40 | 40 | ); |
41 | 41 | |
Index: trunk/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php |
— | — | @@ -14,7 +14,8 @@ |
15 | 15 | private $originTitle = null; |
16 | 16 | private $originQuery = ''; |
17 | 17 | private $originLink = ''; |
18 | | - private $originUrl = ''; |
| 18 | + private $originLinkUrl = ''; |
| 19 | + private $originFullUrl = ''; |
19 | 20 | |
20 | 21 | /* Static Functions */ |
21 | 22 | |
— | — | @@ -39,7 +40,7 @@ |
40 | 41 | } |
41 | 42 | // Swtiched on means any of the preferences in the set are turned on |
42 | 43 | foreach ( $wgPrefSwitchPrefs['on'] as $pref => $value ) { |
43 | | - if ( $pref != 'skin' && $user->getOption( $pref ) == $value ) { |
| 44 | + if ( $user->getOption( $pref ) == $value ) { |
44 | 45 | return true; |
45 | 46 | } |
46 | 47 | } |
— | — | @@ -75,7 +76,7 @@ |
76 | 77 | wfLoadExtensionMessages( 'PrefSwitch' ); |
77 | 78 | } |
78 | 79 | public function execute( $par ) { |
79 | | - global $wgRequest, $wgOut, $wgUser, $wgPrefSwitchSurvey, $wgPrefSwitchStyleVersion; |
| 80 | + global $wgRequest, $wgOut, $wgUser, $wgPrefSwitchSurveys, $wgPrefSwitchStyleVersion; |
80 | 81 | // Get the origin from the request |
81 | 82 | $par = $wgRequest->getVal( 'from', $par ); |
82 | 83 | $this->originTitle = Title::newFromText( $par ); |
— | — | @@ -92,7 +93,8 @@ |
93 | 94 | $this->origin = $this->originTitle->getPrefixedDBKey(); |
94 | 95 | $this->originQuery = $wgRequest->getVal( 'fromquery' ); |
95 | 96 | $this->originLink = $wgUser->getSkin()->link( $this->originTitle, null, array(), $this->originQuery ); |
96 | | - $this->originUrl = $this->originTitle->getLinkUrl( $this->originQuery ); |
| 97 | + $this->originLinkUrl = $this->originTitle->getLinkUrl( $this->originQuery ); |
| 98 | + $this->originFullUrl = $this->originTitle->getFullUrl( $this->originQuery ); |
97 | 99 | } |
98 | 100 | // Begin output |
99 | 101 | $this->setHeaders(); |
— | — | @@ -149,9 +151,9 @@ |
150 | 152 | // Switch off |
151 | 153 | if ( self::checkToken() && self::isSwitchedOn( $wgUser ) && $wgRequest->wasPosted() ) { |
152 | 154 | self::switchOff( $wgUser ); |
153 | | - PrefSwitchSurvey::save( 'feedback', $wgPrefSwitchSurveys['feedback'] ); |
| 155 | + PrefSwitchSurvey::save( 'off', $wgPrefSwitchSurveys['feedback'] ); |
154 | 156 | $wgOut->addWikiMsg( 'prefswitch-success-off' ); |
155 | | - } else if ( self::isSwitchedOn( $wgUser ) ) { |
| 157 | + } else if ( !self::isSwitchedOn( $wgUser ) ) { |
156 | 158 | // User is already switched off then reloaded the page or tried to switch off again |
157 | 159 | $wgOut->addWikiMsg( 'prefswitch-success-off' ); |
158 | 160 | } else { |
— | — | @@ -173,6 +175,9 @@ |
174 | 176 | } else { |
175 | 177 | $this->render( 'main' ); |
176 | 178 | } |
| 179 | + $wgOut->addWikiMsgArray( |
| 180 | + 'prefswitch-return', array( $this->originFullUrl, $this->originTitle ), array( 'parse' ) |
| 181 | + ); |
177 | 182 | } |
178 | 183 | |
179 | 184 | /* Private Functions */ |
— | — | @@ -212,18 +217,28 @@ |
213 | 218 | $html .= Xml::closeElement( 'form' ); |
214 | 219 | $wgOut->addHtml( $html ); |
215 | 220 | } else { |
216 | | - $wgOut->addWikiMsgArray( |
217 | | - 'prefswitch-main', array( $this->originUrl, $this->originTitle ), array( 'parse' ) |
| 221 | + $wgOut->addWikiMsg( |
| 222 | + 'prefswitch-main', array( 'parse' ) |
218 | 223 | ); |
219 | 224 | if ( self::isSwitchedOn( $wgUser ) ) { |
220 | 225 | $wgOut->addWikiMsgArray( |
221 | 226 | 'prefswitch-main-on', |
222 | 227 | array( |
223 | | - $this->getTitle()->getLinkURL( array_merge( $query, array( 'mode' => 'off' ) ) ), |
224 | | - $this->getTitle()->getLinkURL( array_merge( $query, array( 'mode' => 'feedback' ) ) ) |
| 228 | + $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'feedback' ) ) ), |
| 229 | + $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'off' ) ) ) |
225 | 230 | ), |
226 | 231 | array( 'parse' ) |
227 | 232 | ); |
| 233 | + } else { |
| 234 | + $wgOut->addWikiMsgArray( |
| 235 | + 'prefswitch-main-off', |
| 236 | + array( |
| 237 | + $this->getTitle()->getFullURL( |
| 238 | + array_merge( $query, array( 'mode' => 'on', 'token' => $wgUser->editToken() ) ) |
| 239 | + ) |
| 240 | + ), |
| 241 | + array( 'parse' ) |
| 242 | + ); |
228 | 243 | } |
229 | 244 | } |
230 | 245 | } |
Index: trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.sql |
— | — | @@ -22,4 +22,4 @@ |
23 | 23 | pss_answer_data text NULL |
24 | 24 | ) /*$wgDBTableOptions*/; |
25 | 25 | |
26 | | -CREATE UNIQUE INDEX /*i*/pss_user_timestamp_question ON /*_*/prefswitch_survey (pss_user, pss_timestamp, pss_question); |
| 26 | +CREATE UNIQUE INDEX /*i*/pss_user_timestamp_question ON /*_*/prefswitch_survey (pss_user, pss_timestamp, pss_question, pss_name); |