Index: branches/MwEmbedStandAlone/loader.js |
— | — | @@ -49,9 +49,8 @@ |
50 | 50 | 'EmbedPlayer', |
51 | 51 | 'ApiProxy', |
52 | 52 | 'Sequencer', |
53 | | - 'TimedText', |
54 | | - 'UploadWizard' |
55 | | -]; |
| 53 | + 'TimedText' |
| 54 | +]; |
56 | 55 | |
57 | 56 | /** |
58 | 57 | * 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 @@ |
24 | 24 | "mwe-file-thumbnail-no" : "The filename begins with <b><tt>$1<\/tt><\/b>", |
25 | 25 | "mwe-go-to-resource" : "Go to resource page", |
26 | 26 | "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:" |
34 | 33 | }); |
35 | 34 | |
36 | | -var default_uh_options = { |
| 35 | +var defaultUploadHandlerOptions = { |
37 | 36 | // Target api to upload to |
38 | 37 | 'apiUrl' : null, |
39 | 38 | |
— | — | @@ -123,12 +122,12 @@ |
124 | 123 | |
125 | 124 | /** |
126 | 125 | * Object initialization |
127 | | - * @param {Object} options BaseUpload options see default_uh_options |
| 126 | + * @param {Object} options BaseUpload options see defaultUploadHandlerOptions |
128 | 127 | */ |
129 | 128 | init: function( options ) { |
130 | 129 | if ( !options ) |
131 | 130 | options = {}; |
132 | | - $j.extend( this, default_uh_options, options ); |
| 131 | + $j.extend( this, defaultUploadHandlerOptions, options ); |
133 | 132 | |
134 | 133 | // Set a apiUrl if unset |
135 | 134 | if( !this.apiUrl ) { |
— | — | @@ -211,17 +210,18 @@ |
212 | 211 | /** |
213 | 212 | * onSubmit handler for the upload form |
214 | 213 | */ |
215 | | - onSubmit: function( evt ) { |
| 214 | + onSubmit: function() { |
216 | 215 | var _this = this; |
217 | 216 | 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; |
222 | 222 | return false; |
223 | | - } |
224 | | - } |
225 | | - |
| 223 | + } |
| 224 | + } |
| 225 | + |
226 | 226 | // Reinstate the ['name'=comment'] filed since |
227 | 227 | // commons hacks removes wgUploadDesction from the form |
228 | 228 | var $form = $j( this.form ); |
— | — | @@ -236,7 +236,6 @@ |
237 | 237 | } |
238 | 238 | |
239 | 239 | var uploadDesc = _this.getUploadDescription(); |
240 | | - // update the form |
241 | 240 | if( uploadDesc ) { |
242 | 241 | $form.find("[name='comment']").val( uploadDesc ); |
243 | 242 | } |
— | — | @@ -512,7 +511,7 @@ |
513 | 512 | /** |
514 | 513 | * Get the upload description, append the license if available |
515 | 514 | * |
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. |
517 | 516 | * |
518 | 517 | * @param {Boolean} useCache If the upload description cache can be used. |
519 | 518 | * @return {String} |
— | — | @@ -535,9 +534,12 @@ |
536 | 535 | var source = ( $j("[name='wpSource']").length ) ? $j("[name='wpSource']").val() : ''; |
537 | 536 | |
538 | 537 | // 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; |
540 | 540 | } |
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 ); |
542 | 544 | return comment_value; |
543 | 545 | }, |
544 | 546 | |
— | — | @@ -794,9 +796,7 @@ |
795 | 797 | this.ignoreWarningsSubmit(); |
796 | 798 | break; |
797 | 799 | 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; |
801 | 801 | break; |
802 | 802 | case 'disableDirectSubmit': |
803 | 803 | this.formDirectSubmit = false; |
Index: branches/MwEmbedStandAlone/modules/AddMedia/AddMedia.i18n.php |
— | — | @@ -24,11 +24,11 @@ |
25 | 25 | 'mwe-go-to-resource' => 'Go to resource page', |
26 | 26 | 'mwe-upload-misc-error' => 'Unknown upload error', |
27 | 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 | | - '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:', |
33 | 33 | 'mwe-loading-add-media-wiz' => 'Loading add media wizard', |
34 | 34 | 'fogg-save_local_file' => 'Save Ogg', |
35 | 35 | 'fogg-help-sticky' => 'Help (click to stick)', |
Index: branches/MwEmbedStandAlone/jsScriptLoader.php |
— | — | @@ -159,8 +159,9 @@ |
160 | 160 | // Save to the file cache |
161 | 161 | if ( $wgUseFileCache && !$this->debug ) { |
162 | 162 | $status = $this->sFileCache->saveToFileCache( $this->output ); |
163 | | - if ( $status !== true ) |
164 | | - $this->errorMsg .= $status; |
| 163 | + if ( $status !== true ) { |
| 164 | + $this->errorMsg .= $status; |
| 165 | + } |
165 | 166 | } |
166 | 167 | |
167 | 168 | // Check for an error msg |
— | — | @@ -168,7 +169,9 @@ |
169 | 170 | //just set the content type (don't send cache header) |
170 | 171 | header( 'Content-Type: text/javascript' ); |
171 | 172 | 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"; |
173 | 176 | echo trim( $this->output ); |
174 | 177 | } else { |
175 | 178 | // All good, let's output "cache" headers |