Florianschmidtwelzow has uploaded a new change for review.
https://gerrit.wikimedia.org/r/240306
Change subject: Add a way to use different tab indexes for CAPTCHA inpit form
......................................................................
Add a way to use different tab indexes for CAPTCHA inpit form
And use it for UsercreateTemplate.
Bug: T113432
Change-Id: I56a618f2132fbcf3fea1a3ce6a409ce90709e849
---
M FancyCaptcha/FancyCaptcha.class.php
M MathCaptcha/MathCaptcha.class.php
M QuestyCaptcha/QuestyCaptcha.class.php
M ReCaptcha/ReCaptcha.class.php
M ReCaptchaNoCaptcha/ReCaptchaNoCaptcha.class.php
M SimpleCaptcha/Captcha.php
6 files changed, 13 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit
refs/changes/06/240306/1
diff --git a/FancyCaptcha/FancyCaptcha.class.php
b/FancyCaptcha/FancyCaptcha.class.php
index d36e914..1ae70f8 100644
--- a/FancyCaptcha/FancyCaptcha.class.php
+++ b/FancyCaptcha/FancyCaptcha.class.php
@@ -90,7 +90,7 @@
* Insert the captcha prompt into the edit form.
* @param OutputPage $out
*/
- function getForm( OutputPage $out ) {
+ function getForm( OutputPage $out, $tabIndex = 1 ) {
global $wgOut, $wgEnableAPI;
// Uses addModuleStyles so it is loaded when JS is disabled.
@@ -139,7 +139,7 @@
'autocorrect' => 'off',
'autocapitalize' => 'off',
'required' => 'required',
- 'tabindex' => 1,
+ 'tabindex' => $tabIndex,
'placeholder' => wfMessage(
'createacct-imgcaptcha-ph' )
)
); // tab in before the edit textarea
diff --git a/MathCaptcha/MathCaptcha.class.php
b/MathCaptcha/MathCaptcha.class.php
index 4eba6e4..ca8fcc1 100644
--- a/MathCaptcha/MathCaptcha.class.php
+++ b/MathCaptcha/MathCaptcha.class.php
@@ -20,12 +20,12 @@
* Produce a nice little form
* @param OutputPage $out
*/
- function getForm( OutputPage $out ) {
+ function getForm( OutputPage $out, $tabIndex = 1 ) {
list( $sum, $answer ) = $this->pickSum();
$index = $this->storeCaptcha( array( 'answer' => $answer ) );
$form = '<table><tr><td>' . $this->fetchMath( $sum ) . '</td>';
- $form .= '<td>' . Html::input( 'wpCaptchaWord', false, false,
array( 'tabindex' => '1', 'autocomplete' => 'off', 'required' ) ) .
'</td></tr></table>';
+ $form .= '<td>' . Html::input( 'wpCaptchaWord', false, false,
array( 'tabindex' => $tabIndex, 'autocomplete' => 'off', 'required' ) ) .
'</td></tr></table>';
$form .= Html::hidden( 'wpCaptchaId', $index );
return $form;
}
diff --git a/QuestyCaptcha/QuestyCaptcha.class.php
b/QuestyCaptcha/QuestyCaptcha.class.php
index e07dc5d..9c8daf8 100644
--- a/QuestyCaptcha/QuestyCaptcha.class.php
+++ b/QuestyCaptcha/QuestyCaptcha.class.php
@@ -41,7 +41,7 @@
return array( 'question' => $question, 'answer' => $answer );
}
- function getForm( OutputPage $out ) {
+ function getForm( OutputPage $out, $tabIndex = 1 ) {
$captcha = $this->getCaptcha();
if ( !$captcha ) {
die( "No questions found; set some in LocalSettings.php
using the format from QuestyCaptcha.php." );
@@ -54,7 +54,7 @@
'class' => 'mw-ui-input',
'required',
'autocomplete' => 'off',
- 'tabindex' => 1 ) ) . // tab in before the edit
textarea
+ 'tabindex' => $tabIndex ) ) . // tab in before
the edit textarea
"</p>\n" .
Xml::element( 'input', array(
'type' => 'hidden',
diff --git a/ReCaptcha/ReCaptcha.class.php b/ReCaptcha/ReCaptcha.class.php
index 90dc4f6..8b261d2 100644
--- a/ReCaptcha/ReCaptcha.class.php
+++ b/ReCaptcha/ReCaptcha.class.php
@@ -9,11 +9,11 @@
* If $this->recaptcha_error is set, it will display an error in the
widget.
* @param OutputPage $out
*/
- function getForm( OutputPage $out ) {
+ function getForm( OutputPage $out, $tabIndex = 1 ) {
global $wgReCaptchaPublicKey, $wgReCaptchaTheme;
$useHttps = ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS']
== 'on' );
- $js = 'var RecaptchaOptions = ' . Xml::encodeJsVar( array(
'theme' => $wgReCaptchaTheme, 'tabindex' => 1 ) );
+ $js = 'var RecaptchaOptions = ' . Xml::encodeJsVar( array(
'theme' => $wgReCaptchaTheme, 'tabindex' => $tabIndex ) );
return Html::inlineScript( $js ) . recaptcha_get_html(
$wgReCaptchaPublicKey, $this->recaptcha_error, $useHttps );
}
diff --git a/ReCaptchaNoCaptcha/ReCaptchaNoCaptcha.class.php
b/ReCaptchaNoCaptcha/ReCaptchaNoCaptcha.class.php
index 7631b82..4140b24 100644
--- a/ReCaptchaNoCaptcha/ReCaptchaNoCaptcha.class.php
+++ b/ReCaptchaNoCaptcha/ReCaptchaNoCaptcha.class.php
@@ -5,7 +5,7 @@
* Get the captcha form.
* @return string
*/
- function getForm( OutputPage $out ) {
+ function getForm( OutputPage $out, $tabIndex = 1 ) {
global $wgReCaptchaSiteKey;
// Insert reCAPTCHA script.
diff --git a/SimpleCaptcha/Captcha.php b/SimpleCaptcha/Captcha.php
index 79de22f..6da1d1a 100755
--- a/SimpleCaptcha/Captcha.php
+++ b/SimpleCaptcha/Captcha.php
@@ -39,7 +39,7 @@
*
* @return string HTML
*/
- function getForm( OutputPage $out ) {
+ function getForm( OutputPage $out, $tabIndex = 1 ) {
$captcha = $this->getCaptcha();
$index = $this->storeCaptcha( $captcha );
@@ -50,7 +50,7 @@
'id' => 'wpCaptchaWord',
'size' => 5,
'autocomplete' => 'off',
- 'tabindex' => 1 ) ) . // tab in before the edit
textarea
+ 'tabindex' => $tabIndex ) ) . // tab in before
the edit textarea
"</p>\n" .
Xml::element( 'input', array(
'type' => 'hidden',
@@ -152,7 +152,8 @@
) );
$captcha = "<div class='captcha'>" .
$wgOut->parse( $this->getMessage(
'createaccount' ) ) .
- $this->getForm( $wgOut ) .
+ // FIXME: Hardcoded tab index
+ $this->getForm( $wgOut, 8 ) .
"</div>\n";
// for older MediaWiki versions
if ( is_callable( array( $template, 'extend' ) ) ) {
--
To view, visit https://gerrit.wikimedia.org/r/240306
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I56a618f2132fbcf3fea1a3ce6a409ce90709e849
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits