Templates:Captcha position modified,extend functionality added to QuickTemplate

The ConfirmEdit extension presently inserts captcha in the header of Usercreate
and Userlogin templates. The js,if enabled places the captcha before submit
button.  A separate 'extrafields' placeholder for captcha is added just before
submit button in Usercreate.php so that captcha position remains consistent,
even if js is disabled.  An extend method added to QuickTemplate to append any
data to existing field, rather than setting it with fresh data. Particular use
for 'extrafields' in Usercreate and Userlogin.

Bug: T85192
Change-Id: I82c68814e79cbc5aa250a308862c59fcbb6fd527
This commit is contained in:
Sumit Asthana 2015-01-14 02:32:36 +05:30
parent cbb89d9627
commit b9b75d2031
3 changed files with 23 additions and 3 deletions

View file

@ -128,6 +128,9 @@ production.
on action=info about a file page does not list file links anymore.
* (T78637) Search bar is not autofocused unless it is empty so that proper scrolling using arrow keys is possible.
* (T50853) Database::makeList() modified to handle 'NULL' separately when building IN clause
* (T85192) Captcha position modified in Usercreate template. As a result:
** extrafields parameter added to Usercreate.php to insert additional data
** 'extend' method added to QuickTemplate to append additional values to any field of data array
=== Action API changes in 1.25 ===
* (T67403) XML tag highlighting is now only performed for formats

View file

@ -50,6 +50,20 @@ abstract class QuickTemplate {
$this->data[$name] = $value;
}
/**
* extends the value of data with name $name with the value $value
* @since 1.25
* @param string $name
* @param mixed $value
*/
public function extend( $name, $value ) {
if ( $this->haveData( $name ) ) {
$this->data[$name] = $this->data[$name] . $value;
} else {
$this->data[$name] = $value;
}
}
/**
* Gets the template data requested
* @since 1.22

View file

@ -53,7 +53,7 @@ class UsercreateTemplate extends BaseTemplate {
<div id="userloginForm">
<form name="userlogin2" id="userlogin2" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
<section class="mw-form-header">
<?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
<?php $this->html( 'header' ); ?>
</section>
<!-- This element is used by the mediawiki.special.userlogin.signup.js module. -->
<div
@ -248,8 +248,11 @@ class UsercreateTemplate extends BaseTemplate {
}
}
// JS attempts to move the image CAPTCHA below this part of the form,
// so skip one index.
// A separate placeholder for any inserting any extrafields, e.g used by ConfirmEdit extension
if ( $this->haveData( 'extrafields' ) ) {
echo $this->data['extrafields'];
}
// skip one index.
$tabIndex++;
?>
<div class="mw-ui-vform-field mw-submit">