Index: branches/preferences-work/phase3/skins/common/prefs.js |
— | — | @@ -160,5 +160,5 @@ |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | | -hookEvent("load", unhidetzbutton); |
| 164 | +//hookEvent("load", unhidetzbutton); |
165 | 165 | hookEvent("load", tabbedprefs); |
Index: branches/preferences-work/phase3/includes/HTMLForm.php |
— | — | @@ -144,8 +144,13 @@ |
145 | 145 | $html .= Xml::hidden( 'wpEditToken', $wgUser->editToken() ); |
146 | 146 | $html .= Xml::hidden( 'title', $this->getTitle() ); |
147 | 147 | |
148 | | - $html .= Xml::submitButton( $this->getSubmitText() ); |
| 148 | + $attribs = array(); |
149 | 149 | |
| 150 | + if ( isset($this->mSubmitID) ) |
| 151 | + $attribs['id'] = $this->mSubmitID; |
| 152 | + |
| 153 | + $html .= Xml::submitButton( $this->getSubmitText(), $attribs ); |
| 154 | + |
150 | 155 | $html = Xml::tags( 'form', |
151 | 156 | array( |
152 | 157 | 'action' => $this->getTitle()->getFullURL(), |
— | — | @@ -197,6 +202,10 @@ |
198 | 203 | return $this->mSubmitText; |
199 | 204 | } |
200 | 205 | |
| 206 | + function setSubmitID( $t ) { |
| 207 | + $this->mSubmitID = $t; |
| 208 | + } |
| 209 | + |
201 | 210 | function setMessagePrefix( $p ) { |
202 | 211 | $this->mMessagePrefix = $p; |
203 | 212 | } |
Index: branches/preferences-work/phase3/includes/specials/SpecialPreferences.php |
— | — | @@ -24,12 +24,13 @@ |
25 | 25 | |
26 | 26 | $formDescriptor = Preferences::getPreferences( $wgUser ); |
27 | 27 | |
28 | | - $htmlForm = new HTMLForm( $formDescriptor, 'prefs' ); |
| 28 | + $htmlForm = new PreferencesForm( $formDescriptor, 'prefs' ); |
29 | 29 | |
30 | 30 | $htmlForm->setSubmitText( wfMsg('saveprefs') ); |
31 | 31 | $htmlForm->setTitle( $this->getTitle() ); |
| 32 | + $htmlForm->setSubmitID( 'prefsubmit' ); |
32 | 33 | $htmlForm->setSubmitCallback( array( 'SpecialPreferences', 'trySubmit' ) ); |
33 | | - |
| 34 | + |
34 | 35 | $htmlForm->show(); |
35 | 36 | } |
36 | 37 | |
— | — | @@ -93,3 +94,40 @@ |
94 | 95 | return true; |
95 | 96 | } |
96 | 97 | } |
| 98 | + |
| 99 | +/** Some tweaks to allow js prefs to work */ |
| 100 | +class PreferencesForm extends HTMLForm { |
| 101 | + |
| 102 | + function displayForm( $submitResult ) { |
| 103 | + global $wgUser, $wgOut; |
| 104 | + |
| 105 | + if ( $submitResult !== false ) { |
| 106 | + $this->displayErrors( $submitResult ); |
| 107 | + } |
| 108 | + |
| 109 | + $html = $this->displaySection( $this->mFieldTree ); |
| 110 | + |
| 111 | + // Hidden fields |
| 112 | + $html .= Xml::hidden( 'wpEditToken', $wgUser->editToken() ); |
| 113 | + $html .= Xml::hidden( 'title', $this->getTitle() ); |
| 114 | + |
| 115 | + $attribs = array(); |
| 116 | + |
| 117 | + if ( isset($this->mSubmitID) ) |
| 118 | + $attribs['id'] = $this->mSubmitID; |
| 119 | + |
| 120 | + $html .= Xml::submitButton( $this->getSubmitText(), $attribs ); |
| 121 | + |
| 122 | + $html = Xml::tags( 'div', array( 'id' => 'preferences' ), $html ); |
| 123 | + |
| 124 | + $html = Xml::tags( 'form', |
| 125 | + array( |
| 126 | + 'action' => $this->getTitle()->getFullURL(), |
| 127 | + 'method' => 'post', |
| 128 | + ), |
| 129 | + $html ); |
| 130 | + |
| 131 | + $wgOut->addHTML( $html ); |
| 132 | + } |
| 133 | + |
| 134 | +} |
Index: branches/preferences-work/phase3/includes/Preferences.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | 'type' => 'info', |
20 | 20 | 'label-message' => 'username', |
21 | 21 | 'default' => $user->getName(), |
22 | | - 'section' => 'user', |
| 22 | + 'section' => 'personal', |
23 | 23 | ); |
24 | 24 | |
25 | 25 | $defaultPreferences['userid'] = |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | 'type' => 'info', |
28 | 28 | 'label-message' => 'uid', |
29 | 29 | 'default' => $user->getId(), |
30 | | - 'section' => 'user', |
| 30 | + 'section' => 'personal', |
31 | 31 | ); |
32 | 32 | |
33 | 33 | # Get groups to which the user belongs |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | count($userEffectiveGroupsArray) ), |
50 | 50 | 'default' => $wgLang->commaList( $userEffectiveGroupsArray ), |
51 | 51 | 'raw' => true, |
52 | | - 'section' => 'user', |
| 52 | + 'section' => 'personal', |
53 | 53 | ); |
54 | 54 | |
55 | 55 | $defaultPreferences['editcount'] = |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | 'type' => 'info', |
58 | 58 | 'label-message' => 'prefs-edits', |
59 | 59 | 'default' => $user->getEditCount(), |
60 | | - 'section' => 'user', |
| 60 | + 'section' => 'personal', |
61 | 61 | ); |
62 | 62 | |
63 | 63 | if ($user->getRegistration()) { |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | 'type' => 'info', |
67 | 67 | 'label-message' => 'prefs-registration', |
68 | 68 | 'default' => $wgLang->timeanddate( $user->getRegistration() ), |
69 | | - 'section' => 'user', |
| 69 | + 'section' => 'personal', |
70 | 70 | ); |
71 | 71 | } |
72 | 72 | |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | array( |
78 | 78 | 'type' => 'text', |
79 | 79 | 'default' => $user->getRealName(), |
80 | | - 'section' => 'user', |
| 80 | + 'section' => 'personal', |
81 | 81 | 'label-message' => 'yourrealname', |
82 | 82 | 'help-message' => 'prefs-help-realname', |
83 | 83 | ); |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | array( |
90 | 90 | 'type' => 'text', |
91 | 91 | 'default' => $user->getEmail(), |
92 | | - 'section' => 'user', |
| 92 | + 'section' => 'personal', |
93 | 93 | 'label-message' => 'youremail', |
94 | 94 | 'help-message' => $wgEmailConfirmToEdit |
95 | 95 | ? 'prefs-help-email-required' |
— | — | @@ -109,14 +109,14 @@ |
110 | 110 | 'raw' => true, |
111 | 111 | 'default' => $link, |
112 | 112 | 'label-message' => 'yourpassword', |
113 | | - 'section' => 'user', |
| 113 | + 'section' => 'personal', |
114 | 114 | ); |
115 | 115 | } |
116 | 116 | |
117 | 117 | $defaultPreferences['gender'] = |
118 | 118 | array( |
119 | 119 | 'type' => 'select', |
120 | | - 'section' => 'user', |
| 120 | + 'section' => 'personal', |
121 | 121 | 'options' => array( |
122 | 122 | 'male' => wfMsg('gender-male'), |
123 | 123 | 'female' => wfMsg('gender-female'), |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | $defaultPreferences['language'] = |
143 | 143 | array( |
144 | 144 | 'type' => 'select', |
145 | | - 'section' => 'user', |
| 145 | + 'section' => 'personal', |
146 | 146 | 'options' => $options, |
147 | 147 | 'default' => $wgContLanguageCode, |
148 | 148 | 'label-message' => 'yourlanguage', |
— | — | @@ -173,7 +173,7 @@ |
174 | 174 | 'label-message' => 'yourvariant', |
175 | 175 | 'type' => 'select', |
176 | 176 | 'options' => $options, |
177 | | - 'section' => 'user', |
| 177 | + 'section' => 'personal', |
178 | 178 | ); |
179 | 179 | } |
180 | 180 | } |
— | — | @@ -195,14 +195,14 @@ |
196 | 196 | 'label-message' => 'yournick', |
197 | 197 | 'validation-callback' => |
198 | 198 | array( 'Preferences', 'validateSignature' ), |
199 | | - 'section' => 'user', |
| 199 | + 'section' => 'personal', |
200 | 200 | 'filter-callback' => array( 'Preferences', 'cleanSignature' ), |
201 | 201 | ); |
202 | 202 | $defaultPreferences['fancysig'] = |
203 | 203 | array( |
204 | 204 | 'type' => 'toggle', |
205 | 205 | 'label-message' => 'tog-fancysig', |
206 | | - 'section' => 'user' |
| 206 | + 'section' => 'personal' |
207 | 207 | ); |
208 | 208 | |
209 | 209 | |
— | — | @@ -353,13 +353,13 @@ |
354 | 354 | array( |
355 | 355 | 'type' => 'toggle', |
356 | 356 | 'label-message' => 'tog-usenewrc', |
357 | | - 'section' => 'recentchanges', |
| 357 | + 'section' => 'rc', |
358 | 358 | ); |
359 | 359 | $defaultPreferences['rcdays'] = |
360 | 360 | array( |
361 | 361 | 'type' => 'int', |
362 | 362 | 'label-message' => 'recentchangesdays', |
363 | | - 'section' => 'recentchanges', |
| 363 | + 'section' => 'rc', |
364 | 364 | 'min' => 1, |
365 | 365 | 'max' => ceil($wgRCMaxAge / (3600*24)), |
366 | 366 | ); |
— | — | @@ -367,13 +367,13 @@ |
368 | 368 | array( |
369 | 369 | 'type' => 'int', |
370 | 370 | 'label-message' => 'recentchangescount', |
371 | | - 'section' => 'recentchanges', |
| 371 | + 'section' => 'rc', |
372 | 372 | ); |
373 | 373 | $defaultPreferences['hideminor'] = |
374 | 374 | array( |
375 | 375 | 'type' => 'toggle', |
376 | 376 | 'label-message' => 'tog-hideminor', |
377 | | - 'section' => 'recentchanges', |
| 377 | + 'section' => 'rc', |
378 | 378 | ); |
379 | 379 | |
380 | 380 | global $wgUseRCPatrol; |
— | — | @@ -381,13 +381,13 @@ |
382 | 382 | $defaultPreferences['hidepatrolled'] = |
383 | 383 | array( |
384 | 384 | 'type' => 'toggle', |
385 | | - 'section' => 'recentchanges', |
| 385 | + 'section' => 'rc', |
386 | 386 | 'label-message' => 'tog-hidepatrolled', |
387 | 387 | ); |
388 | 388 | $defaultPreferences['newpageshidepatrolled'] = |
389 | 389 | array( |
390 | 390 | 'type' => 'toggle', |
391 | | - 'section' => 'recentchanges', |
| 391 | + 'section' => 'rc', |
392 | 392 | 'label-message' => 'tog-newpageshidepatrolled', |
393 | 393 | ); |
394 | 394 | } |
— | — | @@ -489,21 +489,21 @@ |
490 | 490 | array( |
491 | 491 | 'type' => 'int', |
492 | 492 | 'label-message' => 'resultsperpage', |
493 | | - 'section' => 'search', |
| 493 | + 'section' => 'searchoptions', |
494 | 494 | 'min' => 0, |
495 | 495 | ); |
496 | 496 | $defaultPreferences['contextlines'] = |
497 | 497 | array( |
498 | 498 | 'type' => 'int', |
499 | 499 | 'label-message' => 'contextlines', |
500 | | - 'section' => 'search', |
| 500 | + 'section' => 'searchoptions', |
501 | 501 | 'min' => 0, |
502 | 502 | ); |
503 | 503 | $defaultPreferences['contextchars'] = |
504 | 504 | array( |
505 | 505 | 'type' => 'int', |
506 | 506 | 'label-message' => 'contextchars', |
507 | | - 'section' => 'search', |
| 507 | + 'section' => 'searchoptions', |
508 | 508 | 'min' => 0, |
509 | 509 | ); |
510 | 510 | |
— | — | @@ -522,7 +522,7 @@ |
523 | 523 | 'type' => 'multiselect', |
524 | 524 | 'label-message' => 'defaultns', |
525 | 525 | 'options' => $nsOptions, |
526 | | - 'section' => 'search', |
| 526 | + 'section' => 'searchoptions', |
527 | 527 | ); |
528 | 528 | |
529 | 529 | global $wgEnableMWSuggest; |
— | — | @@ -531,7 +531,7 @@ |
532 | 532 | array( |
533 | 533 | 'type' => 'toggle', |
534 | 534 | 'label-message' => 'mwsuggest-disable', |
535 | | - 'section' => 'search', |
| 535 | + 'section' => 'searchoptions', |
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |