From bf2a2cd71ebf5bb7911234dcd6fe10da7161d5cb Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sat, 14 Jul 2007 23:54:00 +0000 Subject: [PATCH] * Indicate when a preview is unavailable/failed * Show a little progress "spinner" during the AJAX request --- includes/DefaultSettings.php | 2 +- includes/Skin.php | 4 ++-- includes/SpecialUpload.php | 5 +++-- languages/messages/MessagesEn.php | 1 + maintenance/language/messages.inc | 1 + skins/common/images/spinner.gif | Bin 0 -> 2466 bytes skins/common/upload.js | 7 ++++--- skins/common/wikibits.js | 30 ++++++++++++++++++++++++++++++ 8 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 skins/common/images/spinner.gif diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 3d9e0e819f..a5f399e5c1 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1201,7 +1201,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '83'; +$wgStyleVersion = '84'; # Server-side caching: diff --git a/includes/Skin.php b/includes/Skin.php index aa5623773a..21b60ec200 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1652,5 +1652,5 @@ END; wfProfileOut( $fname ); return $bar; } -} - + +} \ No newline at end of file diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 75a0f6a6ca..00cf7ef35b 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -572,7 +572,7 @@ class UploadForm { $output = $wgParser->parse( $revision->getText(), $title, new ParserOptions() ); return $output->getText(); } - return ''; + return wfMsgHtml( 'license-nopreview' ); } /** @@ -890,7 +890,8 @@ EOT " ); if( $useAjaxLicencePreview ) { $wgOut->addHtml( " - + + " ); } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 362ed4d09f..2c7c795603 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1417,6 +1417,7 @@ If you have this image in full resolution upload this one, otherwise change the 'license' => 'Licensing', 'nolicense' => 'None selected', 'licenses' => '-', # don't translate or duplicate this message to other languages +'license-nopreview' => '(Preview not available)', 'upload_source_url' => ' (a valid, publicly accessible URL)', 'upload_source_file' => ' (a file on your computer)', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index d8e7a6d1fc..2351877ee3 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -827,6 +827,7 @@ $wgMessageStructure = array( 'license', 'nolicense', 'licenses', + 'license-nopreview', 'upload_source_url', 'upload_source_file', ), diff --git a/skins/common/images/spinner.gif b/skins/common/images/spinner.gif new file mode 100644 index 0000000000000000000000000000000000000000..1cca4cc35544796b837ca685c07b90bed0edc807 GIT binary patch literal 2466 zcmciEc~BE)6aeteHN=o?;$~%*6he%MAtt&QkX6(s*-!*ERpKq9Fe0MhSPl`JfVoWq zgh22Jcwp3-5UbVdw9eEX4$V+&v}ir+Q7URJGA(tOwod;@H?f_TPW+>my7SF9-(UNF z^WNLHUrz2DSY{Cnz(7A6@OXfr2M7@>NbIsuP!{x*gn}hOk0%)Pgo4B#3=u0ttnf2F z6syi&ticrvv!_i#DI@>@#y_Ku;Q(wvLY#@0!T>-m9y&kch8MeW^uyDuA1>_Mwc?J( z|KveuQcT&8_tD(^+xHsi20hU7G@YtXmiJ-@C00GeL1(?|dwkk)5q0Gmgu~BhH0vUE z07ZB**2cvSw`AZ7sL`DIp*~SsoMP4)kg<`#@W{ZMMg~3%djhi`RxxuP`I3I|etj03 z--O!pnv^4zBCc6*Wh$c2;(HW;z0#&s8# z_RbVfn7AD=WDpQrTx}TQtlZ&-!P@8$?WjXIe*Rq}kr87#kDyFVTbh*tfi#MtAr6;J zW-D3~rIoL>BjE1nrK$UWJc=_hw+PM}DC~hYghBeoIGo*(LUAXWE0OjNE~}OowN&+^ zDtd$;R59pFn)|mDa)uP;yiCHR<0)v{A||6#$!$uZ;CyQ((y^Dz+7_K;cp1{?BG6K9 z;JCZWfy>EI>Pp-lT6SsK$@;MrMkB`9mZ0#YnWe5KbG?d9_%^Rb-kD6P6h*geM1;XRtQ|>7Cwtq z$l$n82VS&FK=tVX!zxT6K2&%@9^yeYo{0cGXL~9cPEWwWiZ>I{GPXRzq`u!XwIy? zd30*3DKRDXoETwR)S(>_Nrsd2-Sp`S&&7LZ6! za^vEuTGbW_g_e^5$#|+{RK%W+!C-byb1G$bl3mE#w|}-Sx=H^})7AHi!=}T>_Yfvb zd+{!s&=dTrB7tg@%k`ah9$60yL`856xP!ANQozC)9{0T?&xXCISEKmtkX%fo9__&} zl)jCD@uf6X0wj&$86zeW7pzk?!^Yi7wy+6dy&WADZuAj}`gbVnt@#z=NgoxS6nERy zw5cuRE|~KUzrXKO!JYFJM3$bDivLWLR@DR-?@Y1^c^!KZ)(fW7=#vmz;JQH}NUwRG zB>gf<7^EzNK}t+5J8fEQ8{hJrv^08`hX>~9W+_4<24;j*#txGpi_*dki>&H4H{U5l zJnhXd7?@i})pMELQoyqX;)y@W;4GY7W;7uNGo-ZG#kIC+u}-~OXl>ic1zV#J@2Z!x zl*sTx1|2!kH&`>kT8~`r>YKPy&^nKD5?hNfoA#~$bz$!CGI3QsTWRK6tLoGZ4sD|_ z)zt!l&ghPfe|Jd13?|XZ1LA#}ju}t8oBTO$<_GR1o{~eSbEYi9fl@M+wRGM(Iz}RO zSKs!pK6Qs_`W`M&H3v?J&^Dvgdal>EVdas6mCfh+lV3-&HfvMmLS3oVAv6E+AyG$O KFJ8^PChK=A{%~#p literal 0 HcmV?d00001 diff --git a/skins/common/upload.js b/skins/common/upload.js index 3fc5fa0a47..d6f589fb90 100644 --- a/skins/common/upload.js +++ b/skins/common/upload.js @@ -147,6 +147,7 @@ var wgUploadLicenceObj = { if( licence in this.responseCache ) { this.showPreview( this.responseCache[licence] ); } else { + injectSpinner( document.getElementById( 'wpLicense' ), 'licence' ); sajax_do_call( 'UploadForm::ajaxGetLicencePreview', [licence], function( result ) { wgUploadLicenceObj.processResult( result, licence ); @@ -156,17 +157,17 @@ var wgUploadLicenceObj = { }, 'processResult' : function( result, licence ) { + removeSpinner( 'licence' ); this.showPreview( result.responseText ); this.responseCache[licence] = result.responseText; }, 'showPreview' : function( preview ) { var previewPanel = document.getElementById( 'mw-licence-preview' ); - if( previewPanel.innerHTML != preview ) { + if( previewPanel.innerHTML != preview ) previewPanel.innerHTML = preview; - } } - + } addOnloadHook( licenseSelectorFixup ); \ No newline at end of file diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 58d2fe6148..e37cd4c39e 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -1243,6 +1243,36 @@ function jsMsg( message, className ) { return true; } +/** + * Inject a cute little progress spinner after the specified element + * + * @param element Element to inject after + * @param id Identifier string (for use with removeSpinner(), below) + */ +function injectSpinner( element, id ) { + var spinner = document.createElement( "img" ); + spinner.id = "mw-spinner-" + id; + spinner.src = stylepath + "/common/images/spinner.gif"; + spinner.alt = spinner.title = "..."; + if( element.nextSibling ) { + element.parentNode.insertBefore( spinner, element.nextSibling ); + } else { + element.parentNode.appendChild( spinner ); + } +} + +/** + * Remove a progress spinner added with injectSpinner() + * + * @param id Identifier string + */ +function removeSpinner( id ) { + var spinner = document.getElementById( "mw-spinner-" + id ); + if( spinner ) { + spinner.parentNode.removeChild( spinner ); + } +} + function runOnloadHook() { // don't run anything below this for non-dom browsers if (doneOnloadHook || !(document.getElementById && document.getElementsByTagName)) { -- 2.20.1