Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | static function setGlobalJSVariables( &$vars ) { |
14 | 14 | global $sfgAutocompleteValues, $sfgAutocompleteOnAllChars; |
15 | 15 | global $sfgInitJSFunctions, $sfgValidationJSFunctions; |
16 | | - global $sfgShowOnSelect, $wgParser, $wgUser; |
| 16 | + global $sfgShowOnSelect; |
17 | 17 | |
18 | 18 | $vars['sfgRemoveText'] = wfMsg( 'sf_formedit_remove' ); |
19 | 19 | $vars['sfgAutocompleteOnAllChars'] = $sfgAutocompleteOnAllChars; |
— | — | @@ -85,17 +85,15 @@ |
86 | 86 | return $text; |
87 | 87 | } |
88 | 88 | |
89 | | - static function minorEditInputHTML( $is_disabled, $label = null, $attr = array() ) { |
90 | | - global $sfgTabIndex; |
| 89 | + static function minorEditInputHTML( $is_disabled, $label = null, $attrs = array() ) { |
| 90 | + global $sfgTabIndex, $wgUser; |
91 | 91 | |
92 | 92 | $sfgTabIndex++; |
| 93 | + $checked = $wgUser->getOption( 'minordefault' ); |
93 | 94 | if ( $label == null ) |
94 | 95 | $label = wfMsgExt( 'minoredit', array( 'parseinline' ) ); |
95 | 96 | $tooltip = wfMsg( 'tooltip-minoredit' ); |
96 | | - $attrs = $attr + array( |
97 | | - 'type' => 'checkbox', |
98 | | - 'value' => '', |
99 | | - 'name' => 'wpMinoredit', |
| 97 | + $attrs += array( |
100 | 98 | 'id' => 'wpMinoredit', |
101 | 99 | 'accesskey' => wfMsg( 'accesskey-minoredit' ), |
102 | 100 | 'tabindex' => $sfgTabIndex, |
— | — | @@ -103,7 +101,7 @@ |
104 | 102 | if ( $is_disabled ) { |
105 | 103 | $attrs['disabled'] = 'disabled'; |
106 | 104 | } |
107 | | - $text = "\t" . Xml::element( 'input', $attrs ) . "\n"; |
| 105 | + $text = "\t" . Xml::check( 'wpMinoredit', $checked, $attrs ) . "\n"; |
108 | 106 | $text .= "\t" . Xml::element( 'label', array( |
109 | 107 | 'for' => 'wpMinoredit', |
110 | 108 | 'title' => $tooltip |
— | — | @@ -112,34 +110,40 @@ |
113 | 111 | return $text; |
114 | 112 | } |
115 | 113 | |
116 | | - static function watchInputHTML( $is_disabled, $label = null, $attr = array() ) { |
| 114 | + static function watchInputHTML( $is_disabled, $label = null, $attrs = array() ) { |
117 | 115 | global $sfgTabIndex, $wgUser, $wgTitle; |
118 | 116 | |
119 | 117 | $sfgTabIndex++; |
120 | | - $checked_text = ""; |
121 | | - $disabled_text = ( $is_disabled ) ? " disabled" : ""; |
| 118 | + $checked = ""; |
122 | 119 | // figure out if the checkbox should be checked - |
123 | 120 | // this code borrowed from /includes/EditPage.php |
124 | 121 | if ( $wgUser->getOption( 'watchdefault' ) ) { |
125 | 122 | # Watch all edits |
126 | | - $checked_text = " checked"; |
| 123 | + $checked = true; |
127 | 124 | } elseif ( $wgUser->getOption( 'watchcreations' ) && !$wgTitle->exists() ) { |
128 | 125 | # Watch creations |
129 | | - $checked_text = " checked"; |
| 126 | + $checked = true; |
130 | 127 | } elseif ( $wgTitle->userIsWatching() ) { |
131 | 128 | # Already watched |
132 | | - $checked_text = " checked"; |
| 129 | + $checked = true; |
133 | 130 | } |
134 | 131 | if ( $label == null ) |
135 | 132 | $label = wfMsgExt( 'watchthis', array( 'parseinline' ) ); |
136 | | - $accesskey = htmlspecialchars( wfMsg( 'accesskey-watch' ) ); |
| 133 | + $attrs += array( |
| 134 | + 'id' => 'wpWatchthis', |
| 135 | + 'accesskey' => wfMsg( 'accesskey-watch' ), |
| 136 | + 'tabindex' => $sfgTabIndex, |
| 137 | + ); |
| 138 | + if ( $is_disabled ) { |
| 139 | + $attrs['disabled'] = 'disabled'; |
| 140 | + } |
| 141 | + $text = "\t" . Xml::check( 'wpWatchthis', $checked, $attrs ) . "\n"; |
137 | 142 | $tooltip = htmlspecialchars( wfMsg( 'tooltip-watch' ) ); |
138 | | - $attr = Xml::expandAttributes( $attr ); |
139 | | - $text = <<<END |
140 | | - <input tabindex="$sfgTabIndex" type="checkbox" name="wpWatchthis" accesskey="$accesskey" id='wpWatchthis'$checked_text$disabled_text$attr/> |
141 | | - <label for="wpWatchthis" title="$tooltip">$label</label> |
| 143 | + $text .= "\t" . Xml::element( 'label', array( |
| 144 | + 'for' => 'wpWatchthis', |
| 145 | + 'title' => $tooltip |
| 146 | + ), $label ) . "\n"; |
142 | 147 | |
143 | | -END; |
144 | 148 | return $text; |
145 | 149 | } |
146 | 150 | |
— | — | @@ -176,8 +180,9 @@ |
177 | 181 | |
178 | 182 | $sfgTabIndex++; |
179 | 183 | |
180 | | - if ( $label == null ) |
| 184 | + if ( $label == null ) { |
181 | 185 | $label = wfMsg( 'sf_formedit_saveandcontinueediting' ); |
| 186 | + } |
182 | 187 | |
183 | 188 | $temp = $attr + array( |
184 | 189 | 'id' => 'wpSaveAndContinue', |