Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/374035 )
Change subject: Add ability for proposal positions to be shuffled on load
..
Add ability for proposal positions to be shuffled on load
Currently the quiz extension only shuffles the order of questions using Js.
This change adds shuffling feature for proposal for each questions by using
shuffle function of Php.It is achieved by using shuffleanswer parameter for
quiz.
Bug: T170799
Change-Id: I7bdeade1fb5359e0db2051a48a2e51831f673ba7
---
M Question.php
M Quiz.class.php
M tests/phpunit/QuestionTest.php
3 files changed, 60 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/35/374035/1
diff --git a/Question.php b/Question.php
index 29fcd2f..a26a3ef 100644
--- a/Question.php
+++ b/Question.php
@@ -9,12 +9,13 @@
* @param $questionId Integer: the Identifier of the question used to
generate input names.
* @param $parser Parser the wikitext parser.
*/
- public function __construct( $beingCorrected, $caseSensitive,
$questionId, &$parser ) {
+ public function __construct( $beingCorrected, $caseSensitive,
$questionId, $shuffle, &$parser ) {
global $wgRequest;
$this->mRequest = &$wgRequest;
$this->mQuestionId = $questionId;
$this->mBeingCorrected = $beingCorrected;
$this->mCaseSensitive = $caseSensitive;
+ $this->shuffleAnswers = $shuffle;
$this->mParser = $parser;
$this->mState = ( $beingCorrected ) ? 'NA' : '';
$this->mType = 'multipleChoice';
@@ -161,12 +162,15 @@
// Parameters used in some special cases.
$expectOn = 0;
$attemptChecker = 0;
+ $lines = [];
+ $proposalCount = -1;
$checkedCount = 0;
foreach ( $raws as $proposalId => $raw ) {
$text = null;
$colSpan = '';
$signesOutput = '';
if ( preg_match( $this->mProposalPattern, $raw,
$matches ) ) {
+ $proposalCount++;
$rawClass = 'proposal';
// Insulate the proposal signes.
$text = array_pop( $matches );
@@ -274,18 +278,61 @@
$colSpan = ' colspan="13"';
}
if ( $text ) {
- $output .= '' .
"\n";
- $output .= $signesOutput;
- $output .= '';
- $output .= $this->mParser->recursiveTagParse(
$text );
- $output .= '';
- $output .= '' . "\n";
+ $lineOutput = '';
+ $lineOutput = ''
. "\n";
+ $lineOutput .= $signesOutput;
+ $lineOutput .= ' | ';
+ $lineOutput .=
$this->mParser->recursiveTagParse( $text );
+ $lineOutput .= '';
+ $lineOutput .= '' . "\n";
+ if ( $rawClass === 'correction selected' ||
$rawClass === 'correction unselected' ) {
+ if ( $proposalCount === -1 ) {
+ // Add to output directly
+ $output .= $lineOutput;
+ } else {
+ // Add feedback to previous
proposal
+ $lines[ $proposalCount ] .=
$lineOutput;
+ }
+ } else {
+ // Add lineOutput for proposal
+ $lines[ $proposalCount ] = $lineOutput;
+ }
}
}
// A single choice object with no correct proposal is a syntax
error.
if ( isset( $typeId ) && $typeId == 'sn' && $expectOn == 0 ) {
$this->setState( 'error' );
}
+ //Finding order
+ $order = '';
+ if ( $this->mBeingCorrected ) {
+ $order = $this->mRequest->getVal( $this->mQuestionId .
'|order' );
+ } else {
+ if ( $this->shuffleAnswers ) {
+ $order = '';
+ for( $i = 0; $i <= $proposalCount; ) {
+
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/373310 )
Change subject: Add feedbackUnselected class to proposals that have not been
attempted
..
Add feedbackUnselected class to proposals that have not been attempted
Currently feedback is shown for all proposals of all questions in a quiz
even if a question/proposal is not selected.This change changes the way feedback
is handled by checking if a proposal has been checked.It adds
feedbackDisplay class to not attempted question and uses CSS to hide/show
these questions.
Bug:T159952
Change-Id: I98b2a9fed27b15650acbb9d569dfed51b05c2e25
---
M Question.php
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/10/373310/1
diff --git a/Question.php b/Question.php
index d9ae793..1a610c0 100644
--- a/Question.php
+++ b/Question.php
@@ -160,6 +160,7 @@
$raws = preg_split( '`\n`s', $input, -1, PREG_SPLIT_NO_EMPTY );
// Parameters used in some special cases.
$expectOn = 0;
+ $attemptChecker = 0;
$checkedCount = 0;
foreach ( $raws as $proposalId => $raw ) {
$text = null;
@@ -200,6 +201,10 @@
if ( $this->mBeingCorrected &&
$this->mRequest->getVal( $name ) == $value ) {
$attribs['checked'] = 'checked';
}
+ // Determine if the proposal has been
attempted
+ $attemptChecker = (
$this->mBeingCorrected && $this->mRequest->getVal( $name ) === $value )
+ ? 1
+ : 0;
// Determine the color of the cell and
modify the state of the question.
switch ( $sign ) {
case '+':
@@ -262,7 +267,7 @@
} elseif ( preg_match( $this->mCorrectionPattern, $raw,
$matches ) &&
$this->mBeingCorrected
) {
- $rawClass = 'correction';
+ $rawClass = $attemptChecker ? 'correction' :
'correction feedbackUnselected';
$text = array_pop( $matches );
$signesOutput = '';
// Hacks to avoid counting the number of signes.
--
To view, visit https://gerrit.wikimedia.org/r/373310
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I98b2a9fed27b15650acbb9d569dfed51b05c2e25
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/372135 )
Change subject: Fix the colour of the text in a quiz that has a syntax error
..
Fix the colour of the text in a quiz that has a syntax error
The quiz is inheriting red color from mediawiki error class.
This patch overrides the class in quiz and fixes the color scheme
for syntax error.
Bug: T173304
Change-Id: I34c15c54192a3edf4ef5285ab9efc3ebcdbc3a45
---
M modules/ext.quiz.css
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/35/372135/1
diff --git a/modules/ext.quiz.css b/modules/ext.quiz.css
index 0d1d1bd..7b35f3b 100644
--- a/modules/ext.quiz.css
+++ b/modules/ext.quiz.css
@@ -50,6 +50,11 @@
background-color: #fc3;
}
+.quiz .error {
+ color: #22;
+ font-size: inherit;
+}
+
/* This should be based on content direction, not interface direction */
/* @noflip */
.mw-content-ltr .quiz .question .border {
--
To view, visit https://gerrit.wikimedia.org/r/372135
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I34c15c54192a3edf4ef5285ab9efc3ebcdbc3a45
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/372130 )
Change subject: Add ability for proposal positions to be shuffled on load
..
Add ability for proposal positions to be shuffled on load
Currently the quiz extension only shuffles the order of questions using Js.
This change adds shuffling feature for proposal for each questions by using
shuffle function of Php.
Bug: T170799
Change-Id: I471984b7a9eb1faa0f5e4e4dae7c519312e495ea
---
M Question.php
1 file changed, 28 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/30/372130/1
diff --git a/Question.php b/Question.php
index f2d544c..85e13a9 100644
--- a/Question.php
+++ b/Question.php
@@ -161,11 +161,14 @@
// Parameters used in some special cases.
$expectOn = 0;
$checkedCount = 0;
+ $lines = [];
+ $proposalCount = -1;
foreach ( $raws as $proposalId => $raw ) {
$text = null;
$colSpan = '';
$signesOutput = '';
if ( preg_match( $this->mProposalPattern, $raw,
$matches ) ) {
+ $proposalCount++;
$rawClass = 'proposal';
// Insulate the proposal signes.
$text = array_pop( $matches );
@@ -269,14 +272,33 @@
$colSpan = ' colspan="13"';
}
if ( $text ) {
- $output .= '' .
"\n";
- $output .= $signesOutput;
- $output .= '';
- $output .= $this->mParser->recursiveTagParse(
$text );
- $output .= '';
- $output .= '' . "\n";
+ $lineOutput = '';
+ $lineOutput = ''
. "\n";
+ $lineOutput .= $signesOutput;
+ $lineOutput .= ' | ';
+ $lineOutput .=
$this->mParser->recursiveTagParse( $text );
+ $lineOutput .= '';
+ $lineOutput .= '' . "\n";
+ if ( $rawClass === 'correction' ) {
+ if ( $proposalCount === -1 ) {
+ // Add to output directly
+ $output .= $lineOutput;
+ } else {
+ // Add feedback to previous
proposal
+ $lines[ $proposalCount ] .=
$lineOutput;
+
+ }
+ } else {
+ // Add lineOutput for proposal
+ $lines[ $proposalCount ] = $lineOutput;
+ }
}
}
+ // Shuffling the proposals
+ shuffle( $lines );
+ for( $i = 0; $i <= $proposalCount; ++$i ) {
+$output .= $lines[ $i ];
+}
// A single choice object with no correct proposal is a syntax
error.
if ( isset( $typeId ) && $typeId == 'sn' && $expectOn == 0 ) {
$this->setState( 'error' );
--
To view, visit https://gerrit.wikimedia.org/r/372130
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I471984b7a9eb1faa0f5e4e4dae7c519312e495ea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/371938 )
Change subject: Use regex splitting for parseCategories to enable Interwiki
links inside Categories
..
Use regex splitting for parseCategories to enable Interwiki links inside
Categories
Currently Php's explode function is used for seprating categories.This cause
a problem when Interwiki links are used inside the categories due to similar
syntax.Preg_split is used instead of explode function in order to enable use
of interwiki links.
Bug: T165363
Change-Id: I9c3dc1437df2d7716688799ba7670e5548d0aec9
---
M Question.php
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/38/371938/1
diff --git a/Question.php b/Question.php
index f2d544c..2610730 100644
--- a/Question.php
+++ b/Question.php
@@ -292,7 +292,8 @@
* @return string
*/
function parseCategories( $input ) {
- $categories = explode( '|', $input );
+ $linkPattern = '`\[\[.*?\]\](*SKIP)(*FAIL)|\|`';
+ $categories = preg_split( $linkPattern, $input );
// Less than two categories is a syntax error.
if ( !array_key_exists( 1, $categories ) ) {
$categories[1] = '???';
--
To view, visit https://gerrit.wikimedia.org/r/371938
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c3dc1437df2d7716688799ba7670e5548d0aec9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/371122 )
Change subject: Add relative postion abilty to quiz form
..
Add relative postion abilty to quiz form
Currently the wrapping of quiz around images hides the questionId of
the quiz.Adding relative position to quiz allows the quiz to wrap
correctly.
Bug:T170081
Change-Id: Ib909adf4f217f42273edfcad5f992d260da708a6
---
M modules/ext.quiz.css
M templates/Quiz.mustache
2 files changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/22/371122/1
diff --git a/modules/ext.quiz.css b/modules/ext.quiz.css
index fb14907..20a2558 100644
--- a/modules/ext.quiz.css
+++ b/modules/ext.quiz.css
@@ -131,6 +131,10 @@
border: 0;
}
+.quiz .quizForm {
+ position:relative;
+}
+
.quiz .correction {
background-color: #f9f9f9;
}
diff --git a/templates/Quiz.mustache b/templates/Quiz.mustache
index d33bf74..9d0842f 100644
--- a/templates/Quiz.mustache
+++ b/templates/Quiz.mustache
@@ -1,5 +1,5 @@
-
+
{{#settingsTable }}
{{{ . }}}
--
To view, visit https://gerrit.wikimedia.org/r/371122
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib909adf4f217f42273edfcad5f992d260da708a6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/369827 )
Change subject: Add answers class to proposals
..
Add answers class to proposals
This patch adds answers class to proposal which can be used to put the
answers/proposals into columns using Common.css
Bug:T170800
Change-Id: I3a71af32162555ec861076622aef46d2fa3fbdc5
---
M Question.php
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/27/369827/1
diff --git a/Question.php b/Question.php
index 4868061..7b79f90 100644
--- a/Question.php
+++ b/Question.php
@@ -283,6 +283,7 @@
$colSpan = ' colspan="13"';
}
if ( $text ) {
+ $rawClass = $rawClass === 'proposal' ?
'proposal answer' : $rawClass;
$output .= '' .
"\n";
$output .= $signesOutput;
$output .= '';
--
To view, visit https://gerrit.wikimedia.org/r/369827
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a71af32162555ec861076622aef46d2fa3fbdc5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/369822 )
Change subject: Add class field to input type in Answer.mustache
..
Add class field to input type in Answer.mustache
The class attribute is used to give class value (numbers/wods) to
textfield object in the template.The patch adds the missing value
to the input type.
Bug:T172355
Change-Id: Ib28b88950d2c6566a8fec2c9ff723e5772ca034b
---
M templates/Answer.mustache
M tests/phpunit/QuestionTest.php
2 files changed, 8 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/22/369822/1
diff --git a/templates/Answer.mustache b/templates/Answer.mustache
index 9f1082e..1025a13 100644
--- a/templates/Answer.mustache
+++ b/templates/Answer.mustache
@@ -4,7 +4,7 @@
{{{ possibility }}}
{{/if}}
-
+
{{ big }}
diff --git a/tests/phpunit/QuestionTest.php b/tests/phpunit/QuestionTest.php
index a5c6975..0ba8b53 100644
--- a/tests/phpunit/QuestionTest.php
+++ b/tests/phpunit/QuestionTest.php
@@ -175,7 +175,7 @@
. "\n\t\t\t" . ' StageiraPlatoGreece'
. "\n\t\t\t" . '' . "\n\t\t\t" . ''
. "\n\t\t\t\t"
-. ''
. "\n\t\t\t\t\t" . '▼' . "\n\t\t\t\t\t"
. '' . "\n\t\t\t"
. '' . "\n\t\n" . '' . "\n",
@@ -187,7 +187,7 @@
'' . "\n\t\n\t\t" .
''
. "\n\t\t\t" . '' . "
\n\t\t\t" . '' . "\n\t\t\t"
. '' . "\n\t\t\t\t"
-. ''
+. ''
. "\n\t\t\t\t\t" . '' .
"\n\t\t\t\t\t" . '' . "\n\t\t\t"
. '' . "\n\t\n" . '' . "\n",
''
@@ -198,7 +198,7 @@
'' . "\n\t\n\t\t" .
''
. "\n\t\t\t" . ' Plato'
. "\n\t\t\t" . '' . "\n\t\t\t"
. '' .
"\n\t\t\t\t"
-. ''
. "\n\t\t\t\t\t" . '▼' . "\n\t\t\t\t\t"
. ''
. "\n\t\t\t" . '' . "\n\t\n" . '' . "\n",
@@ -209,7 +209,7 @@
'' . "\n\t\n\t\t" .
''
. "\n\t\t\t" . ' StageiraPlatoGreece'. "\n\t\t\t"
. '' . "\n\t\t\t" . '' . "\n\t\t\t\t"
-. ''
. "\n\t\t\t\t\t" . '▼' . "\n\t\t\t\t\t"
. '' . "\n\t\t\t" . ''
. "\n\t\n" . '' . "\n",
@@ -221,7 +221,7 @@
'' . "\n\t\n\t\t" .
''
. "\n\t\t\t" . ' Plato'
. "\n\t\t\t" . '' . "\n\t\t\t"
. '' .
"\n\t\t\t\t"
-. ''
. "\n\t\t\t\t\t" . '▼' . "\n\t\t\t\t\t"
. ''
. "\n\t\t\t" . '' . "\n\t\n" . '' . "\n",
@@ -233,7 +233,7 @@
'' . "\n\t\n\t\t" .
''
. "\n\t\t\t" . '' .
"\n\t\t\t" . '' . "\n\t\t\t"
. '' .
"\n\t\t\t\t"
-. ''
. "\n\t\t\t\t\t" . '' . "\n\t\t\t\t\t" .
''
. "\n\t\t\t" . '' . "\n\t\n" . '' . "\n",
@@ -245,7 +245,7 @@
'' . "\n\t\n\t\t" .
''
. "\n\t\t\t" . ' 0' .
"\n\t\t\t" . '' . "\n\t\t\t"
. '' .
"\n\t\t\t\t"
-. ''
. "\n\t\t\t\t\t" . '▼' . "\n\t\t\t\t\t"
. ''
. "\n\t\t\t" . '' . "\n\t\n" . '' . "\n",
--
To view, visit https://gerrit.wikimedia.org/r/369822
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib28b88950d2c6566a8fec2c9ff723e5772ca034b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/368993 )
Change subject: Reassign numbering to shuffled questions
..
Reassign numbering to shuffled questions
Currently the shuffled questions also shuffles the number which distorts
the order in which the questions were shuffled.This patch reassigns the
numbering by adding shuffleNumbering function.
Bug:T170798
Change-Id: I71b0ae7ca47ef9d59a3f2bbba2d92ae35525b8d0
---
M modules/ext.quiz.js
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/93/368993/1
diff --git a/modules/ext.quiz.js b/modules/ext.quiz.js
index 441f44f..701c142 100644
--- a/modules/ext.quiz.js
+++ b/modules/ext.quiz.js
@@ -65,6 +65,14 @@
area.innerHTML = areaHTML;
}
+ // Reassign numbering to shuffled questions
+ function shuffleNumbering( area ) {
+ var list = area.getElementsByClassName( 'questionId' );
+ for( var i =0; i < list.length ; ++i ) {
+ list[i].innerHTML = i+1;
+ }
+ }
+
// Prepare the quiz for "javascriptable" browsers
function prepareQuiz() {
var bodyContentDiv = document.getElementById( 'mw-content-text'
).getElementsByTagName( 'div' );
@@ -84,6 +92,7 @@
/* jshint loopfunc:true */
input[j].onclick = function() {
shuffle(
this.form.getElementsByTagName( 'div' )[1] );
+ shuffleNumbering(
this.form.getElementsByTagName( 'div' )[1] )
var sh_input =
this.form.getElementsByTagName( 'input' );
for( var k = 0; k <
sh_input.length; ++k ) {
// Add the
possibility of unchecking radio buttons
--
To view, visit https://gerrit.wikimedia.org/r/368993
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I71b0ae7ca47ef9d59a3f2bbba2d92ae35525b8d0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/368536 )
Change subject: Add feedbackDisplay class to questions that have not been
attempted
..
Add feedbackDisplay class to questions that have not been attempted
Currently feedback is shown for all questions in a quiz even if
a question is answered or not.This change changes the way feedback
is handled by checking if a question has been attempted.It adds
feedbackDisplay class to not attempted question and uses CSS to hide/show
these questions.
Change-Id: Ibbff5e5c16ed4b3c94479cd1f2b545b918358b0b
---
M Question.php
M modules/ext.quiz.css
2 files changed, 39 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/36/368536/1
diff --git a/Question.php b/Question.php
index 4868061..9080fbb 100644
--- a/Question.php
+++ b/Question.php
@@ -161,6 +161,9 @@
// Parameters used in some special cases.
$expectOn = 0;
$checkedCount = 0;
+ $signes = [];
+ $proposalCount = 0;
+ $attemptChecker = 0;
foreach ( $raws as $proposalId => $raw ) {
$text = null;
$colSpan = '';
@@ -198,6 +201,10 @@
$checked = $this->mBeingCorrected &&
$this->mRequest->getVal( $name ) == $value
? 'checked="checked"'
: null;
+ // Determine if the question has been
attempted
+ $attemptChecker = (
$this->mBeingCorrected && !empty( $this->mRequest->getVal( $name ) ) )
+ ? 1
+ : 0;
// Determine the color of the cell and
modify the state of the question.
switch ( $sign ) {
case '+':
@@ -260,7 +267,9 @@
$inputType . '" ' . $title . '
name="' . $name . '" value="' . $value .
'" ' . $checked . ' ' .
$disabled . ' />';
$signesOutput .= '';
+ $signes[ $proposalCount ] =
$signesOutput;
}
+ $proposalCount++;
if ( $typeId == 'sc' ) {
// A single choice object with no
correct proposal is a syntax error.
if ( $expectOn == 0 ) {
@@ -268,6 +277,18 @@
}
$expectOn = 0;
}
+ }
+ }
+ $counter = 0;
+ foreach( $raws as $proposalId => $raw ) {
+ $text = null;
+ $colSpan = '';
+ $signesOutput = '';
+ $isProposal = 0;
+ if ( preg_match( $this->mProposalPattern, $raw,
$matches ) ) {
+ $isProposal = 1;
+ $rawClass = 'proposal';
+ $text = array_pop( $matches );
// If the proposal text is empty, the question
has a syntax error.
if ( trim( $text ) == '' ) {
$text = '???';
@@ -276,7 +297,8 @@
} elseif ( preg_match( $this->mCorrectionPattern, $raw,
$matches ) &&
$this->mBeingCorrected
) {
- $rawClass = 'correction';
+ $isProposal = 0;
+ $rawClass = $attemptChecker ? 'correction' :
'correction feedbackDisplay';
$text = array_pop( $matches );
$signesOutput = '';
// Hacks to avoid counting the number of signes.
@@ -284,7 +306,12 @@
}
if ( $text ) {
$output .= '' .
"\n";
- $output .= $signesOutput;
+ if( $isProposal ) {
+ $output .= $signes[ $counter ];
+ $counter++;
+ } else {
+ $output .= $signesOutput;
+ }
$output .= '';
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/368341 )
Change subject: Add feedbackDisplay class to feedback( correction ) in quiz to
hide/show feedback
..
Add feedbackDisplay class to feedback( correction ) in quiz to hide/show
feedback
This change adds feedbackDisplay class which can be used to hide/show feedback
on all quizzes
by using CSS in Common.css
Bug: T159952
Change-Id: I0e89cd2c3c5ecf2a0d9c5d7fcd583f35c483d5ac
---
M Question.php
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/41/368341/1
diff --git a/Question.php b/Question.php
index 4868061..577606d 100644
--- a/Question.php
+++ b/Question.php
@@ -276,7 +276,7 @@
} elseif ( preg_match( $this->mCorrectionPattern, $raw,
$matches ) &&
$this->mBeingCorrected
) {
- $rawClass = 'correction';
+ $rawClass = 'correction feedbackDisplay';
$text = array_pop( $matches );
$signesOutput = '';
// Hacks to avoid counting the number of signes.
--
To view, visit https://gerrit.wikimedia.org/r/368341
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e89cd2c3c5ecf2a0d9c5d7fcd583f35c483d5ac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/368338 )
Change subject: Add enumeration class to question id field
..
Add enumeration class to question id field
Adding enumeration class to question id field will enable showing/hiding
question numbers by changing CSS.Admins can change Common.css accordingly.
The default behaviour is to show question number.
Bug: T170852
Change-Id: Ic67aae5489bc8ca5e94f9b6b3c70799caa40c42b
---
M templates/Question.mustache
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/38/368338/1
diff --git a/templates/Question.mustache b/templates/Question.mustache
index 6c66951..66cb68f 100644
--- a/templates/Question.mustache
+++ b/templates/Question.mustache
@@ -1,7 +1,7 @@
{{#if question.numdis }}
- {{ question.id }}
+ {{ question.id
}}
{{/if}}
{{{ question.text }}}
@@ -10,4 +10,4 @@
{{{ question.answers }}}
-
\ No newline at end of file
+
--
To view, visit https://gerrit.wikimedia.org/r/368338
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic67aae5489bc8ca5e94f9b6b3c70799caa40c42b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/367327 )
Change subject: Remove empty cell from settings table in Quiz
..
Remove empty cell from settings table in Quiz
Currently a empty cell is seen inside settings table which is caused by
tags from mustache template.This patch removes the tags and alters
the template.
Bug: T171154
Change-Id: Idb35c7a6aa95ad7bf9d4e9a13d42d7088f33567e
---
M Quiz.class.php
M templates/Setting.mustache
2 files changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/27/367327/1
diff --git a/Quiz.class.php b/Quiz.class.php
index 0a43cfa..9122924 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -123,6 +123,7 @@
* @return string
*/
function parseQuiz( $input ) {
+ global $wgOut;
// Ouput the style and the script to the header once for all.
if ( $this->mQuizId == 0 ) {
global $wgOut;
@@ -147,6 +148,8 @@
'notSimple' => !$this->mDisplaySimple,
'corrected' => $this->mBeingCorrected,
'shuffle' => $this->mShuffle,
+ 'shuffleOrError' => ( $this->mShuffle &&
$this->numberQuestions > 1 ) ||
+ $this->mState === 'error',
'error' => $this->mState === 'error',
'wfMessage' => [
'quiz_added' => wfMessage(
'quiz_addedPoints', $this->mAddedPoints )->text(),
@@ -170,6 +173,7 @@
'shuffleDisplay' => $this->numberQuestions > 1
]
);
+ $wgOut->addHTML("set ".$settingsTable."");
$quiz_score = wfMessage( 'quiz_score' )->rawParams(
'' . $this->mScore . '',
diff --git a/templates/Setting.mustache b/templates/Setting.mustache
index f6496d4..a85b8da 100644
--- a/templates/Setting.mustache
+++ b/templates/Setting.mustache
@@ -41,6 +41,7 @@
{{/ isSettingOtherRow}}
{{# notSimple}}
+ {{# shuffleOrError}}
{{# shuffle}}
{{^ corrected}}
@@ -62,4 +63,5 @@
{{/ corrected}}
{{/ error}}
+ {{/ shuffleOrError}}
{{/ notSimple}}
--
To view, visit https://gerrit.wikimedia.org/r/367327
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb35c7a6aa95ad7bf9d4e9a13d42d7088f33567e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/366280 )
Change subject: Add tests for shuffle control tags {X}, {!X} and {/X}
..
Add tests for shuffle control tags {X}, {!X} and {/X}
This change adds tests for shuffle control.The testParseQuestion function
requires $input array for ParseQuestion, $expected value to assertEquals,
injected value for mShuffleDiv and expected value for mShuffleDiv after
output is returned from ParseQuesiton.Two assertions are made for each
test case.
Bug: T167635
Change-Id: Ie2b66d949aacd3830e669c6b2d5ec4b0cee8fbcd
---
M tests/phpunit/QuizTest.php
1 file changed, 44 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/80/366280/1
diff --git a/tests/phpunit/QuizTest.php b/tests/phpunit/QuizTest.php
index 1615378..a012526 100644
--- a/tests/phpunit/QuizTest.php
+++ b/tests/phpunit/QuizTest.php
@@ -9,7 +9,10 @@
parent::setUp();
global $wgParser;
$wgParser = $this->getParser();
+ $options = new ParserOptions();
+ $title = $wgParser->getTitle();
$this->parser = &$wgParser;
+ $this->parser->startExternalParse( $title, $options, 'text',
true );
$this->quiz = new Quiz( [], $this->parser );
}
@@ -53,4 +56,45 @@
$this->assertEquals( 0, $this->quiz->getQuizId() );
}
+ public function provideParseQuestion() {
+ return [
+ // Test for {X} tag
+ [
+[ [ 'X}', 'X', '' ], '1' ],
+'' . "\n", '0', '1'
+ ],
+ // Test for {!X} tag
+ [
+[ [ '!X}', '!X', '' ], '1' ],
+'' . "\n", '0', '1'
+ ],
+ // Test for {/X} tag when {X} or {!X} has been used
previously
+ [
+[ [ '/X}', '/X', '' ], '1' ],
+'', '0', '0'
+ ],
+ // Test for {/X} tag when {X} or {!X} has not been used
previously
+ [
+[ [ '/X}', '/X', '' ], '1' ],
+'' . "\n", '1', '0'
+ ],
+ // Test when random value is passed inside {} tag
+ [
+[ [ 'abc}', 'abc', '' ], '1' ],
+'abc' . "\n", '0',
'0'
+ ]
+ ];
+ }
+
+ /**
+* @dataProvider provideParseQuestion
+* @covers Question::parseQuestion
+*/
+ public function testParseQuestion( $input, $expected, $injectedValue,
$expectedValue ) {
+ $this->quiz->mShuffleDiv = $injectedValue;
+ $output = $this->quiz->parseQuestion( $input[0], $input[1] );
+ $this->assertEquals( $this->quiz->mShuffleDiv, $expectedValue );
+ $this->assertEquals( $output, $expected );
+ }
+
}
--
To view, visit https://gerrit.wikimedia.org/r/366280
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2b66d949aacd3830e669c6b2d5ec4b0cee8fbcd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/365450 )
Change subject: Add Css classes in quiz extension to provide flexibility
..
Add Css classes in quiz extension to provide flexibility
This change adds the option of showing question numbering even if there
is only one question in quiz.This can be achieved by giving class=number
to the quiz.
Bug: T148624
Change-Id: I9c749745359739327b82c2525cfb29283829a7f9
---
M Quiz.class.php
1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/50/365450/1
diff --git a/Quiz.class.php b/Quiz.class.php
index 0a43cfa..4b8c183 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -81,7 +81,11 @@
}
$this->mShuffle = !( array_key_exists( 'shuffle', $argv ) &&
$argv['shuffle'] == 'none' );
$this->mCaseSensitive = !( array_key_exists( 'case', $argv ) &&
$argv['case'] == '(i)' );
-
+ $classes = array_key_exists( 'class', $argv ) ? $argv['class']
: '' ;
+ $class = explode( ';', $classes );
+ foreach( $class as $val ){
+ $this->isClass[ $val ] = 1;
+ }
// Patterns used in several places
$this->mIncludePattern = '`^\{\{:?(.*)\}\}[ \t]*`m';
}
@@ -250,7 +254,7 @@
$output = '';
$questionPattern = '`(.*?[^|\}])\}[ \t]*(\n(.*)|$)`s';
$this->numberQuestions = count( $unparsedQuestions );
- $numDisplay = $this->numberQuestions > 1;
+ $numDisplay = $this->numberQuestions > 1 ? 1 : ( isset(
$this->isClass['number'] ) ? 1 : 0 );
foreach ( $unparsedQuestions as $unparsedQuestion ) {
// If this "unparsedQuestion" is not a full question,
// we put the text into a buffer to add it at the
beginning of the next question.
--
To view, visit https://gerrit.wikimedia.org/r/365450
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c749745359739327b82c2525cfb29283829a7f9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/365437 )
Change subject: Remove BadMethodCallException when creating quiz with no answer
..
Remove BadMethodCallException when creating quiz with no answer
The quiz throws BadMethodCallException when no answer is provided,
earlier it just showed syntax error.This change creates templateParser
before the if/else block.
Bug: T170733
Change-Id: I6a1fcf8a3707305dd8d41d93c4597950ba537fb4
---
M Question.php
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/37/365437/1
diff --git a/Question.php b/Question.php
index 9065c3f..dd1a4f0 100644
--- a/Question.php
+++ b/Question.php
@@ -401,12 +401,12 @@
}
$maxlength = $input[3];
}
+ $templateParser = new TemplateParser( __DIR__ . '/templates' );
// Syntax error if there is no input text.
if ( empty( $input[1] ) ) {
$value = 'value="???"';
$state = 'error';
} else {
- $templateParser = new TemplateParser( __DIR__ .
'/templates' );
// For hiding down arrow
$bigDisplay = 'display: none';
if ( $this->mBeingCorrected ) {
--
To view, visit https://gerrit.wikimedia.org/r/365437
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a1fcf8a3707305dd8d41d93c4597950ba537fb4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/365436 )
Change subject: Remove BadMethodCallException when zero is taken as answer in
quiz
..
Remove BadMethodCallException when zero is taken as answer in quiz
Currently the quiz throws a BadMethodCallException when zero is taken
as the answer.This was due to the use of empty() function for checking
the input.
Bug: T169135
Change-Id: I717237e5bad1d74abea8c446b95eaf63eb2dad4b
---
M Question.php
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/36/365436/1
diff --git a/Question.php b/Question.php
index 9065c3f..802bba4 100644
--- a/Question.php
+++ b/Question.php
@@ -402,7 +402,7 @@
$maxlength = $input[3];
}
// Syntax error if there is no input text.
- if ( empty( $input[1] ) ) {
+ if ( $input[1] === "" ) {
$value = 'value="???"';
$state = 'error';
} else {
--
To view, visit https://gerrit.wikimedia.org/r/365436
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I717237e5bad1d74abea8c446b95eaf63eb2dad4b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/364003 )
Change subject: Show Right option in the header of quiz
..
Show Right option in the header of quiz
Currently the right option is not visible in the header due to no text
inside the html.This change adds the using wfMessage.
Bug:T170035
Change-Id: I0ed2308717f2337ab4e47b4a66e30e3b952dc406
---
M templates/Setting.mustache
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/03/364003/1
diff --git a/templates/Setting.mustache b/templates/Setting.mustache
index 15f30a4..f6496d4 100644
--- a/templates/Setting.mustache
+++ b/templates/Setting.mustache
@@ -6,7 +6,7 @@
{{/ notSimple}}
{{# corrected}}
- {{
wf.Message.quiz_colorRight }}
+ {{
wfMessage.quiz_colorRight }}
{{/corrected}}
{{# error}}
{{^ corrected}}
--
To view, visit https://gerrit.wikimedia.org/r/364003
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ed2308717f2337ab4e47b4a66e30e3b952dc406
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/363635 )
Change subject: Remove Settings box when Quiz is set to simple
..
Remove Settings box when Quiz is set to simple
Due to the change for T161317, the settings table was being displayed even when
the display is set to simple.This change modifies the mustache templates to
remove the settings box.
Bug:T169529
Change-Id: I2a51df9bfb0fac7a6b1bc8e988836a2d81f6f095
---
M Quiz.class.php
M templates/Quiz.mustache
M templates/Setting.mustache
3 files changed, 44 insertions(+), 37 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/35/363635/1
diff --git a/Quiz.class.php b/Quiz.class.php
index b5c3330..7ef1d2c 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -131,6 +131,8 @@
$settingsTable = $templateParser->processTemplate(
'Setting',
[
+ 'isSettingFirstRow' => ( !$this->mDisplaySimple
|| $this->mBeingCorrected || $this->mState === 'error' ),
+ 'isSettingOtherRow' => ( !$this->mDisplaySimple
|| $this->mBeingCorrected ),
'notSimple' => !$this->mDisplaySimple,
'corrected' => $this->mBeingCorrected,
'shuffle' => $this->mShuffle,
diff --git a/templates/Quiz.mustache b/templates/Quiz.mustache
index aaa30e8..155cbec 100644
--- a/templates/Quiz.mustache
+++ b/templates/Quiz.mustache
@@ -1,9 +1,9 @@
-
- {{{ settingsTable }}}
-
+ {{#settingsTable }}
+ {{{ . }}}
+ {{/settingsTable }}
diff --git a/templates/Setting.mustache b/templates/Setting.mustache
index 547b580..15f30a4 100644
--- a/templates/Setting.mustache
+++ b/templates/Setting.mustache
@@ -1,41 +1,47 @@
-
- {{# notSimple}}
- {{ wfMessage.quiz_added }}
-
- {{/ notSimple}}
- {{# corrected}}
-
- {{
wf.Message.quiz_colorRight }}
- {{/corrected}}
- {{# error}}
- {{^ corrected}}
-
- {{ wfMessage.quiz_colorError }}
+{{# isSettingFirstRow}}
+
+ {{# notSimple}}
+ {{ wfMessage.quiz_added }}
+
+ {{/ notSimple}}
+ {{# corrected}}
+
+ {{
wf.Message.quiz_colorRight }}
{{/corrected}}
- {{/ error}}
+ {{# error}}
+ {{^ corrected}}
+
+ {{ wfMessage.quiz_colorError }}
+ {{/corrected}}
+ {{/ error}}
+{{/ isSettingFirstRow}}
+{{# isSettingOtherRow}}
- {{# notSimple}}
- {{ wfMessage.quiz_cutoff }}
-
- {{/ notSimple}}
- {{# corrected}}
-
- {{
wfMessage.quiz_colorWrong }}
- {{/ corrected}}
+ {{# notSimple}}
+ {{ wfMessage.quiz_cutoff }}
+
+ {{/ notSimple}}
+ {{# corrected}}
+
+ {{
wfMessage.quiz_colorWrong }}
+ {{/ corrected}}
+{{/ isSettingOtherRow}}
+{{# isSettingOtherRow}}
- {{# notSimple}}
- {{{ wfMessage.quiz_ignoreCoef }}}
-
- {{/ notSimple}}
- {{# corrected}}
-
- {{ wfMessage.quiz_colorNA
}}
- {{/ corrected}}
+ {{# notSimple}}
+ {{{ wfMessage.quiz_ignoreCoef }}}
+
+ {{/ notSimple}}
+ {{# corrected}}
+
+ {{
wfMessage.quiz_colorNA }}
+ {{/ corrected}}
+{{/ isSettingOtherRow}}
+{{# notSimple}}
- {{# notSimple}}
{{# shuffle}}
{{^ corrected}}
{{# shuffleDisplay}}
@@ -55,6 +61,5 @@
{{ wfMessage.quiz_colorError }}
{{/ corrected}}
{{/ error}}
- {{/ notSimple}}
-
-
+
+{{/ notSimple}}
--
To view, visit https://gerrit.wikimedia.org/r/363635
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a51df9bfb0fac7a6b1bc8e988836a2d81f6f095
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/363634 )
Change subject: Remove Settings box when Quiz is set to simple
..
Remove Settings box when Quiz is set to simple
Due to the change for T161317, the settings table was being displayed even when
the display is set to simple.This change modifies the mustache templates to
remove the settings box.
Bug:T169529
Change-Id: I0257af97ab2f3612d51c8b88dd29769a2db49e94
---
M Quiz.class.php
M templates/Quiz.mustache
M templates/Setting.mustache
3 files changed, 44 insertions(+), 37 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/34/363634/1
diff --git a/Quiz.class.php b/Quiz.class.php
index b5c3330..7ef1d2c 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -131,6 +131,8 @@
$settingsTable = $templateParser->processTemplate(
'Setting',
[
+ 'isSettingFirstRow' => ( !$this->mDisplaySimple
|| $this->mBeingCorrected || $this->mState === 'error' ),
+ 'isSettingOtherRow' => ( !$this->mDisplaySimple
|| $this->mBeingCorrected ),
'notSimple' => !$this->mDisplaySimple,
'corrected' => $this->mBeingCorrected,
'shuffle' => $this->mShuffle,
diff --git a/templates/Quiz.mustache b/templates/Quiz.mustache
index aaa30e8..155cbec 100644
--- a/templates/Quiz.mustache
+++ b/templates/Quiz.mustache
@@ -1,9 +1,9 @@
-
- {{{ settingsTable }}}
-
+ {{#settingsTable }}
+ {{{ . }}}
+ {{/settingsTable }}
diff --git a/templates/Setting.mustache b/templates/Setting.mustache
index 547b580..15f30a4 100644
--- a/templates/Setting.mustache
+++ b/templates/Setting.mustache
@@ -1,41 +1,47 @@
-
- {{# notSimple}}
- {{ wfMessage.quiz_added }}
-
- {{/ notSimple}}
- {{# corrected}}
-
- {{
wf.Message.quiz_colorRight }}
- {{/corrected}}
- {{# error}}
- {{^ corrected}}
-
- {{ wfMessage.quiz_colorError }}
+{{# isSettingFirstRow}}
+
+ {{# notSimple}}
+ {{ wfMessage.quiz_added }}
+
+ {{/ notSimple}}
+ {{# corrected}}
+
+ {{
wf.Message.quiz_colorRight }}
{{/corrected}}
- {{/ error}}
+ {{# error}}
+ {{^ corrected}}
+
+ {{ wfMessage.quiz_colorError }}
+ {{/corrected}}
+ {{/ error}}
+{{/ isSettingFirstRow}}
+{{# isSettingOtherRow}}
- {{# notSimple}}
- {{ wfMessage.quiz_cutoff }}
-
- {{/ notSimple}}
- {{# corrected}}
-
- {{
wfMessage.quiz_colorWrong }}
- {{/ corrected}}
+ {{# notSimple}}
+ {{ wfMessage.quiz_cutoff }}
+
+ {{/ notSimple}}
+ {{# corrected}}
+
+ {{
wfMessage.quiz_colorWrong }}
+ {{/ corrected}}
+{{/ isSettingOtherRow}}
+{{# isSettingOtherRow}}
- {{# notSimple}}
- {{{ wfMessage.quiz_ignoreCoef }}}
-
- {{/ notSimple}}
- {{# corrected}}
-
- {{ wfMessage.quiz_colorNA
}}
- {{/ corrected}}
+ {{# notSimple}}
+ {{{ wfMessage.quiz_ignoreCoef }}}
+
+ {{/ notSimple}}
+ {{# corrected}}
+
+ {{
wfMessage.quiz_colorNA }}
+ {{/ corrected}}
+{{/ isSettingOtherRow}}
+{{# notSimple}}
- {{# notSimple}}
{{# shuffle}}
{{^ corrected}}
{{# shuffleDisplay}}
@@ -55,6 +61,5 @@
{{ wfMessage.quiz_colorError }}
{{/ corrected}}
{{/ error}}
- {{/ notSimple}}
-
-
+
+{{/ notSimple}}
--
To view, visit https://gerrit.wikimedia.org/r/363634
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0257af97ab2f3612d51c8b88dd29769a2db49e94
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/362264 )
Change subject: Basic Unit Tests for Quiz Extension [WIP]
..
Basic Unit Tests for Quiz Extension [WIP]
Initial test class for Quiz.class is added to check getColor method.
Bug:T159691
Change-Id: Ide874476812dba70c1d2a56aa8a27dfbb99f
---
A tests/phpunit/QuizTest.php
1 file changed, 46 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/64/362264/1
diff --git a/tests/phpunit/QuizTest.php b/tests/phpunit/QuizTest.php
new file mode 100644
index 000..0970382
--- /dev/null
+++ b/tests/phpunit/QuizTest.php
@@ -0,0 +1,46 @@
+getParser();
+ $this->parser = &$wgParser;
+ $this->quiz = new Quiz([], $this->parser );
+ }
+
+ protected function tearDown() {
+ parent::tearDown();
+ }
+
+ private function getParser() {
+ return new StubObject(
+ 'wgParser', $GLOBALS['wgParserConf']['class'],
+ array( $GLOBALS['wgParserConf'] )
+ );
+ }
+
+ public function provideGetColor() {
+ return [
+ [ 'right', '#1FF72D' ],
+ [ 'wrong', '#F74245' ],
+ [ 'correction', '#F9F9F9' ],
+ [ 'NA', '#2834FF' ],
+ [ 'error', '#D700D7' ],
+ ];
+ }
+
+ /**
+* @dataProvider provideGetColor
+* @covers Question::getColor
+*/
+ public function testGetColor( $colorId, $expected ) {
+ $color = $this->quiz->getColor( $colorId );
+ $this->assertEquals( $color, $expected );
+ }
+
+}
--
To view, visit https://gerrit.wikimedia.org/r/362264
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide874476812dba70c1d2a56aa8a27dfbb99f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/359656 )
Change subject: Put Setting table's HTML in mustache template
..
Put Setting table's HTML in mustache template
Currently raw HTML code is used to generate settings table that is
displayed in quiz.This change removes the code and moves it to mustache
template.It utilizes template parser to process template.
Bug:T161317
Change-Id: I6e307229efee16a1efd3c0c0a8c0162ba389d02d
---
M Quiz.class.php
M modules/ext.quiz.js
M templates/Quiz.mustache
A templates/Setting.mustache
4 files changed, 94 insertions(+), 51 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/56/359656/1
diff --git a/Quiz.class.php b/Quiz.class.php
index f0169d8..6bf8742 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -124,52 +124,37 @@
// Generates the output.
$templateParser = new TemplateParser( __DIR__ . '/templates' );
-
+ $checked = '';
// Determine the content of the settings table.
- $settings = array_fill( 0, 4, '' );
- if ( !$this->mDisplaySimple ) {
- $settings[0] .= '' . wfMessage( 'quiz_addedPoints',
$this->mAddedPoints )->escaped() . '' . "\n";
- $settings[0] .= '' . "\n";
-
- $settings[1] .= '' . wfMessage(
'quiz_cutoffPoints', $this->mCutoffPoints )->escaped() . '' . "\n";
- $settings[1] .= '' .
"\n";
-
- $checked = ( $this->mIgnoringCoef ) ? '
checked="checked"' : '';
- $settings[2] .= '' . wfMessage( 'quiz_ignoreCoef'
)->escaped() . '' . "\n";
- $settings[2] .= '' . "\n";
-
- if ( $this->mShuffle && !$this->mBeingCorrected ) {
- $settings[3] .= '' . "\n";
- } else {
- $settings[3] .= '' . "\n";
- }
- $settings[3] .= '' . "\n";
- }
- if ( $this->mBeingCorrected ) {
- $settings[0] .= '' . "\n";
- $settings[0] .= ''
. wfMessage( 'quiz_colorRight' )->escaped() . '' . "\n";
-
- $settings[1] .= '' . "\n";
- $settings[1] .= ''
. wfMessage( 'quiz_colorWrong' )->escaped() . '' . "\n";
-
- $settings[2] .= '' . "\n";
- $settings[2] .= ''
. wfMessage( 'quiz_colorNA' )->escaped() . '' . "\n";
- }
- if ( $this->mState === 'error' ) {
- $errorKey = $this->mBeingCorrected ? 3 : 0;
- $settings[$errorKey] .= '' . "\n";
- $settings[$errorKey] .= '' . wfMessage(
'quiz_colorError' )->escaped() . '' . "\n";
- }
-
- // Build the settings table.
- $settingsTable = '';
- foreach ( $settings as $settingsTr ) {
- if ( !empty( $settingsTr ) ) {
- $settingsTable .= '' . "\n";
- $settingsTable .= $settingsTr . "\n";
- $settingsTable .= '' . "\n";
- }
- }
+ $setTable = '';
+ $setTable = $templateParser->processTemplate(
+ 'Setting',
+ [
+ 'notSimple' => !$this->mDisplaySimple,
+ 'corrected' => $this->mBeingCorrected,
+ 'shuffle' => $this->mShuffle,
+ 'error' => $this->mState === 'error',
+ 'wfMessage' => [
+ 'quiz_added' => wfMessage(
'quiz_addedPoints', $this->mAddedPoints )->escaped(),
+ 'quiz_cutoff' => wfMessage(
'quiz_cutoffPoints', $this->mCutoffPoints )->escaped(),
+ 'quiz_ignoreCoef' => wfMessage(
'quiz_ignoreCoef' )->escaped(),
+ 'quiz_colorRight' => wfMessage(
'quiz_colorRight' )->escaped(),
+ 'quiz_colorWrong' => wfMessage(
'quiz_colorWrong' )->escaped(),
+ 'quiz_colorNA' => wfMessage(
'quiz_colorNA' )->escaped(),
+ 'quiz_colorError' => wfMessage(
'quiz_colorError' )->escaped(),
+ 'quiz_shuffle' => wfMessage(
'quiz_shuffle' )->escaped()
+ ],
+ 'color' => [
+ 'colorWrong' => self::getColor( 'wrong'
),
+ 'colorRight' =>
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/358948 )
Change subject: Add Target mobile for Quiz extension
..
Add Target mobile for Quiz extension
Currently the modules are not loaded for quiz extension by MobileFrontend
in mobile devices.Adding target="mobile" will enable to load modules on
mobiles.
Bug:T167642
Change-Id: I1ee5cfbe608929b963869e01756516c8dd6a2dbe
---
M extension.json
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/48/358948/1
diff --git a/extension.json b/extension.json
index e8b52e5..7c4e3f6 100644
--- a/extension.json
+++ b/extension.json
@@ -20,7 +20,11 @@
"ext.quiz": {
"scripts": "ext.quiz.js",
"styles": "ext.quiz.css",
- "position": "top"
+ "position": "top",
+ "targets": [
+ "desktop",
+ "mobile"
+ ]
}
},
"ResourceFileModulePaths": {
--
To view, visit https://gerrit.wikimedia.org/r/358948
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ee5cfbe608929b963869e01756516c8dd6a2dbe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/358942 )
Change subject: Put Setting table's HTML in mustache template
..
Put Setting table's HTML in mustache template
Currently raw HTML code is used to generate settings table that is
displayed in quiz.This change removes the code and moves it to mustache
template.It utilizes template parser to process template.
Bug:T161317
Change-Id: I2a1643bc327bda4a56c9e260a6088207515b7195
---
M Quiz.class.php
M modules/ext.quiz.js
M templates/Quiz.mustache
3 files changed, 35 insertions(+), 52 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/42/358942/1
diff --git a/Quiz.class.php b/Quiz.class.php
index db48a12..0875a92 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -125,53 +125,36 @@
// Generates the output.
$templateParser = new TemplateParser( __DIR__ . '/templates' );
-
- // Determine the content of the settings table.
- $settings = array_fill( 0, 4, '' );
- if ( !$this->mDisplaySimple ) {
- $settings[0] .= '' . wfMessage( 'quiz_addedPoints',
$this->mAddedPoints )->escaped() . '' . "\n";
- $settings[0] .= '' . "\n";
-
- $settings[1] .= '' . wfMessage(
'quiz_cutoffPoints', $this->mCutoffPoints )->escaped() . '' . "\n";
- $settings[1] .= '' .
"\n";
-
- $checked = ( $this->mIgnoringCoef ) ? '
checked="checked"' : '';
- $settings[2] .= '' . wfMessage( 'quiz_ignoreCoef'
)->escaped() . '' . "\n";
- $settings[2] .= '' . "\n";
-
- if ( $this->mShuffle && !$this->mBeingCorrected ) {
- $settings[3] .= '' . "\n";
- } else {
- $settings[3] .= '' . "\n";
- }
- $settings[3] .= '' . "\n";
- }
- if ( $this->mBeingCorrected ) {
- $settings[0] .= '' . "\n";
- $settings[0] .= ''
. wfMessage( 'quiz_colorRight' )->escaped() . '' . "\n";
-
- $settings[1] .= '' . "\n";
- $settings[1] .= ''
. wfMessage( 'quiz_colorWrong' )->escaped() . '' . "\n";
-
- $settings[2] .= '' . "\n";
- $settings[2] .= ''
. wfMessage( 'quiz_colorNA' )->escaped() . '' . "\n";
- }
- if ( $this->mState === 'error' ) {
- $errorKey = $this->mBeingCorrected ? 3 : 0;
- $settings[$errorKey] .= '' . "\n";
- $settings[$errorKey] .= '' . wfMessage(
'quiz_colorError' )->escaped() . '' . "\n";
- }
-
+ $checked = '';
// Build the settings table.
- $settingsTable = '';
- foreach ( $settings as $settingsTr ) {
- if ( !empty( $settingsTr ) ) {
- $settingsTable .= '' . "\n";
- $settingsTable .= $settingsTr . "\n";
- $settingsTable .= '' . "\n";
- }
- }
-
+ $setTable= '';
+ $setTable = $templateParser->processTemplate(
+ 'Setting',
+ array( 'notSimple' => !$this->mDisplaySimple,
+ 'corrected' => $this->mBeingCorrected,
+ 'shuffle' => $this->mShuffle,
+ 'error' => $this->mState === 'error',
+ 'wfMessage' => array(
+ 'quiz_added' => wfMessage(
'quiz_addedPoints', $this->mAddedPoints )->escaped(),
+ 'quiz_cutoff' => wfMessage(
'quiz_cutoffPoints', $this->mCutoffPoints )->escaped(),
+ 'quiz_ignoreCoef' => wfMessage(
'quiz_ignoreCoef' ),
+ 'quiz_colorRight' => wfMessage(
'quiz_colorRight' )->escaped(),
+ 'quiz_colorWrong' => wfMessage(
'quiz_colorWrong' )->escaped(),
+ 'quiz_colorNA' => wfMessage(
'quiz_colorNA' )->escaped(),
+ 'quiz_colorError' => wfMessage(
'quiz_colorError' )->escaped(),
+ 'quiz_shuffle' => wfMessage(
'quiz_shuffle' )->escaped()
+ ),
+ 'color' => array(
+ 'colorWrong' => self::getColor(
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/358539 )
Change subject: Enable numeric input type questions to evaluate zero as valid
input.
..
Enable numeric input type questions to evaluate zero as valid input.
Currently numeric input type questions doesn't evaluate zero as valid input
even if the answer is correct.When zero is submitted, the quiz state remains
unanswered.This is caused as empty() in php consider 0 to be empty.This
change checks if the input is zero and exempts it from empty().
Bug:T166439
Change-Id: Icd119ce75561eaea98b7b24d515699b1fe771015
---
M Question.php
1 file changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/39/358539/1
diff --git a/Question.php b/Question.php
index 8b19494..36292e5 100644
--- a/Question.php
+++ b/Question.php
@@ -393,7 +393,7 @@
} else {
$strlen = strlen(
$matches[1] );
}
- if ( $this->mBeingCorrected &&
!empty( $value ) ) {
+ if ( $this->mBeingCorrected &&
( !empty( $value ) || $value == '0' ) ) {
$value = str_replace(
',', '.', $value );
if ( is_numeric( $value
) && (
(
array_key_exists( 5, $matches )
@@ -412,7 +412,7 @@
} else {
$strlen = preg_match( '`
\(i\)$`', $possibility ) ? mb_strlen( $possibility ) - 4 : mb_strlen(
$possibility );
$class = 'words';
- if ( $this->mBeingCorrected &&
!empty( $value ) ) {
+ if ( $this->mBeingCorrected &&
( !empty( $value ) || $value == '0' ) ) {
if ( $value ==
$possibility ||
( preg_match(
'`^' . preg_quote( $value, '`' ) . ' \(i\)$`i', $possibility ) ) ||
(
!$this->mCaseSensitive && preg_match( '`^' . preg_quote( $value, '`' ) . '$`i',
$possibility ) )
@@ -437,7 +437,7 @@
$poss .= $possibility . '';
}
}
- $value = empty( $value ) ? '' : str_replace( '"',
'', $value );
+ $value = ( empty( $value ) && $value != '0' ) ? '' :
str_replace( '"', '', $value );
if ( $this->mBeingCorrected ) {
$big = '▼';
$bigDisplay = ' ';
@@ -447,7 +447,7 @@
global $wgContLang;
$border = $wgContLang->isRTL() ? 'border-right' :
'border-left';
$style = $border . ':3px solid ' . Quiz::getColor(
$state ) . ';';
- $this->setState( empty( $value ) ? 'new_NA' : $state );
+ $this->setState( ( empty( $value ) && $value != '0' ) ?
'new_NA' : $state );
if ( $state == 'error' ) {
$size = '';
$maxlength = '';
--
To view, visit https://gerrit.wikimedia.org/r/358539
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd119ce75561eaea98b7b24d515699b1fe771015
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/358532 )
Change subject: Enable numeric input type questions to evaluate zero as valid
input.
..
Enable numeric input type questions to evaluate zero as valid input.
Currently numeric input type questions doesn't evaluate zero as valid input
even if the answer is correct.When zero is submitted, the quiz state remains
unanswered.This is caused as empty() in php consider 0 to be empty.This
change checks if the input is zero and exempts it from empty().
Bug:T166439
Change-Id: I59d67f8424dcc69276cc1d9d0e0e2c5d9ca8a74c
---
M Question.php
1 file changed, 3 insertions(+), 17 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/32/358532/1
diff --git a/Question.php b/Question.php
index b523c46..3dcc5ca 100644
--- a/Question.php
+++ b/Question.php
@@ -411,13 +411,8 @@
}
} else {
$strlen = preg_match( '`
\(i\)$`', $possibility ) ? mb_strlen( $possibility ) - 4 : mb_strlen(
$possibility );
-<<< HEAD (402f45 Enable numeric input type questions to evaluate zero as
vali)
- $class = 'class="words"';
- if ( $this->mBeingCorrected &&
( !empty( $value ) || $value == '0' ) ) {
-===
$class = 'words';
- if ( $this->mBeingCorrected &&
!empty( $value ) ) {
->>> BRANCH (2a7143 Merge "Put Html code of Answer in Question.php into
mustache)
+ if ( $this->mBeingCorrected &&
( !empty( $value ) || $value == '0' ) ) {
if ( $value ==
$possibility ||
( preg_match(
'`^' . preg_quote( $value, '`' ) . ' \(i\)$`i', $possibility ) ) ||
(
!$this->mCaseSensitive && preg_match( '`^' . preg_quote( $value, '`' ) . '$`i',
$possibility ) )
@@ -440,11 +435,7 @@
$poss .= $possibility . '';
}
}
-<<< HEAD (402f45 Enable numeric input type questions to evaluate zero as
vali)
- $value = ( empty( $value ) && $value != '0' ) ? '' :
'value="' . str_replace( '"', '', $value ) . '"';
-===
- $value = empty( $value ) ? '' : str_replace( '"',
'', $value );
->>> BRANCH (2a7143 Merge "Put Html code of Answer in Question.php into
mustache)
+ $value = ( empty( $value ) && $value != '0' ) ? '' :
str_replace( '"', '', $value );
if ( $this->mBeingCorrected ) {
$big = '▼';
$bigDisplay = ' ';
@@ -453,13 +444,8 @@
if ( $state == 'error' || $this->mBeingCorrected ) {
global $wgContLang;
$border = $wgContLang->isRTL() ? 'border-right' :
'border-left';
-<<< HEAD (402f45 Enable numeric input type questions to evaluate zero as
vali)
- $style = 'style="' . $border . ':3px solid ' .
Quiz::getColor( $state ) . ';"';
- $this->setState( ( empty( $value ) && $value != '0' ) ?
'new_NA' : $state );
-===
$style = $border . ':3px solid ' . Quiz::getColor(
$state ) . ';';
- $this->setState( empty( $value ) ? 'new_NA' : $state );
->>> BRANCH (2a7143 Merge "Put Html code of Answer in Question.php into
mustache)
+ $this->setState( ( empty( $value ) && $value != '0' ) ?
'new_NA' : $state );
if ( $state == 'error' ) {
$size = '';
$maxlength = '';
--
To view, visit https://gerrit.wikimedia.org/r/358532
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I59d67f8424dcc69276cc1d9d0e0e2c5d9ca8a74c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/358228 )
Change subject: Define all variables that are sent to process tepmlate
..
Define all variables that are sent to process tepmlate
ProcessTemplate cannot handle undefined variables.This change ensures that
all variables that are being sent to process template are defined.
Bug:T167587
Change-Id: Ic84c38e97baed2d46eefcec555ce4ab0f9191701
---
M Question.php
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/28/358228/1
diff --git a/Question.php b/Question.php
index 952e853..52f60aa 100644
--- a/Question.php
+++ b/Question.php
@@ -354,7 +354,7 @@
function parseTextField( $input ) {
global $wqInputId;
$wqInputId++;
- $title = $state = $size = $maxlength = $class = $style = $value
= $disabled = $big = '';
+ $title = $state = $size = $maxlength = $class = $style = $value
= $disabled = $big = $poss = $name = $bigDisplay = '';
// determine size and maxlength of the input.
if ( array_key_exists( 3, $input ) ) {
$size = $input[3];
--
To view, visit https://gerrit.wikimedia.org/r/358228
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic84c38e97baed2d46eefcec555ce4ab0f9191701
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/358227 )
Change subject: Remove escaped HTML of < inside text field when field length
shorter than answer
..
Remove escaped HTML of < inside text field when field length shorter than answer
Currently escaped HTML for < and > tags is shown inside text field due to using
mustache template.This change replaces the use of and with < and >
respectively.
Bug:T167588
Change-Id: I012b3bf5012c61adce27681bbafd6b01a1f15fab
---
M Question.php
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/27/358227/1
diff --git a/Question.php b/Question.php
index 952e853..6057a1e 100644
--- a/Question.php
+++ b/Question.php
@@ -428,7 +428,7 @@
if ( array_key_exists( 3, $input ) &&
$strlen > $input[3] ) {
// The textfield is too short
for the answer
$state = 'error';
- $value = '_' . $possibility
. '_ ';
+ $value = '<_' . $possibility .
'_>';
}
}
if ( $this->mBeingCorrected ) {
--
To view, visit https://gerrit.wikimedia.org/r/358227
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I012b3bf5012c61adce27681bbafd6b01a1f15fab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/358068 )
Change subject: Remove (i) from correction for case insensitive textfields
..
Remove (i) from correction for case insensitive textfields
Case insensitive textfields use parameter (i) inside answer format.
The (i) parameter is currently shown in correction which is undesirable.
This change removes the parameter by using substring function.
Change can be confirmed by checking correction of textfield using (i)
parameter.
Bug:T166926
Change-Id: I9800f85e31f696d6be78c33463425123548dc0aa
---
M Question.php
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/68/358068/1
diff --git a/Question.php b/Question.php
index 952e853..3fe1700 100644
--- a/Question.php
+++ b/Question.php
@@ -432,6 +432,8 @@
}
}
if ( $this->mBeingCorrected ) {
+ $strlen = preg_match( '` \(i\)$`',
$possibility ) ? mb_strlen( $possibility ) - 4 : mb_strlen( $possibility );
+ $possibility = substr( $possibility, 0,
$strlen );
$poss .= $possibility . '';
}
}
--
To view, visit https://gerrit.wikimedia.org/r/358068
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9800f85e31f696d6be78c33463425123548dc0aa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/357789 )
Change subject: Enable numeric input type questions to evaluate zero as valid
input.
..
Enable numeric input type questions to evaluate zero as valid input.
Currently numeric input type questions doesn't evaluate zero as valid input
even if the answer is correct.When zero is submitted, the quiz state remains
unanswered.This is caused as empty() in php consider 0 to be empty.This
change checks if the input is zero and exempts it from empty().
Bug:T166439
Change-Id: I97cd61cd27f4885ffb85136767e1653e206f4f49
---
M Question.php
1 file changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/89/357789/1
diff --git a/Question.php b/Question.php
index 5410f87..df30bc6 100644
--- a/Question.php
+++ b/Question.php
@@ -389,7 +389,7 @@
} else {
$strlen = strlen(
$matches[1] );
}
- if ( $this->mBeingCorrected &&
!empty( $value ) ) {
+ if ( $this->mBeingCorrected &&
( !empty( $value ) || $value == '0' ) ) {
$value = str_replace(
',', '.', $value );
if ( is_numeric( $value
) && (
(
array_key_exists( 5, $matches )
@@ -408,7 +408,7 @@
} else {
$strlen = preg_match( '`
\(i\)$`', $possibility ) ? mb_strlen( $possibility ) - 4 : mb_strlen(
$possibility );
$class = 'class="words"';
- if ( $this->mBeingCorrected &&
!empty( $value ) ) {
+ if ( $this->mBeingCorrected &&
( !empty( $value ) || $value == '0' ) ) {
if ( $value ==
$possibility ||
( preg_match(
'`^' . preg_quote( $value, '`' ) . ' \(i\)$`i', $possibility ) ) ||
(
!$this->mCaseSensitive && preg_match( '`^' . preg_quote( $value, '`' ) . '$`i',
$possibility ) )
@@ -431,7 +431,7 @@
$a_inputBeg .= $possibility . '';
}
}
- $value = empty( $value ) ? '' : 'value="' .
str_replace( '"', '', $value ) . '"';
+ $value = ( empty( $value ) && $value != '0' ) ? '' :
'value="' . str_replace( '"', '', $value ) . '"';
if ( $this->mBeingCorrected ) {
$a_inputBeg.= '';
$a_inputEnd = '';
@@ -442,7 +442,7 @@
global $wgContLang;
$border = $wgContLang->isRTL() ? 'border-right' :
'border-left';
$style = 'style="' . $border . ':3px solid ' .
Quiz::getColor( $state ) . ';"';
- $this->setState( empty( $value ) ? 'new_NA' : $state );
+ $this->setState( ( empty( $value ) && $value != '0' ) ?
'new_NA' : $state );
if ( $state == 'error' ) {
$size = '';
$maxlength = '';
--
To view, visit https://gerrit.wikimedia.org/r/357789
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I97cd61cd27f4885ffb85136767e1653e206f4f49
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/357781 )
Change subject: Remove Shuffle feature if only one question is in quiz
..
Remove Shuffle feature if only one question is in quiz
Quiz extension can shuffle questions by using shuffle feature.A shuffle button
is shown which allows for shuffling.Currently when a quiz has only a single
question, the shuffle button is visible but as there is only one question it
doesn't shuffle anything.This change hides the shuffle button if there is only
one question in a quiz.
Bug:T146392
Change-Id: Ib52b4cdc3c0aeda33ebfbc1ae8ce2949e781c5fb
---
M Quiz.class.php
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/81/357781/1
diff --git a/Quiz.class.php b/Quiz.class.php
index 6f6c9c8..33857c5 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -122,6 +122,10 @@
// Process the input
$input = $this->parseQuestions( $this->parseIncludes( $input )
);
+ // Count the number of Questions
+ preg_match_all('',$input,$matches);
+ $NumberOfQuestions = count($matches[0]);
+
// Generates the output.
$templateParser = new TemplateParser( __DIR__ . '/templates' );
@@ -139,7 +143,7 @@
$settings[2] .= '' . wfMessage( 'quiz_ignoreCoef'
)->escaped() . '' . "\n";
$settings[2] .= '' . "\n";
- if ( $this->mShuffle && !$this->mBeingCorrected ) {
+ if ( $this->mShuffle && !$this->mBeingCorrected &&
$NumberOfQuestions > 1 ) {
$settings[3] .= '' . "\n";
} else {
$settings[3] .= '' . "\n";
--
To view, visit https://gerrit.wikimedia.org/r/357781
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib52b4cdc3c0aeda33ebfbc1ae8ce2949e781c5fb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/357117 )
Change subject: Remove (i) from correction for case insensitive textfields
..
Remove (i) from correction for case insensitive textfields
Bug:T166926
Change-Id: I329d68f16acc86bc3c247290fe8812a59590da4d
---
M Question.php
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/17/357117/1
diff --git a/Question.php b/Question.php
index 5410f87..c155e93 100644
--- a/Question.php
+++ b/Question.php
@@ -428,6 +428,7 @@
}
}
if ( $this->mBeingCorrected ) {
+ $possibility = $this->mCaseSensitive ?
substr( $possibility, 0, $strlen ) : $possibility;
$a_inputBeg .= $possibility . '';
}
}
--
To view, visit https://gerrit.wikimedia.org/r/357117
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I329d68f16acc86bc3c247290fe8812a59590da4d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/357111 )
Change subject: Show Feedback for only questions that have been attempted
..
Show Feedback for only questions that have been attempted
Bug:T159952
Change-Id: I131d8e762c98f0edb4993f7c24650056bf6e73c6
---
M Question.php
1 file changed, 31 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/11/357111/1
diff --git a/Question.php b/Question.php
index 5410f87..872ed74 100755
--- a/Question.php
+++ b/Question.php
@@ -87,6 +87,7 @@
$output .= '';
$output .= '';
}
+
return $output;
}
@@ -156,15 +157,14 @@
$raws = preg_split( '`\n`s', $input, -1, PREG_SPLIT_NO_EMPTY );
// Parameters used in some special cases.
$expectOn = 0;
+ $signes = [];
+ $proposalCount = 0;
+ $attemptChecker = 0;
$checkedCount = 0;
foreach ( $raws as $proposalId => $raw ) {
- $text = null;
- $colSpan = '';
$signesOutput = '';
if ( preg_match( $this->mProposalPattern, $raw,
$matches ) ) {
- $rawClass = 'proposal';
- // Insulate the proposal signes.
- $text = array_pop( $matches );
+ array_pop( $matches );
array_shift( $matches );
// Determine a type ID, according to the
questionType and the number of signes.
$typeId = substr( $this->mType, 0, 1 );
@@ -193,6 +193,10 @@
// Determine if the input had to be
checked.
$checked = ( $this->mBeingCorrected &&
$this->mRequest->getVal( $name ) == $value ) ? 'checked="checked"' : null;
+ // If any proposal is checked, the
question is attempted
+ if ( $this->mBeingCorrected && !empty(
$this->mRequest->getVal( $name ) ) ) {
+ $attemptChecker = 1;
+ }
// Determine the color of the cell and
modify the state of the question.
switch ( $sign ) {
case '+':
@@ -239,7 +243,9 @@
$signesOutput .= '';
$signesOutput .= '';
$signesOutput .= '';
+ $signes[$proposalCount] = $signesOutput;
}
+ $proposalCount++;
if ( $typeId == 'sc' ) {
// A single choice object with no
correct proposal is a syntax error.
if ( $expectOn == 0 ) {
@@ -247,12 +253,25 @@
}
$expectOn = 0;
}
+ }
+ }
+ $counter = 0;
+ foreach( $raws as $proposalId => $raw ) {
+ $text = null;
+ $colSpan = '';
+ $signesOutput = '';
+ $isProposal = 0;
+ if ( preg_match( $this->mProposalPattern, $raw,
$matches ) ) {
+ $isProposal = 1;
+ $rawClass = 'proposal';
+ $text = array_pop( $matches );
// If the proposal text is empty, the question
has a syntax error.
if ( trim( $text ) == '' ) {
$text = '???';
$this->setState( 'error' );
}
- } elseif ( preg_match( $this->mCorrectionPattern, $raw,
$matches ) && $this->mBeingCorrected ) {
+ } elseif ( preg_match( $this->mCorrectionPattern, $raw,
$matches ) && $this->mBeingCorrected && $attemptChecker ) {
+ $isProposal = 0;
$rawClass = 'correction';
$text = array_pop( $matches );
$signesOutput = '';
@@ -261,7 +280,12 @@
}
if ( $text ) {
$output .= '' .
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/356983 )
Change subject: Suppressing question numbering in a quiz when only one question
in a quiz
..
Suppressing question numbering in a quiz when only one question in a quiz
Bug:T162803
Change-Id: I6931c03208d8ecece0b8113c3b0603f8c0682187
---
M Quiz.class.php
M templates/Question.mustache
2 files changed, 10 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/83/356983/1
diff --git a/Quiz.class.php b/Quiz.class.php
index 6f6c9c8..ec308d7 100755
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -250,6 +250,8 @@
$output = '';
$questionPattern = '`(.*?[^|\}])\}[ \t]*(\n(.*)|$)`s';
+ $numQuestion = count( $unparsedQuestions );
+ $numDisplay = ( $numQuestion == 1 ) ? false : true;
foreach ( $unparsedQuestions as $unparsedQuestion ) {
// If this "unparsedQuestion" is not a full question,
// we put the text into a buffer to add it at the
beginning of the next question.
@@ -259,7 +261,7 @@
if ( preg_match( $questionPattern, $unparsedQuestion,
$matches ) ) {
$buffer = '';
- $output .= $this->parseQuestion( $matches );
+ $output .= $this->parseQuestion( $matches ,
$numDisplay );
} else {
$buffer = $unparsedQuestion;
}
@@ -279,9 +281,10 @@
* @param $matches array: elements matching $questionPattern.
* $matches[1] is the
question header.
* $matches[3] is the
question object.
+* @param $numDisplay Boolean: specifies whether to display question
number.
* @return string
*/
- function parseQuestion( $matches ) {
+ function parseQuestion( $matches , $numDisplay ) {
$question = new Question(
$this->mBeingCorrected,
$this->mCaseSensitive,
@@ -401,6 +404,7 @@
array(
'question' => array(
'id' => $this->mQuestionId,
+ 'numdis' => $numDisplay,
'text' => $questionText,
'answers' => $answers
),
diff --git a/templates/Question.mustache b/templates/Question.mustache
index 790f13a..54c70d9 100644
--- a/templates/Question.mustache
+++ b/templates/Question.mustache
@@ -1,6 +1,8 @@
- {{ question.id }}
+ {{#if question.numdis }}
+ {{ question.id }}
+ {{/if}}
{{{ question.text }}}
@@ -8,4 +10,4 @@
{{{ question.answers }}}
-
\ No newline at end of file
+
--
To view, visit https://gerrit.wikimedia.org/r/356983
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6931c03208d8ecece0b8113c3b0603f8c0682187
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/356110 )
Change subject: Transparent Background for feedback of quiz inside table
..
Transparent Background for feedback of quiz inside table
Bug:T165398
Change-Id: I206ed9c327dac01881c18d7332aa0988218e75ef
---
M modules/ext.quiz.css
1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/10/356110/1
diff --git a/modules/ext.quiz.css b/modules/ext.quiz.css
index b23f361..1d6449e 100644
--- a/modules/ext.quiz.css
+++ b/modules/ext.quiz.css
@@ -6,8 +6,11 @@
text-indent: -1.5em;
}
-.quiz table.object,
-.quiz table.correction {
+.quiz table.object {
+ background-color: transparent;
+}
+
+.quiz .object .correction {
background-color: transparent;
}
--
To view, visit https://gerrit.wikimedia.org/r/356110
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I206ed9c327dac01881c18d7332aa0988218e75ef
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/344726 )
Change subject: Put Html code of Answer in Question.php into mustache template
..
Put Html code of Answer in Question.php into mustache template
Bug:T161318
Change-Id: Ie9641d58db4c0380ce928b930fbb3725d830e6bb
---
M Question.php
A templates/Answer.mustache
2 files changed, 44 insertions(+), 20 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/26/344726/1
diff --git a/Question.php b/Question.php
index 109c563..ebc723d 100755
--- a/Question.php
+++ b/Question.php
@@ -359,26 +359,31 @@
if ( array_key_exists( 3, $input ) ) {
$size = $input[3];
if ( $size < 3 ) {
- $size = 'size="1"';
+ $size = '1';
} elseif ( $size < 12 ) {
- $size = 'size="' . ( $size - 2 ) . '"';
+ $size = "'" . ( $size - 2 ) . "'";
} else {
- $size = 'size="' . ( $size - 1 ) . '"';
+ $size = "'" . ( $size - 1 ) . "'";
}
- $maxlength = 'maxlength="' . $input[3] . '"';
+ $maxlength = "'" . $input[3] . "'";
}
// Syntax error if there is no input text.
if ( empty( $input[1] ) ) {
$value = 'value="???"';
$state = 'error';
} else {
+ $templateParser = new TemplateParser( __DIR__ .
'/templates' );
+ $bigDisplay = 'display: none'; //For hiding down arrow
+
if ( $this->mBeingCorrected ) {
$value = trim( $this->mRequest->getVal(
$wqInputId ) );
- $a_inputBeg = '';
$state = 'NA';
- $title = 'title="' . wfMessage( 'quiz_colorNA'
)->escaped() . '"';
+ $a_inputBeg = '';
+ $title = wfMessage( 'quiz_colorNA' )->escaped();
+
}
- $class = 'class="numbers"';
+ $class = 'numbers';
+ $poss = ' ';
foreach ( preg_split( '` *\| *`', trim( $input[1] ),
-1, PREG_SPLIT_NO_EMPTY ) as $possibility ) {
if ( $state == '' || $state == 'NA' || $state
== 'wrong' ) {
if ( preg_match(
'`^(-?\d+\.?\d*)(-(-?\d+\.?\d*)| (\d+\.?\d*)(%))?$`', str_replace( ',', '.',
$possibility ), $matches ) ) {
@@ -399,25 +404,25 @@
) ||
$value == $possibility )
) {
$state =
'right';
- $title =
'title="' . wfMessage( 'quiz_colorRight' )->escaped() . '"';
+ $title =
wfMessage( 'quiz_colorRight' )->escaped();
} else {
$state =
'wrong';
- $title =
'title="' . wfMessage( 'quiz_colorWrong' )->escaped() . '"';
+ $title =
wfMessage( 'quiz_colorWrong' )->escaped();
}
}
} else {
$strlen = preg_match( '`
\(i\)$`', $possibility ) ? mb_strlen( $possibility ) - 4 : mb_strlen(
$possibility );
- $class = 'class="words"';
+ $class = 'words';
if ( $this->mBeingCorrected &&
!empty( $value ) ) {
if ( $value ==
$possibility ||
( preg_match(
'`^' . preg_quote( $value, '`' ) . ' \(i\)$`i', $possibility ) ) ||
(
!$this->mCaseSensitive && preg_match( '`^' . preg_quote( $value, '`' ) . '$`i',
$possibility ) )
) {
$state =
'right';
- $title =
'title="' .
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342443 )
Change subject: Disable default quick survey
..
Disable default quick survey
Bug: T159739
Change-Id: If681dfa34c7c4dccc302335442e2b5879bcdf743
---
M wmf-config/CommonSettings-labs.php
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config
refs/changes/43/342443/1
diff --git a/wmf-config/CommonSettings-labs.php
b/wmf-config/CommonSettings-labs.php
index 2fb2051..208203a 100644
--- a/wmf-config/CommonSettings-labs.php
+++ b/wmf-config/CommonSettings-labs.php
@@ -228,7 +228,7 @@
"anne-survey-answer-four"
],
"schema" => "QuickSurveysResponses",
- "enabled" => true,
+ "enabled" => false,
"coverage" => 0,
"description" => "anne-survey-description",
"platforms" => [
@@ -246,7 +246,7 @@
"ext-quicksurveys-example-internal-survey-answer-negative",
],
"schema" => "QuickSurveysResponses",
- "enabled" => true,
+ "enabled" => false,
"coverage" => .5,
"description" =>
"ext-quicksurveys-example-internal-survey-description",
"platforms" => [
@@ -262,7 +262,7 @@
"link" =>
"ext-quicksurveys-example-external-survey-link",
"privacyPolicy" =>
"ext-quicksurveys-example-external-survey-privacy-policy",
'coverage' => .5,
- 'enabled' => true,
+ 'enabled' => false,
'platforms' => [
'desktop' => [ 'stable' ],
'mobile' => [ 'stable', 'beta' ],
--
To view, visit https://gerrit.wikimedia.org/r/342443
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If681dfa34c7c4dccc302335442e2b5879bcdf743
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342439 )
Change subject: Secure call to DOMDocument::loadHTML()
..
Secure call to DOMDocument::loadHTML()
Bug: T159458
Change-Id: I2bc425a34ef5cbfb641b285dc155368cc8937129
---
M includes/PF_AutoeditAPI.php
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms
refs/changes/39/342439/1
diff --git a/includes/PF_AutoeditAPI.php b/includes/PF_AutoeditAPI.php
index f46ddc5..20de345 100644
--- a/includes/PF_AutoeditAPI.php
+++ b/includes/PF_AutoeditAPI.php
@@ -989,11 +989,13 @@
$data = array( );
$doc = new DOMDocument();
+ $oldVal = libxml_disable_entity_loader( true );
@$doc->loadHTML(
'http://www.w3.org/TR/REC-html40/loose.dtd;>'
. $html
. ''
);
+ libxml_disable_entity_loader( $oldVal );
// Process input tags.
$inputs = $doc->getElementsByTagName( 'input' );
@@ -1247,4 +1249,4 @@
return __CLASS__ . '-' . PF_VERSION . ($gitSha1 !== false) ? '
(' . substr( $gitSha1, 0, 7 ) . ')' : '';
}
-}
\ No newline at end of file
+}
--
To view, visit https://gerrit.wikimedia.org/r/342439
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bc425a34ef5cbfb641b285dc155368cc8937129
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageForms
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342307 )
Change subject: Add Disable Outside Service button
..
Add Disable Outside Service button
Bug: T159404
Change-Id: I032f3b2b260f7672c2584e85e601fd9c33291b1a
---
M PageForms.php
M i18n/en.json
M includes/PF_FormPrinter.php
M includes/PF_Hooks.php
M specials/PF_CreateForm.php
5 files changed, 34 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms
refs/changes/07/342307/1
diff --git a/PageForms.php b/PageForms.php
index 9891bde..5c57334 100644
--- a/PageForms.php
+++ b/PageForms.php
@@ -107,9 +107,12 @@
// This global variable is needed so that other extensions can
// hook into it to add their own input types.
$GLOBALS['wgPageFormsFormPrinter'] = new StubObject(
'wgPageFormsFormPrinter', 'PFFormPrinter' );
+ $GLOBALS['wgPageFormsDisableOutsideServices'] = new StubObject(
'wgPageFormsDisableOutsideServices', 'PFFormPrinter' );
};
} else {
$GLOBALS['wgPageFormsFormPrinter'] = new StubObject(
'wgPageFormsFormPrinter', 'PFFormPrinter' );
+ $GLOBALS['wgPageFormsDisableOutsideServices'] = new StubObject(
'wgPageFormsDisableOutsideServices', 'PFFormPrinter' );
+
}
$GLOBALS['wgHooks']['LinkEnd'][] = 'PFFormLinker::setBrokenLink';
diff --git a/i18n/en.json b/i18n/en.json
index ebefa68..8314239 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -107,6 +107,8 @@
"pf_createform_template": "Template:",
"pf_createform_templatelabelinput": "Template label (optional):",
"pf_createform_allowmultiple": "Allow for multiple (or zero) instances
of this template in the created page",
+ "pf_createform_disableoutside": "Disable Outside Services",
+ "pf_createform_enableoutside": "Enable Outside Services",
"pf_createform_field": "Field:",
"pf_createform_fieldprop": "This field defines the property $1, of type
$2.",
"pf_createform_fieldproplist": "This field defines a list of elements
that have the property $1, of type $2.",
diff --git a/includes/PF_FormPrinter.php b/includes/PF_FormPrinter.php
index 3895982..2adee7f 100644
--- a/includes/PF_FormPrinter.php
+++ b/includes/PF_FormPrinter.php
@@ -12,6 +12,7 @@
* @file
* @ingroup PF
*/
+global $wgPageFormsDisableOutsideServices;
class PFFormPrinter {
@@ -59,11 +60,12 @@
$this->registerInputType( 'PFRatingInput' );
// Add this if the Semantic Maps extension is not
// included, or if it's SM (really Maps) v4.0 or higher.
- if ( !defined( 'SM_VERSION' ) || version_compare( SM_VERSION,
'4.0', '>=' ) ) {
- $this->registerInputType( 'PFGoogleMapsInput' );
+ if( !$GLOBALS['wgPageFormsDisableOutsideServices'] ){
+ if ( !defined( 'SM_VERSION' ) || version_compare(
SM_VERSION, '4.0', '>=' ) ) {
+ $this->registerInputType( 'PFGoogleMapsInput' );
+ }
+ $this->registerInputType( 'PFOpenLayersInput' );
}
- $this->registerInputType( 'PFOpenLayersInput' );
-
// All-purpose setup hook.
Hooks::run( 'PageForms::FormPrinterSetup', array( $this ) );
}
diff --git a/includes/PF_Hooks.php b/includes/PF_Hooks.php
index f2859da..bee038f 100644
--- a/includes/PF_Hooks.php
+++ b/includes/PF_Hooks.php
@@ -54,6 +54,7 @@
// extensions can hook into it to add their own
// input types.
$GLOBALS['wgPageFormsFormPrinter'] = new StubObject(
'wgPageFormsFormPrinter', 'PFFormPrinter' );
+ $GLOBALS['wgPageFormsDisableOutsideServices'] = new StubObject(
'wgPageFormsDisableOutsideServices', 'PFFromPrinter' );
}
/**
diff --git a/specials/PF_CreateForm.php b/specials/PF_CreateForm.php
index 6cc4c5a..20d6ee2 100644
--- a/specials/PF_CreateForm.php
+++ b/specials/PF_CreateForm.php
@@ -54,6 +54,7 @@
}
function doSpecialCreateForm( $query ) {
+ global $wgPageFormsDisableOutsideServices;
$out = $this->getOutput();
$req = $this->getRequest();
$db = wfGetDB( DB_SLAVE );
@@ -258,6 +259,15 @@
// If a submit button was pressed, create the form-definition
// file, then redirect.
$save_page = $req->getCheck( 'wpSave' );
+ $wgPageFormsDisableOutsideServices = 0;
+ $enable_service = $req->getCheck( 'enableoutside');
+ $disable_service = $req->getCheck( 'disableoutside' );
+ if( $disable_service ){
+ $wgPageFormsDisableOutsideServices = 1;
+ }
+ if( $enable_service ){
+
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342249 )
Change subject: Remove RVM lines from Transparency Report
..
Remove RVM lines from Transparency Report
Bug: T1331
Change-Id: Id43d7e328e98bb0d7a323da183825fe8867a0c5f
---
M Gemfile
1 file changed, 0 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/TransparencyReport
refs/changes/49/342249/1
diff --git a/Gemfile b/Gemfile
index d8bea2c..10e1680 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,3 @@
-#ruby=ruby-2.1.1
-#ruby-gemset=transparencyreport
-
# If you have OpenSSL installed, we recommend updating
# the following line to use "https"
source 'http://rubygems.org'
--
To view, visit https://gerrit.wikimedia.org/r/342249
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id43d7e328e98bb0d7a323da183825fe8867a0c5f
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/TransparencyReport
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342216 )
Change subject: Remove RVM lines from MediaWiki API from Ruby
..
Remove RVM lines from MediaWiki API from Ruby
Bug: T1331
Change-Id: Iceb49ba6b70dc07abc103fe5355ac8356ea3313c
---
M Gemfile
1 file changed, 0 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/ruby/api
refs/changes/16/342216/1
diff --git a/Gemfile b/Gemfile
index 623bd57..9fc9c8a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,3 @@
-# ruby=ruby-2.1.2
-# ruby-gemset=mediawiki_api
-
source 'https://rubygems.org'
# Specify your gem's dependencies in mediawiki_api.gemspec
--
To view, visit https://gerrit.wikimedia.org/r/342216
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iceb49ba6b70dc07abc103fe5355ac8356ea3313c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/ruby/api
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342189 )
Change subject: Remove RVM lines from Wikibase extension
..
Remove RVM lines from Wikibase extension
Bug: T1331
Change-Id: Ie4bfb5275740373abf6842ef212d4c1b93e65a99
---
M Gemfile
1 file changed, 0 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/89/342189/1
diff --git a/Gemfile b/Gemfile
index 80c8b61..37f232a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,3 @@
-# ruby=ruby-2.1.1
-# ruby-gemset=Wikibase
-
source 'https://rubygems.org'
gem 'activesupport', '~> 4.2', '>= 4.2.6'
--
To view, visit https://gerrit.wikimedia.org/r/342189
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4bfb5275740373abf6842ef212d4c1b93e65a99
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342184 )
Change subject: Remove RVM lines from Wikidata extension
..
Remove RVM lines from Wikidata extension
Bug: T1331
Change-Id: I53edfcc1ed4c2d886fbea0f08088d635f6cc002a
---
M extensions/Wikibase/Gemfile
1 file changed, 0 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata
refs/changes/84/342184/1
diff --git a/extensions/Wikibase/Gemfile b/extensions/Wikibase/Gemfile
index 80c8b61..37f232a 100644
--- a/extensions/Wikibase/Gemfile
+++ b/extensions/Wikibase/Gemfile
@@ -1,6 +1,3 @@
-# ruby=ruby-2.1.1
-# ruby-gemset=Wikibase
-
source 'https://rubygems.org'
gem 'activesupport', '~> 4.2', '>= 4.2.6'
--
To view, visit https://gerrit.wikimedia.org/r/342184
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I53edfcc1ed4c2d886fbea0f08088d635f6cc002a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikidata
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342181 )
Change subject: Remove RVM lines from PoolCounter extension
..
Remove RVM lines from PoolCounter extension
Bug: T1331
Change-Id: I62b164fe4166a034fe59b6f1ef806fe1647a042d
---
M Gemfile
1 file changed, 0 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PoolCounter
refs/changes/81/342181/1
diff --git a/Gemfile b/Gemfile
index dd68e60..7326655 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,3 @@
-#ruby=ruby-2.1.5
-#ruby-gemset=PoolCounter
-
source 'https://rubygems.org'
gem 'cucumber'
--
To view, visit https://gerrit.wikimedia.org/r/342181
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I62b164fe4166a034fe59b6f1ef806fe1647a042d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PoolCounter
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342177 )
Change subject: Disable default quick survey
..
Disable default quick survey
Bug: T159739
Change-Id: I1e5792c752fea985e2e8a18deffcd8c986b9cad2
---
M tests/browser/LocalSettings.php
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuickSurveys
refs/changes/77/342177/1
diff --git a/tests/browser/LocalSettings.php b/tests/browser/LocalSettings.php
index cf7405c..eefff45 100644
--- a/tests/browser/LocalSettings.php
+++ b/tests/browser/LocalSettings.php
@@ -11,7 +11,7 @@
"anne-survey-answer-four"
],
"schema" => "QuickSurveysResponses",
- "enabled" => true,
+ "enabled" => false,
"coverage" => 0,
"description" => "anne-survey-description",
"platforms" => [
@@ -29,7 +29,7 @@
"ext-quicksurveys-example-internal-survey-answer-negative",
],
"schema" => "QuickSurveysResponses",
- "enabled" => true,
+ "enabled" => false,
"coverage" => .5,
"description" =>
"ext-quicksurveys-example-internal-survey-description",
"platforms" => [
@@ -46,7 +46,7 @@
"instanceTokenParameterName" => "parameterName",
"privacyPolicy" =>
"ext-quicksurveys-example-external-survey-privacy-policy",
"coverage" => .5,
- "enabled" => true,
+ "enabled" => false,
"platforms" => [
"desktop" => [ "stable" ],
"mobile" => [ "stable", "beta" ],
--
To view, visit https://gerrit.wikimedia.org/r/342177
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e5792c752fea985e2e8a18deffcd8c986b9cad2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/QuickSurveys
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342076 )
Change subject: Add filter by project on Special:GlobalUsage [WIP]
..
Add filter by project on Special:GlobalUsage [WIP]
Bug:T38859
Change-Id: I59cd0303492821d4734e2b6c2e2704f45e9609d2
---
M SpecialGlobalUsage.php
M i18n/en.json
2 files changed, 33 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalUsage
refs/changes/76/342076/1
diff --git a/SpecialGlobalUsage.php b/SpecialGlobalUsage.php
index 8c23783..cd15bab 100644
--- a/SpecialGlobalUsage.php
+++ b/SpecialGlobalUsage.php
@@ -73,6 +73,19 @@
'align' => 'top',
]
);
+ // T38859
+ $fields[] = new OOUI\FieldLayout(
+new OOUI\TextInputWidget( [
+'name' => 'filter',
+'id' => 'filter',
+'autosize' => true,
+] ),
+[
+'label' => $this->msg( 'globalusage-filter'
)->text(),
+'align' => 'top',
+]
+);
+
// Filter local checkbox
$fields[] = new OOUI\FieldLayout(
@@ -153,6 +166,7 @@
}
$query->setLimit( $request->getInt( 'limit', 50 ) );
$query->filterLocal( $this->filterLocal );
+ $filter = $request->getVal('filter');
// Perform query
$query->execute();
@@ -163,6 +177,7 @@
return;
}
+ $found = 0;
$navbar = $this->getNavBar( $query );
$targetName = $this->target->getText();
$out = $this->getOutput();
@@ -172,15 +187,24 @@
$out->addHtml( '' );
foreach ( $query->getSingleImageResult() as $wiki => $result ) {
- $out->addHtml(
- '' . $this->msg(
- 'globalusage-on-wiki',
- $targetName, WikiMap::getWikiName(
$wiki ) )->parse()
- . "\n" );
- foreach ( $result as $item ) {
- $out->addHtml( "\t" . self::formatItem(
$item ) . "\n" );
+ $project = WikiMap::getWikiName( $wiki ) ;
+ if($project == $filter || $filter=='' ) {
+ $found++;
+ $out->addHtml(
+ '' . $this->msg(
+ 'globalusage-on-wiki',
+ $targetName,
WikiMap::getWikiName( $wiki ) )->parse()
+ . "\n" );
+ foreach ( $result as $item ) {
+ $out->addHtml( "\t" .
self::formatItem( $item ) . "\n" );
+ }
+ $out->addHtml( "\n" );
+ }else {
+ continue;
}
- $out->addHtml( "\n" );
+ }
+ if($found ==0 ) {
+ $out->addHtml( "".$found." Results " );
}
$out->addHtml( '' );
diff --git a/i18n/en.json b/i18n/en.json
index d4db06c..2ccbef8 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -7,6 +7,7 @@
"globalusage": "Global file usage",
"globalusage-for": "Global usage for \"$1\"",
"globalusage-filename": "Filename:",
+ "globalusage-filter": "Project Filter:",
"globalusage-desc": "[[Special:GlobalUsage|Special page]] to view
global file usage",
"globalusage-ok": "Search",
"globalusage-text": "Search global file usage",
--
To view, visit https://gerrit.wikimedia.org/r/342076
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I59cd0303492821d4734e2b6c2e2704f45e9609d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalUsage
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/332037 )
Change subject: Convert space after § to non-breaking spaces
..
Convert space after § to non-breaking spaces
Bug: T119463
Change-Id: I2b68849bcacbc356cafa2a35cf570379284fef4f
---
M includes/parser/Parser.php
M tests/parser/parserTests.txt
2 files changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/37/332037/1
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 79fc172..9fedff4 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -1339,6 +1339,7 @@
'/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1',
# french spaces, Guillemet-right
'/(\\302\\253) /' => '\\1',
+ '/(§) (.)/' => '§', # Bug T119463
'/(!\s*important)/' => ' \\1', # Beware of CSS
magic word !important, T13874.
];
$text = preg_replace( array_keys( $fixtags ), array_values(
$fixtags ), $text );
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 3853a12..9ca617a 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -2406,6 +2406,14 @@
!! end
!! test
+Non-breaking spaces after §
+!! wikitext
+U.S § 152
+!! html
+U.S §152
+!! end
+
+!! test
HTML pre followed by indent-pre
!! wikitext
foo
--
To view, visit https://gerrit.wikimedia.org/r/332037
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b68849bcacbc356cafa2a35cf570379284fef4f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/320612
Change subject: Add class error to Warning
..
Add class error to Warning
Bug:T114883
Change-Id: I17d02c18ba0e92f5bdc4edf57f040b56299a735b
---
M includes/EditPage.php
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/12/320612/1
diff --git a/includes/EditPage.php b/includes/EditPage.php
index ad308b1..b6f5198 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -3871,7 +3871,7 @@
$wgOut->addParserOutputMetadata( $parserOutput );
if ( count( $parserOutput->getWarnings() ) ) {
- $note .= "\n\n" . implode( "\n\n",
$parserOutput->getWarnings() );
+ $note .= "\n\n " . implode(
"\n\n", $parserOutput->getWarnings() )."";
}
} catch ( MWContentSerializationException $ex ) {
--
To view, visit https://gerrit.wikimedia.org/r/320612
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I17d02c18ba0e92f5bdc4edf57f040b56299a735b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/320064
Change subject: Removing Hardcoded Css and $wgContLang from parseQuiz()
function.
..
Removing Hardcoded Css and $wgContLang from parseQuiz() function.
Bug: T40372
Change-Id: I69d95d153d6d1da1e019ae5ad2c3e7a4667971b5
---
M Quiz.class.php
1 file changed, 7 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz
refs/changes/64/320064/1
diff --git a/Quiz.class.php b/Quiz.class.php
index 06a65e0..df2b41e 100644
--- a/Quiz.class.php
+++ b/Quiz.class.php
@@ -108,18 +108,15 @@
function parseQuiz( $input ) {
# Ouput the style and the script to the header once for all.
if( $this->mQuizId == 0 ) {
- global $wgContLang;
- $start = $wgContLang->isRTL() ? 'right' : 'left';
- $end = $wgContLang->isRTL() ? 'left' : 'right';
$head = "\n";
- $head .= ".quiz .question { margin-$start: 2em; }\n";
- $head .= ".quiz .margin { padding-$start: 20px; }\n";
- $head .= ".quiz .header .questionId { font-size: 1.1em;
font-weight: bold; float: $start;}\n";
- $head .= ".quiz a.input em { color:black;
background-color:#DFDFDF; margin-$end:1px; }\n";
- $head .= ".quiz a.input input { padding-$start:2px;
border:0; }\n";
+ $head .= ".quiz .question { margin-left: 2em; }\n";
+ $head .= ".quiz .margin { padding-left: 20px; }\n";
+ $head .= ".quiz .header .questionId { font-size: 1.1em;
font-weight: bold; float: left;}\n";
+ $head .= ".quiz a.input em { color:black;
background-color:#DFDFDF; margin-right:1px; }\n";
+ $head .= ".quiz a.input input { padding-left:2px;
border:0; }\n";
- $head .= '.quiz .correction { background-color: ' .
Quiz::getColor( 'correction' ) . ";}\n";
- $head .= ".quiz a.input span.correction { padding:3px;
margin:0; list-style-type:none; display:none; background-color:" .
Quiz::getColor( 'correction' ) . "; }\n";
+ $head .= ".quiz .correction { background-color:#F9F9F9;
}\n";
+ $head .= ".quiz a.input span.correction { padding:3px;
margin:0; list-style-type:none; display:none; background-color:#F9F9F9; }\n";
$head .= "\n";
global $wgOut;
--
To view, visit https://gerrit.wikimedia.org/r/320064
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I69d95d153d6d1da1e019ae5ad2c3e7a4667971b5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/277503
Change subject: [WIP] Add filter by project on Special:GlobalUsage
..
[WIP] Add filter by project on Special:GlobalUsage
Bug:T38859
Change-Id: I2de6cb43c3afaa05a81ddda65e1ec11f5e996807
---
M SpecialGlobalUsage.php
1 file changed, 21 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalUsage
refs/changes/03/277503/1
diff --git a/SpecialGlobalUsage.php b/SpecialGlobalUsage.php
index d896bc3..99a5b06 100644
--- a/SpecialGlobalUsage.php
+++ b/SpecialGlobalUsage.php
@@ -58,6 +58,9 @@
// Input box with target prefilled if available
$formContent = "\t" . Xml::input( 'target', 40, is_null(
$this->target ) ? ''
: $this->target->getText() )
+ //Filter for Project
+ . "\n\t" . Xml::inputLabel('Filter
Project','projectFilter', 20,
+ is_null( $this->projectFilter ) ? '' :
$this->projectFilter)
// Submit button
. "\n\t" . Xml::element( 'input', array(
'type' => 'submit',
@@ -100,7 +103,7 @@
}
$query->setLimit( $request->getInt( 'limit', 50 ) );
$query->filterLocal( $this->filterLocal );
-
+ $projectFilter= $this->getRequest()->getVal('projectFilter');
// Perform query
$query->execute();
@@ -109,7 +112,7 @@
$this->getOutput()->addWikiMsg(
'globalusage-no-results', $this->target->getPrefixedText() );
return;
}
-
+ $resFound=0;
$navbar = $this->getNavBar( $query );
$targetName = $this->target->getText();
$out = $this->getOutput();
@@ -119,15 +122,23 @@
$out->addHtml( '' );
foreach ( $query->getSingleImageResult() as $wiki => $result ) {
- $out->addHtml(
- '' . $this->msg(
- 'globalusage-on-wiki',
- $targetName, WikiMap::getWikiName(
$wiki ) )->parse()
- . "\n" );
- foreach ( $result as $item ) {
- $out->addHtml( "\t" . self::formatItem(
$item ) . "\n" );
+ $project = WikiMap::getWikiName( $wiki ) ;
+ if($project == $projectFilter || $projectFilter==''){
+ $resFound++;
+ $out->addHtml('' . $this->msg(
+ 'globalusage-on-wiki',
+ $targetName,
WikiMap::getWikiName( $wiki ) )->parse()
+ . "\n" );
+ foreach ( $result as $item ) {
+ $out->addHtml( "\t" .
self::formatItem( $item ) . "\n" );
+ }
+ $out->addHtml( "\n" );
+ }else{
+continue;
}
- $out->addHtml( "\n" );
+ }
+ if($resFound==0){
+ $out->addHtml(''.$resFound." Results ");
}
$out->addHtml( '' );
--
To view, visit https://gerrit.wikimedia.org/r/277503
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2de6cb43c3afaa05a81ddda65e1ec11f5e996807
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalUsage
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/275208
Change subject: Add class error to Warning
..
Add class error to Warning
Bug:T114883
Change-Id: I3a1018af09e9e42adcc07957a629457df7c18e2e
---
M includes/EditPage.php
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/08/275208/1
diff --git a/includes/EditPage.php b/includes/EditPage.php
index 1455068..223db13 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -3736,10 +3736,10 @@
} else {
$conflict = '';
}
-
+ $err = [ 'class' => 'error'];
$previewhead = "\n" .
'' . wfMessage( 'preview'
)->escaped() . "" .
- $wgOut->parse( $note, true, /* interface */true ) .
$conflict . "\n";
+ $wgOut->parse( $note = HTML::rawElement( 'p', $err,
$note ), true, /* interface */true ) . $conflict . "\n";
$pageViewLang = $this->mTitle->getPageViewLanguage();
$attribs = [ 'lang' => $pageViewLang->getHtmlCode(), 'dir' =>
$pageViewLang->getDir(),
--
To view, visit https://gerrit.wikimedia.org/r/275208
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a1018af09e9e42adcc07957a629457df7c18e2e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/275160
Change subject: Added jQuery version to Special:Version
..
Added jQuery version to Special:Version
Bug:T34892
Change-Id: I25705d33eb0fa52d1a1e5c0651d7a36bf5d08a7d
---
M includes/specials/SpecialVersion.php
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/60/275160/1
diff --git a/includes/specials/SpecialVersion.php
b/includes/specials/SpecialVersion.php
index c0f9590..ee59f9b 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -222,6 +222,7 @@
$software['[https://php.net/ PHP]'] = PHP_VERSION . "
(" . PHP_SAPI . ")";
}
$software[$dbr->getSoftwareLink()] = $dbr->getServerInfo();
+ $software['[https://www.jquery.com/ jQuery]'] = "1.11.3";
if ( IcuCollation::getICUVersion() ) {
$software['[http://site.icu-project.org/ ICU]'] =
IcuCollation::getICUVersion();
--
To view, visit https://gerrit.wikimedia.org/r/275160
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I25705d33eb0fa52d1a1e5c0651d7a36bf5d08a7d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/274773
Change subject: Added jQuery Version
..
Added jQuery Version
Bug:T34892
Change-Id: I1b83d7f832ecfb93b738239d52db988a3f05e9f0
Convert spaces after section markers (§) into non-breaking spaces
Bug:T119463
Change-Id: I0a27c754ef5d7ca2ea82993bd078fffc9b1c2138
---
M includes/parser/Parser.php
M includes/specials/SpecialVersion.php
2 files changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/73/274773/1
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index d65e8be..6947e49 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -1301,6 +1301,7 @@
'/(.) (?=\\?|:|;|!|%|\\302\\273)/' => '\\1',
# french spaces, Guillemet-right
'/(\\302\\253) /' => '\\1',
+'/(§)(.)/' => '§',
'/(!\s*important)/' => ' \\1', # Beware of CSS
magic word !important, bug #11874.
];
$text = preg_replace( array_keys( $fixtags ), array_values(
$fixtags ), $text );
diff --git a/includes/specials/SpecialVersion.php
b/includes/specials/SpecialVersion.php
index c0f9590..88cf551 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -222,6 +222,7 @@
$software['[https://php.net/ PHP]'] = PHP_VERSION . "
(" . PHP_SAPI . ")";
}
$software[$dbr->getSoftwareLink()] = $dbr->getServerInfo();
+$software['[https://www.jquery.com/ jQuery]'] = "1.11.3";
if ( IcuCollation::getICUVersion() ) {
$software['[http://site.icu-project.org/ ICU]'] =
IcuCollation::getICUVersion();
--
To view, visit https://gerrit.wikimedia.org/r/274773
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a27c754ef5d7ca2ea82993bd078fffc9b1c2138
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
Harjotsingh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/274770
Change subject: Added jQuery Version
..
Added jQuery Version
Change-Id: I1b83d7f832ecfb93b738239d52db988a3f05e9f0
---
M includes/specials/SpecialVersion.php
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/70/274770/1
diff --git a/includes/specials/SpecialVersion.php
b/includes/specials/SpecialVersion.php
index c0f9590..88cf551 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -222,6 +222,7 @@
$software['[https://php.net/ PHP]'] = PHP_VERSION . "
(" . PHP_SAPI . ")";
}
$software[$dbr->getSoftwareLink()] = $dbr->getServerInfo();
+$software['[https://www.jquery.com/ jQuery]'] = "1.11.3";
if ( IcuCollation::getICUVersion() ) {
$software['[http://site.icu-project.org/ ICU]'] =
IcuCollation::getICUVersion();
--
To view, visit https://gerrit.wikimedia.org/r/274770
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b83d7f832ecfb93b738239d52db988a3f05e9f0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
54 matches
Mail list logo
|
|
|
|