jenkins-bot has submitted this change and it was merged.

Change subject: Randomize task order and switch spelling to clarification.
......................................................................


Randomize task order and switch spelling to clarification.

To do this, I brought some stuff into the extension and refactored.
We can still reevaluate this later when the dynamic task generation is
more developed.

Note that the clarification task still uses the old copy and task image.

Change-Id: Id77584508f65e9f0141f3f2ad9d6c891cc57790f
---
M GettingStarted.hooks.php
M GettingStarted.i18n.php
M GettingStarted.php
M SpecialGettingStarted.php
M resources/ext.gettingstarted.js
M resources/tours/gettingstartedpage.js
6 files changed, 62 insertions(+), 27 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/GettingStarted.hooks.php b/GettingStarted.hooks.php
index 322361e..2e29110 100644
--- a/GettingStarted.hooks.php
+++ b/GettingStarted.hooks.php
@@ -62,8 +62,10 @@
                        }
                }
 
+               // Replace default message with blank one
                $welcomeCreationMsg = 'gettingstarted-msg';
-
+               $specialGS = new SpecialGettingStarted();
+               $injectHtml = $specialGS->getHtmlResult() . $injectHtml;
                $wgOut->addModules( 'ext.gettingstarted.accountcreation' );
 
                return true;
diff --git a/GettingStarted.i18n.php b/GettingStarted.i18n.php
index be4c2e9..bc423f7 100644
--- a/GettingStarted.i18n.php
+++ b/GettingStarted.i18n.php
@@ -13,11 +13,15 @@
 $messages['en'] = array(
        'gettingstarted' => "Getting started",
        'gettingstarted-desc' => 'Adds a [[Special:GettingStarted|welcome 
page]] for new users (shown after account creation)',
-       'gettingstarted-msg' => 'An administrator on {{SITENAME}} should 
customize this message by editing [[{{ns:MediaWiki}}:gettingstarted-msg]].',
+       'gettingstarted-msg' => '', // Intentionally blank
        'gettingstarted-welcomesiteuser' => "Welcome to $1, $2!",
        'gettingstarted-welcomesiteuseranon' => "Welcome to $1!",
+       'gettingstarted-task-header' => 'Here are some ways you can get 
started. Select an article below and try to improve it.',
        'gettingstarted-return' => "← No thanks, return to the page I was 
reading",
        'gettingstarted-project-link' => '{{ns:Project}}:GettingStarted',
+       'gettingstarted-task-1' => '',
+       'gettingstarted-task-2' => '',
+       'gettingstarted-task-3' => '',
        // Change tags
        'tag-gettingstarted_edit' => '[[Special:Tags|Tag]]: new editor 
[[{{MediaWiki:gettingstarted-project-link}}|getting started]]',
        'tag-gettingstarted_edit-description' => 'Edit of a page that the user 
chose from the task list in [[Special:GettingStarted|Getting started]]',
@@ -27,8 +31,8 @@
        // gettingstartedpage
        'guidedtour-tour-gettingstartedpage-copy-editing-title' => 'Copy 
editing',
        'guidedtour-tour-gettingstartedpage-copy-editing-description' => 'Copy 
editing is simply improving how things are worded. The pages below are in 
decent shape, but some users felt they could be better. See if you can improve 
things. Just click the {{int:vector-view-edit}} tab!',
-       'guidedtour-tour-gettingstartedpage-fix-spelling-title' => 'Fix 
spelling and grammar',
-       'guidedtour-tour-gettingstartedpage-fix-spelling-description' => 
'Fixing spelling and grammar is an easy way to improve the readability of 
{{SITENAME}}. Just click the {{int:vector-view-edit}} tab and make a couple 
fixes!',
+       'guidedtour-tour-gettingstartedpage-clarification-title' => 'Fix 
spelling and grammar',
+       'guidedtour-tour-gettingstartedpage-clarification-description' => 
'Fixing spelling and grammar is an easy way to improve the readability of 
{{SITENAME}}. Just click the {{int:vector-view-edit}} tab and make a couple 
fixes!',
        'guidedtour-tour-gettingstartedpage-add-links-title' => 'Adding links',
        'guidedtour-tour-gettingstartedpage-add-links-description' => "Have you 
ever accidentally spent two hours clicking around on {{SITENAME}}? We've been 
there. Pick one of these pages and look for potential links to others. Just 
click the {{int:vector-view-edit}} tab to add them!",
 
@@ -41,15 +45,18 @@
 $messages['qqq'] = array(
        'gettingstarted' => "The name of the extension's entry in 
[[Special:SpecialPages]]",
        'gettingstarted-desc' => '{{desc|name=Getting 
Started|url=http://www.mediawiki.org/wiki/Extension:GettingStarted}}',
-       'gettingstarted-msg' => 'Main content of Special:GettingStarted page.
-* $1 - username',
+       'gettingstarted-msg' => 'Blank message used to replace 
welcomecreation-msg.  Additional dynamically generated task HTML is injected',
        'gettingstarted-welcomesiteuser' => 'The title of the Getting Started 
page for logged-in users.
 * $1 - sitename
 * $2 - username; GENDER is supported',
        'gettingstarted-welcomesiteuseranon' => 'The title of the Getting 
Started page for anonymous users.
 * $1 - sitename',
+       'gettingstarted-task-header' => 'Header above task information',
        'gettingstarted-return' => 'Text of navigation button for returning to 
previous page',
        'gettingstarted-project-link' => 'Name of page that describes how 
GettingStarted is used on the wiki',
+       'gettingstarted-task-1' => 'Wikitext for first randomly ordered 
GettingStarted task message',
+       'gettingstarted-task-2' => 'Wikitext for second randomly ordered 
GettingStarted task message',
+       'gettingstarted-task-3' => 'Wikitext for third randomly ordered 
GettingStarted task message',
        'tag-gettingstarted_edit' => 'Text of tag identifying an edit from 
GettingStarted that appears e.g. in [[Special:RecentChanges]].
 
 See also:
@@ -57,8 +64,8 @@
        'tag-gettingstarted_edit-description' => 'Description of tag that 
appears e.g. in [[Special:Tags]]',
        'guidedtour-tour-gettingstartedpage-copy-editing-title' => 'Title of 
copy-editing tooltip on Special:GettingStarted',
        'guidedtour-tour-gettingstartedpage-copy-editing-description' => 
'Description of copy-editing tooltip on Special:GettingStarted',
-       'guidedtour-tour-gettingstartedpage-fix-spelling-title' => 'Title of 
spelling and grammar tooltip on Special:GettingStarted',
-       'guidedtour-tour-gettingstartedpage-fix-spelling-description' => 
'Description of spelling and grammar tooltip on Special:GettingStarted',
+       'guidedtour-tour-gettingstartedpage-clarification-title' => 'Title of 
clarification tooltip on Special:GettingStarted',
+       'guidedtour-tour-gettingstartedpage-clarification-description' => 
'Description of clarification tooltip on Special:GettingStarted',
        'guidedtour-tour-gettingstartedpage-add-links-title' => 'Title of 
tooltip about adding links on Special:GettingStarted',
        'guidedtour-tour-gettingstartedpage-add-links-description' => 
'Description of tooltip about adding links on Special:GettingStarted',
 );
diff --git a/GettingStarted.php b/GettingStarted.php
index dd87c43..94fb93f 100644
--- a/GettingStarted.php
+++ b/GettingStarted.php
@@ -46,6 +46,7 @@
        ),
 ) + $gettingStartedModuleInfo;
 
+// This runs on both account creation and the special page
 $wgResourceModules[ 'ext.gettingstarted' ] = array(
        'scripts' => 'ext.gettingstarted.js',
        'styles' => 'ext.gettingstarted.css',
@@ -57,7 +58,7 @@
        ),
 ) + $gettingStartedModuleInfo;
 
-// This is the version that runs on account creation.  It depends on the CSS 
code above.
+// This is the version that runs on account creation.
 $wgResourceModules[ 'ext.gettingstarted.accountcreation' ] = array(
        'scripts' => 'ext.gettingstarted.accountcreation.js',
        'messages' => array(
diff --git a/SpecialGettingStarted.php b/SpecialGettingStarted.php
index 72f0b6a..4034fa3 100644
--- a/SpecialGettingStarted.php
+++ b/SpecialGettingStarted.php
@@ -1,20 +1,18 @@
 <?php
 class SpecialGettingStarted extends SpecialPage {
-       function __construct() {
+       // Update GettingStarted.i18n.php too if this is changed
+       const TASK_COUNT = 3;
+
+       public function __construct() {
                parent::__construct( 'GettingStarted' );
        }
 
-       function execute( $par ) {
+       public function execute( $par ) {
                global $wgSitename;
 
-
-               $output = $this->getOutput();
-               $output->addModules( array(
-                               'ext.guidedTour.tour.gettingstartedpage',
-                               'ext.gettingstarted'
-               ) );
-
                $this->setHeaders();
+               $output = $this->getOutput();
+
                $user = $this->getUser();
                if( !$user->isAnon() ) {
                        $output->setPageTitle( $this->msg( 
'gettingstarted-welcomesiteuser', $wgSitename, $user->getName() ) );
@@ -22,8 +20,38 @@
                        $output->setPageTitle( $this->msg( 
'gettingstarted-welcomesiteuseranon', $wgSitename ) );
                }
 
-               $gettingstarted_msg = 'gettingstarted-msg';
+               $output->addModules( array(
+                               'ext.guidedTour.tour.gettingstartedpage',
+                               'ext.gettingstarted'
+               ) );
 
-               $output->addWikiMsg( $gettingstarted_msg, wfEscapeWikiText( 
$user->getName() ) );
+               $output->addHTML( $this->getHtmlResult() );
+       }
+
+       public function getHtmlResult() {
+               $result = '';
+               $headerText = $this->msg( 'gettingstarted-task-header' 
)->escaped();
+
+               $result .= <<< EOF
+                       <div class="onboarding-container clearfix">
+                               <h3 class="onboarding-header">
+                                       $headerText
+                               </h3>
+                               <ul class="clearfix" id="onboarding-tasks">
+EOF;
+               $tasks = array();
+               for ( $i = 1; $i <= self::TASK_COUNT; $i++ ) {
+                       $tasks[] = "gettingstarted-task-$i";
+               }
+               shuffle( $tasks );
+               foreach ( $tasks as $task ) {
+                       $result .= $this->msg( $task )->parse();
+               }
+
+               $result .= <<< 'EOF'
+                               </ul>
+                       </div>
+EOF;
+               return $result;
        }
 }
diff --git a/resources/ext.gettingstarted.js b/resources/ext.gettingstarted.js
index e956a0e..0af1ecd 100644
--- a/resources/ext.gettingstarted.js
+++ b/resources/ext.gettingstarted.js
@@ -57,10 +57,7 @@
                var $ancestorLi, stepNumber, tourId;
                $ancestorLi = $( this ).closest( 'li' );
                stepNumber = $ancestorLi.index() + 1;
-               tourId = gt.makeTourId( {
-                       name: 'gettingstartedpage',
-                       step: stepNumber
-               } );
+               tourId = $ancestorLi.data( 'guiderId' );
 
                // Wait until the event is over before showing it, so the
                // event doesn't propagate up and hide the guider we just 
showed.
diff --git a/resources/tours/gettingstartedpage.js 
b/resources/tours/gettingstartedpage.js
index 2ca4596..ef079da 100644
--- a/resources/tours/gettingstartedpage.js
+++ b/resources/tours/gettingstartedpage.js
@@ -11,9 +11,9 @@
                        attachTo: '.onboarding-help.copyedit',
                        position: 'right'
                }, {
-                       titlemsg: 
'guidedtour-tour-gettingstartedpage-fix-spelling-title',
-                       descriptionmsg: 
'guidedtour-tour-gettingstartedpage-fix-spelling-description',
-                       attachTo: '.onboarding-help.fixspelling',
+                       titlemsg: 
'guidedtour-tour-gettingstartedpage-clarification-title',
+                       descriptionmsg: 
'guidedtour-tour-gettingstartedpage-clarification-description',
+                       attachTo: '.onboarding-help.clarification',
                        position: 'right'
                }, {
                        titlemsg: 
'guidedtour-tour-gettingstartedpage-add-links-title',

-- 
To view, visit https://gerrit.wikimedia.org/r/49975
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id77584508f65e9f0141f3f2ad9d6c891cc57790f
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/GettingStarted
Gerrit-Branch: feature/gettingstartedv2
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Spage <[email protected]>
Gerrit-Reviewer: Swalling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to