r24097 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24096‎ | r24097 | r24098 >
Date:23:54, 14 July 2007
Author:robchurch
Status:old
Tags:
Comment:
* Indicate when a preview is unavailable/failed
* Show a little progress "spinner" during the AJAX request
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SpecialUpload.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)
  • /trunk/phase3/skins/common/images/spinner.gif (added) (history)
  • /trunk/phase3/skins/common/upload.js (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1417,6 +1417,7 @@
14181418 'license' => 'Licensing',
14191419 'nolicense' => 'None selected',
14201420 'licenses' => '-', # don't translate or duplicate this message to other languages
 1421+'license-nopreview' => '(Preview not available)',
14211422 'upload_source_url' => ' (a valid, publicly accessible URL)',
14221423 'upload_source_file' => ' (a file on your computer)',
14231424
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1201,7 +1201,7 @@
12021202 * to ensure that client-side caches don't keep obsolete copies of global
12031203 * styles.
12041204 */
1205 -$wgStyleVersion = '83';
 1205+$wgStyleVersion = '84';
12061206
12071207
12081208 # Server-side caching:
Index: trunk/phase3/includes/Skin.php
@@ -1652,5 +1652,5 @@
16531653 wfProfileOut( $fname );
16541654 return $bar;
16551655 }
1656 -}
1657 -
 1656+
 1657+}
\ No newline at end of file
Index: trunk/phase3/includes/SpecialUpload.php
@@ -572,7 +572,7 @@
573573 $output = $wgParser->parse( $revision->getText(), $title, new ParserOptions() );
574574 return $output->getText();
575575 }
576 - return '';
 576+ return wfMsgHtml( 'license-nopreview' );
577577 }
578578
579579 /**
@@ -890,7 +890,8 @@
891891 <tr>" );
892892 if( $useAjaxLicencePreview ) {
893893 $wgOut->addHtml( "
894 - <td id=\"mw-licence-preview\" colspan=\"2\"></td>
 894+ <td></td>
 895+ <td id=\"mw-licence-preview\"></td>
895896 </tr>
896897 <tr>" );
897898 }
Index: trunk/phase3/maintenance/language/messages.inc
@@ -827,6 +827,7 @@
828828 'license',
829829 'nolicense',
830830 'licenses',
 831+ 'license-nopreview',
831832 'upload_source_url',
832833 'upload_source_file',
833834 ),
Index: trunk/phase3/skins/common/upload.js
@@ -147,6 +147,7 @@
148148 if( licence in this.responseCache ) {
149149 this.showPreview( this.responseCache[licence] );
150150 } else {
 151+ injectSpinner( document.getElementById( 'wpLicense' ), 'licence' );
151152 sajax_do_call( 'UploadForm::ajaxGetLicencePreview', [licence],
152153 function( result ) {
153154 wgUploadLicenceObj.processResult( result, licence );
@@ -156,17 +157,17 @@
157158 },
158159
159160 'processResult' : function( result, licence ) {
 161+ removeSpinner( 'licence' );
160162 this.showPreview( result.responseText );
161163 this.responseCache[licence] = result.responseText;
162164 },
163165
164166 'showPreview' : function( preview ) {
165167 var previewPanel = document.getElementById( 'mw-licence-preview' );
166 - if( previewPanel.innerHTML != preview ) {
 168+ if( previewPanel.innerHTML != preview )
167169 previewPanel.innerHTML = preview;
168 - }
169170 }
170 -
 171+
171172 }
172173
173174 addOnloadHook( licenseSelectorFixup );
\ No newline at end of file
Index: trunk/phase3/skins/common/wikibits.js
@@ -1243,6 +1243,36 @@
12441244 return true;
12451245 }
12461246
 1247+/**
 1248+ * Inject a cute little progress spinner after the specified element
 1249+ *
 1250+ * @param element Element to inject after
 1251+ * @param id Identifier string (for use with removeSpinner(), below)
 1252+ */
 1253+function injectSpinner( element, id ) {
 1254+ var spinner = document.createElement( "img" );
 1255+ spinner.id = "mw-spinner-" + id;
 1256+ spinner.src = stylepath + "/common/images/spinner.gif";
 1257+ spinner.alt = spinner.title = "...";
 1258+ if( element.nextSibling ) {
 1259+ element.parentNode.insertBefore( spinner, element.nextSibling );
 1260+ } else {
 1261+ element.parentNode.appendChild( spinner );
 1262+ }
 1263+}
 1264+
 1265+/**
 1266+ * Remove a progress spinner added with injectSpinner()
 1267+ *
 1268+ * @param id Identifier string
 1269+ */
 1270+function removeSpinner( id ) {
 1271+ var spinner = document.getElementById( "mw-spinner-" + id );
 1272+ if( spinner ) {
 1273+ spinner.parentNode.removeChild( spinner );
 1274+ }
 1275+}
 1276+
12471277 function runOnloadHook() {
12481278 // don't run anything below this for non-dom browsers
12491279 if (doneOnloadHook || !(document.getElementById && document.getElementsByTagName)) {
Index: trunk/phase3/skins/common/images/spinner.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/phase3/skins/common/images/spinner.gif
___________________________________________________________________
Added: svn:mime-type
12501280 + application/octet-stream

Follow-up revisions

RevisionCommit summaryAuthorDate
r24215Merged revisions 24095-24212 via svnmerge from...david21:19, 17 July 2007

Status & tagging log