Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -235,26 +235,35 @@ |
236 | 236 | * Creates the HTML for the inner table for every instance of a |
237 | 237 | * multiple-instance template in the form. |
238 | 238 | */ |
239 | | - function multipleTemplateInstanceTableHTML( $mainText ) { |
| 239 | + function multipleTemplateInstanceTableHTML( $form_is_disabled, $mainText ) { |
240 | 240 | global $sfgTabIndex, $sfgScriptPath; |
241 | 241 | |
242 | | - $remove_text = wfMsg( 'sf_formedit_remove' ); |
| 242 | + $attributes = array( |
| 243 | + 'type' => 'button', |
| 244 | + 'value' => wfMsg( 'sf_formedit_remove' ), |
| 245 | + 'tabindex' => $sfgTabIndex, |
| 246 | + 'class' => 'remover', |
| 247 | + ); |
| 248 | + |
| 249 | + $rearranger = 'class="rearrangerImage"'; |
| 250 | + |
| 251 | + if ( $form_is_disabled ) { |
| 252 | + $attributes['disabled'] = 'disabled'; |
| 253 | + $rearranger = ''; |
| 254 | + } |
| 255 | + |
| 256 | + $removeButton = Xml::element( 'input', $attributes ); |
| 257 | + |
243 | 258 | $text =<<<END |
244 | | - |
245 | 259 | <table> |
246 | 260 | <tr> |
247 | | - <td> |
248 | | - $mainText |
249 | | - </td> |
250 | | - <td class="removeButton"> |
251 | | - <input type="button" value="$remove_text" tabindex="$sfgTabIndex" class="remover" /> |
252 | | - </td> |
| 261 | + <td>$mainText</td> |
| 262 | + <td class="removeButton">$removeButton</td> |
253 | 263 | <td class="instanceRearranger"> |
254 | | - <img src="$sfgScriptPath/skins/rearranger.png" class="rearrangerImage" /> |
| 264 | + <img src="$sfgScriptPath/skins/rearranger.png" $rearranger /> |
255 | 265 | </td> |
256 | 266 | </tr> |
257 | 267 | </table> |
258 | | - |
259 | 268 | END; |
260 | 269 | |
261 | 270 | return $text; |
— | — | @@ -264,7 +273,7 @@ |
265 | 274 | * Creates the HTML for a single instance of a multiple-instance template; |
266 | 275 | * plus the end tags for the full multiple-instance HTML. |
267 | 276 | */ |
268 | | - function multipleTemplateInstanceHTML( $all_instances_printed, &$section, $instance_num, $add_button_text ) { |
| 277 | + function multipleTemplateInstanceHTML( $form_is_disabled, $all_instances_printed, &$section, $instance_num, $add_button_text ) { |
269 | 278 | global $sfgTabIndex; |
270 | 279 | |
271 | 280 | if ( ! $all_instances_printed ) { |
— | — | @@ -280,7 +289,7 @@ |
281 | 290 | // wikis before SF 2.0.9. |
282 | 291 | 'class' => "multipleTemplateInstance multipleTemplate" |
283 | 292 | ), |
284 | | - $this->multipleTemplateInstanceTableHTML( $section ) |
| 293 | + $this->multipleTemplateInstanceTableHTML( $form_is_disabled, $section ) |
285 | 294 | ) . "\n"; |
286 | 295 | |
287 | 296 | } else { //if ( $all_instances_printed ) { |
— | — | @@ -293,12 +302,20 @@ |
294 | 303 | 'class' => "multipleTemplateStarter", |
295 | 304 | 'style' => "display: none", |
296 | 305 | ), |
297 | | - $this->multipleTemplateInstanceTableHTML( $section ) |
| 306 | + $this->multipleTemplateInstanceTableHTML( $form_is_disabled, $section ) |
298 | 307 | ) . "\n"; |
| 308 | + |
| 309 | + $attributes = array( |
| 310 | + 'type' => 'button', |
| 311 | + 'value' => Sanitizer::decodeCharReferences( $add_button_text ), |
| 312 | + 'tabindex' => $sfgTabIndex, |
| 313 | + 'class' => 'multipleTemplateAdder', |
| 314 | + ); |
| 315 | + if ( $form_is_disabled ) $attributes['disabled'] = 'disabled'; |
| 316 | + $button = Xml::element( 'input', $attributes ); |
299 | 317 | $text .= <<<END |
300 | 318 | </div><!-- multipleTemplateList --> |
301 | | - <p style="margin-left:10px;" /> |
302 | | - <p><input type="button" value="$add_button_text" tabindex="$sfgTabIndex" class="multipleTemplateAdder" /></p> |
| 319 | + <p>$button</p> |
303 | 320 | </div><!-- multipleTemplateWrapper --> |
304 | 321 | END; |
305 | 322 | } |
— | — | @@ -1400,14 +1417,14 @@ |
1401 | 1418 | if ( $allow_multiple ) { |
1402 | 1419 | if ( $curPlaceholder == null ) { |
1403 | 1420 | // The normal process. |
1404 | | - $form_text .= $this->multipleTemplateInstanceHTML( $all_instances_printed, $section, $instance_num, $add_button_text ); |
| 1421 | + $form_text .= $this->multipleTemplateInstanceHTML( $form_is_disabled, $all_instances_printed, $section, $instance_num, $add_button_text ); |
1405 | 1422 | } else { // if ( $curPlaceholder != null ){ |
1406 | 1423 | // The template text won't be appended at the end of the template like for usual multiple template forms. |
1407 | 1424 | // The HTML text will then be stored in the $multipleTemplateString variable, |
1408 | 1425 | // and then added in the right @insertHTML_".$placeHolderField."@"; position |
1409 | 1426 | // Optimization: actually, instead of separating the processes, the usual multiple |
1410 | 1427 | // template forms could also be handled this way if a fitting placeholder tag was added. |
1411 | | - $multipleTemplateString .= $this->multipleTemplateInstanceHTML( $all_instances_printed, $section, $instance_num, $add_button_text ); |
| 1428 | + $multipleTemplateString .= $this->multipleTemplateInstanceHTML( $form_is_disabled, $all_instances_printed, $section, $instance_num, $add_button_text ); |
1412 | 1429 | // We replace the $multipleTemplateString HTML into the |
1413 | 1430 | // current placeholder tag, but also add another |
1414 | 1431 | // placeholder tag, to keep track of it. |
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php |
— | — | @@ -17,7 +17,6 @@ |
18 | 18 | // global $sfgInitJSFunctions, $sfgValidationJSFunctions; |
19 | 19 | global $sfgShowOnSelect; |
20 | 20 | |
21 | | - $vars['sfgRemoveText'] = wfMsg( 'sf_formedit_remove' ); |
22 | 21 | $vars['sfgAutocompleteOnAllChars'] = $sfgAutocompleteOnAllChars; |
23 | 22 | $vars['sfgScriptPath'] = $sfgScriptPath; |
24 | 23 | // variables that are associative arrays need to be cast as |