r81872 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81871‎ | r81872 | r81873 >
Date:02:43, 10 February 2011
Author:kaldari
Status:deferred
Tags:
Comment:
adding interface and function for setting skip tutorial cookie
Modified paths:
  • /trunk/extensions/UploadWizard/SpecialUploadWizard.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -1596,6 +1596,10 @@
15971597 // handler for next button
15981598 $j( '#mwe-upwiz-stepdiv-tutorial .mwe-upwiz-button-next')
15991599 .click( function() {
 1600+ // if the skip checkbox is checked, set the skip cookie
 1601+ if ( $j('#mwe-upwiz-skip').is(':checked') ) {
 1602+ _this.setSkipTutorialCookie( 1 );
 1603+ }
16001604 _this.moveToStep( 'file', function() {
16011605 // we explicitly move the file input at this point
16021606 // because it was probably jumping around due to other "steps" on this page during file construction.
@@ -2223,6 +2227,16 @@
22242228 $j( '#mwe-upwiz-thanks' ).append( thanksDiv );
22252229 } );
22262230 },
 2231+
 2232+ /**
 2233+ * Set a cookie which lets the user skip the tutorial step in the future
 2234+ */
 2235+ setSkipTutorialCookie: function( state ) {
 2236+ var e = new Date();
 2237+ e.setTime( e.getTime() + (365*24*60*60*1000) ); // one year
 2238+ var cookieString='skiptutorial='+state+'; expires=' + e.toGMTString() + '; path=/';
 2239+ document.cookie = cookieString;
 2240+ },
22272241
22282242 /**
22292243 *
Index: trunk/extensions/UploadWizard/SpecialUploadWizard.php
@@ -196,6 +196,8 @@
197197 . UploadWizardTutorial::getHtml()
198198 . '</div>'
199199 . '<div class="mwe-upwiz-buttons">'
 200+ . '<input type="checkbox" id="mwe-upwiz-skip" value="1" name="skip">'
 201+ . '<label for="mwe-upwiz-skip">Skip this step in the future</label>'
200202 . '<button class="mwe-upwiz-button-next">' . wfMsg( "mwe-upwiz-next" ) . '</button>'
201203 . '</div>'
202204 . '</div>'

Status & tagging log