r66246 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66245‎ | r66246 | r66247 >
Date:00:20, 12 May 2010
Author:dale
Status:deferred
Tags:
Comment:
msg key updates for addMediaWizard
Modified paths:
  • /branches/MwEmbedStandAlone/includes/maintenance/clearMwEmbedVars.php (deleted) (history)
  • /branches/MwEmbedStandAlone/jsScriptLoader.php (modified) (history)
  • /branches/MwEmbedStandAlone/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/AddMedia/AddMedia.i18n.php (modified) (history)
  • /branches/MwEmbedStandAlone/modules/AddMedia/mw.UploadHandler.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/loader.js
@@ -49,9 +49,8 @@
5050 'EmbedPlayer',
5151 'ApiProxy',
5252 'Sequencer',
53 - 'TimedText',
54 - 'UploadWizard'
55 -];
 53+ 'TimedText'
 54+];
5655
5756 /**
5857 * mwEmbed default config values.
Index: branches/MwEmbedStandAlone/includes/maintenance/clearMwEmbedVars.php
@@ -1,57 +0,0 @@
2 -<?php
3 -if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
4 - print "This script must be run from the command line\n";
5 - exit();
6 -}
7 -exit( 'This script has been depreciated' );
8 -$mwPath = dirname( __FILE__ ) . '/../../languages/mwEmbed.i18n.php' ;
9 -
10 -include( $mwPath );
11 -$saveKeys = array(
12 -/*
13 - * js file: /mwEmbed.js
14 - */
15 -'mwe-loading_txt' => 'Loading ...',
16 -'mwe-size-gigabytes' => '$1 GB',
17 -'mwe-size-megabytes' => '$1 MB',
18 -'mwe-size-kilobytes' => '$1 K',
19 -'mwe-size-bytes' => '$1 B',
20 -'mwe-error_load_lib' => 'Error: JavaScript $1 was not retrievable or does not define $2',
21 -'mwe-apiproxy-setup' => 'Setting up API proxy',
22 -'mwe-load-drag-item' => 'Loading dragged item',
23 -'mwe-ok' => 'OK',
24 -'mwe-cancel' => 'Cancel',
25 -'mwe-enable-gadget' => 'Enable multimedia beta ( mwEmbed ) for all pages',
26 -'mwe-enable-gadget-done' => 'multimedia beta gadget has been enabled',
27 -'mwe-must-login-gadget' => 'To enable gadget you must <a target="_new" href="$1">login</a>',
28 -'mwe-test-plural' => 'I ran {{PLURAL:$1|$1 test|$1 tests}}',
29 -);
30 -
31 -//output only the $saveKeys
32 -$s = '<?php
33 -
34 -/**
35 - * Localization file for mwEmbed.js
36 - */
37 -';
38 -foreach( $messages as $langKey => $msgSet ){
39 - $startLangFlag = false;
40 -
41 - // Check every msg for language keys:
42 - foreach( $saveKeys as $mk => $mv ) {
43 - if( isset( $messages[$langKey][ $mk ] ) ){
44 - if( !$startLangFlag ){
45 - $s.= '$messages[\''.$langKey.'\'] = array(' . "\n";
46 - $startLangFlag = true;
47 - }
48 - $s.="\t'{$mk}' => '" . str_replace( '\'', '\\\'', $messages[ $langKey ][$mk] ) . "',\n";
49 - }
50 - }
51 - if( $startLangFlag ){
52 - $s.= ");\n";
53 - }
54 -}
55 -
56 -file_put_contents( $mwPath , $s);
57 -
58 -
Index: branches/MwEmbedStandAlone/modules/AddMedia/mw.UploadHandler.js
@@ -23,16 +23,15 @@
2424 "mwe-file-thumbnail-no" : "The filename begins with <b><tt>$1<\/tt><\/b>",
2525 "mwe-go-to-resource" : "Go to resource page",
2626 "mwe-upload-misc-error" : "Unknown upload error",
27 - "mwe-wgfogg_warning_bad_extension" : "You have selected a file with an unsuported extension (<a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Firefogg#Supported_File_Types\">more information<\/a>).",
28 - "thumbnail-more" : "Enlarge",
29 -
30 - "license-header" : "Licensing",
31 - "filedesc" : "Summary",
32 - "filesource" : "Source:",
33 - "filestatus" : "Copyright status:"
 27+ "mwe-wgfogg_warning_bad_extension" : "You have selected a file with an unsuported extension (<a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Firefogg#Supported_File_Types\">more information<\/a>).",
 28+ "mwe-thumbnail-more" : "Enlarge",
 29+ "mwe-license-header" : "Licensing",
 30+ "mwe-filedesc" : "Summary",
 31+ "mwe-filesource" : "Source:",
 32+ "mwe-filestatus" : "Copyright status:"
3433 });
3534
36 -var default_uh_options = {
 35+var defaultUploadHandlerOptions = {
3736 // Target api to upload to
3837 'apiUrl' : null,
3938
@@ -123,12 +122,12 @@
124123
125124 /**
126125 * Object initialization
127 - * @param {Object} options BaseUpload options see default_uh_options
 126+ * @param {Object} options BaseUpload options see defaultUploadHandlerOptions
128127 */
129128 init: function( options ) {
130129 if ( !options )
131130 options = {};
132 - $j.extend( this, default_uh_options, options );
 131+ $j.extend( this, defaultUploadHandlerOptions, options );
133132
134133 // Set a apiUrl if unset
135134 if( !this.apiUrl ) {
@@ -211,17 +210,18 @@
212211 /**
213212 * onSubmit handler for the upload form
214213 */
215 - onSubmit: function( evt ) {
 214+ onSubmit: function() {
216215 var _this = this;
217216 mw.log( 'Base::onSubmit: isRawFormUpload:' + this.formDirectSubmit );
218 - var currentForm = this.getForm();
219 -
220 - if( currentForm.onsubmit ){
221 - if( ! currentForm.onsubmit() ){
 217+
 218+ // Run the original onsubmit (if not run yet set flag to avoid excessive chaining)
 219+ if ( typeof( this.orig_onsubmit ) == 'function' ) {
 220+ if ( ! this.orig_onsubmit() ) {
 221+ //error in orig submit return false;
222222 return false;
223 - }
224 - }
225 -
 223+ }
 224+ }
 225+
226226 // Reinstate the ['name'=comment'] filed since
227227 // commons hacks removes wgUploadDesction from the form
228228 var $form = $j( this.form );
@@ -236,7 +236,6 @@
237237 }
238238
239239 var uploadDesc = _this.getUploadDescription();
240 - // update the form
241240 if( uploadDesc ) {
242241 $form.find("[name='comment']").val( uploadDesc );
243242 }
@@ -512,7 +511,7 @@
513512 /**
514513 * Get the upload description, append the license if available
515514 *
516 - * NOTE: this hack ontop of the commons hack will be depreciated in favor of the uploadWizard
 515+ * NOTE: wpUploadDescription should be a configuration option.
517516 *
518517 * @param {Boolean} useCache If the upload description cache can be used.
519518 * @return {String}
@@ -535,9 +534,12 @@
536535 var source = ( $j("[name='wpSource']").length ) ? $j("[name='wpSource']").val() : '';
537536
538537 // Run the JS equivalent of SpecialUpload.php getInitialPageText
539 - comment_value = this.getCommentText( comment_value, license, copyStatus, source );
 538+ comment_value = this.getCommentText( comment_value, license, copyStatus, source );
 539+ this.rewriteDescriptionText = false;
540540 }
541 - mw.log( 'getUploadDescription:: rewrite:' + comment_value + ' ucr:' + this.rewriteDescriptionText );
 541+ var cat = $j( '#wpUploadDescription' );
 542+ debugger;
 543+ mw.log( 'getUploadDescription:: new val:' + comment_value );
542544 return comment_value;
543545 },
544546
@@ -794,9 +796,7 @@
795797 this.ignoreWarningsSubmit();
796798 break;
797799 case 'returnToForm':
798 - this.rewriteDescriptionText = true;
799 - //clear out the warning session id ( so we don't submit to the same session key )
800 - this.warnings_sessionkey = false;
 800+ this.rewriteDescriptionText = false;
801801 break;
802802 case 'disableDirectSubmit':
803803 this.formDirectSubmit = false;
Index: branches/MwEmbedStandAlone/modules/AddMedia/AddMedia.i18n.php
@@ -24,11 +24,11 @@
2525 'mwe-go-to-resource' => 'Go to resource page',
2626 'mwe-upload-misc-error' => 'Unknown upload error',
2727 'mwe-wgfogg_warning_bad_extension' => 'You have selected a file with an unsuported extension (<a href="http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types">more information</a>).',
28 - 'thumbnail-more' => 'Enlarge',
29 - 'license-header' => 'Licensing',
30 - 'filedesc' => 'Summary',
31 - 'filesource' => 'Source:',
32 - 'filestatus' => 'Copyright status:',
 28+ 'mwe-thumbnail-more' => 'Enlarge',
 29+ 'mwe-license-header' => 'Licensing',
 30+ 'mwe-filedesc' => 'Summary',
 31+ 'mwe-filesource' => 'Source:',
 32+ 'mwe-filestatus' => 'Copyright status:',
3333 'mwe-loading-add-media-wiz' => 'Loading add media wizard',
3434 'fogg-save_local_file' => 'Save Ogg',
3535 'fogg-help-sticky' => 'Help (click to stick)',
Index: branches/MwEmbedStandAlone/jsScriptLoader.php
@@ -159,8 +159,9 @@
160160 // Save to the file cache
161161 if ( $wgUseFileCache && !$this->debug ) {
162162 $status = $this->sFileCache->saveToFileCache( $this->output );
163 - if ( $status !== true )
164 - $this->errorMsg .= $status;
 163+ if ( $status !== true ) {
 164+ $this->errorMsg .= $status;
 165+ }
165166 }
166167
167168 // Check for an error msg
@@ -168,7 +169,9 @@
169170 //just set the content type (don't send cache header)
170171 header( 'Content-Type: text/javascript' );
171172 echo 'alert(\'Error With ScriptLoader ::' .
172 - str_replace( "\n", '\'+"\n"+' . "\n'", htmlspecialchars( $this->errorMsg ) ). '\');'."\n";
 173+ str_replace( "\n", '\'+"\n"+' . "\n'",
 174+ xml::escapeJsString( $this->errorMsg )
 175+ ) . '\');'."\n";
173176 echo trim( $this->output );
174177 } else {
175178 // All good, let's output "cache" headers

Status & tagging log