Index: trunk/extensions/UploadWizard/resources/combined.js |
— | — | @@ -9924,80 +9924,7 @@ |
9925 | 9925 | */ |
9926 | 9926 | createInterface: function( selector ) { |
9927 | 9927 | var _this = this; |
9928 | | - var div = $j( selector ).get(0); |
9929 | | - |
9930 | | - div.innerHTML = |
9931 | | - // the arrow steps |
9932 | | - '<ul id="mwe-upwiz-steps">' |
9933 | | - + '<li id="mwe-upwiz-step-tutorial"><div>' + gM('mwe-upwiz-step-tutorial') + '</div></li>' |
9934 | | - + '<li id="mwe-upwiz-step-file"><div>' + gM('mwe-upwiz-step-file') + '</div></li>' |
9935 | | - + '<li id="mwe-upwiz-step-deeds"><div>' + gM('mwe-upwiz-step-deeds') + '</div></li>' |
9936 | | - + '<li id="mwe-upwiz-step-details"><div>' + gM('mwe-upwiz-step-details') + '</div></li>' |
9937 | | - + '<li id="mwe-upwiz-step-thanks"><div>' + gM('mwe-upwiz-step-thanks') + '</div></li>' |
9938 | | - + '</ul>' |
9939 | 9928 | |
9940 | | - // the individual steps, all at once |
9941 | | - + '<div id="mwe-upwiz-content">' |
9942 | | - |
9943 | | - + '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-tutorial">' |
9944 | | - + '<div id="mwe-upwiz-tutorial">' // this is hardcoded badness |
9945 | | - + '</div>' |
9946 | | - + '<div class="mwe-upwiz-buttons">' |
9947 | | - + '<button class="mwe-upwiz-button-next" />' |
9948 | | - + '</div>' |
9949 | | - + '</div>' |
9950 | | - |
9951 | | - + '<div class="mwe-upwiz-stepdiv ui-helper-clearfix" id="mwe-upwiz-stepdiv-file">' |
9952 | | - + '<div id="mwe-upwiz-intro">' + gM('mwe-upwiz-intro') + '</div>' |
9953 | | - + '<div id="mwe-upwiz-files">' |
9954 | | - + '<div id="mwe-upwiz-upload-ctrls" class="mwe-upwiz-file">' |
9955 | | - + '<div id="mwe-upwiz-add-file-container" class="mwe-upwiz-add-files-0">' |
9956 | | - + '<a id="mwe-upwiz-add-file">' + gM("mwe-upwiz-add-file-0") + '</a>' |
9957 | | - + '</div>' |
9958 | | - + '</div>' |
9959 | | - + '<div id="mwe-upwiz-progress" class="ui-helper-clearfix"></div>' |
9960 | | - + '</div>' |
9961 | | - + '<div class="mwe-upwiz-buttons" style="display: none"/>' |
9962 | | - + '<button class="mwe-upwiz-button-next" />' |
9963 | | - + '</div>' |
9964 | | - + '</div>' |
9965 | | - |
9966 | | - + '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-deeds">' |
9967 | | - + '<div id="mwe-upwiz-deeds-intro"></div>' |
9968 | | - + '<div id="mwe-upwiz-deeds-thumbnails" class="ui-helper-clearfix"></div>' |
9969 | | - + '<div id="mwe-upwiz-deeds" class="ui-helper-clearfix"></div>' |
9970 | | - + '<div id="mwe-upwiz-deeds-custom" class="ui-helper-clearfix"></div>' |
9971 | | - + '<div class="mwe-upwiz-buttons"/>' |
9972 | | - + '<button class="mwe-upwiz-button-next" />' |
9973 | | - + '</div>' |
9974 | | - + '</div>' |
9975 | | - |
9976 | | - + '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-details">' |
9977 | | - + '<div id="mwe-upwiz-macro">' |
9978 | | - + '<div id="mwe-upwiz-macro-progress" class="ui-helper-clearfix"></div>' |
9979 | | - + '<div id="mwe-upwiz-macro-choice">' |
9980 | | - + '<div>' + gM( 'mwe-upwiz-details-intro' ) + '</div>' |
9981 | | - + '</div>' |
9982 | | - + '<div id="mwe-upwiz-macro-files"></div>' |
9983 | | - + '</div>' |
9984 | | - + '<div class="mwe-upwiz-buttons"/>' |
9985 | | - + '<button class="mwe-upwiz-button-next" />' |
9986 | | - + '</div>' |
9987 | | - + '</div>' |
9988 | | - |
9989 | | - + '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-thanks">' |
9990 | | - + '<div id="mwe-upwiz-thanks"></div>' |
9991 | | - + '<div class="mwe-upwiz-buttons"/>' |
9992 | | - + '<button class="mwe-upwiz-button-begin"></button>' |
9993 | | - + '<br/><button class="mwe-upwiz-button-home"></button>' |
9994 | | - + '</div>' |
9995 | | - + '</div>' |
9996 | | - |
9997 | | - + '</div>' |
9998 | | - |
9999 | | - + '<div class="mwe-upwiz-clearing"></div>'; |
10000 | | - |
10001 | | - this.setTutorialImage( $j( '#mwe-upwiz-tutorial' ) ); |
10002 | 9929 | $j( '#mwe-upwiz-steps' ) |
10003 | 9930 | .addClass( 'ui-helper-clearfix ui-state-default ui-widget ui-helper-reset ui-helper-clearfix' ) |
10004 | 9931 | .arrowSteps(); |
— | — | @@ -10139,57 +10066,6 @@ |
10140 | 10067 | }, |
10141 | 10068 | |
10142 | 10069 | /** |
10143 | | - * Using the API, fetch the appropriate HTML for the licensing tutorial, and append it to $element |
10144 | | - * @param {jQuery} jQuery instance initialized with selector |
10145 | | - */ |
10146 | | - setTutorialImage: function( $el ) { |
10147 | | - var title = new mw.Title( 'WikimediaCommonsUploadTutorial-' + mw.UploadWizard.config.userLanguage + '.png', 'file' ); |
10148 | | - var params = { |
10149 | | - 'prop': 'imageinfo', |
10150 | | - 'titles': title.toString(), |
10151 | | - 'iiurlwidth': '722', // determined to be the correct size for the tutorial, such that body text is the similar in size to our normal HTML text |
10152 | | - 'iiprop': 'url|size' |
10153 | | - }; |
10154 | | - var tutorialError = function( code, result ) { |
10155 | | - $el.append( |
10156 | | - $j( '<p/>' ).append( gM( 'mwe-upwiz-tutorial-error' ) ), |
10157 | | - /* make it hidden or grey or small something... */ |
10158 | | - $j( '<p/>' ).append( gM( 'mwe-upwiz-api-error-code', code ) ) |
10159 | | - ); |
10160 | | - }; |
10161 | | - var tutorialOk = function( data ) { |
10162 | | - if ( !data || !data.query || !data.query.pages ) { |
10163 | | - return; |
10164 | | - } |
10165 | | - var thumbnail; |
10166 | | - $j.each( data.query.pages, function( id, page ) { |
10167 | | - if ( page.imageinfo && page.imageinfo.length ) { |
10168 | | - var imageinfo = page.imageinfo[0]; |
10169 | | - if ( imageinfo.thumburl && imageinfo.thumbwidth && imageinfo.thumbheight ) { |
10170 | | - thumbnail = page.imageinfo[0]; |
10171 | | - return false; |
10172 | | - } |
10173 | | - } |
10174 | | - } ); |
10175 | | - if ( ! mw.isDefined( thumbnail ) ) { |
10176 | | - tutorialError( data ); |
10177 | | - } else { |
10178 | | - $el.append( |
10179 | | - $j( '<img/>' ).attr( { |
10180 | | - 'src': thumbnail.thumburl, |
10181 | | - 'width': thumbnail.thumbwidth, |
10182 | | - 'height': thumbnail.thumbheight |
10183 | | - } ) |
10184 | | - ); |
10185 | | - } |
10186 | | - }; |
10187 | | - |
10188 | | - //var commonsApi = new mw.Api( { 'url': 'http://commons.wikimedia.org/w/api.php' } ); |
10189 | | - this.api.get( params, { ok: tutorialOk, err: tutorialError } ); |
10190 | | - }, |
10191 | | - |
10192 | | - |
10193 | | - /** |
10194 | 10070 | * Advance one "step" in the wizard interface. |
10195 | 10071 | * It is assumed that the previous step to the current one was selected. |
10196 | 10072 | * We do not hide the tabs because this messes up certain calculations we'd like to make about dimensions, while elements are not |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -1476,80 +1476,7 @@ |
1477 | 1477 | */ |
1478 | 1478 | createInterface: function( selector ) { |
1479 | 1479 | var _this = this; |
1480 | | - var div = $j( selector ).get(0); |
1481 | | - |
1482 | | - div.innerHTML = |
1483 | | - // the arrow steps |
1484 | | - '<ul id="mwe-upwiz-steps">' |
1485 | | - + '<li id="mwe-upwiz-step-tutorial"><div>' + gM('mwe-upwiz-step-tutorial') + '</div></li>' |
1486 | | - + '<li id="mwe-upwiz-step-file"><div>' + gM('mwe-upwiz-step-file') + '</div></li>' |
1487 | | - + '<li id="mwe-upwiz-step-deeds"><div>' + gM('mwe-upwiz-step-deeds') + '</div></li>' |
1488 | | - + '<li id="mwe-upwiz-step-details"><div>' + gM('mwe-upwiz-step-details') + '</div></li>' |
1489 | | - + '<li id="mwe-upwiz-step-thanks"><div>' + gM('mwe-upwiz-step-thanks') + '</div></li>' |
1490 | | - + '</ul>' |
1491 | 1480 | |
1492 | | - // the individual steps, all at once |
1493 | | - + '<div id="mwe-upwiz-content">' |
1494 | | - |
1495 | | - + '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-tutorial">' |
1496 | | - + '<div id="mwe-upwiz-tutorial">' // this is hardcoded badness |
1497 | | - + '</div>' |
1498 | | - + '<div class="mwe-upwiz-buttons">' |
1499 | | - + '<button class="mwe-upwiz-button-next" />' |
1500 | | - + '</div>' |
1501 | | - + '</div>' |
1502 | | - |
1503 | | - + '<div class="mwe-upwiz-stepdiv ui-helper-clearfix" id="mwe-upwiz-stepdiv-file">' |
1504 | | - + '<div id="mwe-upwiz-intro">' + gM('mwe-upwiz-intro') + '</div>' |
1505 | | - + '<div id="mwe-upwiz-files">' |
1506 | | - + '<div id="mwe-upwiz-upload-ctrls" class="mwe-upwiz-file">' |
1507 | | - + '<div id="mwe-upwiz-add-file-container" class="mwe-upwiz-add-files-0">' |
1508 | | - + '<a id="mwe-upwiz-add-file">' + gM("mwe-upwiz-add-file-0") + '</a>' |
1509 | | - + '</div>' |
1510 | | - + '</div>' |
1511 | | - + '<div id="mwe-upwiz-progress" class="ui-helper-clearfix"></div>' |
1512 | | - + '</div>' |
1513 | | - + '<div class="mwe-upwiz-buttons" style="display: none"/>' |
1514 | | - + '<button class="mwe-upwiz-button-next" />' |
1515 | | - + '</div>' |
1516 | | - + '</div>' |
1517 | | - |
1518 | | - + '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-deeds">' |
1519 | | - + '<div id="mwe-upwiz-deeds-intro"></div>' |
1520 | | - + '<div id="mwe-upwiz-deeds-thumbnails" class="ui-helper-clearfix"></div>' |
1521 | | - + '<div id="mwe-upwiz-deeds" class="ui-helper-clearfix"></div>' |
1522 | | - + '<div id="mwe-upwiz-deeds-custom" class="ui-helper-clearfix"></div>' |
1523 | | - + '<div class="mwe-upwiz-buttons"/>' |
1524 | | - + '<button class="mwe-upwiz-button-next" />' |
1525 | | - + '</div>' |
1526 | | - + '</div>' |
1527 | | - |
1528 | | - + '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-details">' |
1529 | | - + '<div id="mwe-upwiz-macro">' |
1530 | | - + '<div id="mwe-upwiz-macro-progress" class="ui-helper-clearfix"></div>' |
1531 | | - + '<div id="mwe-upwiz-macro-choice">' |
1532 | | - + '<div>' + gM( 'mwe-upwiz-details-intro' ) + '</div>' |
1533 | | - + '</div>' |
1534 | | - + '<div id="mwe-upwiz-macro-files"></div>' |
1535 | | - + '</div>' |
1536 | | - + '<div class="mwe-upwiz-buttons"/>' |
1537 | | - + '<button class="mwe-upwiz-button-next" />' |
1538 | | - + '</div>' |
1539 | | - + '</div>' |
1540 | | - |
1541 | | - + '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-thanks">' |
1542 | | - + '<div id="mwe-upwiz-thanks"></div>' |
1543 | | - + '<div class="mwe-upwiz-buttons"/>' |
1544 | | - + '<button class="mwe-upwiz-button-begin"></button>' |
1545 | | - + '<br/><button class="mwe-upwiz-button-home"></button>' |
1546 | | - + '</div>' |
1547 | | - + '</div>' |
1548 | | - |
1549 | | - + '</div>' |
1550 | | - |
1551 | | - + '<div class="mwe-upwiz-clearing"></div>'; |
1552 | | - |
1553 | | - this.setTutorialImage( $j( '#mwe-upwiz-tutorial' ) ); |
1554 | 1481 | $j( '#mwe-upwiz-steps' ) |
1555 | 1482 | .addClass( 'ui-helper-clearfix ui-state-default ui-widget ui-helper-reset ui-helper-clearfix' ) |
1556 | 1483 | .arrowSteps(); |
— | — | @@ -1691,57 +1618,6 @@ |
1692 | 1619 | }, |
1693 | 1620 | |
1694 | 1621 | /** |
1695 | | - * Using the API, fetch the appropriate HTML for the licensing tutorial, and append it to $element |
1696 | | - * @param {jQuery} jQuery instance initialized with selector |
1697 | | - */ |
1698 | | - setTutorialImage: function( $el ) { |
1699 | | - var title = new mw.Title( 'WikimediaCommonsUploadTutorial-' + mw.UploadWizard.config.userLanguage + '.png', 'file' ); |
1700 | | - var params = { |
1701 | | - 'prop': 'imageinfo', |
1702 | | - 'titles': title.toString(), |
1703 | | - 'iiurlwidth': '722', // determined to be the correct size for the tutorial, such that body text is the similar in size to our normal HTML text |
1704 | | - 'iiprop': 'url|size' |
1705 | | - }; |
1706 | | - var tutorialError = function( code, result ) { |
1707 | | - $el.append( |
1708 | | - $j( '<p/>' ).append( gM( 'mwe-upwiz-tutorial-error' ) ), |
1709 | | - /* make it hidden or grey or small something... */ |
1710 | | - $j( '<p/>' ).append( gM( 'mwe-upwiz-api-error-code', code ) ) |
1711 | | - ); |
1712 | | - }; |
1713 | | - var tutorialOk = function( data ) { |
1714 | | - if ( !data || !data.query || !data.query.pages ) { |
1715 | | - return; |
1716 | | - } |
1717 | | - var thumbnail; |
1718 | | - $j.each( data.query.pages, function( id, page ) { |
1719 | | - if ( page.imageinfo && page.imageinfo.length ) { |
1720 | | - var imageinfo = page.imageinfo[0]; |
1721 | | - if ( imageinfo.thumburl && imageinfo.thumbwidth && imageinfo.thumbheight ) { |
1722 | | - thumbnail = page.imageinfo[0]; |
1723 | | - return false; |
1724 | | - } |
1725 | | - } |
1726 | | - } ); |
1727 | | - if ( ! mw.isDefined( thumbnail ) ) { |
1728 | | - tutorialError( data ); |
1729 | | - } else { |
1730 | | - $el.append( |
1731 | | - $j( '<img/>' ).attr( { |
1732 | | - 'src': thumbnail.thumburl, |
1733 | | - 'width': thumbnail.thumbwidth, |
1734 | | - 'height': thumbnail.thumbheight |
1735 | | - } ) |
1736 | | - ); |
1737 | | - } |
1738 | | - }; |
1739 | | - |
1740 | | - //var commonsApi = new mw.Api( { 'url': 'http://commons.wikimedia.org/w/api.php' } ); |
1741 | | - this.api.get( params, { ok: tutorialOk, err: tutorialError } ); |
1742 | | - }, |
1743 | | - |
1744 | | - |
1745 | | - /** |
1746 | 1622 | * Advance one "step" in the wizard interface. |
1747 | 1623 | * It is assumed that the previous step to the current one was selected. |
1748 | 1624 | * We do not hide the tabs because this messes up certain calculations we'd like to make about dimensions, while elements are not |
Index: trunk/extensions/UploadWizard/resources/combined.min.js |
— | — | @@ -9924,80 +9924,7 @@ |
9925 | 9925 | |
9926 | 9926 | createInterface:function(selector){ |
9927 | 9927 | var _this=this; |
9928 | | -var div=$j(selector).get(0); |
9929 | 9928 | |
9930 | | -div.innerHTML= |
9931 | | - |
9932 | | -'<ul id="mwe-upwiz-steps">' |
9933 | | -+'<li id="mwe-upwiz-step-tutorial"><div>'+gM('mwe-upwiz-step-tutorial')+'</div></li>' |
9934 | | -+'<li id="mwe-upwiz-step-file"><div>'+gM('mwe-upwiz-step-file')+'</div></li>' |
9935 | | -+'<li id="mwe-upwiz-step-deeds"><div>'+gM('mwe-upwiz-step-deeds')+'</div></li>' |
9936 | | -+'<li id="mwe-upwiz-step-details"><div>'+gM('mwe-upwiz-step-details')+'</div></li>' |
9937 | | -+'<li id="mwe-upwiz-step-thanks"><div>'+gM('mwe-upwiz-step-thanks')+'</div></li>' |
9938 | | -+'</ul>' |
9939 | | - |
9940 | | - |
9941 | | -+'<div id="mwe-upwiz-content">' |
9942 | | - |
9943 | | -+'<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-tutorial">' |
9944 | | -+'<div id="mwe-upwiz-tutorial">' |
9945 | | -+'</div>' |
9946 | | -+'<div class="mwe-upwiz-buttons">' |
9947 | | -+'<button class="mwe-upwiz-button-next" />' |
9948 | | -+'</div>' |
9949 | | -+'</div>' |
9950 | | - |
9951 | | -+'<div class="mwe-upwiz-stepdiv ui-helper-clearfix" id="mwe-upwiz-stepdiv-file">' |
9952 | | -+'<div id="mwe-upwiz-intro">'+gM('mwe-upwiz-intro')+'</div>' |
9953 | | -+'<div id="mwe-upwiz-files">' |
9954 | | -+'<div id="mwe-upwiz-upload-ctrls" class="mwe-upwiz-file">' |
9955 | | -+'<div id="mwe-upwiz-add-file-container" class="mwe-upwiz-add-files-0">' |
9956 | | -+'<a id="mwe-upwiz-add-file">'+gM("mwe-upwiz-add-file-0")+'</a>' |
9957 | | -+'</div>' |
9958 | | -+'</div>' |
9959 | | -+'<div id="mwe-upwiz-progress" class="ui-helper-clearfix"></div>' |
9960 | | -+'</div>' |
9961 | | -+'<div class="mwe-upwiz-buttons" style="display: none"/>' |
9962 | | -+'<button class="mwe-upwiz-button-next" />' |
9963 | | -+'</div>' |
9964 | | -+'</div>' |
9965 | | - |
9966 | | -+'<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-deeds">' |
9967 | | -+'<div id="mwe-upwiz-deeds-intro"></div>' |
9968 | | -+'<div id="mwe-upwiz-deeds-thumbnails" class="ui-helper-clearfix"></div>' |
9969 | | -+'<div id="mwe-upwiz-deeds" class="ui-helper-clearfix"></div>' |
9970 | | -+'<div id="mwe-upwiz-deeds-custom" class="ui-helper-clearfix"></div>' |
9971 | | -+'<div class="mwe-upwiz-buttons"/>' |
9972 | | -+'<button class="mwe-upwiz-button-next" />' |
9973 | | -+'</div>' |
9974 | | -+'</div>' |
9975 | | - |
9976 | | -+'<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-details">' |
9977 | | -+'<div id="mwe-upwiz-macro">' |
9978 | | -+'<div id="mwe-upwiz-macro-progress" class="ui-helper-clearfix"></div>' |
9979 | | -+'<div id="mwe-upwiz-macro-choice">' |
9980 | | -+'<div>'+gM('mwe-upwiz-details-intro')+'</div>' |
9981 | | -+'</div>' |
9982 | | -+'<div id="mwe-upwiz-macro-files"></div>' |
9983 | | -+'</div>' |
9984 | | -+'<div class="mwe-upwiz-buttons"/>' |
9985 | | -+'<button class="mwe-upwiz-button-next" />' |
9986 | | -+'</div>' |
9987 | | -+'</div>' |
9988 | | - |
9989 | | -+'<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-thanks">' |
9990 | | -+'<div id="mwe-upwiz-thanks"></div>' |
9991 | | -+'<div class="mwe-upwiz-buttons"/>' |
9992 | | -+'<button class="mwe-upwiz-button-begin"></button>' |
9993 | | -+'<br/><button class="mwe-upwiz-button-home"></button>' |
9994 | | -+'</div>' |
9995 | | -+'</div>' |
9996 | | - |
9997 | | -+'</div>' |
9998 | | - |
9999 | | -+'<div class="mwe-upwiz-clearing"></div>'; |
10000 | | - |
10001 | | -this.setTutorialImage($j('#mwe-upwiz-tutorial')); |
10002 | 9929 | $j('#mwe-upwiz-steps') |
10003 | 9930 | .addClass('ui-helper-clearfix ui-state-default ui-widget ui-helper-reset ui-helper-clearfix') |
10004 | 9931 | .arrowSteps(); |
— | — | @@ -10142,61 +10069,10 @@ |
10143 | 10070 | |
10144 | 10071 | |
10145 | 10072 | |
10146 | | -setTutorialImage:function($el){ |
10147 | | -var title=new mw.Title('WikimediaCommonsUploadTutorial-'+mw.UploadWizard.config.userLanguage+'.png','file'); |
10148 | | -var params={ |
10149 | | -'prop':'imageinfo', |
10150 | | -'titles':title.toString(), |
10151 | | -'iiurlwidth':'722', |
10152 | | -'iiprop':'url|size' |
10153 | | -}; |
10154 | | -var tutorialError=function(code,result){ |
10155 | | -$el.append( |
10156 | | -$j('<p/>').append(gM('mwe-upwiz-tutorial-error')), |
10157 | 10073 | |
10158 | | -$j('<p/>').append(gM('mwe-upwiz-api-error-code',code)) |
10159 | | -); |
10160 | | -}; |
10161 | | -var tutorialOk=function(data){ |
10162 | | -if(!data||!data.query||!data.query.pages){ |
10163 | | -return; |
10164 | | -} |
10165 | | -var thumbnail; |
10166 | | -$j.each(data.query.pages,function(id,page){ |
10167 | | -if(page.imageinfo&&page.imageinfo.length){ |
10168 | | -var imageinfo=page.imageinfo[0]; |
10169 | | -if(imageinfo.thumburl&&imageinfo.thumbwidth&&imageinfo.thumbheight){ |
10170 | | -thumbnail=page.imageinfo[0]; |
10171 | | -return false; |
10172 | | -} |
10173 | | -} |
10174 | | -}); |
10175 | | -if(!mw.isDefined(thumbnail)){ |
10176 | | -tutorialError(data); |
10177 | | -}else{ |
10178 | | -$el.append( |
10179 | | -$j('<img/>').attr({ |
10180 | | -'src':thumbnail.thumburl, |
10181 | | -'width':thumbnail.thumbwidth, |
10182 | | -'height':thumbnail.thumbheight |
10183 | | -}) |
10184 | | -); |
10185 | | -} |
10186 | | -}; |
10187 | 10074 | |
10188 | 10075 | |
10189 | | -this.api.get(params,{ok:tutorialOk,err:tutorialError}); |
10190 | | -}, |
10191 | 10076 | |
10192 | | - |
10193 | | - |
10194 | | - |
10195 | | - |
10196 | | - |
10197 | | - |
10198 | | - |
10199 | | - |
10200 | | - |
10201 | 10077 | moveToStep:function(selectedStepName,callback){ |
10202 | 10078 | var _this=this; |
10203 | 10079 | |
Index: trunk/extensions/UploadWizard/SpecialUploadWizard.php |
— | — | @@ -11,6 +11,8 @@ |
12 | 12 | |
13 | 13 | class SpecialUploadWizard extends SpecialPage { |
14 | 14 | |
| 15 | + const TUTORIAL_NAME_TEMPLATE = 'Licensing_tutorial_$1.svg'; |
| 16 | + |
15 | 17 | private $simpleForm; |
16 | 18 | |
17 | 19 | // $request is the request (usually wgRequest) |
— | — | @@ -56,6 +58,7 @@ |
57 | 59 | $this->simpleForm->show(); |
58 | 60 | $wgOut->addHTML('</noscript>'); |
59 | 61 | |
| 62 | + |
60 | 63 | // global javascript variables |
61 | 64 | $this->addJsVars( $subPage ); |
62 | 65 | |
— | — | @@ -76,10 +79,8 @@ |
77 | 80 | |
78 | 81 | // where the uploadwizard will go |
79 | 82 | // TODO import more from UploadWizard's createInterface call. |
80 | | - $wgOut->addHTML( |
81 | | - '<div id="upload-wizard" class="upload-section"><div class="loadingSpinner"></div></div>' |
82 | | - ); |
83 | | - |
| 83 | + $wgOut->addHTML( self::getWizardHtml() ); |
| 84 | + |
84 | 85 | } |
85 | 86 | |
86 | 87 | /** |
— | — | @@ -168,6 +169,129 @@ |
169 | 170 | return true; |
170 | 171 | } |
171 | 172 | |
| 173 | + /** |
| 174 | + * Fetches appropriate HTML for the tutorial portion of the wizard. |
| 175 | + * Looks up an image on the current wiki. This will work as is on Commons, and will also work |
| 176 | + * on test wikis that enable instantCommons. |
| 177 | + * @param {String} $langCode language code as used by MediaWiki, similar but not identical to ISO 639-1. |
| 178 | + * @return {String} html that will display the tutorial. |
| 179 | + */ |
| 180 | + function getTutorialHtml() { |
| 181 | + global $wgLanguageCode; |
| 182 | + |
| 183 | + // assume failure (this will be replaced if we're successful) |
| 184 | + $tutorialHtml = '<p class="errorbox">' . wfMsg( 'mwe-upwiz-tutorial-error' ) . '</p>'; |
| 185 | + |
| 186 | + // get a valid language code, even if the global is wrong |
| 187 | + $langCode = $wgLanguageCode; |
| 188 | + if ( !isset( $langCode) or $langCode === '' ) { |
| 189 | + $langCode = 'en'; |
| 190 | + } |
| 191 | + |
| 192 | + $tutorialName = str_replace( '$1', $langCode, self::TUTORIAL_NAME_TEMPLATE ); |
| 193 | + $tutorialTitle = Title::newFromText( $tutorialName, NS_FILE ); |
| 194 | + |
| 195 | + // wfFindFile() returns a File object, or false |
| 196 | + if ( $tutorialFile = wfFindFile( $tutorialTitle ) ) { |
| 197 | + // XXX TODO if the client can handle SVG, we could also just send it the unscaled thumb, client-scaled into a DIV or something. |
| 198 | + // if ( client can handle SVG ) { |
| 199 | + // $tutorialThumbnailImage->getUnscaledThumb(); |
| 200 | + // } |
| 201 | + // put it into a div of appropriate dimensions. |
| 202 | + |
| 203 | + // n.b. File::transform() returns false if failed, MediaTransformOutput otherwise |
| 204 | + if ( $tutorialThumbnailImage = $tutorialFile->transform( array( 'width' => '720' ) ) ) { |
| 205 | + $tutorialHtml = $tutorialThumbnailImage->toHtml(); |
| 206 | + } |
| 207 | + } |
| 208 | + |
| 209 | + return $tutorialHtml; |
| 210 | + } |
| 211 | + |
| 212 | + /** |
| 213 | + * Return the basic HTML structure for the entire page |
| 214 | + * Will be enhanced by the javascript to actually do stuff |
| 215 | + * @return {String} html |
| 216 | + */ |
| 217 | + function getWizardHtml() { |
| 218 | + // TODO loading spinner, hide these by default till enhanced? |
| 219 | + return |
| 220 | + '<div id="upload-wizard" class="upload-section">' |
| 221 | + |
| 222 | + // the arrow steps |
| 223 | + . '<ul id="mwe-upwiz-steps">' |
| 224 | + . '<li id="mwe-upwiz-step-tutorial"><div>' . wfMsg('mwe-upwiz-step-tutorial') . '</div></li>' |
| 225 | + . '<li id="mwe-upwiz-step-file"><div>' . wfMsg('mwe-upwiz-step-file') . '</div></li>' |
| 226 | + . '<li id="mwe-upwiz-step-deeds"><div>' . wfMsg('mwe-upwiz-step-deeds') . '</div></li>' |
| 227 | + . '<li id="mwe-upwiz-step-details"><div>' . wfMsg('mwe-upwiz-step-details') . '</div></li>' |
| 228 | + . '<li id="mwe-upwiz-step-thanks"><div>' . wfMsg('mwe-upwiz-step-thanks') . '</div></li>' |
| 229 | + . '</ul>' |
| 230 | + |
| 231 | + // the individual steps, all at once |
| 232 | + . '<div id="mwe-upwiz-content">' |
| 233 | + |
| 234 | + . '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-tutorial">' |
| 235 | + . '<div id="mwe-upwiz-tutorial">' |
| 236 | + . self::getTutorialHtml() |
| 237 | + . '</div>' |
| 238 | + . '<div class="mwe-upwiz-buttons">' |
| 239 | + . '<button class="mwe-upwiz-button-next" />' |
| 240 | + . '</div>' |
| 241 | + . '</div>' |
| 242 | + |
| 243 | + . '<div class="mwe-upwiz-stepdiv ui-helper-clearfix" id="mwe-upwiz-stepdiv-file">' |
| 244 | + . '<div id="mwe-upwiz-intro">' . wfMsg('mwe-upwiz-intro') . '</div>' |
| 245 | + . '<div id="mwe-upwiz-files">' |
| 246 | + . '<div id="mwe-upwiz-upload-ctrls" class="mwe-upwiz-file">' |
| 247 | + . '<div id="mwe-upwiz-add-file-container" class="mwe-upwiz-add-files-0">' |
| 248 | + . '<a id="mwe-upwiz-add-file">' . wfMsg("mwe-upwiz-add-file-0") . '</a>' |
| 249 | + . '</div>' |
| 250 | + . '</div>' |
| 251 | + . '<div id="mwe-upwiz-progress" class="ui-helper-clearfix"></div>' |
| 252 | + . '</div>' |
| 253 | + . '<div class="mwe-upwiz-buttons" style="display: none"/>' |
| 254 | + . '<button class="mwe-upwiz-button-next" />' |
| 255 | + . '</div>' |
| 256 | + . '</div>' |
| 257 | + |
| 258 | + . '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-deeds">' |
| 259 | + . '<div id="mwe-upwiz-deeds-intro"></div>' |
| 260 | + . '<div id="mwe-upwiz-deeds-thumbnails" class="ui-helper-clearfix"></div>' |
| 261 | + . '<div id="mwe-upwiz-deeds" class="ui-helper-clearfix"></div>' |
| 262 | + . '<div id="mwe-upwiz-deeds-custom" class="ui-helper-clearfix"></div>' |
| 263 | + . '<div class="mwe-upwiz-buttons"/>' |
| 264 | + . '<button class="mwe-upwiz-button-next" />' |
| 265 | + . '</div>' |
| 266 | + . '</div>' |
| 267 | + |
| 268 | + . '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-details">' |
| 269 | + . '<div id="mwe-upwiz-macro">' |
| 270 | + . '<div id="mwe-upwiz-macro-progress" class="ui-helper-clearfix"></div>' |
| 271 | + . '<div id="mwe-upwiz-macro-choice">' |
| 272 | + . '<div>' . wfMsg( 'mwe-upwiz-details-intro' ) . '</div>' |
| 273 | + . '</div>' |
| 274 | + . '<div id="mwe-upwiz-macro-files"></div>' |
| 275 | + . '</div>' |
| 276 | + . '<div class="mwe-upwiz-buttons"/>' |
| 277 | + . '<button class="mwe-upwiz-button-next" />' |
| 278 | + . '</div>' |
| 279 | + . '</div>' |
| 280 | + |
| 281 | + . '<div class="mwe-upwiz-stepdiv" id="mwe-upwiz-stepdiv-thanks">' |
| 282 | + . '<div id="mwe-upwiz-thanks"></div>' |
| 283 | + . '<div class="mwe-upwiz-buttons"/>' |
| 284 | + . '<button class="mwe-upwiz-button-begin"></button>' |
| 285 | + . '<br/><button class="mwe-upwiz-button-home"></button>' |
| 286 | + . '</div>' |
| 287 | + . '</div>' |
| 288 | + |
| 289 | + . '</div>' |
| 290 | + |
| 291 | + . '<div class="mwe-upwiz-clearing"></div>' |
| 292 | + |
| 293 | + . '</div>'; |
| 294 | + } |
| 295 | + |
172 | 296 | } |
173 | 297 | |
174 | 298 | |