From b9b75d20317193e7aa89d5b62604a5326808cd78 Mon Sep 17 00:00:00 2001 From: Sumit Asthana Date: Wed, 14 Jan 2015 02:32:36 +0530 Subject: [PATCH] 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 --- RELEASE-NOTES-1.25 | 3 +++ includes/skins/QuickTemplate.php | 14 ++++++++++++++ includes/templates/Usercreate.php | 9 ++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25 index 1ba6e97548..2e937e277a 100644 --- a/RELEASE-NOTES-1.25 +++ b/RELEASE-NOTES-1.25 @@ -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 diff --git a/includes/skins/QuickTemplate.php b/includes/skins/QuickTemplate.php index b28dc51168..905e537e58 100644 --- a/includes/skins/QuickTemplate.php +++ b/includes/skins/QuickTemplate.php @@ -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 diff --git a/includes/templates/Usercreate.php b/includes/templates/Usercreate.php index d783c6ae52..b185cb3829 100644 --- a/includes/templates/Usercreate.php +++ b/includes/templates/Usercreate.php @@ -53,7 +53,7 @@ class UsercreateTemplate extends BaseTemplate {
- html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?> + html( 'header' ); ?>
haveData( 'extrafields' ) ) { + echo $this->data['extrafields']; + } + // skip one index. $tabIndex++; ?>
-- 2.20.1