Index: trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitchLink.i18n.php |
— | — | @@ -14,15 +14,18 @@ |
15 | 15 | * @author Trevor Parscal |
16 | 16 | */ |
17 | 17 | $messages['en'] = array( |
18 | | - 'prefswitch-link' => 'New!', |
19 | | - 'tooltip-pt-prefswitch-link' => 'Try out new features', |
| 18 | + 'prefswitch-link-anon' => 'New features', |
| 19 | + 'tooltip-pt-prefswitch-link-anon' => 'Learn about new features', |
| 20 | + 'prefswitch-link-on' => 'Take me back', |
| 21 | + 'tooltip-pt-prefswitch-link-on' => 'Disable new features', |
| 22 | + 'prefswitch-link-off' => 'New features', |
| 23 | + 'tooltip-pt-prefswitch-link-off' => 'Try out new features', |
20 | 24 | ); |
21 | 25 | |
22 | 26 | /** Message documentation (Message documentation) |
23 | 27 | * @author EugeneZelenko |
24 | 28 | */ |
25 | 29 | $messages['qqq'] = array( |
26 | | - 'prefswitch-link' => '{{Identical|New}}', |
27 | 30 | ); |
28 | 31 | |
29 | 32 | /** Arabic (العربية) |
— | — | @@ -30,8 +33,7 @@ |
31 | 34 | * @author OsamaK |
32 | 35 | */ |
33 | 36 | $messages['ar'] = array( |
34 | | - 'prefswitch-link' => 'جديد!', |
35 | | - 'tooltip-pt-prefswitch-link' => 'جرّب المزايا الجديدة', |
| 37 | + 'tooltip-pt-prefswitch-link-off' => 'جرّب المزايا الجديدة', |
36 | 38 | ); |
37 | 39 | |
38 | 40 | /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
— | — | @@ -39,179 +41,138 @@ |
40 | 42 | * @author Jim-by |
41 | 43 | */ |
42 | 44 | $messages['be-tarask'] = array( |
43 | | - 'prefswitch-link' => 'Новае!', |
44 | | - 'tooltip-pt-prefswitch-link' => 'Паспрабуйце нашыя новыя магчымасьці', |
| 45 | + 'tooltip-pt-prefswitch-link-off' => 'Паспрабуйце нашыя новыя магчымасьці', |
45 | 46 | ); |
46 | 47 | |
47 | 48 | /** Bengali (বাংলা) |
48 | 49 | * @author Bellayet |
49 | 50 | */ |
50 | 51 | $messages['bn'] = array( |
51 | | - 'prefswitch-link' => 'নতুন!', |
52 | | - 'tooltip-pt-prefswitch-link' => 'নতুন বৈশিষ্ট্যগুলো ব্যবহার করুন', |
| 52 | + 'tooltip-pt-prefswitch-link-off' => 'নতুন বৈশিষ্ট্যগুলো ব্যবহার করুন', |
53 | 53 | ); |
54 | 54 | |
55 | 55 | /** Breton (Brezhoneg) |
56 | 56 | * @author Y-M D |
57 | 57 | */ |
58 | 58 | $messages['br'] = array( |
59 | | - 'prefswitch-link' => 'Nevez', |
60 | | - 'tooltip-pt-prefswitch-link' => 'Esaeañ elfennoù nevez', |
| 59 | + 'tooltip-pt-prefswitch-link-off' => 'Esaeañ elfennoù nevez', |
61 | 60 | ); |
62 | 61 | |
63 | 62 | /** Catalan (Català) |
64 | 63 | * @author Paucabot |
65 | 64 | */ |
66 | 65 | $messages['ca'] = array( |
67 | | - 'prefswitch-link' => 'Nou!', |
68 | | - 'tooltip-pt-prefswitch-link' => 'Proveu les noves funcions', |
| 66 | + 'tooltip-pt-prefswitch-link-off' => 'Proveu les noves funcions', |
69 | 67 | ); |
70 | 68 | |
71 | 69 | /** Czech (Česky) |
72 | 70 | * @author Kuvaly |
73 | 71 | */ |
74 | 72 | $messages['cs'] = array( |
75 | | - 'prefswitch-link' => 'Novinky!', |
76 | | - 'tooltip-pt-prefswitch-link' => 'Vyzkoušejte nové funkce', |
| 73 | + 'tooltip-pt-prefswitch-link-off' => 'Vyzkoušejte nové funkce', |
77 | 74 | ); |
78 | 75 | |
79 | 76 | /** German (Deutsch) */ |
80 | 77 | $messages['de'] = array( |
81 | | - 'prefswitch-link' => 'Neu', |
82 | | - 'tooltip-pt-prefswitch-link' => 'Neue Features ausprobieren', |
| 78 | + 'tooltip-pt-prefswitch-link-off' => 'Neue Features ausprobieren', |
83 | 79 | ); |
84 | 80 | |
85 | 81 | /** Lower Sorbian (Dolnoserbski) |
86 | 82 | * @author Michawiki |
87 | 83 | */ |
88 | 84 | $messages['dsb'] = array( |
89 | | - 'prefswitch-link' => 'Nowy!', |
90 | | - 'tooltip-pt-prefswitch-link' => 'Nowe funkcije wopytaś', |
| 85 | + 'tooltip-pt-prefswitch-link-off' => 'Nowe funkcije wopytaś', |
91 | 86 | ); |
92 | 87 | |
93 | 88 | /** Greek (Ελληνικά) |
94 | 89 | * @author Απεργός |
95 | 90 | */ |
96 | 91 | $messages['el'] = array( |
97 | | - 'prefswitch-link' => 'Νέο!', |
98 | | - 'tooltip-pt-prefswitch-link' => 'Δοκιμάστε καινούριες λειτουργίες', |
| 92 | + 'tooltip-pt-prefswitch-link-off' => 'Δοκιμάστε καινούριες λειτουργίες', |
99 | 93 | ); |
100 | 94 | |
101 | 95 | /** Esperanto (Esperanto) |
102 | 96 | * @author Yekrats |
103 | 97 | */ |
104 | 98 | $messages['eo'] = array( |
105 | | - 'prefswitch-link' => 'Nova!', |
106 | | - 'tooltip-pt-prefswitch-link' => 'Provi novajn funkciojn', |
| 99 | + 'tooltip-pt-prefswitch-link-off' => 'Provi novajn funkciojn', |
107 | 100 | ); |
108 | 101 | |
109 | 102 | /** Spanish (Español) |
110 | 103 | * @author Pertile |
111 | 104 | */ |
112 | 105 | $messages['es'] = array( |
113 | | - 'prefswitch-link' => '¡Nuevo!', |
114 | | - 'tooltip-pt-prefswitch-link' => 'Probar las nuevas características', |
| 106 | + 'tooltip-pt-prefswitch-link-off' => 'Probar las nuevas características', |
115 | 107 | ); |
116 | 108 | |
117 | | -/** Estonian (Eesti) |
118 | | - * @author Hendrik |
119 | | - */ |
120 | | -$messages['et'] = array( |
121 | | - 'prefswitch-link' => 'Uus!', |
122 | | -); |
123 | | - |
124 | | -/** Basque (Euskara) |
125 | | - * @author Joxemai |
126 | | - */ |
127 | | -$messages['eu'] = array( |
128 | | - 'prefswitch-link' => 'Berria!', |
129 | | -); |
130 | | - |
131 | 109 | /** Finnish (Suomi) |
132 | 110 | * @author Crt |
133 | 111 | */ |
134 | 112 | $messages['fi'] = array( |
135 | | - 'prefswitch-link' => 'Uutta!', |
136 | | - 'tooltip-pt-prefswitch-link' => 'Kokeile uusia ominaisuuksia', |
| 113 | + 'tooltip-pt-prefswitch-link-off' => 'Kokeile uusia ominaisuuksia', |
137 | 114 | ); |
138 | 115 | |
139 | 116 | /** French (Français) |
140 | 117 | * @author IAlex |
141 | 118 | */ |
142 | 119 | $messages['fr'] = array( |
143 | | - 'prefswitch-link' => 'Nouveau !', |
144 | | - 'tooltip-pt-prefswitch-link' => 'Essayer les nouvelles fonctionnalités', |
| 120 | + 'tooltip-pt-prefswitch-link-off' => 'Essayer les nouvelles fonctionnalités', |
145 | 121 | ); |
146 | 122 | |
147 | 123 | /** Galician (Galego) |
148 | 124 | * @author Toliño |
149 | 125 | */ |
150 | 126 | $messages['gl'] = array( |
151 | | - 'prefswitch-link' => 'Novo!', |
152 | | - 'tooltip-pt-prefswitch-link' => 'Probar as novas características', |
| 127 | + 'tooltip-pt-prefswitch-link-off' => 'Probar as novas características', |
153 | 128 | ); |
154 | 129 | |
155 | 130 | /** Swiss German (Alemannisch) |
156 | 131 | * @author Als-Holder |
157 | 132 | */ |
158 | 133 | $messages['gsw'] = array( |
159 | | - 'prefswitch-link' => 'Nej!', |
160 | | - 'tooltip-pt-prefswitch-link' => 'Di neje Funktione uusprobiere', |
| 134 | + 'tooltip-pt-prefswitch-link-off' => 'Di neje Funktione uusprobiere', |
161 | 135 | ); |
162 | 136 | |
163 | 137 | /** Hebrew (עברית) |
164 | 138 | * @author Amire80 |
165 | 139 | */ |
166 | 140 | $messages['he'] = array( |
167 | | - 'prefswitch-link' => 'חדש!', |
168 | | - 'tooltip-pt-prefswitch-link' => 'לנסות תכונות חדשות', |
| 141 | + 'tooltip-pt-prefswitch-link-off' => 'לנסות תכונות חדשות', |
169 | 142 | ); |
170 | 143 | |
171 | | -/** Croatian (Hrvatski) |
172 | | - * @author Ex13 |
173 | | - */ |
174 | | -$messages['hr'] = array( |
175 | | - 'prefswitch-link' => 'Novo!', |
176 | | -); |
177 | | - |
178 | 144 | /** Upper Sorbian (Hornjoserbsce) |
179 | 145 | * @author Michawiki |
180 | 146 | */ |
181 | 147 | $messages['hsb'] = array( |
182 | | - 'prefswitch-link' => 'Nowy!', |
183 | | - 'tooltip-pt-prefswitch-link' => 'Nowe funkcije wupruwować', |
| 148 | + 'tooltip-pt-prefswitch-link-off' => 'Nowe funkcije wupruwować', |
184 | 149 | ); |
185 | 150 | |
186 | 151 | /** Hungarian (Magyar) |
187 | 152 | * @author Glanthor Reviol |
188 | 153 | */ |
189 | 154 | $messages['hu'] = array( |
190 | | - 'prefswitch-link' => 'Újdonság!', |
191 | | - 'tooltip-pt-prefswitch-link' => 'Próbáld ki az új funkciókat', |
| 155 | + 'tooltip-pt-prefswitch-link-off' => 'Próbáld ki az új funkciókat', |
192 | 156 | ); |
193 | 157 | |
194 | 158 | /** Interlingua (Interlingua) |
195 | 159 | * @author McDutchie |
196 | 160 | */ |
197 | 161 | $messages['ia'] = array( |
198 | | - 'prefswitch-link' => 'Nove!', |
199 | | - 'tooltip-pt-prefswitch-link' => 'Probar nove functiones', |
| 162 | + 'tooltip-pt-prefswitch-link-off' => 'Probar nove functiones', |
200 | 163 | ); |
201 | 164 | |
202 | 165 | /** Indonesian (Bahasa Indonesia) |
203 | 166 | * @author Kenrick95 |
204 | 167 | */ |
205 | 168 | $messages['id'] = array( |
206 | | - 'prefswitch-link' => 'Baru!', |
207 | | - 'tooltip-pt-prefswitch-link' => 'Coba fitur baru', |
| 169 | + 'tooltip-pt-prefswitch-link-off' => 'Coba fitur baru', |
208 | 170 | ); |
209 | 171 | |
210 | 172 | /** Italian (Italiano) |
211 | 173 | * @author Una giornata uggiosa '94 |
212 | 174 | */ |
213 | 175 | $messages['it'] = array( |
214 | | - 'prefswitch-link' => 'Nuovo!', |
215 | | - 'tooltip-pt-prefswitch-link' => 'Prova le nuove funzioni', |
| 176 | + 'tooltip-pt-prefswitch-link-off' => 'Prova le nuove funzioni', |
216 | 177 | ); |
217 | 178 | |
218 | 179 | /** Japanese (日本語) |
— | — | @@ -220,142 +181,124 @@ |
221 | 182 | * @author 青子守歌 |
222 | 183 | */ |
223 | 184 | $messages['ja'] = array( |
224 | | - 'prefswitch-link' => '新機能!', |
225 | | - 'tooltip-pt-prefswitch-link' => '新機能を試す', |
| 185 | + 'tooltip-pt-prefswitch-link-off' => '新機能を試す', |
226 | 186 | ); |
227 | 187 | |
228 | 188 | /** Georgian (ქართული) |
229 | 189 | * @author გიორგიმელა |
230 | 190 | */ |
231 | 191 | $messages['ka'] = array( |
232 | | - 'prefswitch-link' => 'ახალი', |
233 | | - 'tooltip-pt-prefswitch-link' => 'სცადეთ ახალი ხელსაწყოები', |
| 192 | + 'tooltip-pt-prefswitch-link-off' => 'სცადეთ ახალი ხელსაწყოები', |
234 | 193 | ); |
235 | 194 | |
236 | 195 | /** Korean (한국어) |
237 | 196 | * @author Devunt |
238 | 197 | */ |
239 | 198 | $messages['ko'] = array( |
240 | | - 'prefswitch-link' => '새 기능!', |
241 | | - 'tooltip-pt-prefswitch-link' => '새 기능 체험하기', |
| 199 | + 'tooltip-pt-prefswitch-link-off' => '새 기능 체험하기', |
242 | 200 | ); |
243 | 201 | |
244 | 202 | /** Luxembourgish (Lëtzebuergesch) |
245 | 203 | * @author Robby |
246 | 204 | */ |
247 | 205 | $messages['lb'] = array( |
248 | | - 'prefswitch-link' => 'Nei!', |
249 | | - 'tooltip-pt-prefswitch-link' => 'Probéiert déi nei Fonctionalitéiten aus', |
| 206 | + 'tooltip-pt-prefswitch-link-off' => 'Probéiert déi nei Fonctionalitéiten aus', |
250 | 207 | ); |
251 | 208 | |
252 | 209 | /** Latvian (Latviešu) |
253 | 210 | * @author Papuass |
254 | 211 | */ |
255 | 212 | $messages['lv'] = array( |
256 | | - 'prefswitch-link' => 'Kas jauns?', |
257 | 213 | ); |
258 | 214 | |
259 | 215 | /** Macedonian (Македонски) |
260 | 216 | * @author Bjankuloski06 |
261 | 217 | */ |
262 | 218 | $messages['mk'] = array( |
263 | | - 'prefswitch-link' => 'Ново!', |
264 | | - 'tooltip-pt-prefswitch-link' => 'Испробајте нови функции', |
| 219 | + 'tooltip-pt-prefswitch-link-off' => 'Испробајте нови функции', |
265 | 220 | ); |
266 | 221 | |
267 | 222 | /** Malayalam (മലയാളം) |
268 | 223 | * @author Praveenp |
269 | 224 | */ |
270 | 225 | $messages['ml'] = array( |
271 | | - 'prefswitch-link' => 'നൂതനം!', |
272 | | - 'tooltip-pt-prefswitch-link' => 'പുതിയ സവിശേഷതകൾ പരീക്ഷിക്കുക', |
| 226 | + 'tooltip-pt-prefswitch-link-off' => 'പുതിയ സവിശേഷതകൾ പരീക്ഷിക്കുക', |
273 | 227 | ); |
274 | 228 | |
275 | 229 | /** Dutch (Nederlands) |
276 | 230 | * @author Siebrand |
277 | 231 | */ |
278 | 232 | $messages['nl'] = array( |
279 | | - 'prefswitch-link' => 'Nieuw!', |
280 | | - 'tooltip-pt-prefswitch-link' => 'Nieuwe mogelijkheden uitproberen', |
| 233 | + 'tooltip-pt-prefswitch-link-off' => 'Nieuwe mogelijkheden uitproberen', |
281 | 234 | ); |
282 | 235 | |
283 | 236 | /** Norwegian (bokmål) (Norsk (bokmål)) |
284 | 237 | * @author Nghtwlkr |
285 | 238 | */ |
286 | 239 | $messages['no'] = array( |
287 | | - 'prefswitch-link' => 'Ny', |
288 | | - 'tooltip-pt-prefswitch-link' => 'Prøv nye funksjoner', |
| 240 | + 'tooltip-pt-prefswitch-link-off' => 'Prøv nye funksjoner', |
289 | 241 | ); |
290 | 242 | |
291 | 243 | /** Occitan (Occitan) |
292 | 244 | * @author Cedric31 |
293 | 245 | */ |
294 | 246 | $messages['oc'] = array( |
295 | | - 'prefswitch-link' => 'Novèl !', |
296 | | - 'tooltip-pt-prefswitch-link' => 'Ensajatz las foncionalitats novèlas', |
| 247 | + 'tooltip-pt-prefswitch-link-off' => 'Ensajatz las foncionalitats novèlas', |
297 | 248 | ); |
298 | 249 | |
299 | 250 | /** Polish (Polski) |
300 | 251 | * @author Sp5uhe |
301 | 252 | */ |
302 | 253 | $messages['pl'] = array( |
303 | | - 'prefswitch-link' => 'Nowy wygląd!', |
304 | | - 'tooltip-pt-prefswitch-link' => 'Wypróbuj nowe funkcjonalności', |
| 254 | + 'tooltip-pt-prefswitch-link-off' => 'Wypróbuj nowe funkcjonalności', |
305 | 255 | ); |
306 | 256 | |
307 | 257 | /** Piedmontese (Piemontèis) |
308 | 258 | * @author Dragonòt |
309 | 259 | */ |
310 | 260 | $messages['pms'] = array( |
311 | | - 'prefswitch-link' => 'Neuv!', |
312 | | - 'tooltip-pt-prefswitch-link' => 'Preuva le neuve funsionalità', |
| 261 | + 'tooltip-pt-prefswitch-link-off' => 'Preuva le neuve funsionalità', |
313 | 262 | ); |
314 | 263 | |
315 | 264 | /** Portuguese (Português) |
316 | 265 | * @author Hamilton Abreu |
317 | 266 | */ |
318 | 267 | $messages['pt'] = array( |
319 | | - 'prefswitch-link' => 'Novo!', |
320 | | - 'tooltip-pt-prefswitch-link' => 'Experimente novas funcionalidades', |
| 268 | + 'tooltip-pt-prefswitch-link-off' => 'Experimente novas funcionalidades', |
321 | 269 | ); |
322 | 270 | |
323 | 271 | /** Russian (Русский) |
324 | 272 | * @author Александр Сигачёв |
325 | 273 | */ |
326 | 274 | $messages['ru'] = array( |
327 | | - 'prefswitch-link' => 'Новинка!', |
328 | | - 'tooltip-pt-prefswitch-link' => 'Опробуйте новые возможности', |
| 275 | + 'tooltip-pt-prefswitch-link-off' => 'Опробуйте новые возможности', |
329 | 276 | ); |
330 | 277 | |
331 | 278 | /** Slovenian (Slovenščina) |
332 | 279 | * @author Dbc334 |
333 | 280 | */ |
334 | 281 | $messages['sl'] = array( |
335 | | - 'prefswitch-link' => 'Novo!', |
336 | | - 'tooltip-pt-prefswitch-link' => 'Preizkusite nove funkcije', |
| 282 | + 'tooltip-pt-prefswitch-link-off' => 'Preizkusite nove funkcije', |
337 | 283 | ); |
338 | 284 | |
339 | 285 | /** Telugu (తెలుగు) |
340 | 286 | * @author Veeven |
341 | 287 | */ |
342 | 288 | $messages['te'] = array( |
343 | | - 'prefswitch-link' => 'కొత్తది!', |
344 | | - 'tooltip-pt-prefswitch-link' => 'కొత్త సౌలభ్యాలను ప్రయత్నించండి', |
| 289 | + 'tooltip-pt-prefswitch-link-off' => 'కొత్త సౌలభ్యాలను ప్రయత్నించండి', |
345 | 290 | ); |
346 | 291 | |
347 | 292 | /** Turkish (Türkçe) |
348 | 293 | * @author Joseph |
349 | 294 | */ |
350 | 295 | $messages['tr'] = array( |
351 | | - 'prefswitch-link' => 'Yeni!', |
352 | | - 'tooltip-pt-prefswitch-link' => 'Yeni özellikleri dene', |
| 296 | + 'tooltip-pt-prefswitch-link-off' => 'Yeni özellikleri dene', |
353 | 297 | ); |
354 | 298 | |
355 | 299 | /** Vietnamese (Tiếng Việt) |
356 | 300 | * @author Minh Nguyen |
357 | 301 | */ |
358 | 302 | $messages['vi'] = array( |
359 | | - 'prefswitch-link' => 'Mới!', |
360 | | - 'tooltip-pt-prefswitch-link' => 'Hãy thử các tính năng mới', |
| 303 | + 'tooltip-pt-prefswitch-link-off' => 'Hãy thử các tính năng mới', |
361 | 304 | ); |
362 | 305 | |
Index: trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.i18n.php |
— | — | @@ -79,6 +79,8 @@ |
80 | 80 | * Link wizard: An easy-to-use tool allows you to add links to other wiki pages as well as links to external sites. |
81 | 81 | * Search improvements: We have improved search suggestions to get you to the page you are looking for more quickly. |
82 | 82 | * Other new features: We have also introduced a table wizard to make creating tables easier and find and a replace feature to simplify page editing.", |
| 83 | + 'prefswitch-main-anon' => "===Take Me Back=== |
| 84 | +If you would like to turn off the new features, <span class=\"plainlinks\">[$1 click here]</span>. You will be asked to login or create an account first.", |
83 | 85 | 'prefswitch-main-on' => "===Feedback?=== |
84 | 86 | We would love to hear from you. Please visit our <span class=\"plainlinks\">[$1 feedback page]</span>. |
85 | 87 | ===Take me back!=== |
Index: trunk/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php |
— | — | @@ -46,6 +46,15 @@ |
47 | 47 | } |
48 | 48 | return false; |
49 | 49 | } |
| 50 | + /* |
| 51 | + * Returns a string representing the current state of a given user. There are 3 modes the system can be in, 'anon', |
| 52 | + * 'on' or 'off'. If the user is not logged in, the mode is always 'anon'. If the user is logged in, the mode will |
| 53 | + * be 'on' if SpecialPrefSwitch::isSwitchedOn() returns true, and 'off' otherwise. |
| 54 | + * @param $user User object to check switched state for |
| 55 | + */ |
| 56 | + public static function userState( $user ) { |
| 57 | + return $user->isAnon() ? 'anon' : ( self::isSwitchedOn( $user ) ? 'on' : 'off' ); |
| 58 | + } |
50 | 59 | /** |
51 | 60 | * Switches a user's prefernces on |
52 | 61 | * @param $user User object to set preferences for |
— | — | @@ -225,28 +234,32 @@ |
226 | 235 | $wgOut->addWikiMsg( |
227 | 236 | 'prefswitch-main', array( 'parse' ) |
228 | 237 | ); |
229 | | - if ( $wgUser->isLoggedIn() ) { |
230 | | - if ( self::isSwitchedOn( $wgUser ) ) { |
231 | | - $wgOut->addWikiMsgArray( |
232 | | - 'prefswitch-main-on', |
233 | | - array( |
234 | | - $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'feedback' ) ) ), |
235 | | - $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'off' ) ) ) |
236 | | - ), |
237 | | - array( 'parse' ) |
238 | | - ); |
239 | | - } else { |
240 | | - $wgOut->addWikiMsgArray( |
241 | | - 'prefswitch-main-off', |
242 | | - array( |
243 | | - $this->getTitle()->getFullURL( |
244 | | - array_merge( $query, array( 'mode' => 'on', 'token' => $wgUser->editToken() ) ) |
| 238 | + $state = self::userState( $wgUser ); |
| 239 | + switch ( $state ) { |
| 240 | + case 'anon': |
| 241 | + $parameters = array( |
| 242 | + SpecialPage::getTitleFor( 'Userlogin' )->getFullURL( |
| 243 | + array( 'returnto' => $this->getTitle()->getPrefixedText(), |
| 244 | + 'returntoquery' => wfArrayToCGI( array_merge( $query, array( 'mode' => 'off' ) ) ) |
245 | 245 | ) |
246 | | - ), |
247 | | - array( 'parse' ) |
| 246 | + ) |
248 | 247 | ); |
249 | | - } |
| 248 | + break; |
| 249 | + case 'on': |
| 250 | + $parameters = array( |
| 251 | + $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'feedback' ) ) ), |
| 252 | + $this->getTitle()->getFullURL( array_merge( $query, array( 'mode' => 'off' ) ) ) |
| 253 | + ); |
| 254 | + break; |
| 255 | + case 'off': |
| 256 | + $parameters = array( |
| 257 | + $this->getTitle()->getFullURL( |
| 258 | + array_merge( $query, array( 'mode' => 'on', 'token' => $wgUser->editToken() ) ) |
| 259 | + ) |
| 260 | + ); |
| 261 | + break; |
250 | 262 | } |
| 263 | + $wgOut->addWikiMsgArray( 'prefswitch-main-' . $state, $parameters, array( 'parse' ) ); |
251 | 264 | } |
252 | 265 | } |
253 | 266 | } |
Index: trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.hooks.php |
— | — | @@ -31,17 +31,18 @@ |
32 | 32 | } else { |
33 | 33 | $query = array( 'from' => $title->getPrefixedDBKey(), 'fromquery' => wfArrayToCGI( $fromquery ) ); |
34 | 34 | } |
| 35 | + $state = SpecialPrefSwitch::userState( $wgUser ); |
35 | 36 | // Inserts a link into personal tools |
36 | 37 | $personal_urls = array_merge( |
37 | 38 | array( |
38 | | - 'prefswitch-link' => array( |
39 | | - 'text' => wfMsg( 'prefswitch-link' ), |
| 39 | + "prefswitch-link-{$state}" => array( |
| 40 | + 'text' => wfMsg( 'prefswitch-link-' . $state ), |
40 | 41 | 'href' => SpecialPage::getTitleFor( 'PrefSwitch' )->getFullURL( $query ), |
41 | 42 | 'class' => 'no-text-transform', |
42 | 43 | ), |
43 | 44 | ), |
44 | 45 | $personal_urls |
45 | | - ); |
| 46 | + ); |
46 | 47 | return true; |
47 | 48 | } |
48 | 49 | } |