Index: branches/js2-work/phase3/js/mwEmbed/loader.js |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | |
91 | 91 | // Default request timeout ( for cases where we inlucde js and normal browser timeout can't be used ) |
92 | 92 | // stored in seconds |
93 | | - 'defaultRequestTimeout' : 25, |
| 93 | + 'defaultRequestTimeout' : 10, |
94 | 94 | |
95 | 95 | // Default user language is "en" Can be overwritten by: |
96 | 96 | // "uselang" url param |
Index: branches/js2-work/phase3/js/mwEmbed/tests/testApiProxy.html |
— | — | @@ -80,54 +80,74 @@ |
81 | 81 | function doFileUpload(){ |
82 | 82 | $j('#file-upload-container').fadeIn( 'slow' ); |
83 | 83 | $j('#browseTarget').loadingSpinner(); |
| 84 | + // Load firefogg lib |
| 85 | + mw.load('AddMedia.firefogg', function( ) { |
| 86 | + // Load proxy lib |
| 87 | + mw.load( 'ApiProxy', function( ) { |
| 88 | + // Get a token for the upload: |
| 89 | + mw.getToken( remote_apiUrl, 'File:MyRandomFileTokenCheck.jpg', function( eToken ) { |
| 90 | + mw.log(" got token :: " + eToken); |
| 91 | + // Add the token to the dom: |
| 92 | + $j( '#file-name' ).append( |
| 93 | + $j('<input />') |
| 94 | + .attr({ |
| 95 | + 'type': 'hidden', |
| 96 | + 'id' : 'wpEditToken', |
| 97 | + 'name' : 'token' |
| 98 | + }) |
| 99 | + .val( eToken ) |
| 100 | + ); |
| 101 | + var fileIframeName = mw.ApiProxy.browseFile( { |
| 102 | + //Target div to put the iframe browser button: |
| 103 | + 'target' : '#browseTarget', |
84 | 104 | |
85 | | - mw.load('AddMedia.firefogg', function( ) { |
86 | | - mw.load( 'ApiProxy', function( ) { |
87 | | - var fileIframeName = mw.ApiProxy.browseFile( { |
88 | | - //Target div to put the iframe browser button: |
89 | | - 'target' : '#browseTarget', |
| 105 | + // Set the token |
| 106 | + 'token' : eToken, |
| 107 | + |
| 108 | + // Api url to upload to |
| 109 | + 'apiUrl' : remote_apiUrl, |
| 110 | + |
| 111 | + // File Destination Name change callback: |
| 112 | + 'selectFileCb' : function( fname ){ |
| 113 | + // Update our local target: |
| 114 | + $j('#file-name').val( fname ); |
| 115 | + // Run a destination file name check on the remote target |
| 116 | + $j('#file-name').doDestCheck( { |
| 117 | + 'apiUrl' : remote_apiUrl, |
| 118 | + 'warn_target': '#file-warning' |
| 119 | + } ); |
| 120 | + }, |
| 121 | + 'doneUploadCb' : function( apiResult ){ |
| 122 | + alert(' upload done' ); |
| 123 | + } |
| 124 | + } ); |
90 | 125 | |
91 | | - // Api url to upload to |
92 | | - 'apiUrl' : remote_apiUrl, |
| 126 | + //Setup submit binding: |
| 127 | + $j('#uploadButton').click( function( ){ |
| 128 | + // Build the output and send upload request to fileProxy |
| 129 | + mw.ApiProxy.sendServerMsg( { |
| 130 | + 'apiUrl' : remote_apiUrl, |
| 131 | + 'frameName' : fileIframeName, |
| 132 | + 'frameMsg' : { |
| 133 | + 'action' : 'fileSubmit', |
| 134 | + 'formData' : { |
| 135 | + 'filename' : $j('#file-name').val(), |
| 136 | + 'comment' : $j('#file-desc').val() |
| 137 | + } |
| 138 | + } |
| 139 | + } ); |
| 140 | + // Maybe set loading to spinner |
| 141 | + } ); |
93 | 142 | |
94 | | - // File Destination Name change callback: |
95 | | - 'selectFileCb' : function( fname ){ |
96 | | - // Update our local target: |
97 | | - $j('#file-name').val( fname ); |
98 | | - // Run a destination file name check on the remote target |
| 143 | + |
| 144 | + // Setup doDestCheck on change |
| 145 | + $j('#file-name').change(function(){ |
99 | 146 | $j('#file-name').doDestCheck( { |
100 | 147 | 'apiUrl' : remote_apiUrl, |
101 | 148 | 'warn_target': '#file-warning' |
102 | | - } ); |
103 | | - } |
104 | | - } ); |
105 | | - |
106 | | - //Setup submit binding: |
107 | | - $j('#uploadButton').click(function(){ |
108 | | - // Build the output and send upload request to fileProxy |
109 | | - mw.ApiProxy.sendServerMsg( { |
110 | | - 'apiUrl' : remote_apiUrl, |
111 | | - 'frameName' : fileIframeName, |
112 | | - 'frameMsg' : { |
113 | | - 'action' : 'fileSubmit', |
114 | | - 'formData' : { |
115 | | - 'filename' : $j('#file-name').val(), |
116 | | - 'comment' : $j('#file-desc').val() |
117 | | - } |
118 | | - } |
119 | | - } ); |
120 | | - // Maybe set loading to spinner |
121 | | - } ); |
122 | | - |
123 | | - |
124 | | - // Setup doDestCheck on change |
125 | | - $j('#file-name').change(function(){ |
126 | | - $j('#file-name').doDestCheck( { |
127 | | - 'apiUrl' : remote_apiUrl, |
128 | | - 'warn_target': '#file-warning' |
129 | | - } ); |
| 149 | + } ); |
| 150 | + }); |
130 | 151 | }); |
131 | | - |
132 | 152 | }) |
133 | 153 | }); |
134 | 154 | }; |
Index: branches/js2-work/phase3/js/mwEmbed/languages/mwEmbed.i18n.php |
— | — | @@ -12,22 +12,67 @@ |
13 | 13 | |
14 | 14 | $messages['en'] = array( |
15 | 15 | /* |
16 | | - * js file: /skins/kskin/kskinConfig.js |
| 16 | + * js file: /modules/EmbedPlayer/mw.EmbedPlayer.js |
17 | 17 | */ |
18 | | - 'mwe-credit-title' => 'Title: $1', |
| 18 | + 'mwe-loading_plugin' => 'loading plugin ...', |
| 19 | + 'mwe-select_playback' => 'Set playback preference', |
| 20 | + 'mwe-link_back' => 'Link back', |
| 21 | + 'mwe-error_swap_vid' => 'Error: mwEmbed was unable to swap the video tag for the mwEmbed interface', |
| 22 | + 'mwe-add_to_end_of_sequence' => 'Add to end of sequence', |
| 23 | + 'mwe-missing_video_stream' => 'The video file for this stream is missing', |
| 24 | + 'mwe-play_clip' => 'Play clip', |
| 25 | + 'mwe-pause_clip' => 'Pause clip', |
| 26 | + 'mwe-volume_control' => 'Volume control', |
| 27 | + 'mwe-player_options' => 'Player options', |
| 28 | + 'mwe-timed_text' => 'Timed text', |
| 29 | + 'mwe-player_fullscreen' => 'Fullscreen', |
| 30 | + 'mwe-next_clip_msg' => 'Play next clip', |
| 31 | + 'mwe-prev_clip_msg' => 'Play previous clip', |
| 32 | + 'mwe-current_clip_msg' => 'Continue playing this clip', |
| 33 | + 'mwe-seek_to' => 'Seek $1', |
| 34 | + 'mwe-paused' => 'paused', |
| 35 | + 'mwe-download_segment' => 'Download selection:', |
| 36 | + 'mwe-download_full' => 'Download full video file:', |
| 37 | + 'mwe-download_right_click' => 'To download, right click and select <i>Save link as...</i>', |
| 38 | + 'mwe-download_clip' => 'Download video', |
| 39 | + 'mwe-download_text' => 'Download text (<a style="color:white" title="cmml" href="http://wiki.xiph.org/index.php/CMML">CMML</a> xml):', |
| 40 | + 'mwe-download' => 'Download', |
| 41 | + 'mwe-share' => 'Share', |
| 42 | + 'mwe-credits' => 'Credits', |
| 43 | + 'mwe-clip_linkback' => 'Clip source page', |
| 44 | + 'mwe-chose_player' => 'Choose video player', |
| 45 | + 'mwe-no-player' => 'No player available for $1', |
| 46 | + 'mwe-share_this_video' => 'Share this video', |
| 47 | + 'mwe-video_credits' => 'Video credits', |
| 48 | + 'mwe-kaltura-platform-title' => 'Kaltura open source video platform', |
| 49 | + 'mwe-menu_btn' => 'Menu', |
| 50 | + 'mwe-close_btn' => 'Close', |
| 51 | + 'mwe-ogg-player-vlc-player' => 'VLC player', |
| 52 | + 'mwe-ogg-player-oggNative' => 'HTML5 ogg player', |
| 53 | + 'mwe-ogg-player-h264Native' => 'HTML5 h.264 player', |
| 54 | + 'mwe-ogg-player-oggPlugin' => 'Generic Ogg plugin', |
| 55 | + 'mwe-ogg-player-quicktime-mozilla' => 'QuickTime plugin', |
| 56 | + 'mwe-ogg-player-quicktime-activex' => 'QuickTime ActiveX', |
| 57 | + 'mwe-ogg-player-cortado' => 'Java Cortado', |
| 58 | + 'mwe-ogg-player-flowplayer' => 'Flowplayer', |
| 59 | + 'mwe-ogg-player-kplayer' => 'Kaltura player', |
| 60 | + 'mwe-ogg-player-selected' => '(selected)', |
| 61 | + 'mwe-ogg-player-omtkplayer' => 'OMTK Flash Vorbis', |
| 62 | + 'mwe-generic_missing_plugin' => 'You browser does not appear to support the following playback type: <b>$1</b><br />Visit the <a href="http://commons.wikimedia.org/wiki/Commons:Media_help">Playback Methods</a> page to download a player.<br />', |
| 63 | + 'mwe-for_best_experience' => 'For a better video playback experience we recommend the <b><a href="http://www.mozilla.com/en-US/firefox/upgrade.html?from=mwEmbed">latest firefox</a>.</b>', |
| 64 | + 'mwe-do_not_warn_again' => 'Dismiss for now.', |
| 65 | + 'mwe-playerSelect' => 'Players', |
| 66 | + 'mwe-read_before_embed' => '<a href="http://mediawiki.org/wiki/Security_Notes_on_Remote_Embedding" target="_new">Read this</a> before embedding.', |
| 67 | + 'mwe-embed_site_or_blog' => 'Embed on a page', |
| 68 | + 'mwe-related_videos' => 'Related videos', |
| 69 | + 'mwe-seeking' => 'seeking', |
| 70 | + 'mwe-copy-code' => 'Copy code', |
| 71 | + 'mwe-video-h264' => 'H.264 video', |
| 72 | + 'mwe-video-flv' => 'Flash video', |
| 73 | + 'mwe-video-ogg' => 'Ogg video', |
| 74 | + 'mwe-video-audio' => 'Ogg audio', |
19 | 75 | |
20 | 76 | /* |
21 | | - * js file: /modules/Sequencer/mw.TimedEffectsEdit.js |
22 | | - */ |
23 | | - 'mwe-transition_in' => 'Transition in', |
24 | | - 'mwe-transition_out' => 'Transition out', |
25 | | - 'mwe-effects' => 'Effects stack', |
26 | | - 'mwe-remove_transition' => 'Remove transition', |
27 | | - 'mwe-edit_transin' => 'Edit transition into clip', |
28 | | - 'mwe-edit_transout' => 'Edit transition out of clip', |
29 | | - 'mwe-add-transition' => 'Add a transition', |
30 | | - |
31 | | - /* |
32 | 77 | * js file: /modules/Sequencer/mw.Sequencer.js |
33 | 78 | */ |
34 | 79 | 'mwe-menu_clipedit' => 'Edit media', |
— | — | @@ -66,12 +111,66 @@ |
67 | 112 | 'mwe-sequencer_credit_line' => 'Developed by <a href="http://kaltura.com">Kaltura, Inc.</a> in partnership with the <a href="http://wikimediafoundation.org/wiki/Home">Wikimedia Foundation</a> (<a href="#">more information</a>).', |
68 | 113 | |
69 | 114 | /* |
| 115 | + * js file: /modules/Sequencer/mw.TimedEffectsEdit.js |
| 116 | + */ |
| 117 | + 'mwe-transition_in' => 'Transition in', |
| 118 | + 'mwe-transition_out' => 'Transition out', |
| 119 | + 'mwe-effects' => 'Effects stack', |
| 120 | + 'mwe-remove_transition' => 'Remove transition', |
| 121 | + 'mwe-edit_transin' => 'Edit transition into clip', |
| 122 | + 'mwe-edit_transout' => 'Edit transition out of clip', |
| 123 | + 'mwe-add-transition' => 'Add a transition', |
| 124 | + |
| 125 | + /* |
70 | 126 | * js file: /modules/Sequencer/remotes/RemoteMwSequencer.js |
71 | 127 | */ |
72 | 128 | 'mwe-no-sequence-create' => 'No sequence exists named $1, You can $2', |
73 | 129 | 'mwe-sequence-create-one' => 'start a sequence', |
74 | 130 | |
75 | 131 | /* |
| 132 | + * js file: /modules/ClipEdit/mw.ClipEdit.js |
| 133 | + */ |
| 134 | + 'mwe-crop' => 'Crop image', |
| 135 | + 'mwe-apply_crop' => 'Apply crop to image', |
| 136 | + 'mwe-reset_crop' => 'Reset crop', |
| 137 | + 'mwe-insert_image_page' => 'Insert into page', |
| 138 | + 'mwe-insert_into_sequence' => 'Insert into sequence', |
| 139 | + 'mwe-preview_insert' => 'Preview insert', |
| 140 | + 'mwe-cancel_image_insert' => 'Cancel insert', |
| 141 | + 'mwe-sc_attributes' => 'Clip detail edit', |
| 142 | + 'mwe-sc_inoutpoints' => 'Set in-out points', |
| 143 | + 'mwe-sc_overlays' => 'Overlays', |
| 144 | + 'mwe-sc_audio' => 'Audio control', |
| 145 | + 'mwe-sc_duration' => 'Duration', |
| 146 | + 'mwe-template_properties' => 'Template properties', |
| 147 | + 'mwe-custom_title' => 'Custom title', |
| 148 | + 'mwe-edit_properties' => 'Edit properties', |
| 149 | + 'mwe-other_properties' => 'Other properties', |
| 150 | + 'mwe-resource_page' => 'Resource page:', |
| 151 | + 'mwe-set_in_out_points' => 'Set in-out points', |
| 152 | + 'mwe-start_time' => 'Start time', |
| 153 | + 'mwe-end_time' => 'End time', |
| 154 | + 'mwe-preview_inout' => 'Preview in-out points', |
| 155 | + 'mwe-edit-tools' => 'Edit tools', |
| 156 | + 'mwe-inline-description' => 'Caption', |
| 157 | + 'mwe-edit-video-tools' => 'Edit video tools:', |
| 158 | + 'mwe-duration' => 'Duration:', |
| 159 | + 'mwe-layout' => 'Layout', |
| 160 | + 'mwe-layout_right' => 'Right side image layout', |
| 161 | + 'mwe-layout_left' => 'Left side image layout', |
| 162 | + |
| 163 | + /* |
| 164 | + * js file: /modules/ApiProxy/mw.ApiProxy.js |
| 165 | + */ |
| 166 | + 'mwe-setting-up-proxy' => 'Setting up proxy...', |
| 167 | + 'mwe-re-try' => 'Retry API request', |
| 168 | + 'mwe-re-trying' => 'Retrying API request...', |
| 169 | + 'mwe-proxy-not-ready' => 'Proxy is not configured', |
| 170 | + 'mwe-please-login' => 'The request failed. Are you logged in on $1 ? Please $2 and try again', |
| 171 | + 'mwe-log-in-link' => 'log in', |
| 172 | + 'mwe-remember-loging' => 'General security reminder: Only login to web sites when your address bar displays that site\'s address.', |
| 173 | + |
| 174 | + /* |
76 | 175 | * js file: /modules/TimedText/mw.TimedTextEdit.js |
77 | 176 | */ |
78 | 177 | 'mew-timedtext-editor' => 'Timed text editor', |
— | — | @@ -130,211 +229,6 @@ |
131 | 230 | 'mwe-language-no-subtitles-for-clip' => 'No $1 subtitles where found for clip: $2', |
132 | 231 | |
133 | 232 | /* |
134 | | - * js file: /modules/EmbedPlayer/mw.EmbedPlayer.js |
135 | | - */ |
136 | | - 'mwe-loading_plugin' => 'loading plugin ...', |
137 | | - 'mwe-select_playback' => 'Set playback preference', |
138 | | - 'mwe-link_back' => 'Link back', |
139 | | - 'mwe-error_swap_vid' => 'Error: mwEmbed was unable to swap the video tag for the mwEmbed interface', |
140 | | - 'mwe-add_to_end_of_sequence' => 'Add to end of sequence', |
141 | | - 'mwe-missing_video_stream' => 'The video file for this stream is missing', |
142 | | - 'mwe-play_clip' => 'Play clip', |
143 | | - 'mwe-pause_clip' => 'Pause clip', |
144 | | - 'mwe-volume_control' => 'Volume control', |
145 | | - 'mwe-player_options' => 'Player options', |
146 | | - 'mwe-timed_text' => 'Timed text', |
147 | | - 'mwe-player_fullscreen' => 'Fullscreen', |
148 | | - 'mwe-next_clip_msg' => 'Play next clip', |
149 | | - 'mwe-prev_clip_msg' => 'Play previous clip', |
150 | | - 'mwe-current_clip_msg' => 'Continue playing this clip', |
151 | | - 'mwe-seek_to' => 'Seek $1', |
152 | | - 'mwe-paused' => 'paused', |
153 | | - 'mwe-download_segment' => 'Download selection:', |
154 | | - 'mwe-download_full' => 'Download full video file:', |
155 | | - 'mwe-download_right_click' => 'To download, right click and select <i>Save link as...</i>', |
156 | | - 'mwe-download_clip' => 'Download video', |
157 | | - 'mwe-download_text' => 'Download text (<a style="color:white" title="cmml" href="http://wiki.xiph.org/index.php/CMML">CMML</a> xml):', |
158 | | - 'mwe-download' => 'Download', |
159 | | - 'mwe-share' => 'Share', |
160 | | - 'mwe-credits' => 'Credits', |
161 | | - 'mwe-clip_linkback' => 'Clip source page', |
162 | | - 'mwe-chose_player' => 'Choose video player', |
163 | | - 'mwe-no-player' => 'No player available for $1', |
164 | | - 'mwe-share_this_video' => 'Share this video', |
165 | | - 'mwe-video_credits' => 'Video credits', |
166 | | - 'mwe-kaltura-platform-title' => 'Kaltura open source video platform', |
167 | | - 'mwe-menu_btn' => 'Menu', |
168 | | - 'mwe-close_btn' => 'Close', |
169 | | - 'mwe-ogg-player-vlc-player' => 'VLC player', |
170 | | - 'mwe-ogg-player-oggNative' => 'HTML5 ogg player', |
171 | | - 'mwe-ogg-player-h264Native' => 'HTML5 h.264 player', |
172 | | - 'mwe-ogg-player-oggPlugin' => 'Generic Ogg plugin', |
173 | | - 'mwe-ogg-player-quicktime-mozilla' => 'QuickTime plugin', |
174 | | - 'mwe-ogg-player-quicktime-activex' => 'QuickTime ActiveX', |
175 | | - 'mwe-ogg-player-cortado' => 'Java Cortado', |
176 | | - 'mwe-ogg-player-flowplayer' => 'Flowplayer', |
177 | | - 'mwe-ogg-player-kplayer' => 'Kaltura player', |
178 | | - 'mwe-ogg-player-selected' => '(selected)', |
179 | | - 'mwe-ogg-player-omtkplayer' => 'OMTK Flash Vorbis', |
180 | | - 'mwe-generic_missing_plugin' => 'You browser does not appear to support the following playback type: <b>$1</b><br />Visit the <a href="http://commons.wikimedia.org/wiki/Commons:Media_help">Playback Methods</a> page to download a player.<br />', |
181 | | - 'mwe-for_best_experience' => 'For a better video playback experience we recommend the <b><a href="http://www.mozilla.com/en-US/firefox/upgrade.html?from=mwEmbed">latest firefox</a>.</b>', |
182 | | - 'mwe-do_not_warn_again' => 'Dismiss for now.', |
183 | | - 'mwe-playerSelect' => 'Players', |
184 | | - 'mwe-read_before_embed' => '<a href="http://mediawiki.org/wiki/Security_Notes_on_Remote_Embedding" target="_new">Read this</a> before embedding.', |
185 | | - 'mwe-embed_site_or_blog' => 'Embed on a page', |
186 | | - 'mwe-related_videos' => 'Related videos', |
187 | | - 'mwe-seeking' => 'seeking', |
188 | | - 'mwe-copy-code' => 'Copy code', |
189 | | - 'mwe-video-h264' => 'H.264 video', |
190 | | - 'mwe-video-flv' => 'Flash video', |
191 | | - 'mwe-video-ogg' => 'Ogg video', |
192 | | - 'mwe-video-audio' => 'Ogg audio', |
193 | | - |
194 | | - /* |
195 | | - * js file: /modules/AddMedia/mw.UploadHandler.js |
196 | | - */ |
197 | | - 'mwe-upload-transcoded-status' => 'Transcoded', |
198 | | - 'mwe-upload-stats-fileprogress' => '$1 of $2', |
199 | | - 'mwe-upload_completed' => 'Your upload is complete', |
200 | | - 'mwe-upload_done' => '<a href="$1">Your upload <i>should be</i> accessible</a>.', |
201 | | - 'mwe-upload-unknown-size' => 'Unknown size', |
202 | | - 'mwe-cancel-confim' => 'Are you sure you want to cancel?', |
203 | | - 'mwe-successfulupload' => 'Upload successful', |
204 | | - 'mwe-uploaderror' => 'Upload error', |
205 | | - 'mwe-uploadwarning' => 'Upload warning', |
206 | | - 'mwe-unknown-error' => 'Unknown error:', |
207 | | - 'mwe-return-to-form' => 'Return to form', |
208 | | - 'mwe-file-exists-duplicate' => 'This file is a duplicate of the following file:', |
209 | | - 'mwe-fileexists' => 'A file with this name exists already. Please check <b><tt>$1</tt></b> if you are not sure if you want to change it.', |
210 | | - 'mwe-fileexists-thumb' => '<center><b>Existing file</b></center>', |
211 | | - 'mwe-ignorewarning' => 'Ignore warning and save file anyway', |
212 | | - 'mwe-file-thumbnail-no' => 'The filename begins with <b><tt>$1</tt></b>', |
213 | | - 'mwe-go-to-resource' => 'Go to resource page', |
214 | | - 'mwe-upload-misc-error' => 'Unknown upload error', |
215 | | - '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>).', |
216 | | - 'thumbnail-more' => 'Enlarge', |
217 | | - 'license-header' => 'Licensing', |
218 | | - 'filedesc' => 'Summary', |
219 | | - 'filesource' => 'Source:', |
220 | | - 'filestatus' => 'Copyright status:', |
221 | | - |
222 | | - /* |
223 | | - * js file: /modules/AddMedia/loader.js |
224 | | - */ |
225 | | - 'mwe-loading-add-media-wiz' => 'Loading add media wizard', |
226 | | - |
227 | | - /* |
228 | | - * js file: /modules/AddMedia/mw.FirefoggGUI.js |
229 | | - */ |
230 | | - 'fogg-save_local_file' => 'Save Ogg', |
231 | | - 'fogg-help-sticky' => 'Help (click to stick)', |
232 | | - 'fogg-cg-preset' => 'Preset: <strong>$1</strong>', |
233 | | - 'fogg-cg-quality' => 'Basic quality and resolution control', |
234 | | - 'fogg-cg-meta' => 'Metadata for the clip', |
235 | | - 'fogg-cg-range' => 'Encoding range', |
236 | | - 'fogg-cg-advVideo' => 'Advanced video encoding controls', |
237 | | - 'fogg-cg-advAudio' => 'Advanced audio encoding controls', |
238 | | - 'fogg-preset-custom' => 'Custom settings', |
239 | | - 'fogg-webvideo-desc' => 'Web video Theora, Vorbis 400 kbit/s and 400px maximum width', |
240 | | - 'fogg-savebandwidth-desc' => 'Low bandwidth Theora, Vorbis 164 kbit/s and 200px maximum width', |
241 | | - 'fogg-highquality-desc' => 'High quality Theora, Vorbis 1080px maximum width', |
242 | | - 'fogg-videoQuality-title' => 'Video quality', |
243 | | - 'fogg-videoQuality-help' => 'Used to set the <i>visual quality</i> of the encoded video (not used if you set bitrate in advanced controls below).', |
244 | | - 'fogg-starttime-title' => 'Start second', |
245 | | - 'fogg-starttime-help' => 'Only encode from time in seconds', |
246 | | - 'fogg-endtime-title' => 'End second', |
247 | | - 'fogg-endtime-help' => 'Only encode to time in seconds', |
248 | | - 'fogg-audioQuality-title' => 'Audio quality', |
249 | | - 'fogg-audioQuality-help' => 'Used to set the <i>acoustic quality</i> of the encoded audio (not used if you set bitrate in advanced controls below).', |
250 | | - 'fogg-videoCodec-title' => 'Video codec', |
251 | | - 'fogg-videoCodec-help' => 'Used to select the clip video codec. Presently only Theora is supported. More about the <a target="_new" href="http://en.wikipedia.org/wiki/Theora">Theora codec</a>.', |
252 | | - 'fogg-audioCodec-title' => 'Audio codec', |
253 | | - 'fogg-audioCodec-help' => 'Used to set the clip audio codec. Presently only Vorbis is supported. More about the <a target="_new" href="http://en.wikipedia.org/wiki/Vorbis">Vorbis codec</a>', |
254 | | - 'fogg-width-title' => 'Video width', |
255 | | - 'fogg-width-help' => 'Resize to given width.', |
256 | | - 'fogg-height-title' => 'Video height', |
257 | | - 'fogg-height-help' => 'Resize to given height.', |
258 | | - 'fogg-videoBitrate-title' => 'Video bitrate', |
259 | | - 'fogg-videoBitrate-help' => 'Video bitrate sets the encoding bitrate for video in (kb/s)', |
260 | | - 'fogg-twopass-title' => 'Two pass encoding', |
261 | | - 'fogg-twopass-help' => 'Two pass encoding enables more constant quality by making two passes over the video file', |
262 | | - 'fogg-framerate-title' => 'Frame rate', |
263 | | - 'fogg-framerate-help' => 'The video frame rate. More about <a target="_new" href="http://en.wikipedia.org/wiki/Frame_rate">frame rate</a>.', |
264 | | - 'fogg-aspect-title' => 'Aspect ratio', |
265 | | - 'fogg-aspect-help' => 'The video aspect ratio can be 4:3 or 16:9. More about <a target="_new" href="http://en.wikipedia.org/wiki/Aspect_ratio_%28image%29">aspect ratios</a>.', |
266 | | - 'fogg-keyframeInterval-title' => 'Key frame interval', |
267 | | - 'fogg-keyframeInterval-help' => 'The keyframe interval in frames. Note: Most codecs force keyframes if the difference between frames is greater than keyframe encode size. More about <a href="http://en.wikipedia.org/wiki/I-frame">keyframes</a>.', |
268 | | - 'fogg-denoise-title' => 'Denoise filter', |
269 | | - 'fogg-denoise-help' => 'Denoise input video. More about <a href="http://en.wikipedia.org/wiki/Video_denoising">denoise</a>.', |
270 | | - 'fogg-novideo-title' => 'No video', |
271 | | - 'fogg-novideo-help' => 'disable video in the output', |
272 | | - 'fogg-audioBitrate-title' => 'Audio bitrate', |
273 | | - 'fogg-samplerate-title' => 'Audio sampling rate', |
274 | | - 'fogg-samplerate-help' => 'set output sample rate (in Hz).', |
275 | | - 'fogg-noaudio-title' => 'No audio', |
276 | | - 'fogg-noaudio-help' => 'disable audio in the output', |
277 | | - 'fogg-title-title' => 'Title', |
278 | | - 'fogg-title-help' => 'A title for your clip', |
279 | | - 'fogg-artist-title' => 'Creator name', |
280 | | - 'fogg-artist-help' => 'The creator of this clip', |
281 | | - 'fogg-date-title' => 'Date', |
282 | | - 'fogg-date-help' => 'The date the footage was created or released', |
283 | | - 'fogg-location-title' => 'Location', |
284 | | - 'fogg-location-help' => 'The location of the footage', |
285 | | - 'fogg-organization-title' => 'Organization', |
286 | | - 'fogg-organization-help' => 'Name of organization (studio)', |
287 | | - 'fogg-copyright-title' => 'Copyright', |
288 | | - 'fogg-copyright-help' => 'The copyright of the clip', |
289 | | - 'fogg-license-title' => 'License', |
290 | | - 'fogg-license-help' => 'The license of the clip (preferably a Creative Commons URL).', |
291 | | - 'fogg-contact-title' => 'Contact', |
292 | | - 'fogg-contact-help' => 'Contact link', |
293 | | - |
294 | | - /* |
295 | | - * js file: /modules/AddMedia/searchLibs/metavidSearch.js |
296 | | - */ |
297 | | - 'mwe-stream_title' => '$1 $2 to $3', |
298 | | - |
299 | | - /* |
300 | | - * js file: /modules/AddMedia/searchLibs/kalturaSearch.js |
301 | | - */ |
302 | | - 'rsd-media-filter-title' => 'Media', |
303 | | - 'rsd-media-filter-videos' => 'Videos', |
304 | | - 'rsd-media-filter-images' => 'Images', |
305 | | - 'rsd-provider-filter-title' => 'Providers', |
306 | | - |
307 | | - /* |
308 | | - * js file: /modules/AddMedia/searchLibs/baseRemoteSearch.js |
309 | | - */ |
310 | | - 'mwe-imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more information.', |
311 | | - 'mwe-import-description' => '$1, imported from $2', |
312 | | - |
313 | | - /* |
314 | | - * js file: /modules/AddMedia/mw.UploadForm.js |
315 | | - */ |
316 | | - 'mwe-select_file' => 'Select file', |
317 | | - 'mwe-select_ownwork' => 'I am uploading entirely my own work, and licensing it under:', |
318 | | - 'mwe-license_cc-by-sa' => 'Creative Commons Share Alike (3.0)', |
319 | | - 'mwe-upload' => 'Upload file', |
320 | | - 'mwe-destfilename' => 'Destination filename:', |
321 | | - 'mwe-summary' => 'Summary', |
322 | | - 'mwe-error_not_loggedin' => 'You do not appear to be logged in or do not have upload privileges.', |
323 | | - 'mwe-watch-this-file' => 'Watch this file', |
324 | | - 'mwe-ignore-any-warnings' => 'Ignore any warnings', |
325 | | - 'mwe-i-would-like-to' => 'I would like to', |
326 | | - 'mwe-upload-own-file' => 'Upload my own work to $1', |
327 | | - 'mwe-upload-not-my-file' => 'Upload media that is not my own work to $1', |
328 | | - 'mwe-upload-once-done' => 'Please upload in the new window or tab. Once you have completed your upload, $1', |
329 | | - 'mwe-upload-refresh' => 'refresh your upload list', |
330 | | - |
331 | | - /* |
332 | | - * js file: /modules/AddMedia/mw.UploadInterface.js |
333 | | - */ |
334 | | - 'mwe-upload-in-progress' => 'Upload in progress (do not close this window)', |
335 | | - 'mwe-uploaded-status' => 'Uploaded', |
336 | | - 'mwe-uploaded-time-remaining' => 'Time remaining: $1', |
337 | | - |
338 | | - /* |
339 | 233 | * js file: /modules/AddMedia/mw.RemoteSearchDriver.js |
340 | 234 | */ |
341 | 235 | 'mwe-add_media_wizard' => 'Add media wizard', |
— | — | @@ -362,14 +256,15 @@ |
363 | 257 | 'mwe-no-import-by-url' => 'This user or wiki <b>cannot</b> import assets from remote URLs.<p>Do you need to login?</p><p>Is upload_by_url permission set for you?<br />Does the wiki have $1 enabled?</p>', |
364 | 258 | 'mwe-no-import-by-url-linktext' => '$wgAllowCopyUploads', |
365 | 259 | 'mwe-results_from' => 'Results from $1', |
366 | | - 'mwe-missing_desc_see_source' => 'This asset is missing a description. Please see the [$1 original source] and help describe it.', |
| 260 | + 'mwe-missing_desc_see_source' => 'This asset is missing a description. Please see the $1 and help describe it.', |
367 | 261 | 'rsd_config_error' => 'Add media wizard configuration error: $1', |
368 | | - 'mwe-your_recent_uploads' => 'Your recent uploads to $1', |
| 262 | + 'mwe-your-recent-uploads' => 'Your recent uploads to $1', |
369 | 263 | 'mwe-no_recent_uploads' => 'No recent uploads', |
370 | 264 | 'mwe-not-logged-in-uploads' => 'You may not be logged in so no recent uploads can be displayed. $1 login and $2', |
371 | 265 | 'mwe-loggin-link' => 'Please login', |
372 | 266 | 'mwe-try-again-link' => 'try again', |
373 | | - 'mwe-upload_a_file' => 'Upload a new file', |
| 267 | + 'mwe-upload-a-file' => 'Upload a new file', |
| 268 | + 'mwe-upload-a-file-to' => 'Upload a new file to $1', |
374 | 269 | 'mwe-resource_page_desc' => 'Resource page description:', |
375 | 270 | 'mwe-edit_resource_desc' => 'Edit wiki text resource description:', |
376 | 271 | 'mwe-local_resource_title' => 'Local resource title:', |
— | — | @@ -405,8 +300,34 @@ |
406 | 301 | 'rsd-search-timeout' => 'The search request did not complete. The server may be down experiencing heavy load. You can try again later', |
407 | 302 | |
408 | 303 | /* |
| 304 | + * js file: /modules/AddMedia/mw.UploadHandler.js |
| 305 | + */ |
| 306 | + 'mwe-upload-stats-fileprogress' => '$1 of $2', |
| 307 | + 'mwe-upload-unknown-size' => 'Unknown size', |
| 308 | + 'mwe-cancel-confim' => 'Are you sure you want to cancel?', |
| 309 | + 'mwe-successfulupload' => 'Upload successful', |
| 310 | + 'mwe-uploaderror' => 'Upload error', |
| 311 | + 'mwe-uploadwarning' => 'Upload warning', |
| 312 | + 'mwe-unknown-error' => 'Unknown error:', |
| 313 | + 'mwe-return-to-form' => 'Return to form', |
| 314 | + 'mwe-file-exists-duplicate' => 'This file is a duplicate of the following file:', |
| 315 | + 'mwe-fileexists' => 'A file with this name exists already. Please check <b><tt>$1</tt></b> if you are not sure if you want to change it.', |
| 316 | + 'mwe-fileexists-thumb' => 'Existing file', |
| 317 | + 'mwe-ignorewarning' => 'Ignore warning and save file anyway', |
| 318 | + 'mwe-file-thumbnail-no' => 'The filename begins with <b><tt>$1</tt></b>', |
| 319 | + 'mwe-go-to-resource' => 'Go to resource page', |
| 320 | + 'mwe-upload-misc-error' => 'Unknown upload error', |
| 321 | + '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>).', |
| 322 | + 'thumbnail-more' => 'Enlarge', |
| 323 | + 'license-header' => 'Licensing', |
| 324 | + 'filedesc' => 'Summary', |
| 325 | + 'filesource' => 'Source:', |
| 326 | + 'filestatus' => 'Copyright status:', |
| 327 | + |
| 328 | + /* |
409 | 329 | * js file: /modules/AddMedia/mw.Firefogg.js |
410 | 330 | */ |
| 331 | + 'mwe-upload-transcoded-status' => 'Transcoded', |
411 | 332 | 'mwe-upload-transcode-in-progress' => 'Transcode and upload in progress (do not close this window)', |
412 | 333 | 'fogg-transcoding' => 'Encoding video to ogg', |
413 | 334 | 'fogg-select_file' => 'Select file', |
— | — | @@ -414,12 +335,13 @@ |
415 | 336 | 'fogg-select_url' => 'Select URL', |
416 | 337 | 'fogg-check_for_firefogg' => 'Checking for Firefogg...', |
417 | 338 | 'fogg-installed' => 'Firefogg is installed,', |
418 | | - 'fogg-not-installed' => 'Firefogg is not installed', |
| 339 | + 'fogg-not-installed' => 'Firefogg is not installed or not enabled.', |
419 | 340 | 'fogg-for_improved_uploads' => 'For improved uploads:', |
420 | 341 | 'fogg-please-install' => '$1. More $2', |
421 | 342 | 'fogg-please-install-install-linktext' => 'Install firefogg', |
422 | 343 | 'fogg-please-install-about-linktext' => 'about firefogg', |
423 | | - 'fogg-use_latest_firefox' => 'Please first install <a href="http://www.mozilla.com/en-US/firefox/upgrade.html?from=firefogg">Firefox 3.5</a> (or later). <i>Then revisit this page to install the <b>Firefogg</b> extension.</i>', |
| 344 | + 'fogg-use_latest_firefox' => 'Please first install $1. <i>Then revisit this page to install the <b>Firefogg</b> extension.</i>', |
| 345 | + 'fogg-latest-firefox' => 'latest firefox', |
424 | 346 | 'fogg-passthrough_mode' => 'Your selected file is already ogg or not a video file', |
425 | 347 | 'fogg-encoding-done' => 'Encoding complete', |
426 | 348 | 'fogg-badtoken' => 'Token is not valid', |
— | — | @@ -428,55 +350,124 @@ |
429 | 351 | 'fogg-warning-firebug' => '<b>Firebug</b> can cause conflicts with <i>Firefogg</i>. Please disable <b>Firebug</b> for this page.', |
430 | 352 | |
431 | 353 | /* |
| 354 | + * js file: /modules/AddMedia/searchLibs/metavidSearch.js |
| 355 | + */ |
| 356 | + 'mwe-stream_title' => '$1 $2 to $3', |
| 357 | + |
| 358 | + /* |
| 359 | + * js file: /modules/AddMedia/searchLibs/kalturaSearch.js |
| 360 | + */ |
| 361 | + 'rsd-media-filter-title' => 'Media', |
| 362 | + 'rsd-media-filter-videos' => 'Videos', |
| 363 | + 'rsd-media-filter-images' => 'Images', |
| 364 | + 'rsd-provider-filter-title' => 'Providers', |
| 365 | + |
| 366 | + /* |
| 367 | + * js file: /modules/AddMedia/searchLibs/baseRemoteSearch.js |
| 368 | + */ |
| 369 | + 'mwe-imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more information.', |
| 370 | + 'mwe-import-description' => '$1, imported from $2', |
| 371 | + |
| 372 | + /* |
432 | 373 | * js file: /modules/AddMedia/jquery.dragDropFile.js |
433 | 374 | */ |
434 | 375 | 'mwe-upload-multi' => 'Upload {{PLURAL:$1|file|files}}', |
435 | 376 | 'mwe-review-upload' => 'Review file {{PLURAL:$1|upload|uploads}}', |
436 | 377 | |
437 | 378 | /* |
438 | | - * js file: /modules/ClipEdit/mw.ClipEdit.js |
| 379 | + * js file: /modules/AddMedia/mw.UploadForm.js |
439 | 380 | */ |
440 | | - 'mwe-crop' => 'Crop image', |
441 | | - 'mwe-apply_crop' => 'Apply crop to image', |
442 | | - 'mwe-reset_crop' => 'Reset crop', |
443 | | - 'mwe-insert_image_page' => 'Insert into page', |
444 | | - 'mwe-insert_into_sequence' => 'Insert into sequence', |
445 | | - 'mwe-preview_insert' => 'Preview insert', |
446 | | - 'mwe-cancel_image_insert' => 'Cancel insert', |
447 | | - 'mwe-sc_attributes' => 'Clip detail edit', |
448 | | - 'mwe-sc_inoutpoints' => 'Set in-out points', |
449 | | - 'mwe-sc_overlays' => 'Overlays', |
450 | | - 'mwe-sc_audio' => 'Audio control', |
451 | | - 'mwe-sc_duration' => 'Duration', |
452 | | - 'mwe-template_properties' => 'Template properties', |
453 | | - 'mwe-custom_title' => 'Custom title', |
454 | | - 'mwe-edit_properties' => 'Edit properties', |
455 | | - 'mwe-other_properties' => 'Other properties', |
456 | | - 'mwe-resource_page' => 'Resource page:', |
457 | | - 'mwe-set_in_out_points' => 'Set in-out points', |
458 | | - 'mwe-start_time' => 'Start time', |
459 | | - 'mwe-end_time' => 'End time', |
460 | | - 'mwe-preview_inout' => 'Preview in-out points', |
461 | | - 'mwe-edit-tools' => 'Edit tools', |
462 | | - 'mwe-inline-description' => 'Caption', |
463 | | - 'mwe-edit-video-tools' => 'Edit video tools:', |
464 | | - 'mwe-duration' => 'Duration:', |
465 | | - 'mwe-layout' => 'Layout', |
466 | | - 'mwe-layout_right' => 'Right side image layout', |
467 | | - 'mwe-layout_left' => 'Left side image layout', |
| 381 | + 'mwe-select_file' => 'Select file', |
| 382 | + 'mwe-select_ownwork' => 'I am uploading entirely my own work, and licensing it under:', |
| 383 | + 'mwe-license_cc-by-sa' => 'Creative Commons Share Alike (3.0)', |
| 384 | + 'mwe-upload' => 'Upload file', |
| 385 | + 'mwe-destfilename' => 'Destination filename:', |
| 386 | + 'mwe-summary' => 'Summary', |
| 387 | + 'mwe-error_not_loggedin' => 'You do not appear to be logged in or do not have upload privileges.', |
| 388 | + 'mwe-error-not-loggedin-file' => 'You do not appear to be logged in or there was an error in the software. You can $1 and try again', |
| 389 | + 'mwe-link-login' => 'login', |
| 390 | + 'mwe-watch-this-file' => 'Watch this file', |
| 391 | + 'mwe-ignore-any-warnings' => 'Ignore any warnings', |
| 392 | + 'mwe-i-would-like-to' => 'I would like to', |
| 393 | + 'mwe-upload-own-file' => 'Upload my own work to $1', |
| 394 | + 'mwe-upload-not-my-file' => 'Upload media that is not my own work to $1', |
| 395 | + 'mwe-upload-once-done' => 'Please $1. Once you have completed your upload, $2', |
| 396 | + 'mwe-upload-in-new-win-link' => 'upload in the new window or tab', |
| 397 | + 'mwe-upload-refresh' => 'refresh your upload list', |
468 | 398 | |
469 | 399 | /* |
470 | | - * js file: /modules/ApiProxy/mw.ApiProxy.js |
| 400 | + * js file: /modules/AddMedia/mw.FirefoggGUI.js |
471 | 401 | */ |
472 | | - 'mwe-setting-up-proxy' => 'Setting up proxy...', |
473 | | - 'mwe-re-try' => 'Retry API request', |
474 | | - 'mwe-re-trying' => 'Retrying API request...', |
475 | | - 'mwe-proxy-not-ready' => 'Proxy is not configured', |
476 | | - 'mwe-please-login' => 'The request failed. Are you logged in on $1 ? Please $2 and try again', |
477 | | - 'mwe-log-in-link' => 'log in', |
478 | | - 'mwe-remember-loging' => 'General security reminder: Only login to web sites when your address bar displays that site\'s address.', |
| 402 | + 'fogg-save_local_file' => 'Save Ogg', |
| 403 | + 'fogg-help-sticky' => 'Help (click to stick)', |
| 404 | + 'fogg-cg-preset' => 'Preset: <strong>$1</strong>', |
| 405 | + 'fogg-cg-quality' => 'Basic quality and resolution control', |
| 406 | + 'fogg-cg-meta' => 'Metadata for the clip', |
| 407 | + 'fogg-cg-range' => 'Encoding range', |
| 408 | + 'fogg-cg-advVideo' => 'Advanced video encoding controls', |
| 409 | + 'fogg-cg-advAudio' => 'Advanced audio encoding controls', |
| 410 | + 'fogg-preset-custom' => 'Custom settings', |
| 411 | + 'fogg-webvideo-desc' => 'Web video Theora, Vorbis 400 kbit/s and 400px maximum width', |
| 412 | + 'fogg-savebandwidth-desc' => 'Low bandwidth Theora, Vorbis 164 kbit/s and 200px maximum width', |
| 413 | + 'fogg-highquality-desc' => 'High quality Theora, Vorbis 1080px maximum width', |
| 414 | + 'fogg-videoQuality-title' => 'Video quality', |
| 415 | + 'fogg-videoQuality-help' => 'Used to set the <i>visual quality</i> of the encoded video (not used if you set bitrate in advanced controls below).', |
| 416 | + 'fogg-starttime-title' => 'Start second', |
| 417 | + 'fogg-starttime-help' => 'Only encode from time in seconds', |
| 418 | + 'fogg-endtime-title' => 'End second', |
| 419 | + 'fogg-endtime-help' => 'Only encode to time in seconds', |
| 420 | + 'fogg-audioQuality-title' => 'Audio quality', |
| 421 | + 'fogg-audioQuality-help' => 'Used to set the <i>acoustic quality</i> of the encoded audio (not used if you set bitrate in advanced controls below).', |
| 422 | + 'fogg-videoCodec-title' => 'Video codec', |
| 423 | + 'fogg-videoCodec-help' => 'Used to select the clip video codec. Presently only Theora is supported. More about the <a target="_new" href="http://en.wikipedia.org/wiki/Theora">Theora codec</a>.', |
| 424 | + 'fogg-audioCodec-title' => 'Audio codec', |
| 425 | + 'fogg-audioCodec-help' => 'Used to set the clip audio codec. Presently only Vorbis is supported. More about the <a target="_new" href="http://en.wikipedia.org/wiki/Vorbis">Vorbis codec</a>', |
| 426 | + 'fogg-width-title' => 'Video width', |
| 427 | + 'fogg-width-help' => 'Resize to given width.', |
| 428 | + 'fogg-height-title' => 'Video height', |
| 429 | + 'fogg-height-help' => 'Resize to given height.', |
| 430 | + 'fogg-videoBitrate-title' => 'Video bitrate', |
| 431 | + 'fogg-videoBitrate-help' => 'Video bitrate sets the encoding bitrate for video in (kb/s)', |
| 432 | + 'fogg-twopass-title' => 'Two pass encoding', |
| 433 | + 'fogg-twopass-help' => 'Two pass encoding enables more constant quality by making two passes over the video file', |
| 434 | + 'fogg-framerate-title' => 'Frame rate', |
| 435 | + 'fogg-framerate-help' => 'The video frame rate. More about <a target="_new" href="http://en.wikipedia.org/wiki/Frame_rate">frame rate</a>.', |
| 436 | + 'fogg-aspect-title' => 'Aspect ratio', |
| 437 | + 'fogg-aspect-help' => 'The video aspect ratio can be 4:3 or 16:9. More about <a target="_new" href="http://en.wikipedia.org/wiki/Aspect_ratio_%28image%29">aspect ratios</a>.', |
| 438 | + 'fogg-keyframeInterval-title' => 'Key frame interval', |
| 439 | + 'fogg-keyframeInterval-help' => 'The keyframe interval in frames. Note: Most codecs force keyframes if the difference between frames is greater than keyframe encode size. More about <a href="http://en.wikipedia.org/wiki/I-frame">keyframes</a>.', |
| 440 | + 'fogg-denoise-title' => 'Denoise filter', |
| 441 | + 'fogg-denoise-help' => 'Denoise input video. More about <a href="http://en.wikipedia.org/wiki/Video_denoising">denoise</a>.', |
| 442 | + 'fogg-novideo-title' => 'No video', |
| 443 | + 'fogg-novideo-help' => 'disable video in the output', |
| 444 | + 'fogg-audioBitrate-title' => 'Audio bitrate', |
| 445 | + 'fogg-samplerate-title' => 'Audio sampling rate', |
| 446 | + 'fogg-samplerate-help' => 'set output sample rate (in Hz).', |
| 447 | + 'fogg-noaudio-title' => 'No audio', |
| 448 | + 'fogg-noaudio-help' => 'disable audio in the output', |
| 449 | + 'fogg-title-title' => 'Title', |
| 450 | + 'fogg-title-help' => 'A title for your clip', |
| 451 | + 'fogg-artist-title' => 'Creator name', |
| 452 | + 'fogg-artist-help' => 'The creator of this clip', |
| 453 | + 'fogg-date-title' => 'Date', |
| 454 | + 'fogg-date-help' => 'The date the footage was created or released', |
| 455 | + 'fogg-location-title' => 'Location', |
| 456 | + 'fogg-location-help' => 'The location of the footage', |
| 457 | + 'fogg-organization-title' => 'Organization', |
| 458 | + 'fogg-organization-help' => 'Name of organization (studio)', |
| 459 | + 'fogg-copyright-title' => 'Copyright', |
| 460 | + 'fogg-copyright-help' => 'The copyright of the clip', |
| 461 | + 'fogg-license-title' => 'License', |
| 462 | + 'fogg-license-help' => 'The license of the clip (preferably a Creative Commons URL).', |
| 463 | + 'fogg-contact-title' => 'Contact', |
| 464 | + 'fogg-contact-help' => 'Contact link', |
479 | 465 | |
480 | 466 | /* |
| 467 | + * js file: /modules/AddMedia/loader.js |
| 468 | + */ |
| 469 | + 'mwe-loading-add-media-wiz' => 'Loading add media wizard', |
| 470 | + |
| 471 | + /* |
481 | 472 | * js file: /mwEmbed.js |
482 | 473 | */ |
483 | 474 | 'mwe-loading_txt' => 'Loading ...', |
— | — | @@ -493,6 +484,11 @@ |
494 | 485 | 'mwe-enable-gadget-done' => 'mwEmbed gadget has been enabled', |
495 | 486 | 'mwe-must-login-gadget' => 'To enable gadget you must <a target="_new" href="$1">login</a>', |
496 | 487 | 'mwe-test-plural' => 'I ran {{PLURAL:$1|$1 test|$1 tests}}', |
| 488 | + |
| 489 | + /* |
| 490 | + * js file: /skins/kskin/kskinConfig.js |
| 491 | + */ |
| 492 | + 'mwe-credit-title' => 'Title: $1', |
497 | 493 | ); |
498 | 494 | |
499 | 495 | /** Afrikaans (Afrikaans) |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js |
— | — | @@ -7,11 +7,8 @@ |
8 | 8 | * This base upload class is optionally extended by Firefogg |
9 | 9 | * |
10 | 10 | */ |
11 | | -mw.addMessages({ |
12 | | - "mwe-upload-transcoded-status" : "Transcoded", |
13 | | - "mwe-upload-stats-fileprogress" : "$1 of $2", |
14 | | - "mwe-upload_completed" : "Your upload is complete", |
15 | | - "mwe-upload_done" : "<a href=\"$1\">Your upload <i>should be<\/i> accessible<\/a>.", |
| 11 | +mw.addMessages( { |
| 12 | + "mwe-upload-stats-fileprogress" : "$1 of $2", |
16 | 13 | "mwe-upload-unknown-size" : "Unknown size", |
17 | 14 | "mwe-cancel-confim" : "Are you sure you want to cancel?", |
18 | 15 | "mwe-successfulupload" : "Upload successful", |
— | — | @@ -21,7 +18,7 @@ |
22 | 19 | "mwe-return-to-form" : "Return to form", |
23 | 20 | "mwe-file-exists-duplicate" : "This file is a duplicate of the following file:", |
24 | 21 | "mwe-fileexists" : "A file with this name exists already. Please check <b><tt>$1<\/tt><\/b> if you are not sure if you want to change it.", |
25 | | - "mwe-fileexists-thumb" : "<center><b>Existing file<\/b><\/center>", |
| 22 | + "mwe-fileexists-thumb" : "Existing file", |
26 | 23 | "mwe-ignorewarning" : "Ignore warning and save file anyway", |
27 | 24 | "mwe-file-thumbnail-no" : "The filename begins with <b><tt>$1<\/tt><\/b>", |
28 | 25 | "mwe-go-to-resource" : "Go to resource page", |
— | — | @@ -102,10 +99,10 @@ |
103 | 100 | // If chunks uploading is supported |
104 | 101 | chunks_supported: true, |
105 | 102 | |
106 | | - // If the existing form should be used to post to the api |
| 103 | + // If the form should be used to directly upload / submit to the api |
107 | 104 | // Since file selection can't be "moved" we have to use the existing |
108 | 105 | // form and just submit it to a different target |
109 | | - form_post_override: false, |
| 106 | + formDirectSubmit: false, |
110 | 107 | |
111 | 108 | // http copy by url mode flag |
112 | 109 | http_copy_upload : null, |
— | — | @@ -113,9 +110,9 @@ |
114 | 111 | // If the upload action is done |
115 | 112 | action_done: false, |
116 | 113 | |
117 | | - // Edit token for upload |
| 114 | + // Edit token for upload lazy initialized with getToken() function |
118 | 115 | editToken: false, |
119 | | - |
| 116 | + |
120 | 117 | // The DOM node for the upload form |
121 | 118 | form: false, |
122 | 119 | |
— | — | @@ -168,19 +165,48 @@ |
169 | 166 | this.orig_onsubmit = this.form.onsubmit; |
170 | 167 | } |
171 | 168 | |
| 169 | + if( this.selectFileCb ){ |
| 170 | + this.bindSelectFileCb(); |
| 171 | + } |
| 172 | + |
172 | 173 | // Set up the submit action: |
173 | | - $j( this.form ).submit( function() { |
| 174 | + $j( this.form ).unbind( 'submit' ).submit( function() { |
174 | 175 | mw.log( "FORM SUBMIT::" ); |
175 | 176 | return _this.onSubmit(); |
176 | 177 | } ); |
177 | 178 | }, |
178 | | - |
| 179 | + |
179 | 180 | /** |
| 181 | + * Binds the onSelect file callback |
| 182 | + */ |
| 183 | + bindSelectFileCb: function(){ |
| 184 | + var _this = this; |
| 185 | + // Grab the select file input from the form |
| 186 | + var $target = $j( this.form ).find( "input[type='file']" ); |
| 187 | + $target.change( function() { |
| 188 | + var path = $j( this ).val(); |
| 189 | + // Find trailing part |
| 190 | + var slash = path.lastIndexOf( '/' ); |
| 191 | + var backslash = path.lastIndexOf( '\\' ); |
| 192 | + var fname; |
| 193 | + if ( slash == -1 && backslash == -1 ) { |
| 194 | + fname = path; |
| 195 | + } else if ( slash > backslash ) { |
| 196 | + fname = path.substring( slash + 1, 10000 ); |
| 197 | + } else { |
| 198 | + fname = path.substring( backslash + 1, 10000 ); |
| 199 | + } |
| 200 | + fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / /g, '_' ); |
| 201 | + _this.selectFileCb( fname ); |
| 202 | + } ); |
| 203 | + }, |
| 204 | + |
| 205 | + /** |
180 | 206 | * onSubmit handler for the upload form |
181 | 207 | */ |
182 | 208 | onSubmit: function() { |
183 | 209 | var _this = this; |
184 | | - mw.log( 'Base::onSubmit:' ); |
| 210 | + mw.log( 'Base::onSubmit: isRawFormUpload:' + this.formDirectSubmit ); |
185 | 211 | |
186 | 212 | // Run the original onsubmit (if not run yet set flag to avoid excessive chaining) |
187 | 213 | if ( typeof( this.orig_onsubmit ) == 'function' ) { |
— | — | @@ -189,6 +215,13 @@ |
190 | 216 | return false; |
191 | 217 | } |
192 | 218 | } |
| 219 | + // Check for post action |
| 220 | + // formDirectSubmit is needed to actualy do the upload via a form "submit" |
| 221 | + if ( this.formDirectSubmit ) { |
| 222 | + mw.log("direct submit: "); |
| 223 | + |
| 224 | + return true; |
| 225 | + } |
193 | 226 | |
194 | 227 | // Call the onsubmit_cb option if set: |
195 | 228 | if( this.onsubmit_cb && typeof this.onsubmit_cb == 'function' ) { |
— | — | @@ -198,12 +231,9 @@ |
199 | 232 | // Remap the upload form to the "api" form: |
200 | 233 | this.remapFormToApi(); |
201 | 234 | |
202 | | - // Check for post action override |
203 | | - if ( this.form_post_override ) { |
204 | | - mw.log( 'form_post_override is true, do ordinary form submit' ); |
205 | | - return true; |
206 | | - } |
207 | | - mw.log(" about to run try / catch " ); |
| 235 | + |
| 236 | + |
| 237 | + mw.log(" about to run onSubmit try / catch: detectUploadMode" ); |
208 | 238 | // Put into a try catch so we are sure to return false: |
209 | 239 | try { |
210 | 240 | // Startup interface dispatch dialog |
— | — | @@ -321,13 +351,13 @@ |
322 | 352 | remapFormToApi: function() { |
323 | 353 | var _this = this; |
324 | 354 | // |
325 | | - mw.log("remapFormToApi:: " + this.apiUrl + ' form: ' + this.form); |
| 355 | + mw.log("remapFormToApi:: " + this.apiUrl + ' form: ' + this.form); |
326 | 356 | |
327 | 357 | if ( !this.apiUrl ) { |
328 | 358 | mw.log( 'Error: no api url target' ); |
329 | 359 | return false; |
330 | 360 | } |
331 | | - var $form = $j( this.form_selector ); |
| 361 | + var $form = $j( this.form ); |
332 | 362 | |
333 | 363 | // Set the form action |
334 | 364 | try { |
— | — | @@ -335,7 +365,7 @@ |
336 | 366 | } catch( e ) { |
337 | 367 | mw.log( "IE sometimes errors out when you change the action" ); |
338 | 368 | } |
339 | | - |
| 369 | + |
340 | 370 | // Add API action |
341 | 371 | if ( $form.find( "[name='action']" ).length == 0 ) { |
342 | 372 | $form.append( |
— | — | @@ -346,7 +376,7 @@ |
347 | 377 | 'value' : "upload" |
348 | 378 | }) |
349 | 379 | ) |
350 | | - } |
| 380 | + } |
351 | 381 | |
352 | 382 | // Add JSON response format |
353 | 383 | if ( $form.find( "[name='format']" ).length == 0 ) { |
— | — | @@ -358,8 +388,8 @@ |
359 | 389 | 'value' : "jsonfm" |
360 | 390 | }) |
361 | 391 | ) |
362 | | - } |
363 | | - |
| 392 | + } |
| 393 | + |
364 | 394 | // Map a new hidden form |
365 | 395 | $form.find( "[name='wpUploadFile']" ).attr( 'name', 'file' ); |
366 | 396 | $form.find( "[name='wpDestFile']" ).attr( 'name', 'filename' ); |
— | — | @@ -391,11 +421,7 @@ |
392 | 422 | doPostUpload: function() { |
393 | 423 | var _this = this; |
394 | 424 | var $form = $j( _this.form ); |
395 | | - mw.log( 'mvBaseUploadHandler.doPostUpload' ); |
396 | | - |
397 | | - // Issue a normal post request |
398 | | - // Get the token from the page |
399 | | - _this.editToken = $j( "#wpEditToken" ).val(); |
| 425 | + mw.log( 'mvBaseUploadHandler.doPostUpload' ); |
400 | 426 | |
401 | 427 | // TODO check for sendAsBinary to support Firefox/HTML5 progress on upload |
402 | 428 | this.ui.setLoading(); |
— | — | @@ -413,14 +439,14 @@ |
414 | 440 | $j( "body" ).append( |
415 | 441 | $j( iframe ) |
416 | 442 | .attr({ |
417 | | - 'src':'javascript:false;', |
418 | | - 'id':_this.iframeId, |
419 | | - 'name': _this.iframeId |
| 443 | + 'src' : 'javascript:false;', |
| 444 | + 'id' : _this.iframeId, |
| 445 | + 'name': _this.iframeId |
420 | 446 | }) |
421 | 447 | .css('display', 'none') |
422 | 448 | ); |
| 449 | + |
423 | 450 | |
424 | | - |
425 | 451 | // Set the form target to the iframe |
426 | 452 | $form.attr( 'target', _this.iframeId ); |
427 | 453 | |
— | — | @@ -429,9 +455,13 @@ |
430 | 456 | _this.processIframeResult( $j( this ).get( 0 ) ); |
431 | 457 | }); |
432 | 458 | |
433 | | - // Do post override |
434 | | - _this.form_post_override = true; |
435 | | - |
| 459 | + // Do normal post upload override |
| 460 | + _this.formDirectSubmit = true; |
| 461 | + mw.log('About to submit:'); |
| 462 | + $form.find('input').each( function(){ |
| 463 | + mw.log( $j(this).attr( 'name' ) + ' :: ' + $j(this).val() ); |
| 464 | + }) |
| 465 | + |
436 | 466 | $form.submit(); |
437 | 467 | }, |
438 | 468 | |
— | — | @@ -448,9 +478,7 @@ |
449 | 479 | 'comment' : this.getUploadDescription(), |
450 | 480 | 'watch' : ( $j( '#wpWatchthis' ).is( ':checked' ) ) ? 'true' : 'false', |
451 | 481 | 'ignorewarnings': ($j('#wpIgnoreWarning' ).is( ':checked' ) ) ? 'true' : 'false' |
452 | | - } |
453 | | - //check for editToken |
454 | | - this.editToken = $j( "#wpEditToken" ).val(); |
| 482 | + } |
455 | 483 | this.doHttpUpload( httpUpConf ); |
456 | 484 | }, |
457 | 485 | |
— | — | @@ -466,7 +494,8 @@ |
467 | 495 | //Special case of upload.js commons hack: |
468 | 496 | var comment_value = $j( '#wpUploadDescription' ).val(); |
469 | 497 | if( comment_value == '' ) { |
470 | | - comment_value = $j( "[name='wpUploadDescription']").val(); |
| 498 | + // Else try with the form name: |
| 499 | + comment_value = $j( "[name='comment']").val(); |
471 | 500 | } |
472 | 501 | mw.log( 'getUploadDescription:: base:' + comment_value + ' ucr:' + this.useCopyrightUpload ); |
473 | 502 | // Set license, copyStatus, source if available ( generally not available SpecialUpload needs some refactoring ) |
— | — | @@ -515,8 +544,8 @@ |
516 | 545 | * @param {Element} iframe iframe to extract result from |
517 | 546 | */ |
518 | 547 | processIframeResult: function( iframe ) { |
519 | | - var _this = this; |
520 | | - var doc = iframe.contentDocument ? iframe.contentDocument : frames[iframe.id].document; |
| 548 | + var _this = this; |
| 549 | + var doc = iframe.contentDocument ? iframe.contentDocument : frames[ iframe.id ].document; |
521 | 550 | // Fix for Opera 9.26 |
522 | 551 | if ( doc.readyState && doc.readyState != 'complete' ) { |
523 | 552 | return; |
— | — | @@ -525,13 +554,14 @@ |
526 | 555 | if ( doc.body && doc.body.innerHTML == "false" ) { |
527 | 556 | return; |
528 | 557 | } |
| 558 | + |
529 | 559 | var response; |
530 | 560 | if ( doc.XMLDocument ) { |
531 | 561 | // The response is a document property in IE |
532 | 562 | response = doc.XMLDocument; |
533 | 563 | } else if ( doc.body ) { |
534 | 564 | // Get the json string |
535 | | - json = $j( doc.body ).find( 'pre' ).text(); |
| 565 | + var json = $j( doc.body ).find( 'pre' ).text(); |
536 | 566 | //mw.log( 'iframe:json::' + json_str + "\nbody:" + $j( doc.body ).html() ); |
537 | 567 | if ( json ) { |
538 | 568 | response = window["eval"]( "(" + json + ")" ); |
— | — | @@ -560,7 +590,8 @@ |
561 | 591 | // Set up the request |
562 | 592 | var request = { |
563 | 593 | 'action' : 'upload', |
564 | | - 'asyncdownload' : true // Do async download |
| 594 | + 'asyncdownload' : true, // Do async download |
| 595 | + 'token' : this.getToken() |
565 | 596 | }; |
566 | 597 | |
567 | 598 | // Add any parameters specified by the caller |
— | — | @@ -570,13 +601,6 @@ |
571 | 602 | } |
572 | 603 | } |
573 | 604 | |
574 | | - // Add the edit token (if available) |
575 | | - if( !_this.editToken && _this.apiUrl ) { |
576 | | - mw.log( 'Error:doHttpUpload: missing token' ); |
577 | | - } else { |
578 | | - request['token'] =_this.editToken; |
579 | | - } |
580 | | - |
581 | 605 | // Reset the done with action flag |
582 | 606 | _this.action_done = false; |
583 | 607 | |
— | — | @@ -598,12 +622,9 @@ |
599 | 623 | this.upload_status_request = { |
600 | 624 | 'action' : 'upload', |
601 | 625 | 'httpstatus' : 'true', |
602 | | - 'sessionkey' : _this.upload_session_key |
603 | | - }; |
604 | | - |
605 | | - // Add token if present |
606 | | - if ( this.editToken ) |
607 | | - this.upload_status_request['token'] = this.editToken; |
| 626 | + 'sessionkey' : _this.upload_session_key, |
| 627 | + 'token' : _this.getToken() |
| 628 | + }; |
608 | 629 | |
609 | 630 | // Trigger an initial request (subsequent ones will be done by a timer) |
610 | 631 | this.onAjaxUploadStatusTimer(); |
— | — | @@ -720,16 +741,14 @@ |
721 | 742 | |
722 | 743 | if ( apiRes.upload && apiRes.upload.imageinfo && apiRes.upload.imageinfo.descriptionurl ) { |
723 | 744 | // Call the completion callback if available. |
724 | | - if ( _this.done_upload_cb && typeof _this.done_upload_cb == 'function' ) { |
725 | | - mw.log( "call done_upload_cb" ); |
726 | | - |
727 | | - // This overrides our normal completion handling so we close the |
728 | | - // dialog immediately. |
729 | | - _this.ui.close(); |
730 | | - _this.done_upload_cb( apiRes.upload ); |
731 | | - return true; |
732 | | - } |
733 | | - |
| 745 | + if ( typeof _this.doneUploadCb == 'function' ) { |
| 746 | + // check if the callback returns true and close up shop |
| 747 | + if( _this.doneUploadCb( apiRes ) ){ |
| 748 | + // Close the ui |
| 749 | + _this.ui.close(); |
| 750 | + return true; |
| 751 | + } |
| 752 | + } |
734 | 753 | // Else pass off the api Success to interface: |
735 | 754 | _this.ui.showApiSuccess( apiRes ); |
736 | 755 | return true; |
— | — | @@ -747,8 +766,8 @@ |
748 | 767 | case 'ignoreWarnings': |
749 | 768 | this.ignoreWarningsSubmit(); |
750 | 769 | break; |
751 | | - case 'disableFormPostOverride': |
752 | | - this.form_post_override = false; |
| 770 | + case 'disableDirectSubmit': |
| 771 | + this.formDirectSubmit = false; |
753 | 772 | break; |
754 | 773 | default: |
755 | 774 | mw.log( "Error reciveUploadAction:: unkown action: " + action ); |
— | — | @@ -766,14 +785,14 @@ |
767 | 786 | // Check if we have a stashed key: |
768 | 787 | if ( _this.warnings_sessionkey !== false ) { |
769 | 788 | //set to "loading" |
770 | | - $j( '#upProgressDialog' ).html( mw.loading_spinner() ); |
| 789 | + _this.ui.setLoading(); |
771 | 790 | //setup request: |
772 | 791 | var request = { |
773 | 792 | 'action': 'upload', |
774 | 793 | 'sessionkey': _this.warnings_sessionkey, |
775 | 794 | 'ignorewarnings': 1, |
776 | 795 | 'filename': $j( '#wpDestFile' ).val(), |
777 | | - 'token' : _this.editToken, |
| 796 | + 'token' : _this.getToken(), |
778 | 797 | 'comment' : _this.getUploadDescription() |
779 | 798 | }; |
780 | 799 | //run the upload from stash request |
— | — | @@ -782,9 +801,9 @@ |
783 | 802 | } ); |
784 | 803 | } else { |
785 | 804 | mw.log( 'No session key re-sending upload' ) |
786 | | - //do a stashed upload |
| 805 | + //Do a stashed upload |
787 | 806 | $j( '#wpIgnoreWarning' ).attr( 'checked', true ); |
788 | | - $j( _this.editForm ).submit(); |
| 807 | + $j( _this.form ).submit(); |
789 | 808 | } |
790 | 809 | }, |
791 | 810 | |
— | — | @@ -799,15 +818,32 @@ |
800 | 819 | * Get the DOMNode of the form element we are rewriting. |
801 | 820 | * Returns false if it can't be found. |
802 | 821 | */ |
803 | | - getForm: function() { |
804 | | - |
| 822 | + getForm: function() { |
805 | 823 | if ( this.form_selector && $j( this.form_selector ).length != 0 ) { |
806 | 824 | return $j( this.form_selector ).get( 0 ); |
807 | 825 | } else { |
808 | 826 | mw.log( "mvBaseUploadHandler.getForm(): no form_selector" ); |
809 | 827 | return false; |
810 | 828 | } |
811 | | - } |
| 829 | + }, |
| 830 | + |
| 831 | + // Get the editToken from the page. |
| 832 | + getToken : function(){ |
| 833 | + if( this.editToken ){ |
| 834 | + return this.editToken; |
| 835 | + } |
| 836 | + if( $j( '#wpEditToken').length ){ |
| 837 | + this.editToken = $j( '#wpEditToken').val(); |
| 838 | + } |
| 839 | + if( $j("form[name='token']").length){ |
| 840 | + this.editToken = $j("form[name='token']").val(); |
| 841 | + } |
| 842 | + if( !this.editToken ){ |
| 843 | + mw.log("Error: can not find edit token ") |
| 844 | + return false; |
| 845 | + } |
| 846 | + return this.editToken; |
| 847 | + } |
812 | 848 | |
813 | 849 | }; |
814 | 850 | |
— | — | @@ -831,6 +867,7 @@ |
832 | 868 | if ( !options.warn_target ) { |
833 | 869 | options.warn_target = '#wpDestFile-warning'; |
834 | 870 | } |
| 871 | + mw.log( 'do doDestCheck and update: ' + options.warn_target ); |
835 | 872 | |
836 | 873 | if( ! options.apiUrl ) { |
837 | 874 | options.apiUrl = mw.getLocalApiUrl(); |
— | — | @@ -845,8 +882,7 @@ |
846 | 883 | .append( '<td />' ) |
847 | 884 | .attr('id', 'wpDestFile-warning') |
848 | 885 | ); |
849 | | - } |
850 | | - mw.log( 'past dest'); |
| 886 | + } |
851 | 887 | // Remove any existing warning |
852 | 888 | $j( options.warn_target ).empty(); |
853 | 889 | |
— | — | @@ -859,72 +895,116 @@ |
860 | 896 | .loadingSpinner() |
861 | 897 | ); |
862 | 898 | // Setup the request |
863 | | - var request = { |
| 899 | + var request = { |
864 | 900 | 'titles': 'File:' + $j( _this.selector ).val(), |
865 | 901 | 'prop': 'imageinfo', |
866 | 902 | 'iiprop': 'url|mime|size', |
867 | 903 | 'iiurlwidth': 150 |
868 | | - }; |
| 904 | + }; |
869 | 905 | |
870 | 906 | // Do the destination check ( on the local wiki ) |
871 | 907 | mw.getJSON( options.apiUrl, request, function( data ) { |
872 | | - // Remove spinner |
873 | | - $j( '#mw-spinner-wpDestFile' ).remove(); |
874 | | - |
875 | | - if ( !data || !data.query || !data.query.pages ) { |
876 | | - // Ignore a null result |
877 | | - return; |
| 908 | + mw.log(" got callback? wtf"); |
| 909 | + // Remove spinner |
| 910 | + $j( '#mw-spinner-wpDestFile' ).remove(); |
| 911 | + |
| 912 | + if ( !data || !data.query || !data.query.pages ) { |
| 913 | + // Ignore a null result |
| 914 | + mw.log(" No data in DestCheck result") |
| 915 | + return; |
| 916 | + } |
| 917 | + |
| 918 | + if ( data.query.pages[-1] ) { |
| 919 | + // No conflict found |
| 920 | + mw.log(" No pages in DestCheck result") |
| 921 | + return; |
| 922 | + } |
| 923 | + for ( var page_id in data.query.pages ) { |
| 924 | + if ( !data.query.pages[ page_id ].imageinfo ) { |
| 925 | + continue; |
878 | 926 | } |
879 | 927 | |
880 | | - if ( data.query.pages[-1] ) { |
881 | | - // No conflict found |
882 | | - return; |
| 928 | + // Conflict found, show warning |
| 929 | + if ( data.query.normalized ) { |
| 930 | + var ntitle = data.query.normalized[0].to; |
| 931 | + } else { |
| 932 | + var ntitle = data.query.pages[ page_id ].title |
883 | 933 | } |
884 | | - for ( var page_id in data.query.pages ) { |
885 | | - if ( !data.query.pages[ page_id ].imageinfo ) { |
886 | | - continue; |
887 | | - } |
888 | | - |
889 | | - // Conflict found, show warning |
890 | | - if ( data.query.normalized ) { |
891 | | - var ntitle = data.query.normalized[0].to; |
892 | | - } else { |
893 | | - var ntitle = data.query.pages[ page_id ].title |
894 | | - } |
895 | | - var img = data.query.pages[ page_id ].imageinfo[0]; |
896 | | - $j( options.warn_target ).html( |
897 | | - gM( 'mwe-fileexists', ntitle ) + |
898 | | - '<div class="thumb tright">' + |
899 | | - '<div ' + |
900 | | - 'style="width: ' + ( parseInt( img.thumbwidth ) + 2 ) + 'px;" ' + |
901 | | - 'class="thumbinner">' + |
902 | | - '<a ' + |
903 | | - 'title="' + ntitle + '" ' + |
904 | | - 'class="image" ' + |
905 | | - 'href="' + img.descriptionurl + '">' + |
906 | | - '<img ' + |
907 | | - 'width="' + img.thumbwidth + '" ' + |
908 | | - 'height="' + img.thumbheight + '" ' + |
909 | | - 'border="0" ' + |
910 | | - 'class="thumbimage" ' + |
911 | | - 'src="' + img.thumburl + '" ' + |
912 | | - 'alt="' + ntitle + '"/>' + |
913 | | - '</a>' + |
914 | | - '<div class="thumbcaption">' + |
915 | | - '<div class="magnify">' + |
916 | | - '<a title="' + gM('thumbnail-more') + '" class="internal" ' + |
917 | | - 'href="' + img.descriptionurl +'">' + |
918 | | - '<img border="0" width="15" height="11" alt="" ' + |
919 | | - 'src="' + mw.getConfig( 'images_path' ) + 'magnify-clip.png" />' + |
920 | | - '</a>' + |
921 | | - '</div>' + |
922 | | - gM( 'mwe-fileexists-thumb' ) + |
923 | | - '</div>' + |
924 | | - '</div>' + |
925 | | - '</div>' |
| 934 | + var img = data.query.pages[ page_id ].imageinfo[0]; |
| 935 | + |
| 936 | + var linkAttr ={ |
| 937 | + 'title' : ntitle, |
| 938 | + 'href' : img.descriptionurl, |
| 939 | + 'target' : '_new' |
| 940 | + }; |
| 941 | + |
| 942 | + var $fileAlreadyExists = $j('<div />') |
| 943 | + .append( |
| 944 | + gM( 'mwe-fileexists', |
| 945 | + $j('<a />') |
| 946 | + .attr( linkAttr ) |
| 947 | + .text( ntitle ) |
| 948 | + ) |
| 949 | + ) |
| 950 | + |
| 951 | + var $imageLink = $j('<a />') |
| 952 | + .addClass( 'image' ) |
| 953 | + .attr( linkAttr ) |
| 954 | + .append( |
| 955 | + $j( '<img />') |
| 956 | + .addClass( 'thumbimage' ) |
| 957 | + .attr( { |
| 958 | + 'width' : img.thumbwidth, |
| 959 | + 'height' : img.thumbheight, |
| 960 | + 'border' : 0, |
| 961 | + 'src' : img.thumburl, |
| 962 | + 'alt' : ntitle |
| 963 | + } ) |
926 | 964 | ); |
927 | | - } |
| 965 | + |
| 966 | + var $imageCaption = $j( '<div />' ) |
| 967 | + .addClass( 'thumbcaption' ) |
| 968 | + .append( |
| 969 | + $j('<div />') |
| 970 | + .addClass( "magnify" ) |
| 971 | + .append( |
| 972 | + $j('<a />' ) |
| 973 | + .addClass( 'internal' ) |
| 974 | + .attr( { |
| 975 | + 'title' : gM('thumbnail-more'), |
| 976 | + 'href' : img.descriptionurl |
| 977 | + } ), |
| 978 | + |
| 979 | + $j( '<img />' ) |
| 980 | + .attr( { |
| 981 | + 'border' : 0, |
| 982 | + 'width' : 15, |
| 983 | + 'height' : 11, |
| 984 | + 'src' : mw.getConfig( 'images_path' ) + 'magnify-clip.png' |
| 985 | + } ), |
| 986 | + |
| 987 | + $j('<span />') |
| 988 | + .html( gM( 'mwe-fileexists-thumb' ) ) |
| 989 | + ) |
| 990 | + ); |
| 991 | + $j( options.warn_target ).append( |
| 992 | + $fileAlreadyExists, |
| 993 | + |
| 994 | + $j( '<div />' ) |
| 995 | + .addClass( 'thumb tright' ) |
| 996 | + .append( |
| 997 | + $j( '<div />' ) |
| 998 | + .addClass( 'thumbinner' ) |
| 999 | + .css({ |
| 1000 | + 'width' : ( parseInt( img.thumbwidth ) + 2 ) + 'px;' |
| 1001 | + }) |
| 1002 | + .append( |
| 1003 | + $imageLink, |
| 1004 | + $imageCaption |
| 1005 | + ) |
| 1006 | + ) |
| 1007 | + ); |
928 | 1008 | } |
929 | | - ); |
| 1009 | + } ); |
930 | 1010 | } |
931 | 1011 | })( jQuery ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/loader.js |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | * Includes both firefogg & firefogg "GUI" which share some loading logic: |
90 | 90 | */ |
91 | 91 | |
92 | | - // Clone the baseUploadlibs array |
| 92 | + // Clone the baseUploadlibs array and add the firefogg lib: |
93 | 93 | var mwBaseFirefoggReq = baseUploadlibs.slice( 0 ) |
94 | 94 | mwBaseFirefoggReq[ 0 ].push( 'mw.Firefogg' ); |
95 | 95 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadInterface.js |
— | — | @@ -16,7 +16,8 @@ |
17 | 17 | mw.addMessages( { |
18 | 18 | "mwe-upload-in-progress" : "Upload in progress (do not close this window)", |
19 | 19 | "mwe-uploaded-status" : "Uploaded", |
20 | | - "mwe-uploaded-time-remaining" : "Time remaining: $1" |
| 20 | + "mwe-uploaded-time-remaining" : "Time remaining: $1", |
| 21 | + "mwe-upload-done" : "Your upload <i>should be<\/i> accessible.", |
21 | 22 | } ); |
22 | 23 | |
23 | 24 | /** |
— | — | @@ -60,9 +61,11 @@ |
61 | 62 | $j( '<div />') |
62 | 63 | .attr( 'id', "upProgressDialog" ) |
63 | 64 | ); |
| 65 | + |
64 | 66 | if( typeof options == 'undefined' || !options.title ) { |
65 | 67 | options.title = gM('mwe-upload-in-progress'); |
66 | 68 | } |
| 69 | + |
67 | 70 | $j( '#upProgressDialog' ).dialog( { |
68 | 71 | title : options.title, |
69 | 72 | bgiframe: true, |
— | — | @@ -82,6 +85,7 @@ |
83 | 86 | }, |
84 | 87 | buttons: _this.getCancelButton() |
85 | 88 | } ); |
| 89 | + |
86 | 90 | mw.log( 'upProgressDialog::dialog done' ); |
87 | 91 | |
88 | 92 | var $progressContainer = $j('<div />') |
— | — | @@ -89,7 +93,8 @@ |
90 | 94 | .css({ |
91 | 95 | 'height' : '15px' |
92 | 96 | }); |
93 | | - // add the progress bar |
| 97 | + |
| 98 | + // Add the progress bar |
94 | 99 | $progressContainer.append( |
95 | 100 | $j('<div />') |
96 | 101 | .attr('id', 'up-progressbar') |
— | — | @@ -192,7 +197,6 @@ |
193 | 198 | |
194 | 199 | /** |
195 | 200 | * Set the dialog to loading |
196 | | - * @param optional loadingText text to set dialog to. |
197 | 201 | */ |
198 | 202 | setLoading: function( ) { |
199 | 203 | this.action_done = false; |
— | — | @@ -244,9 +248,10 @@ |
245 | 249 | |
246 | 250 | // Generate the error button |
247 | 251 | var buttons = {}; |
248 | | - buttons[ gM( 'mwe-return-to-form' ) ] = function() { |
249 | | - _this.form_post_override = false; |
| 252 | + buttons[ gM( 'mwe-return-to-form' ) ] = function() { |
250 | 253 | $j( this ).dialog( 'close' ); |
| 254 | + // Disable direct submit so that we can handle updated form data |
| 255 | + _this.sendUploadAction( 'disableDirectSubmit' ); |
251 | 256 | }; |
252 | 257 | |
253 | 258 | |
— | — | @@ -388,7 +393,7 @@ |
389 | 394 | // Create the "return to form" button |
390 | 395 | buttons[ gM( 'mwe-return-to-form' ) ] = function() { |
391 | 396 | $j( this ).dialog( 'close' ); |
392 | | - _this.sendUploadAction( 'disableFormPostOverride' ); |
| 397 | + _this.sendUploadAction( 'disableDirectSubmit' ); |
393 | 398 | } |
394 | 399 | // Show warning |
395 | 400 | _this.setPrompt( |
— | — | @@ -418,6 +423,7 @@ |
419 | 424 | |
420 | 425 | /** |
421 | 426 | * Shows api success from a apiResult |
| 427 | + * @param {Object} apiRes Result object |
422 | 428 | */ |
423 | 429 | showApiSuccess: function( apiRes ){ |
424 | 430 | mw.log( " UI:: showApiSuccess: " ); |
— | — | @@ -428,7 +434,7 @@ |
429 | 435 | // "Return" button |
430 | 436 | buttons[ gM( 'mwe-return-to-form' ) ] = function() { |
431 | 437 | $j( this ).dialog( 'destroy' ).remove(); |
432 | | - _this.sendUploadAction( 'disableFormPostOverride' ); |
| 438 | + _this.sendUploadAction( 'disableDirectSubmit' ); |
433 | 439 | } |
434 | 440 | // "Go to resource" button |
435 | 441 | buttons[ gM('mwe-go-to-resource') ] = function() { |
— | — | @@ -437,7 +443,11 @@ |
438 | 444 | _this.action_done = true; |
439 | 445 | _this.setPrompt( |
440 | 446 | gM( 'mwe-successfulupload' ), |
441 | | - gM( 'mwe-upload_done', url), |
| 447 | + $j('<a />') |
| 448 | + .attr( 'href', url ) |
| 449 | + .html( |
| 450 | + gM( 'mwe-upload-done') |
| 451 | + ), |
442 | 452 | buttons |
443 | 453 | ); |
444 | 454 | mw.log( 'apiRes.upload.imageinfo::' + url ); |
— | — | @@ -482,12 +492,10 @@ |
483 | 493 | * other domain via iframe proxy or eventually html5 sendMsg |
484 | 494 | */ |
485 | 495 | init: function( callbackProxy ){ |
486 | | - this.callbackProxy = callbackProxy; |
| 496 | + var _this = this; |
| 497 | + this.callbackProxy = callbackProxy; |
487 | 498 | }, |
488 | | - setup: function( options ){ |
489 | | - this.callbackProxy( 'setup', options ); |
490 | | - }, |
491 | | - |
| 499 | + |
492 | 500 | // Don't call update progress more than once every 3 seconds |
493 | 501 | // Since it involves loading a cached iframe. Once we support html5 |
494 | 502 | // cross domain "sendMsg" then we can pass all updates |
— | — | @@ -497,16 +505,35 @@ |
498 | 506 | this.callbackProxy( 'updateProgress', fraction ); |
499 | 507 | } |
500 | 508 | }, |
| 509 | + |
| 510 | + // Pass on the setup call |
| 511 | + setup: function( options ){ |
| 512 | + this.callbackProxy( 'setup', options ); |
| 513 | + }, |
| 514 | + |
| 515 | + // pass along the close request |
| 516 | + close: function(){ |
| 517 | + this.callbackProxy( 'close' ); |
| 518 | + }, |
| 519 | + |
| 520 | + // Pass on the "setLoading" action |
| 521 | + setLoading: function( ){ |
| 522 | + this.callbackProxy( 'setLoading' ); |
| 523 | + }, |
| 524 | + |
501 | 525 | // Pass on the show api errror: |
502 | 526 | showApiError: function ( apiRes ){ |
503 | 527 | this.callbackProxy( 'showApiError', apiRes ); |
504 | 528 | }, |
| 529 | + |
505 | 530 | // Pass on the show api success: |
506 | 531 | showApiSuccess: function ( apiRes ) { |
507 | 532 | this.callbackProxy( 'showApiSuccess', apiRes ); |
508 | 533 | }, |
| 534 | + |
509 | 535 | // Pass on api action |
510 | 536 | sendUploadAction: function( action ) { |
511 | 537 | this.callbackProxy( 'sendUploadAction', action ); |
512 | 538 | } |
| 539 | + |
513 | 540 | }; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js |
— | — | @@ -4,6 +4,7 @@ |
5 | 5 | */ |
6 | 6 | |
7 | 7 | mw.addMessages({ |
| 8 | + "mwe-upload-transcoded-status" : "Transcoded", |
8 | 9 | "mwe-upload-transcode-in-progress" : "Transcode and upload in progress (do not close this window)", |
9 | 10 | "fogg-transcoding" : "Encoding video to ogg", |
10 | 11 | "fogg-select_file" : "Select file", |
— | — | @@ -11,12 +12,13 @@ |
12 | 13 | "fogg-select_url" : "Select URL", |
13 | 14 | "fogg-check_for_firefogg" : "Checking for Firefogg...", |
14 | 15 | "fogg-installed" : "Firefogg is installed,", |
15 | | - "fogg-not-installed" : "Firefogg is not installed", |
| 16 | + "fogg-not-installed" : "Firefogg is not installed or not enabled.", |
16 | 17 | "fogg-for_improved_uploads" : "For improved uploads:", |
17 | 18 | "fogg-please-install" : "$1. More $2", |
18 | 19 | "fogg-please-install-install-linktext" : "Install firefogg", |
19 | 20 | "fogg-please-install-about-linktext" : "about firefogg", |
20 | | - "fogg-use_latest_firefox" : "Please first install <a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=firefogg\">Firefox 3.5<\/a> (or later). <i>Then revisit this page to install the <b>Firefogg<\/b> extension.<\/i>", |
| 21 | + "fogg-use_latest_firefox" : "Please first install $1. <i>Then revisit this page to install the <b>Firefogg<\/b> extension.<\/i>", |
| 22 | + "fogg-latest-firefox" : "latest firefox", |
21 | 23 | "fogg-passthrough_mode" : "Your selected file is already ogg or not a video file", |
22 | 24 | "fogg-encoding-done" : "Encoding complete", |
23 | 25 | "fogg-badtoken" : "Token is not valid", |
— | — | @@ -33,7 +35,7 @@ |
34 | 36 | |
35 | 37 | var default_firefogg_options = { |
36 | 38 | // Callback for upload completion |
37 | | - 'done_upload_cb': false, |
| 39 | + 'doneUploadCb': false, |
38 | 40 | |
39 | 41 | // The API URL to upload to |
40 | 42 | 'apiUrl': null, |
— | — | @@ -44,15 +46,14 @@ |
45 | 47 | // True if we will be showing the encoder interface |
46 | 48 | 'encoder_interface': false, |
47 | 49 | |
48 | | - // True if we want to limit the library functionality to "only firefogg" |
49 | | - // (no upload or progress bars) |
50 | | - 'only_firefogg': false, |
51 | | - |
52 | 50 | // jQuery selector identifying the target control container or form (can't be left null) |
53 | 51 | 'selector': '', |
54 | 52 | |
55 | 53 | // May be "upload" to if we are rewriting an upload form, or "local" if we are encoding a local file |
56 | 54 | 'form_type': 'local', |
| 55 | + |
| 56 | + // Special Mode that just checks for firefogg install and puts a notice after the target |
| 57 | + 'installCheckMode': false, |
57 | 58 | |
58 | 59 | // CSS selector for the select file button |
59 | 60 | 'target_btn_select_file': false, |
— | — | @@ -106,8 +107,10 @@ |
107 | 108 | |
108 | 109 | // Setup the Firefogg: |
109 | 110 | var myFogg = new mw.Firefogg( options ); |
110 | | - |
111 | | - if ( myFogg ) { |
| 111 | + |
| 112 | + // Kind of silly installCheckMode check |
| 113 | + // need to refactor as described in init :: installCheckMode |
| 114 | + if ( myFogg && ! myFogg.installCheckMode ) { |
112 | 115 | myFogg.doRewrite( ); |
113 | 116 | var selectorElement = $j( this.selector ).get( 0 ); |
114 | 117 | selectorElement[ 'uploadHandler' ] = myFogg; |
— | — | @@ -151,12 +154,14 @@ |
152 | 155 | * Object initialisation |
153 | 156 | */ |
154 | 157 | init: function( options ) { |
155 | | - if ( !options ) |
| 158 | + if ( !options ){ |
156 | 159 | options = {}; |
| 160 | + } |
157 | 161 | |
158 | 162 | // If we have no apiUrl, set upload mode to "post" |
159 | | - if ( !options.apiUrl ) |
| 163 | + if ( !options.apiUrl ){ |
160 | 164 | options.upload_mode = 'post'; |
| 165 | + } |
161 | 166 | |
162 | 167 | // Set options |
163 | 168 | for ( var i in default_firefogg_options ) { |
— | — | @@ -166,18 +171,34 @@ |
167 | 172 | this[i] = default_firefogg_options[i]; |
168 | 173 | } |
169 | 174 | } |
| 175 | + |
| 176 | + // Check for special installCheckMode |
| 177 | + |
| 178 | + // NOTE we should refactor install checks into static functions / entry points |
| 179 | + // so that they can be called without initializing the firefogg object with a special flag. |
| 180 | + if( this.installCheckMode ){ |
| 181 | + if ( ! this.getFirefogg() ) { |
| 182 | + this.form_type = 'upload'; |
| 183 | + // Show install firefogg msg |
| 184 | + this.showInstallFirefog(); |
| 185 | + return ; |
| 186 | + } |
| 187 | + if( console.firebug ) { |
| 188 | + this.appendFirebugWarning(); |
| 189 | + } |
| 190 | + mw.log( "installCheckMode no firefogg init"); |
| 191 | + return ; |
| 192 | + } |
170 | 193 | |
171 | | - // Inherit from mw.BaseUploadHandler (unless we're in only_firefogg mode) |
172 | | - if ( !this.only_firefogg ) { |
173 | | - var myBUI = new mw.UploadHandler( options ); |
| 194 | + // Inherit from mw.BaseUploadHandler |
| 195 | + var myBUI = new mw.UploadHandler( options ); |
174 | 196 | |
175 | | - // Prefix conflicting members with parent_ |
176 | | - for ( var i in myBUI ) { |
177 | | - if ( this[ i ] ) { |
178 | | - this[ 'parent_'+ i ] = myBUI[i]; |
179 | | - } else { |
180 | | - this[ i ] = myBUI[i]; |
181 | | - } |
| 197 | + // Prefix conflicting members with parent_ |
| 198 | + for ( var i in myBUI ) { |
| 199 | + if ( this[ i ] ) { |
| 200 | + this[ 'parent_'+ i ] = myBUI[i]; |
| 201 | + } else { |
| 202 | + this[ i ] = myBUI[i]; |
182 | 203 | } |
183 | 204 | } |
184 | 205 | |
— | — | @@ -319,10 +340,10 @@ |
320 | 341 | /** |
321 | 342 | * Show the install firefogg msg |
322 | 343 | */ |
323 | | - showInstallFirefog: function() { |
324 | | - var _this = this; |
| 344 | + showInstallFirefog: function() { |
| 345 | + var _this = this; |
325 | 346 | |
326 | | - var upMsg = ( _this.form_type == 'upload' ) ? |
| 347 | + var upMsg = ( _this.form_type == 'upload' ) ? |
327 | 348 | gM( 'fogg-for_improved_uploads' ) + ' ' : gM( 'fogg-not-installed') + ' '; |
328 | 349 | |
329 | 350 | // Show the "use latest Firefox" message if necessary |
— | — | @@ -332,7 +353,22 @@ |
333 | 354 | |
334 | 355 | // Add the use_latest if not present: |
335 | 356 | if ( !this.target_use_latest_firefox ) { |
336 | | - $j( this.selector ).after( this.getControlHtml( 'target_use_latest_firefox' ) ); |
| 357 | + $j( this.selector ).after( |
| 358 | + $j( '<div />' ) |
| 359 | + .addClass( 'target_use_latest_firefox' ) |
| 360 | + .html( |
| 361 | + gM('fogg-use_latest_firefox', |
| 362 | + $j('<a />') |
| 363 | + .attr({ |
| 364 | + 'href' : 'http://www.mozilla.com/firefox/?from=firefogg', |
| 365 | + 'target' : "_new" |
| 366 | + }) |
| 367 | + .text( |
| 368 | + gM( 'fogg-latest-firefox' ) |
| 369 | + ) |
| 370 | + ) |
| 371 | + ) |
| 372 | + ); |
337 | 373 | this.target_use_latest_firefox = this.selector + ' ~ .target_use_latest_firefox'; |
338 | 374 | } |
339 | 375 | |
— | — | @@ -342,24 +378,31 @@ |
343 | 379 | .prepend( upMsg ); |
344 | 380 | } |
345 | 381 | |
346 | | - $j( _this.target_use_latest_firefox ).show(); |
| 382 | + $j( _this.target_use_latest_firefox ).show(); |
347 | 383 | return ; |
348 | 384 | } |
349 | 385 | mw.log( 'should show install link'); |
350 | 386 | |
351 | | - // Otherwise show the "install Firefogg" message |
| 387 | + // Otherwise show the "install Firefogg" message |
352 | 388 | var firefoggUrl = _this.getFirefoggInstallUrl(); |
353 | 389 | if( firefoggUrl ) { |
354 | 390 | |
355 | 391 | // Add the target please install in not present: |
356 | 392 | if ( !this.target_please_install ) { |
357 | | - $j( this.selector ).after( this.getControlHtml( 'target_please_install' ) ); |
358 | | - this.target_please_install = this.selector + ' ~ .target_please_install'; |
| 393 | + $j( this.selector ).after( |
| 394 | + $j('<div />') |
| 395 | + .addClass( 'ui-corner-all target_please_install' ) |
| 396 | + .css({ |
| 397 | + 'border' : 'thin solid black', |
| 398 | + 'margin' : '4px' |
| 399 | + }) |
| 400 | + ); |
| 401 | + this.target_please_install = this.selector + ' ~ .target_please_install'; |
359 | 402 | } |
360 | 403 | // Add the install msg |
361 | 404 | $j( _this.target_please_install ) |
362 | 405 | .html( upMsg + |
363 | | - gM( 'fogg-please-install', [ |
| 406 | + gM( 'fogg-please-install', [ |
364 | 407 | // Install link |
365 | 408 | $j('<a />') |
366 | 409 | .text( gM( "fogg-please-install-install-linktext" ) ) |
— | — | @@ -368,7 +411,10 @@ |
369 | 412 | // About link |
370 | 413 | $j('<a />') |
371 | 414 | .text( gM( "fogg-please-install-about-linktext" ) ) |
372 | | - .attr( 'href', 'http://commons.wikimedia.org/wiki/Commons:Firefogg' ) |
| 415 | + .attr({ |
| 416 | + 'href' : 'http://commons.wikimedia.org/wiki/Commons:Firefogg', |
| 417 | + 'target' : '_new' |
| 418 | + } ) |
373 | 419 | ]) |
374 | 420 | ) |
375 | 421 | .css( 'padding', '10px' ) |
— | — | @@ -423,7 +469,7 @@ |
424 | 470 | } |
425 | 471 | |
426 | 472 | // If Firefogg is not available, just show a "please install" message |
427 | | - if ( ! _this.getFirefogg() ) { |
| 473 | + if ( ! _this.getFirefogg() ) { |
428 | 474 | // Show install firefogg msg |
429 | 475 | this.showInstallFirefog(); |
430 | 476 | return; |
— | — | @@ -433,16 +479,7 @@ |
434 | 480 | if ( this.form_type == 'upload' |
435 | 481 | && typeof console != 'undefined' |
436 | 482 | && console.firebug ) { |
437 | | - $j( this.selector ).after( |
438 | | - $j( '<div />' ) |
439 | | - .addClass( 'ui-state-error ui-corner-all' ) |
440 | | - .html( gM( 'fogg-warning-firebug' ) ) |
441 | | - .css({ |
442 | | - 'width' : 'auto', |
443 | | - 'margin' : '5px', |
444 | | - 'padding' : '5px' |
445 | | - }) |
446 | | - ); |
| 483 | + this.appendFirebugWarning(); |
447 | 484 | } |
448 | 485 | |
449 | 486 | // Change the file browser to type text. We can't simply change the attribute so |
— | — | @@ -473,7 +510,18 @@ |
474 | 511 | this.createControls(); |
475 | 512 | this.bindControls(); |
476 | 513 | }, |
477 | | - |
| 514 | + appendFirebugWarning : function(){ |
| 515 | + $j( this.selector ).after( |
| 516 | + $j( '<div />' ) |
| 517 | + .addClass( 'ui-state-error ui-corner-all' ) |
| 518 | + .html( gM( 'fogg-warning-firebug' ) ) |
| 519 | + .css({ |
| 520 | + 'width' : 'auto', |
| 521 | + 'margin' : '5px', |
| 522 | + 'padding' : '5px' |
| 523 | + }) |
| 524 | + ); |
| 525 | + }, |
478 | 526 | /** |
479 | 527 | * Create controls for showing a transcode/crop/resize preview |
480 | 528 | */ |
— | — | @@ -883,13 +931,10 @@ |
884 | 932 | |
885 | 933 | /** |
886 | 934 | * Do an upload, with the mode given by this.upload_mode |
887 | | - * XXX should probably be dispatched from BaseUploadHandler doUpload instead |
| 935 | + * NOTE: should probably be dispatched from BaseUploadHandler doUpload instead |
888 | 936 | */ |
889 | 937 | doUpload: function() { |
890 | | - var _this = this; |
891 | | - mw.log( "firefogg: doUpload:: " + |
892 | | - ( this.getFirefogg() ? 'on' : 'off' ) + |
893 | | - ' up mode:' + _this.upload_mode ); |
| 938 | + var _this = this; |
894 | 939 | |
895 | 940 | _this.uploadBeginTime = (new Date()).getTime(); |
896 | 941 | // If Firefogg is disabled or doing an copyByUrl upload, just invoke the parent method |
— | — | @@ -897,6 +942,8 @@ |
898 | 943 | _this.parent_doUpload(); |
899 | 944 | return ; |
900 | 945 | } |
| 946 | + // We are doing a firefogg upload: |
| 947 | + mw.log( "firefogg: doUpload:: " ); |
901 | 948 | |
902 | 949 | // Setup the firefogg dialog (if not passthrough ) |
903 | 950 | _this.ui.setup( { 'title' : gM( 'mwe-upload-transcode-in-progress' ) } ); |
— | — | @@ -1151,22 +1198,6 @@ |
1152 | 1199 | _this.processApiResult ( apiResult ); |
1153 | 1200 | return true; |
1154 | 1201 | } |
1155 | | - |
1156 | | - /* |
1157 | | - if( apiResult && _this.isApiSuccess( apiResult ) ) { |
1158 | | - if( _this.processApiResult ( apiResult ) ) { |
1159 | | - return true; |
1160 | | - } |
1161 | | - } |
1162 | | - |
1163 | | - if ( apiResult && !_this.isApiSuccess( apiResult ) ) { |
1164 | | - // Show the error and stop the upload |
1165 | | - _this.ui.showApiError( apiResult ); |
1166 | | - _this.action_done = true; |
1167 | | - _this.fogg.cancel(); |
1168 | | - return false; |
1169 | | - } |
1170 | | - */ |
1171 | 1202 | |
1172 | 1203 | } |
1173 | 1204 | // Show the video preview if encoding and show_preview is enabled. |
— | — | @@ -1191,26 +1222,21 @@ |
1192 | 1223 | } |
1193 | 1224 | // Chunk upload mode: |
1194 | 1225 | if ( apiResult && apiResult.resultUrl ) { |
1195 | | - var buttons = { }; |
1196 | | - buttons[ gM( 'mwe-go-to-resource' ) ] = function() { |
1197 | | - window.location = apiResult.resultUrl; |
| 1226 | + this.action_done = true; |
| 1227 | + // Call the callback |
| 1228 | + if ( typeof _this.doneUploadCb == 'function' ) { |
| 1229 | + // check if the callback returns true and close up shop |
| 1230 | + if( _this.doneUploadCb( apiRes ) ){ |
| 1231 | + _this.ui.close(); |
| 1232 | + return true; |
| 1233 | + } |
1198 | 1234 | } |
1199 | | - var go_to_url_txt = gM( 'mwe-go-to-resource' ); |
1200 | | - var showMessage = true; |
1201 | | - if ( typeof _this.done_upload_cb == 'function' ) { |
1202 | | - // Call the callback |
1203 | | - // It will return false if it doesn't want us to show our own "done" message |
1204 | | - showMessage = _this.done_upload_cb( _this.formData ); |
1205 | | - } |
1206 | | - if ( showMessage ) { |
1207 | | - _this.ui.setPrompt( gM( 'mwe-successfulupload' ), |
1208 | | - gM( 'mwe-upload_done', apiResult.resultUrl ), buttons ); |
1209 | | - } else { |
1210 | | - this.action_done = true; |
1211 | | - $j( '#upProgressDialog' ).empty().dialog( 'close' ); |
1212 | | - } |
| 1235 | + // Else pass off the api Success to interface: |
| 1236 | + _this.ui.showApiSuccess( apiResult ); |
| 1237 | + return true; |
1213 | 1238 | } else { |
1214 | | - // Done state with error? Not really possible given how firefogg works... |
| 1239 | + // Done state with error? |
| 1240 | + // Should not be possible because firefogg would not be "done" without resultURL |
1215 | 1241 | mw.log( " Upload done in chunks mode, but no resultUrl!" ); |
1216 | 1242 | } |
1217 | 1243 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js |
— | — | @@ -1,9 +1,8 @@ |
2 | 2 | /** |
3 | 3 | * Simple form output jquery binding |
4 | 4 | * enables dynamic form output to a given target |
5 | | - * |
6 | 5 | */ |
7 | | - |
| 6 | + |
8 | 7 | mw.addMessages( { |
9 | 8 | "mwe-select_file" : "Select file", |
10 | 9 | "mwe-select_ownwork" : "I am uploading entirely my own work, and licensing it under:", |
— | — | @@ -22,15 +21,16 @@ |
23 | 22 | "mwe-i-would-like-to" : "I would like to", |
24 | 23 | "mwe-upload-own-file" : "Upload my own work to $1", |
25 | 24 | "mwe-upload-not-my-file" : "Upload media that is not my own work to $1", |
26 | | - "mwe-upload-once-done" : "Please upload in the new window or tab. Once you have completed your upload, $1", |
| 25 | + "mwe-upload-once-done" : "Please $1. Once you have completed your upload, $2", |
| 26 | + "mwe-upload-in-new-win-link" : "upload in the new window or tab", |
27 | 27 | "mwe-upload-refresh" : "refresh your upload list" |
28 | 28 | } ); |
29 | 29 | |
30 | 30 | var default_form_options = { |
31 | 31 | 'enable_fogg' : true, |
32 | 32 | 'license_options': ['cc-by-sa'], |
33 | | - 'api_target' : false, |
34 | | - 'ondone_callback' : null |
| 33 | + 'apiUrl' : false, |
| 34 | + 'doneUploadCb' : null |
35 | 35 | }; |
36 | 36 | mw.UploadForm = { }; |
37 | 37 | |
— | — | @@ -41,6 +41,8 @@ |
42 | 42 | */ |
43 | 43 | var uploadMenuTarget = null; |
44 | 44 | var remoteSearchDriver = null; |
| 45 | + var selectUploadProviderCb = null; |
| 46 | + |
45 | 47 | mw.UploadForm.getUploadMenu = function( options ){ |
46 | 48 | if( ! options.target ){ |
47 | 49 | mw.log("Error no target for upload menu" ); |
— | — | @@ -53,9 +55,12 @@ |
54 | 56 | remoteSearchDriver = options.remoteSearchDriver |
55 | 57 | } |
56 | 58 | |
| 59 | + if( options.selectUploadProviderCb ){ |
| 60 | + selectUploadProviderCb = options.selectUploadProviderCb; |
| 61 | + } |
| 62 | + |
57 | 63 | // Build out the menu |
58 | | - $j( uploadMenuTarget ).empty().append( |
59 | | - |
| 64 | + $j( uploadMenuTarget ).empty().append( |
60 | 65 | $j( '<span />' ) |
61 | 66 | .text( |
62 | 67 | gM('mwe-i-would-like-to' ) |
— | — | @@ -65,6 +70,7 @@ |
66 | 71 | ); |
67 | 72 | |
68 | 73 | $uploadTargetsList = $j( '<ul />' ); |
| 74 | + |
69 | 75 | // Set provider Target |
70 | 76 | for( var uploadTargetId in options.uploadTargets ){ |
71 | 77 | $uploadTargetsList.append( |
— | — | @@ -90,13 +96,13 @@ |
91 | 97 | } |
92 | 98 | |
93 | 99 | // First do a reality check on the options: |
94 | | - if ( !options.api_target ) { |
| 100 | + if ( !options.apiUrl ) { |
95 | 101 | $j( options.target ).html( 'Error: Missing api target' ); |
96 | 102 | return false; |
97 | 103 | } |
98 | 104 | |
99 | 105 | // Get an edit Token for "uploading" |
100 | | - mw.getToken( options.api_target, 'File:MyRandomFileTokenCheck.jpg', function( eToken ) { |
| 106 | + mw.getToken( options.apiUrl, 'File:MyRandomFileTokenCheck.jpg', function( eToken ) { |
101 | 107 | if ( !eToken || eToken == '+\\' ) { |
102 | 108 | $j( options.target ).html( gM( 'mwe-error_not_loggedin' ) ); |
103 | 109 | return false; |
— | — | @@ -120,23 +126,24 @@ |
121 | 127 | } ); |
122 | 128 | |
123 | 129 | |
124 | | - // Do local destination fill ( if we are local ) |
125 | | - // Otherwise its handled via mw.ApiProxy.browseFile selectFileCb option |
126 | | - if( mw.isLocalDomain( options.api_target ) ) { |
127 | | - setupLocalUploadBindings(); |
| 130 | + //Set up the bindings |
| 131 | + if( mw.isLocalDomain( options.apiUrl ) ) { |
| 132 | + // Setup Local upload bindings |
| 133 | + setupLocalUploadBindings( options ); |
| 134 | + }else{ |
| 135 | + // Setup ApiFile bindings |
| 136 | + setupApiFileBrowseProxy( |
| 137 | + options |
| 138 | + ); |
128 | 139 | } |
129 | 140 | |
130 | 141 | // Do remote or local destination check: |
131 | 142 | $j( "#wpDestFile" ).change( function( ) { |
132 | 143 | $j( "#wpDestFile" ).doDestCheck( { |
133 | | - 'apiUrl' : options.api_target, |
| 144 | + 'apiUrl' : options.apiUrl, |
134 | 145 | 'warn_target':'#wpDestFile-warning' |
135 | 146 | } ); |
136 | | - } ); |
137 | | - |
138 | | - if ( typeof options.ondone_callback == 'undefined' ) { |
139 | | - options.ondone_callback = false; |
140 | | - } |
| 147 | + } ); |
141 | 148 | }); // ( token ) |
142 | 149 | } |
143 | 150 | |
— | — | @@ -145,44 +152,26 @@ |
146 | 153 | * ( this is different from the api file proxy bindings that |
147 | 154 | * handles the interface bindings within the api file proxy setup. |
148 | 155 | */ |
149 | | - function setupLocalUploadBindings( ) { |
150 | | - |
151 | | - $j( "#wpUploadFile" ).change( function() { |
152 | | - var path = $j( this ).val(); |
153 | | - // Find trailing part |
154 | | - var slash = path.lastIndexOf( '/' ); |
155 | | - var backslash = path.lastIndexOf( '\\' ); |
156 | | - var fname; |
157 | | - if ( slash == -1 && backslash == -1 ) { |
158 | | - fname = path; |
159 | | - } else if ( slash > backslash ) { |
160 | | - fname = path.substring( slash + 1, 10000 ); |
161 | | - } else { |
162 | | - fname = path.substring( backslash + 1, 10000 ); |
163 | | - } |
164 | | - fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / /g, '_' ); |
165 | | - |
166 | | - // Output result |
167 | | - $j( "#wpDestFile" ).val( fname ); |
168 | | - |
169 | | - // Do destination check |
170 | | - $j( "#wpDestFile" ).doDestCheck( { |
171 | | - 'warn_target':'#wpDestFile-warning' |
172 | | - } ); |
173 | | - } ); |
| 156 | + function setupLocalUploadBindings( options ) { |
174 | 157 | |
175 | | - mw.load( 'AddMedia.firefogg', function( ) { |
| 158 | + mw.load( 'AddMedia.firefogg', function( ) { |
176 | 159 | $j( "#wpUploadFile" ).firefogg( { |
177 | 160 | // An api url (we won't submit directly to action of the form) |
178 | | - 'apiUrl' : options.api_target, |
| 161 | + 'apiUrl' : options.apiUrl, |
179 | 162 | |
180 | 163 | // MediaWiki API supports chunk uploads: |
181 | 164 | 'enable_chunks' : false, |
182 | 165 | |
183 | 166 | 'form_selector' : '#suf_upload', |
| 167 | + |
| 168 | + 'doneUploadCb' : options.doneUploadCb, |
| 169 | + |
184 | 170 | 'selectFileCb' : function( fileName ) { |
185 | | - $j( "#wpDestFile" ).val( oggName ).doDestCheck( { |
186 | | - warn_target: "#wpDestFile-warning" |
| 171 | + // Update our local target: |
| 172 | + $j('#wpDestFile').val( fileName ); |
| 173 | + $j( "#wpDestFile" ).doDestCheck( { |
| 174 | + 'apiUrl' : options.apiUrl, |
| 175 | + 'warn_target' : "#wpDestFile-warning" |
187 | 176 | } ); |
188 | 177 | }, |
189 | 178 | 'onsubmit_cb' : function( ) { |
— | — | @@ -205,31 +194,42 @@ |
206 | 195 | '{{self|cc-by-sa-3.0}}' + "\n" |
207 | 196 | ); |
208 | 197 | } |
209 | | - }, |
210 | | - 'done_upload_cb' : options.ondone_callback |
| 198 | + } |
211 | 199 | } ); |
212 | 200 | }); |
213 | 201 | } |
214 | 202 | /** |
215 | 203 | * Setup a fileBrowse proxy for a given target |
216 | 204 | */ |
217 | | - function setupApiFileBrowseProxy ( $targetFileBrowse, options ) { |
| 205 | + function setupApiFileBrowseProxy ( options ) { |
| 206 | + // Set the "firefogg warning" |
| 207 | + // ( note AddMedia.firefogg will be loaded by the same url should be cached ) |
| 208 | + mw.load( 'AddMedia.firefogg', function( ) { |
| 209 | + $j( options.target ).find( '.remote-browse-file' ).firefogg( { |
| 210 | + 'installCheckMode' : true |
| 211 | + }); |
| 212 | + } ); |
218 | 213 | // Load the apiProxy ( if its not already loaded ) |
219 | 214 | mw.load( 'ApiProxy', function( ) { |
220 | 215 | var fileIframeName = mw.ApiProxy.browseFile( { |
221 | 216 | //Target div to put the iframe browser button: |
222 | | - 'target' : $targetFileBrowse, |
| 217 | + 'target' : $j( options.target ).find( '.remote-browse-file' ), |
223 | 218 | |
| 219 | + 'token' : options.eToken, |
| 220 | + |
224 | 221 | // Api url to upload to |
225 | | - 'apiUrl' : options.api_target, |
226 | | - |
| 222 | + 'apiUrl' : options.apiUrl, |
| 223 | + |
| 224 | + // Setup the callback: |
| 225 | + 'doneUploadCb' : options.doneUploadCb, |
| 226 | + |
227 | 227 | // File Destination Name change callback: |
228 | | - 'selectFileCb' : function( fname ) { |
| 228 | + 'selectFileCb' : function( fileName ) { |
229 | 229 | // Update our local target: |
230 | | - $j('#wpDestFile').val( fname ); |
| 230 | + $j('#wpDestFile').val( fileName ); |
231 | 231 | // Run a destination file name check on the remote target |
232 | 232 | $j('#wpDestFile').doDestCheck( { |
233 | | - 'apiUrl' : options.api_target, |
| 233 | + 'apiUrl' : options.apiUrl, |
234 | 234 | 'warn_target': '#file-warning' |
235 | 235 | } ); |
236 | 236 | }, |
— | — | @@ -240,19 +240,50 @@ |
241 | 241 | gM( 'mwe-error-not-loggedin-file', |
242 | 242 | $j( '<a />' ) |
243 | 243 | .text( gM('mwe-link-login') ) |
244 | | - .attr('attr', options.api_target.replace( 'api.php', 'index.php' ) + '?title=Special:UserLogin' ) |
| 244 | + .attr('attr', options.apiUrl.replace( 'api.php', 'index.php' ) + '?title=Special:UserLogin' ) |
245 | 245 | ) |
246 | 246 | ); |
247 | 247 | |
248 | 248 | } |
249 | 249 | } ); |
250 | | - }); |
| 250 | + |
| 251 | + // Setup submit binding: |
| 252 | + $j('#wpUploadBtn').click( function(){ |
| 253 | + // Build the output and send upload request to fileProxy |
| 254 | + mw.ApiProxy.sendServerMsg( { |
| 255 | + 'apiUrl' : options.apiUrl, |
| 256 | + 'frameName' : fileIframeName, |
| 257 | + 'frameMsg' : { |
| 258 | + 'action' : 'fileSubmit', |
| 259 | + 'formData' : { |
| 260 | + 'filename' : $j('#wpDestFile').val(), |
| 261 | + 'comment' : $j('#wpUploadDescription').val(), |
| 262 | + 'watch' : ( $j( '#wpWatchthis' ).is( ':checked' ) ) ? 'true' : 'false', |
| 263 | + 'ignorewarnings': ($j('#wpIgnoreWarning' ).is( ':checked' ) ) ? 'true' : 'false' |
| 264 | + } |
| 265 | + } |
| 266 | + } ); |
| 267 | + // Maybe set loading to spinner |
| 268 | + } ); |
| 269 | + |
| 270 | + // Overwide the form submit: |
| 271 | + $j( '#suf_upload' ).submit( function(){ |
| 272 | + // Only support form submit via button click |
| 273 | + return false; |
| 274 | + }); |
| 275 | + |
| 276 | + |
| 277 | + }); |
251 | 278 | } |
252 | 279 | /** |
253 | 280 | * Get a provider upload links for local upload and remote |
254 | 281 | */ |
255 | | - function getProviderUploadLinks( uploadTargetId ){ |
| 282 | + function getProviderUploadLinks( uploadTargetId ){ |
| 283 | + // Setup local pointers: |
| 284 | + var _this = this |
256 | 285 | var uploadProvider = remoteSearchDriver.getUploadTargets()[ uploadTargetId ]; |
| 286 | + var searchProvider = remoteSearchDriver.content_providers[ uploadTargetId ]; |
| 287 | + |
257 | 288 | var apiUrl = uploadProvider.apiUrl; |
258 | 289 | $uploadLinks = $j( '<div />' ); |
259 | 290 | |
— | — | @@ -272,19 +303,31 @@ |
273 | 304 | gM( 'mwe-upload-own-file', uploadProvider.title ) |
274 | 305 | ) |
275 | 306 | .click( function( ) { |
276 | | - $j( uploadMenuTarget ).empty().loadingSpinner(); |
| 307 | + $j( uploadMenuTarget ).empty().loadingSpinner(); |
| 308 | + |
| 309 | + // if selectUploadProviderCb is set run the callback |
| 310 | + if( selectUploadProviderCb ){ |
| 311 | + selectUploadProviderCb( uploadProvider ) |
| 312 | + } |
| 313 | + |
277 | 314 | // Do upload form |
278 | 315 | mw.UploadForm.getForm( { |
279 | 316 | "target" : uploadMenuTarget, |
280 | | - "api_target" : apiUrl, |
281 | | - "ondone_callback" : function( resultData ) { |
282 | | - var wTitle = resultData['filename']; |
283 | | - // Add a loading div |
| 317 | + "apiUrl" : apiUrl, |
| 318 | + "doneUploadCb" : function( resultData ) { |
| 319 | + if( !resultData || ! resultData.upload || ! resultData.upload['filename']){ |
| 320 | + mw.log( "Error in upload form no upload data in done Upload callback "); |
| 321 | + return false; |
| 322 | + } |
| 323 | + var wTitle = resultData.upload['filename']; |
| 324 | + mw.log( 'uploadForm: doneUploadCb : '+ wTitle); |
| 325 | + // Add the resource editor interface with loaders: |
284 | 326 | remoteSearchDriver.addResourceEditLoader(); |
| 327 | + |
285 | 328 | //Add the uploaded result |
286 | | - provider.sObj.addByTitle( wTitle, function( resource ) { |
287 | | - // Redraw ( with added result if new ) |
288 | | - remoteSearchDriver.showResults(); |
| 329 | + searchProvider.sObj.addByTitle( wTitle, function( resource ) { |
| 330 | + // Update the recent uploads ( background task ) |
| 331 | + remoteSearchDriver.showUserRecentUploads( uploadTargetId ); |
289 | 332 | // Pull up resource editor: |
290 | 333 | remoteSearchDriver.showResourceEditor( resource ); |
291 | 334 | } ); |
— | — | @@ -302,7 +345,7 @@ |
303 | 346 | $j('<li />').append( |
304 | 347 | $j( '<a />' ) |
305 | 348 | .attr( { |
306 | | - 'href' : uploadProvider.uploadPage, |
| 349 | + 'href' : '#', |
307 | 350 | 'target' : '_new' |
308 | 351 | } ) |
309 | 352 | .text( |
— | — | @@ -313,6 +356,15 @@ |
314 | 357 | gM( "mwe-upload-once-done", |
315 | 358 | $j('<a />') |
316 | 359 | .attr( { |
| 360 | + 'href' : uploadProvider.uploadPage, |
| 361 | + 'target' : "_new" |
| 362 | + } ) |
| 363 | + .text( |
| 364 | + gM("mwe-upload-in-new-win-link") |
| 365 | + ), |
| 366 | + |
| 367 | + $j('<a />') |
| 368 | + .attr( { |
317 | 369 | 'href' : '#' |
318 | 370 | } ) |
319 | 371 | .addClass('user-upload-refresh') |
— | — | @@ -326,10 +378,8 @@ |
327 | 379 | $j( uploadMenuTarget ).find( '.user-upload-refresh' ) |
328 | 380 | .click( function( ) { |
329 | 381 | remoteSearchDriver.showUserRecentUploads( uploadTargetId ); |
330 | | - } ); |
331 | | - |
332 | | - // Follow the link to open a new tab |
333 | | - return true; |
| 382 | + return false; |
| 383 | + } ); |
334 | 384 | } ) |
335 | 385 | ) |
336 | 386 | ); |
— | — | @@ -352,7 +402,7 @@ |
353 | 403 | 'id' : "suf_upload", |
354 | 404 | 'name' : "suf_upload", |
355 | 405 | 'enctype' : "multipart/form-data", |
356 | | - 'action' : options.api_target, |
| 406 | + 'action' : options.apiUrl, |
357 | 407 | 'method' : "post" |
358 | 408 | } ) |
359 | 409 | ); |
— | — | @@ -380,7 +430,7 @@ |
381 | 431 | .attr( { |
382 | 432 | 'type' : "hidden", |
383 | 433 | 'id' : "wpEditToken", |
384 | | - 'name' : "wpEditToken", |
| 434 | + 'name' : "token", |
385 | 435 | 'value' : options.eToken |
386 | 436 | }) |
387 | 437 | ) |
— | — | @@ -396,7 +446,7 @@ |
397 | 447 | ); |
398 | 448 | |
399 | 449 | // Output the upload file button ( check for cross domain ) |
400 | | - if( mw.isLocalDomain( options.api_target ) ) { |
| 450 | + if( mw.isLocalDomain( options.apiUrl ) ) { |
401 | 451 | $uploadForm.append( |
402 | 452 | $j( '<input />') |
403 | 453 | .attr( { |
— | — | @@ -405,7 +455,9 @@ |
406 | 456 | 'name' : "wpUploadFile", |
407 | 457 | 'size' : "15" |
408 | 458 | } ) |
409 | | - .css( 'display', 'inline' ) |
| 459 | + .css( 'display', 'inline' ), |
| 460 | + |
| 461 | + $j( '<br />' ) |
410 | 462 | ); |
411 | 463 | } else { |
412 | 464 | /** |
— | — | @@ -417,16 +469,9 @@ |
418 | 470 | $j( '<div />' ) |
419 | 471 | .addClass( 'remote-browse-file' ) |
420 | 472 | .loadingSpinner() |
421 | | - ) |
422 | | - setupApiFileBrowseProxy( |
423 | | - $uploadForm.find('.remote-browse-file' ), |
424 | | - options |
425 | | - ); |
426 | | - } |
| 473 | + ); |
| 474 | + } |
427 | 475 | |
428 | | - // Add firefogg warning |
429 | | - |
430 | | - |
431 | 476 | // Add destination fileName |
432 | 477 | $uploadForm.append( |
433 | 478 | $j( '<label />' ).attr({ |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -36,14 +36,16 @@ |
37 | 37 | "mwe-missing_desc_see_source" : "This asset is missing a description. Please see the $1 and help describe it.", |
38 | 38 | |
39 | 39 | "rsd_config_error" : "Add media wizard configuration error: $1", |
40 | | - "mwe-your_recent_uploads" : "Your recent uploads to $1", |
| 40 | + "mwe-your-recent-uploads" : "Your recent uploads to $1", |
41 | 41 | "mwe-no_recent_uploads" : "No recent uploads", |
42 | 42 | |
43 | 43 | "mwe-not-logged-in-uploads" : "You may not be logged in so no recent uploads can be displayed. $1 login and $2", |
44 | 44 | "mwe-loggin-link" : "Please login", |
45 | 45 | "mwe-try-again-link" : "try again", |
46 | 46 | |
47 | | - "mwe-upload_a_file" : "Upload a new file", |
| 47 | + "mwe-upload-a-file" : "Upload a new file", |
| 48 | + "mwe-upload-a-file-to" : "Upload a new file to $1", |
| 49 | + |
48 | 50 | "mwe-resource_page_desc" : "Resource page description:", |
49 | 51 | "mwe-edit_resource_desc" : "Edit wiki text resource description:", |
50 | 52 | "mwe-local_resource_title" : "Local resource title:", |
— | — | @@ -1038,12 +1040,16 @@ |
1039 | 1041 | // Set the tab container to loading: |
1040 | 1042 | this.$resultsContainer.loadingSpinner(); |
1041 | 1043 | |
1042 | | - //Show the upload form |
1043 | | - mw.load( ['mw.UploadForm'], function() { |
1044 | | - var provider = _this.content_providers[ 'this_wiki' ]; |
1045 | | - // Load this_wiki search system to grab the resource |
1046 | | - _this.loadSearchLib( provider, function() { |
1047 | | - _this.showUploadForm( provider ); |
| 1044 | + // Show the upload form (use the standard module AddMedia.firefogg |
| 1045 | + // This way we get a high cache hit rate by using a general module |
| 1046 | + // and not grouping mw.UploadForm into the upload code set |
| 1047 | + mw.load( 'AddMedia.firefogg', function() { |
| 1048 | + mw.load( 'mw.UploadForm', function() { |
| 1049 | + var provider = _this.content_providers[ 'this_wiki' ]; |
| 1050 | + // Load this_wiki search system to grab the resource |
| 1051 | + _this.loadSearchLib( provider, function() { |
| 1052 | + _this.showUploadForm( provider ); |
| 1053 | + } ); |
1048 | 1054 | } ); |
1049 | 1055 | } ); |
1050 | 1056 | }, |
— | — | @@ -1067,7 +1073,8 @@ |
1068 | 1074 | }) |
1069 | 1075 | .append( |
1070 | 1076 | $j('<h3 />') |
1071 | | - .text( gM( 'mwe-upload_a_file' ) ), |
| 1077 | + .addClass( 'upload-a-file-msg' ) |
| 1078 | + .text( gM( 'mwe-upload-a-file' ) ), |
1072 | 1079 | |
1073 | 1080 | $j('<div />').attr({ |
1074 | 1081 | 'id': 'rsd_upload_form' |
— | — | @@ -1093,7 +1100,12 @@ |
1094 | 1101 | mw.UploadForm.getUploadMenu( { |
1095 | 1102 | 'target': '#rsd_upload_form', |
1096 | 1103 | 'uploadTargets' : _this.getUploadTargets(), |
1097 | | - 'remoteSearchDriver' : this |
| 1104 | + 'remoteSearchDriver' : this, |
| 1105 | + 'selectUploadProviderCb' : function( uploadProvider ){ |
| 1106 | + _this.$resultsContainer.find( '.upload-a-file-msg' ).html( |
| 1107 | + gM( 'mwe-upload-a-file-to', uploadProvider.title ) |
| 1108 | + ); |
| 1109 | + } |
1098 | 1110 | } ); |
1099 | 1111 | }, |
1100 | 1112 | |
— | — | @@ -1113,13 +1125,12 @@ |
1114 | 1126 | $j( target ).append( |
1115 | 1127 | $j( '<h3 />' ) |
1116 | 1128 | .append( |
1117 | | - gM( 'mwe-your_recent_uploads', uploadTarget.title ) |
| 1129 | + gM( 'mwe-your-recent-uploads', uploadTarget.title ) |
1118 | 1130 | ), |
1119 | 1131 | |
1120 | 1132 | // Add the targetUpload container |
1121 | 1133 | $j('<div />') |
1122 | | - .attr( 'id', 'user-results-' + uploadTargetId ) |
1123 | | - .loadingSpinner() |
| 1134 | + .attr( 'id', 'user-results-' + uploadTargetId ) |
1124 | 1135 | ) |
1125 | 1136 | // Issue the call to get the recent uploads: |
1126 | 1137 | _this.showUserRecentUploads( uploadTargetId ); |
— | — | @@ -1132,32 +1143,17 @@ |
1133 | 1144 | var provider = _this.content_providers[ uploadTargetId ]; |
1134 | 1145 | var uploadTargets = _this.getUploadTargets(); |
1135 | 1146 | var uploadApiUrl = uploadTargets[ uploadTargetId ].apiUrl ; |
1136 | | - |
| 1147 | + |
| 1148 | + // Set the target to a loadingSpinner |
| 1149 | + $j('#user-results-' + uploadTargetId ).loadingSpinner(); |
| 1150 | + |
1137 | 1151 | // If the target is not local or we don't have a userName |
1138 | 1152 | // ( try and grab the user name via api call (will be a proxy call if remote) ) |
1139 | | - if( ! mw.isLocalDomain( uploadApiUrl ) ) { |
1140 | | - // Garb the userName via api call |
1141 | | - var request = { |
1142 | | - 'action':'query', |
1143 | | - 'meta':'userinfo' |
1144 | | - } |
1145 | | - // Do request ( will automatically invoke proxy because its a proxy action and remote url ) |
1146 | | - mw.getJSON( uploadApiUrl, request, function( data ){ |
1147 | | - // Now we get the data back for that domain |
1148 | | - if( !data || !data.query || !data.query.userinfo ){ |
1149 | | - // Could not get user name user is not-logge |
1150 | | - mw.log( " No user data in resposne " ); |
1151 | | - return false; |
1152 | | - } |
1153 | | - var userName = data.query.userinfo.name; |
1154 | | - _this.showUserRecentUploadsWithUser( uploadTargetId, userName ); |
1155 | | - |
1156 | | - }, |
1157 | | - // Add a timeout function for getting the user-name |
1158 | | - function( ) { |
| 1153 | + mw.getUserName( uploadApiUrl, function( userName ) { |
| 1154 | + if( userName === false ){ |
1159 | 1155 | var logInLink = uploadApiUrl.replace( 'api.php', 'index.php' ) + '?title=Special:UserLogin'; |
1160 | 1156 | // Timed out or proxy not setup ( for remotes ) |
1161 | | - $j( '#user-results-' + uploadTargetId ).html( |
| 1157 | + $j( '#user-results-' + uploadTargetId ).html( |
1162 | 1158 | gM( "mwe-not-logged-in-uploads", |
1163 | 1159 | $j( '<a />' ) |
1164 | 1160 | .attr( { |
— | — | @@ -1179,19 +1175,15 @@ |
1180 | 1176 | $j( '#user-results-' + uploadTargetId ) |
1181 | 1177 | .find( '.try-again' ) |
1182 | 1178 | .click(function(){ |
1183 | | - //Refresh the user uploads |
| 1179 | + mw.log(" try again:: " + uploadTargetId); |
| 1180 | + $j( '#user-results-' + uploadTargetId ).empty().loadingSpinner(); |
| 1181 | + // Refresh the user uploads |
1184 | 1182 | _this.showUserRecentUploads( uploadTargetId ); |
1185 | 1183 | }) |
1186 | | - } ); |
1187 | | - } else { |
1188 | | - // No user name, since every page outputs wgUserName assume the user is not logged in ) |
1189 | | - if( !wgUserName ) { |
1190 | | - $j( '#user-results-' + uploadTargetId ) |
1191 | | - .text( gM( 'mwe-not-logged-in-uploads' ) ); |
1192 | | - }else{ |
1193 | | - _this.showUserRecentUploadsWithUser( uploadTargetId, wgUserName ); |
| 1184 | + } else { |
| 1185 | + _this.showUserRecentUploadsWithUser( uploadTargetId, userName ); |
1194 | 1186 | } |
1195 | | - } |
| 1187 | + } ); |
1196 | 1188 | }, |
1197 | 1189 | |
1198 | 1190 | showUserRecentUploadsWithUser: function( uploadTargetId, userId ){ |
— | — | @@ -1269,7 +1261,8 @@ |
1270 | 1262 | mw.parseUri( thisWikiProvider.apiUrl ).host, |
1271 | 1263 | $j( '<a />' ) |
1272 | 1264 | .attr( { |
1273 | | - 'href' : $uploadLink.attr('href') |
| 1265 | + 'href' : $uploadLink.attr('href'), |
| 1266 | + 'target' : '_new' |
1274 | 1267 | } ) |
1275 | 1268 | .text( gM('mwe-local-upload-policy-link') ) |
1276 | 1269 | ), |
— | — | @@ -1286,7 +1279,7 @@ |
1287 | 1280 | */ |
1288 | 1281 | updateResults: function() { |
1289 | 1282 | if ( this.current_provider == 'upload' ) { |
1290 | | - this.updateUploadResults(); |
| 1283 | + this.showUploadTab(); |
1291 | 1284 | } else { |
1292 | 1285 | this.updateSearchResults( this.current_provider, false ); |
1293 | 1286 | } |
— | — | @@ -1509,17 +1502,18 @@ |
1510 | 1503 | _this.currentRequest = context(); |
1511 | 1504 | mw.log( "ProviderCallBack Generated " + context() ) |
1512 | 1505 | provider.sObj.getSearchResults( $j( '#rsd_q' ).val() , |
1513 | | - function( resultStatus ) { |
1514 | | - mw.log( "ProviderCallBack Received " + context() ); |
1515 | | - if( _this.currentRequest != context() ) { |
1516 | | - mw.log( "Context mismatch for request " + _this.currentRequest + ' != ' + context ); |
1517 | | - // do not update the results this.currentRequest |
1518 | | - // does not match the interface request state. |
1519 | | - return false; |
1520 | | - } |
1521 | | - //else update search results |
1522 | | - _this.showResults(); |
1523 | | - }); |
| 1506 | + function( resultStatus ) { |
| 1507 | + mw.log( "ProviderCallBack Received " + context() ); |
| 1508 | + if( _this.currentRequest != context() ) { |
| 1509 | + mw.log( "Context mismatch for request " + _this.currentRequest + ' != ' + context ); |
| 1510 | + // do not update the results this.currentRequest |
| 1511 | + // does not match the interface request state. |
| 1512 | + return false; |
| 1513 | + } |
| 1514 | + //else update search results |
| 1515 | + _this.showResults(); |
| 1516 | + } |
| 1517 | + ); |
1524 | 1518 | |
1525 | 1519 | // Set a timeout of 20 seconds |
1526 | 1520 | setTimeout( function() { |
— | — | @@ -1693,9 +1687,16 @@ |
1694 | 1688 | // Add "no search results" text |
1695 | 1689 | $j( '#rsd_no_search_res' ).remove(); |
1696 | 1690 | if ( numResults == 0 ) { |
1697 | | - $resultsContainer.append( |
1698 | | - gM( 'rsd_no_results', $j( '#rsd_q' ).val() ) |
1699 | | - ) |
| 1691 | + // NOTE: we should handle no-results with a callback not with condition check |
| 1692 | + if( _this.current_provider == 'upload' ) { |
| 1693 | + $resultsContainer.append( |
| 1694 | + gM( 'mwe-no_recent_uploads' ) |
| 1695 | + ); |
| 1696 | + } else { |
| 1697 | + $resultsContainer.append( |
| 1698 | + gM( 'rsd_no_results', $j( '#rsd_q' ).val() ) |
| 1699 | + ) ; |
| 1700 | + } |
1700 | 1701 | } |
1701 | 1702 | this.addResultBindings(); |
1702 | 1703 | }, |
— | — | @@ -2697,7 +2698,7 @@ |
2698 | 2699 | // ( mvBaseUploadInterface handles upload errors ) |
2699 | 2700 | var uploader = new mw.BaseUploadInterface( { |
2700 | 2701 | 'apiUrl' : _this.upload_api_target, |
2701 | | - 'done_upload_cb':function() { |
| 2702 | + 'doneUploadCb': function() { |
2702 | 2703 | mw.log( 'doApiImport:: run callback::' ); |
2703 | 2704 | // We have finished the upload: |
2704 | 2705 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Generate a new context object: (its oky that optional arguments are null ) |
73 | | - var context = getNewContext({ |
| 73 | + var context = createContext({ |
74 | 74 | 'apiUrl' : apiUrl,// currentServerApiUrl |
75 | 75 | 'apiReq' : requestQuery, |
76 | 76 | 'callback' : callback, |
— | — | @@ -97,15 +97,42 @@ |
98 | 98 | mw.log( "Error: no target for file browse iframe" ) ; |
99 | 99 | return false; |
100 | 100 | } |
| 101 | + |
| 102 | + if( !options.token ){ |
| 103 | + mw.log( "Error: no token for file browse "); |
| 104 | + return false; |
| 105 | + } |
| 106 | + |
| 107 | + mw.log( "browseFile:: " + $j(options.target).length ); |
| 108 | + |
| 109 | + mw.log( "BROWSE FILE:: cb: " + options.doneUploadCb); |
| 110 | + |
101 | 111 | if( ! options.apiUrl ) { |
102 | 112 | mw.log( "Error: no api url to target" ); |
103 | 113 | return false; |
104 | 114 | } |
| 115 | + mw.log( 'Setup uploadDialogInterface' ); |
105 | 116 | |
106 | | - // Setup the context with the callback |
107 | | - var context = getNewContext({ |
| 117 | + // Make sure we have the dialog interface: |
| 118 | + var uploadDialogInterface = new mw.UploadDialogInterface( { |
| 119 | + 'uploadHandlerAction' : function( action ){ |
| 120 | + mw.log( 'apiProxy uploadActionHandler:: ' + action ); |
| 121 | + // Send action to remote frame |
| 122 | + mw.ApiProxy.sendServerMsg( { |
| 123 | + 'apiUrl' : options.apiUrl, |
| 124 | + 'frameName' : iFrameName, |
| 125 | + 'frameMsg' : { |
| 126 | + 'action' : 'uploadHandlerAction', |
| 127 | + 'uiAction' : action |
| 128 | + } |
| 129 | + } ); |
| 130 | + } |
| 131 | + } ); |
| 132 | + |
| 133 | + // Setup the context with the callback in the current closure |
| 134 | + var context = createContext({ |
108 | 135 | 'apiUrl' : options.apiUrl, |
109 | | - // Setup the proxy scope callback to display the upload unhide the iframe upload form |
| 136 | + // Setup the callback to process iframeData |
110 | 137 | 'callback' : function( iframeData ) { |
111 | 138 | // Process fileBrowse callbacks :: |
112 | 139 | |
— | — | @@ -117,17 +144,28 @@ |
118 | 145 | $j( '#' + iFrameName ).fadeIn( 'fast' ); |
119 | 146 | return ; |
120 | 147 | } |
| 148 | + mw.log( '~browseFile Callback~ event type: ' + iframeData['event'] ); |
121 | 149 | |
122 | 150 | // Else check for event |
123 | 151 | if( iframeData['event'] ) { |
124 | 152 | switch( iframeData['event'] ) { |
125 | 153 | case 'selectFileCb': |
126 | 154 | if( options.selectFileCb ) { |
127 | | - options.selectFileCb( iframeData['fileName'] ); |
| 155 | + options.selectFileCb( iframeData[ 'fileName' ] ); |
128 | 156 | } |
129 | 157 | break |
| 158 | + // Set the doneUploadCb if set in the browseFile options |
| 159 | + case 'doneUploadCb': |
| 160 | + mw.log( "should call cb: " + options.doneUploadCb ); |
| 161 | + if( options.doneUploadCb ) { |
| 162 | + options.doneUploadCb( iframeData[ 'apiResult' ] ); |
| 163 | + return true; |
| 164 | + }else{ |
| 165 | + return false; |
| 166 | + } |
| 167 | + break; |
130 | 168 | case 'uploadUI': |
131 | | - if( uploadDialogInterface[ iframeData['method'] ] ){ |
| 169 | + if( uploadDialogInterface[ iframeData[ 'method' ] ] ){ |
132 | 170 | var args = iframeData['arguments']; |
133 | 171 | mw.log( "Do dialog interface: " + iframeData['method'] + ' args: ' + args[0] + ', ' + args[1] + ', ' + args[2] ); |
134 | 172 | uploadDialogInterface[ iframeData['method'] ]( |
— | — | @@ -142,10 +180,6 @@ |
143 | 181 | } |
144 | 182 | }); |
145 | 183 | |
146 | | - |
147 | | - // Update the current apiUrl: |
148 | | - context[ 'apiUrl' ] = options.apiUrl; |
149 | | - |
150 | 184 | // Setup the default width and height: |
151 | 185 | if( ! options.width ) { |
152 | 186 | options.width = 270; |
— | — | @@ -156,9 +190,10 @@ |
157 | 191 | |
158 | 192 | var iFrameName = ( options.iframeName ) ? options.iframeName : 'fileBrowse_' + $j('iframe').length; |
159 | 193 | // Setup an object to be packaged into the frame |
160 | | - var iFrameRequest ={ |
| 194 | + var iFrameRequest = { |
161 | 195 | 'clientFrame' : getClientFrame( context ), |
162 | | - 'action' : 'browseFile' |
| 196 | + 'action' : 'browseFile', |
| 197 | + 'token' : options.token |
163 | 198 | }; |
164 | 199 | |
165 | 200 | var frameStyle = 'display:none;border:none;overflow:hidden;' |
— | — | @@ -168,7 +203,13 @@ |
169 | 204 | // Empty the target ( so that the iframe can be put there ) |
170 | 205 | $j( options.target ).empty(); |
171 | 206 | |
172 | | - // Append the browseFile iframe to the target: |
| 207 | + mw.log( 'append spinner'); |
| 208 | + // Add a loading spinner to the target |
| 209 | + $j( options.target ).append( |
| 210 | + $j( '<div />' ).loadingSpinner() |
| 211 | + ); |
| 212 | + |
| 213 | + // Append the browseFile iframe to the target: |
173 | 214 | appendIframe( { |
174 | 215 | 'context' : context, |
175 | 216 | 'persist' : true, |
— | — | @@ -176,29 +217,6 @@ |
177 | 218 | 'name' : iFrameName, |
178 | 219 | 'request' : iFrameRequest, |
179 | 220 | 'target' : options.target |
180 | | - } ); |
181 | | - |
182 | | - // Add a loading spinner to the target |
183 | | - $j( options.target ).append( |
184 | | - $j( '<div />' ).loadingSpinner() |
185 | | - ); |
186 | | - |
187 | | - // Make sure we have the dialog interface: |
188 | | - mw.load( 'mw.UploadInterface', function(){ |
189 | | - var uploadDialogInterface = new mw.UploadDialogInterface( { |
190 | | - 'uploadHandlerAction' : function( action ){ |
191 | | - mw.log( 'apiProxy uploadActionHandler:: ' + action ); |
192 | | - // Send action to remote frame |
193 | | - mw.ApiProxy.sendServerMsg( { |
194 | | - 'apiUrl' : options.apiUrl, |
195 | | - 'frameName' : iFrameName, |
196 | | - 'frameMsg' : { |
197 | | - 'action' : 'uploadHandlerAction', |
198 | | - 'uiAction' : action |
199 | | - } |
200 | | - } ); |
201 | | - } |
202 | | - } ); |
203 | 221 | } ); |
204 | 222 | |
205 | 223 | // Return the name of the browseFile frame |
— | — | @@ -221,7 +239,7 @@ |
222 | 240 | } |
223 | 241 | |
224 | 242 | //Setup a new context |
225 | | - var context = getNewContext({ |
| 243 | + var context = createContext({ |
226 | 244 | 'apiUrl' : options.apiUrl |
227 | 245 | }); |
228 | 246 | |
— | — | @@ -271,20 +289,21 @@ |
272 | 290 | } |
273 | 291 | |
274 | 292 | // Get the context via contextKey |
275 | | - var context = getContext( resultObject.contextKey ); |
| 293 | + var context = getContext( resultObject.contextKey ); |
276 | 294 | |
277 | 295 | // Set the loaded flag to true. ( avoids timeout calls ) |
278 | 296 | context[ 'proxyLoaded' ] = true; |
279 | 297 | |
280 | | - // Special callback to frameProxyOk flag |
281 | | - // (only used to quickly test the proxy connection) |
| 298 | + // Special callback to quickly establish a valid proxy connection. |
| 299 | + // If the proxyed "request" takes more time it does not |
| 300 | + // count against the proxy connection being established. |
282 | 301 | if ( resultObject.state == 'ok' ) { |
283 | 302 | return ; |
284 | 303 | } |
285 | 304 | |
286 | 305 | // Check for the context callback: |
287 | | - if( context ['callback'] ){ |
288 | | - context ['callback']( resultObject ); |
| 306 | + if( context.callback ){ |
| 307 | + context.callback( resultObject ); |
289 | 308 | } |
290 | 309 | } |
291 | 310 | |
— | — | @@ -332,35 +351,35 @@ |
333 | 352 | */ |
334 | 353 | |
335 | 354 | /** |
336 | | - * Get new context (creates a new context and stores it in the proxyContext local global |
| 355 | + * Creates a new context stored in the proxyContext local global |
337 | 356 | * @param {Object} contextVars Initial contextVars |
338 | 357 | */ |
339 | | - function getNewContext ( contextVars ) { |
| 358 | + function createContext ( contextVars ) { |
340 | 359 | // Create a ~ sufficently ~ unique context key |
341 | 360 | var contextKey = new Date().getTime() * Math.random(); |
342 | 361 | proxyContext [ contextKey ] = contextVars; |
343 | 362 | |
344 | 363 | // Setup the proxy loaded flag for this context: |
345 | | - proxyContext[ contextKey ][ 'proxyLoaded' ] = false; // frameProxyOk |
| 364 | + proxyContext[ contextKey ][ 'proxyLoaded' ] = false; |
346 | 365 | |
347 | 366 | // Set a local pointer to the contextKey |
348 | 367 | proxyContext[ contextKey ]['contextKey' ] = contextKey; |
349 | 368 | |
| 369 | + mw.log( "created context with key:" + contextKey ); |
| 370 | + |
350 | 371 | // Return the proxy context |
351 | 372 | return proxyContext [ contextKey ]; |
352 | 373 | } |
353 | 374 | |
354 | 375 | /** |
355 | 376 | * Get a context from a contextKey |
356 | | - * @param {String} contextKey Key of the context object to be returned |
| 377 | + * @param {String} [optional] contextKey Key of the context object to be returned |
357 | 378 | * @return context object |
358 | 379 | * false if context object can not be found |
359 | 380 | */ |
360 | | - function getContext ( contextKey ){ |
| 381 | + function getContext ( contextKey ){ |
361 | 382 | if( ! proxyContext [ contextKey ] ){ |
362 | 383 | mw.log( "Error: contextKey not found:: " + contextKey ); |
363 | | - var cat = proxyContext; |
364 | | - debugger; |
365 | 384 | return false; |
366 | 385 | } |
367 | 386 | return proxyContext [ contextKey ];; |
— | — | @@ -396,7 +415,7 @@ |
397 | 416 | //var gadgetWithJS = '?withJS=MediaWiki:Gadget-mwEmbed.js'; |
398 | 417 | var gadgetWithJS = ''; |
399 | 418 | function getServerFrame( context ) { |
400 | | - if( ! context.apiUrl ){ |
| 419 | + if( ! context || ! context.apiUrl ){ |
401 | 420 | mw.log( "Error no context api url " ); |
402 | 421 | return false; |
403 | 422 | } |
— | — | @@ -408,7 +427,7 @@ |
409 | 428 | |
410 | 429 | /** |
411 | 430 | * Do the frame proxy |
412 | | - * Writes an iframe with a hashed value of the requestQuery |
| 431 | + * Sets up a frame proxy request |
413 | 432 | * |
414 | 433 | * @param {Object} context ( the context of the current doFrameProxy call ) |
415 | 434 | * @param {Object} requestQuery The api request object |
— | — | @@ -512,6 +531,7 @@ |
513 | 532 | * @param {Object} context |
514 | 533 | */ |
515 | 534 | function proxyNotReadyTimeout( context ) { |
| 535 | + mw.log( 'proxyNotReadyTimeout::' + context[ 'timeoutCb' ]); |
516 | 536 | |
517 | 537 | // See if we have a callback function to call ( do not display the dialog ) |
518 | 538 | if( context[ 'timeoutCb' ] && typeof context[ 'timeoutCb' ] == 'function' ) { |
— | — | @@ -521,16 +541,16 @@ |
522 | 542 | |
523 | 543 | var buttons = { }; |
524 | 544 | buttons[ gM( 'mwe-re-try' ) ] = function() { |
525 | | - mw.addLoaderDialog( gM( 'mwe-re-trying' ) ); |
| 545 | + mw.addLoaderDialog( gM( 'mwe-re-trying' ) ); |
526 | 546 | // Re try the same context request: |
527 | | - doFrameProxy( context ); |
| 547 | + doFrameProxy( context ); |
528 | 548 | } |
529 | 549 | buttons[ gM( 'mwe-cancel' ) ] = function() { |
530 | 550 | mw.closeLoaderDialog(); |
531 | 551 | } |
532 | 552 | |
533 | 553 | // Setup the login link: |
534 | | - var pUri = mw.parseUri( getServerFrame() ); |
| 554 | + var pUri = mw.parseUri( getServerFrame( context ) ); |
535 | 555 | var login_url = pUri.protocol + '://' + pUri.host; |
536 | 556 | login_url += pUri.path.replace( 'MediaWiki:ApiProxy', 'Special:UserLogin' ); |
537 | 557 | |
— | — | @@ -604,10 +624,11 @@ |
605 | 625 | clientRequest.request[ 'format' ] = 'json'; |
606 | 626 | |
607 | 627 | mw.log(" do post request to: " + wgScriptPath + '/api' + wgScriptExtension ); |
608 | | - |
| 628 | + /* |
609 | 629 | for( var i in clientRequest.request ) { |
610 | 630 | mw.log("req: " + i + " = " + clientRequest.request[i] ); |
611 | 631 | } |
| 632 | + */ |
612 | 633 | |
613 | 634 | // Process the API request. We don't use mw.getJSON since we need to "post" |
614 | 635 | $j.post( wgScriptPath + '/api' + wgScriptExtension, |
— | — | @@ -683,12 +704,19 @@ |
684 | 705 | * @return browse file config |
685 | 706 | */ |
686 | 707 | function serverBrowseFileSetup( ){ |
687 | | - // Get the proxy config |
688 | | - var proxyConfig = mw.getConfig( 'apiProxyConfig' ); |
689 | | - //check for fw ( file width ) |
690 | | - if( ! proxyConfig.fileWidth ) { |
691 | | - proxyConfig.fileWidth = 130; |
| 708 | + // Get the client request config |
| 709 | + var clientRequest = getClientRequest(); |
| 710 | + |
| 711 | + // Check for fw ( file width ) |
| 712 | + if( ! clientRequest.fileWidth ) { |
| 713 | + clientRequest.fileWidth = 130; |
692 | 714 | } |
| 715 | + // Check for the token |
| 716 | + if( ! clientRequest.token ){ |
| 717 | + mw.log("Error server browse file setup without token") |
| 718 | + return false; |
| 719 | + } |
| 720 | + |
693 | 721 | //Build a form with bindings similar to uploadPage.js ( but only the browse button ) |
694 | 722 | $j('body').html( |
695 | 723 | $j('<form />') |
— | — | @@ -701,7 +729,7 @@ |
702 | 730 | 'action' : mw.getLocalApiUrl() |
703 | 731 | } ) |
704 | 732 | .append( |
705 | | - //Add a single "browse for file" button |
| 733 | + //Add the "browse for file" button |
706 | 734 | $j('<input />') |
707 | 735 | .attr({ |
708 | 736 | 'type' : "file", |
— | — | @@ -709,8 +737,17 @@ |
710 | 738 | 'id' : "wpUploadFile" |
711 | 739 | }) |
712 | 740 | .css({ |
713 | | - 'width' : proxyConfig.fileWidth |
| 741 | + 'width' : clientRequest.fileWidth |
| 742 | + }), |
| 743 | + |
| 744 | + // Append the token |
| 745 | + $j('<input />') |
| 746 | + .attr({ |
| 747 | + 'type' : 'hidden', |
| 748 | + 'id' : "wpEditToken", |
| 749 | + 'name' : 'token', |
714 | 750 | }) |
| 751 | + .val( clientRequest.token ) |
715 | 752 | ) |
716 | 753 | ); |
717 | 754 | } |
— | — | @@ -718,7 +755,9 @@ |
719 | 756 | /** |
720 | 757 | * Browse file upload config generator |
721 | 758 | */ |
722 | | - function getUploadFileConfig(){ |
| 759 | + function getUploadFileConfig(){ |
| 760 | + |
| 761 | + // Setup the upload iframeUI |
723 | 762 | var uploadIframeUI = new mw.UploadIframeUI( function( method ){ |
724 | 763 | // Get all the arguments after the "method" |
725 | 764 | var args = $j.makeArray( arguments ).splice( 1 ); |
— | — | @@ -741,8 +780,16 @@ |
742 | 781 | 'event': 'selectFileCb', |
743 | 782 | 'fileName' : fileName |
744 | 783 | } ); |
745 | | - } |
746 | | - } |
| 784 | + }, |
| 785 | + // Set the doneUploadCb if set in the browseFile options |
| 786 | + 'doneUploadCb' : function ( apiResult ){ |
| 787 | + sendClientMsg( { |
| 788 | + 'event': 'doneUploadCb', |
| 789 | + 'apiResult' : apiResult |
| 790 | + } ); |
| 791 | + } |
| 792 | + } |
| 793 | + |
747 | 794 | return uploadConfig; |
748 | 795 | } |
749 | 796 | |
— | — | @@ -751,7 +798,7 @@ |
752 | 799 | */ |
753 | 800 | function serverSendUploadHandlerAction( action ) { |
754 | 801 | // Get a refrence to the uploadHandler: |
755 | | - // NOTE: this should not be hard-coded |
| 802 | + // NOTE: both firefogg and upload form should save upload target in a similar way |
756 | 803 | var selector = ( wgEnableFirefogg ) ? '#wpUploadFile' : '#mw-upload-form'; |
757 | 804 | var uploadHandler = $j( selector ).get(0).uploadHandler; |
758 | 805 | if( uploadHandler ){ |
— | — | @@ -766,38 +813,28 @@ |
767 | 814 | * @param {Object} options Options for submiting file |
768 | 815 | */ |
769 | 816 | function serverSubmitFile( formData ){ |
| 817 | + mw.log("Submit form with fname:" + formData.filename + "\n :: " + formData.comment) |
770 | 818 | // Add the FileName and and the description to the form |
771 | 819 | var $form = $j('#mw-upload-form'); |
772 | | - // Add the filename and description if missing |
773 | | - if( ! $form.find("[name='filename']").length ){ |
774 | | - $form.append( |
775 | | - $j( '<input />' ) |
776 | | - .attr( { |
777 | | - 'id' : 'wpDestFile', |
778 | | - 'name' : 'filename', |
779 | | - 'type' : 'hidden' |
780 | | - } ) |
781 | | - ); |
782 | | - } |
783 | | - if( ! $form.find("[name='description']").length ){ |
784 | | - $form.append( |
785 | | - $j( '<input />' ) |
786 | | - .attr( { |
787 | | - 'id' : 'wpUploadDescription', |
788 | | - 'name' : 'comment', |
789 | | - 'type' : 'hidden' |
790 | | - } ) |
791 | | - ); |
792 | | - } |
793 | | - |
794 | | - // Update filename and description ( if set ) |
795 | | - if( formData.filename ) { |
796 | | - $form.find( "[name='filename']" ).val( formData.filename ) |
797 | | - } |
798 | | - if( formData.description ) { |
799 | | - $form.find( "[name='description']" ).val( formData.description ) |
800 | | - } |
| 820 | + var formApiFields = [ 'filename', 'comment', 'watch', 'ignorewarnings', 'token' ]; |
801 | 821 | |
| 822 | + for( var i=0; i < formApiFields.length ; i++ ){ |
| 823 | + var fieldName = formApiFields[ i ]; |
| 824 | + if( typeof formData[ fieldName ] == 'string' ) { |
| 825 | + // Add the input field if not already there: |
| 826 | + if( ! $form.find("[name='" + fieldName + "']" ).length ){ |
| 827 | + $form.append( |
| 828 | + $j( '<input />' ) |
| 829 | + .attr( { |
| 830 | + 'name' : fieldName, |
| 831 | + 'type' : 'hidden' |
| 832 | + } ) |
| 833 | + ) |
| 834 | + } |
| 835 | + // Add the value if set: |
| 836 | + $form.find("[name='" + fieldName + "']" ).val( formData[ fieldName ] ); |
| 837 | + } |
| 838 | + } |
802 | 839 | // Do submit the form |
803 | 840 | $form.submit(); |
804 | 841 | }; |
— | — | @@ -854,9 +891,10 @@ |
855 | 892 | * persist - set to true if the iframe should not |
856 | 893 | * be removed from the dom after its done loading |
857 | 894 | */ |
858 | | - function appendIframe( options ){ |
859 | | - var s = '<iframe '; |
860 | | - |
| 895 | + function appendIframe( options ){ |
| 896 | + |
| 897 | + |
| 898 | + var s = '<iframe '; |
861 | 899 | // check for context |
862 | 900 | if( ! options[ 'context' ] ) { |
863 | 901 | mw.log("Error missing context"); |
— | — | @@ -873,7 +911,8 @@ |
874 | 912 | if( ! options[ 'name' ] ) { |
875 | 913 | options[ 'name' ] = 'mwApiProxyFrame_' + $j('iframe').length; |
876 | 914 | } |
877 | | - |
| 915 | + |
| 916 | + |
878 | 917 | // Add the frame name / id: |
879 | 918 | s += 'name="' + mw.escapeQuotes( options[ 'name' ] ) + '" '; |
880 | 919 | s += 'id="' + mw.escapeQuotes( options[ 'name' ] ) + '" '; |
— | — | @@ -906,14 +945,14 @@ |
907 | 946 | if( ! options[ 'target' ] ){ |
908 | 947 | options[ 'target' ] = 'body'; |
909 | 948 | } |
910 | | - |
| 949 | + var nameTarget = ( typeof options[ 'target' ] == 'string') ? options[ 'target' ] : $j( options[ 'target' ]).length ; |
| 950 | + mw.log( "Append iframe:" + options[ 'name' ] + ' to: ' + nameTarget); |
911 | 951 | // Append to target |
912 | 952 | $j( options['target'] ).append( s ); |
913 | 953 | |
914 | 954 | // Setup the onload callback |
915 | | - $j( '#' + options['name'] ).get( 0 ).onload = function() { |
| 955 | + $j( '#' + options['name'] ).get( 0 ).onload = function() { |
916 | 956 | if( ! options.persist ){ |
917 | | - |
918 | 957 | // Schedule the removal of the iframe |
919 | 958 | // We don't call it directly since some browsers seem to call "ready" |
920 | 959 | // before blocking code is done running |
— | — | @@ -921,15 +960,15 @@ |
922 | 961 | $j('#' + options[ 'name' ] ).remove(); |
923 | 962 | }, 10 ); |
924 | 963 | } |
925 | | - // Setupt the timeout check: |
926 | | - setTimeout( function() { |
927 | | - if ( context[ 'frameProxyOk'] ) { |
928 | | - // We timed out no api proxy (should make sure the user is "logged in") |
929 | | - mw.log( "Error:: api proxy timeout are we logged in? mwEmbed is on?" ); |
930 | | - proxyNotReadyTimeout( context ); |
931 | | - } |
932 | | - }, mw.getConfig( 'defaultRequestTimeout') * 1000 ); |
933 | | - }; |
| 964 | + }; |
| 965 | + // Setupt the timeout check: |
| 966 | + setTimeout( function() { |
| 967 | + if ( context[ 'proxyLoaded'] === false ) { |
| 968 | + // We timed out no api proxy (should make sure the user is "logged in") |
| 969 | + mw.log( "Error:: api proxy timeout" + context.contextKey ); |
| 970 | + proxyNotReadyTimeout( context ); |
| 971 | + } |
| 972 | + }, mw.getConfig( 'defaultRequestTimeout') * 1000 ); |
934 | 973 | } |
935 | 974 | |
936 | 975 | } )( window.mw.ApiProxy ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/mw.ClipEdit.js |
— | — | @@ -772,6 +772,7 @@ |
773 | 773 | $j( '#mw_layout_right' )[0].checked = false; |
774 | 774 | $j( '#mw_layout_left' )[0].checked = true; |
775 | 775 | _this.resource.layout = 'left'; |
| 776 | + return true; |
776 | 777 | } ); |
777 | 778 | |
778 | 779 | // Right radio click |
— | — | @@ -779,6 +780,7 @@ |
780 | 781 | $j( '#mw_layout_left' )[0].checked = false; |
781 | 782 | $j( '#mw_layout_right' )[0].checked = true; |
782 | 783 | _this.resource.layout = 'right'; |
| 784 | + return true; |
783 | 785 | } ); |
784 | 786 | break; |
785 | 787 | case 'crop': |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -1380,8 +1380,7 @@ |
1381 | 1381 | * @param {Mixed} data or callback |
1382 | 1382 | * @param {Function} callbcak function called on success |
1383 | 1383 | * @param {Function} callbackTimeout - optional function called on timeout |
1384 | | - * Setting timeout callback also avoids dialog display for timed out proxy calls. |
1385 | | - * |
| 1384 | + * Setting timeout callback also avoids default dialog display for timed-out proxy calls. |
1386 | 1385 | */ |
1387 | 1386 | mw.getJSON = function() { |
1388 | 1387 | // Set up the url |
— | — | @@ -1425,10 +1424,15 @@ |
1426 | 1425 | data['format'] = 'json'; |
1427 | 1426 | } |
1428 | 1427 | |
1429 | | - // Setup callback wrapper for timeout |
| 1428 | + // Setup callback wrapper for timeout |
1430 | 1429 | var requestTimeOutFlag = false; |
1431 | 1430 | var ranCallback = false; |
1432 | | - var myCallback = function( data ){ |
| 1431 | + |
| 1432 | + /** |
| 1433 | + * local callback function to control timeout |
| 1434 | + * @param {Object} data Result data |
| 1435 | + */ |
| 1436 | + var myCallback = function( data ){ |
1433 | 1437 | if( ! requestTimeOutFlag ){ |
1434 | 1438 | ranCallback = true; |
1435 | 1439 | callback( data ); |
— | — | @@ -1436,25 +1440,33 @@ |
1437 | 1441 | } |
1438 | 1442 | // Set the local timeout call based on defaultRequestTimeout |
1439 | 1443 | setTimeout( function( ) { |
1440 | | - if( ! ranCallback ){ |
| 1444 | + if( ! ranCallback ) { |
1441 | 1445 | requestTimeOutFlag = true; |
1442 | | - mw.log( "Error:: request timed out: " + url ) ; |
1443 | | - if( timeoutCallback ) { |
| 1446 | + mw.log( "Error:: request timed out: " + url ) ; |
| 1447 | + if( timeoutCallback ){ |
1444 | 1448 | timeoutCallback(); |
1445 | 1449 | } |
1446 | 1450 | } |
1447 | 1451 | }, mw.getConfig( 'defaultRequestTimeout' ) * 1000 ); |
1448 | 1452 | |
1449 | | - mw.log("run getJSON: " + mw.replaceUrlParams( url, data ) ); |
| 1453 | + mw.log("run getJSON: " + mw.replaceUrlParams( url, data ) ); |
| 1454 | + |
1450 | 1455 | // Check if the request requires a "post" |
1451 | 1456 | if( mw.checkRequestPost( data ) ) { |
| 1457 | + |
1452 | 1458 | // Check if we need to setup a proxy |
1453 | 1459 | if( ! mw.isLocalDomain( url ) ) { |
| 1460 | + |
| 1461 | + //Set local scope ranCallback to true |
| 1462 | + // ( ApiProxy handles timeouts internnaly ) |
| 1463 | + ranCallback = true; |
| 1464 | + |
1454 | 1465 | // Load the proxy and issue the request |
1455 | | - mw.load( 'ApiProxy', function() { |
1456 | | - mw.ApiProxy.doRequest( url, data, myCallback, timeoutCallback); |
| 1466 | + mw.load( 'ApiProxy', function() { |
| 1467 | + mw.ApiProxy.doRequest( url, data, callback, timeoutCallback); |
1457 | 1468 | }); |
1458 | | - }else{ |
| 1469 | + |
| 1470 | + } else { |
1459 | 1471 | // Do the request an ajax post |
1460 | 1472 | $j.post( url, data, myCallback, 'json'); |
1461 | 1473 | } |
— | — | @@ -1509,11 +1521,11 @@ |
1510 | 1522 | } |
1511 | 1523 | |
1512 | 1524 | /** |
1513 | | - * Simple api helper to grab an edit token |
| 1525 | + * Api helper to grab an edit token |
1514 | 1526 | * |
1515 | 1527 | * @param {String} [apiUrl] Optional target API URL (uses default local api if unset) |
1516 | 1528 | * @param {String} title The wiki page title you want to edit |
1517 | | - * @param {callback} callback Function to pass the token to |
| 1529 | + * @param {callback} callback Function to pass the token to returns false if token not retrived |
1518 | 1530 | */ |
1519 | 1531 | mw.getToken = function( apiUrl, title, callback ) { |
1520 | 1532 | // Make the apiUrl be optional: |
— | — | @@ -1533,23 +1545,69 @@ |
1534 | 1546 | mw.getJSON( apiUrl, request, function( data ) { |
1535 | 1547 | for ( var i in data.query.pages ) { |
1536 | 1548 | if ( data.query.pages[i]['edittoken'] ) { |
1537 | | - if ( typeof callback == 'function' ) |
1538 | | - callback ( data.query.pages[i]['edittoken'] ); |
| 1549 | + callback ( data.query.pages[i]['edittoken'] ); |
| 1550 | + return ; |
1539 | 1551 | } |
1540 | 1552 | } |
1541 | 1553 | // No token found: |
1542 | | - return false; |
| 1554 | + callback ( false ); |
1543 | 1555 | } ); |
1544 | 1556 | } |
1545 | 1557 | |
1546 | 1558 | /** |
| 1559 | + * Api helper to grab the username |
| 1560 | + * @param {String} [apiUrl] Optional target API url (uses default local api if unset) |
| 1561 | + * @param {Function} callback Function to callback with username or false if not found |
| 1562 | + */ |
| 1563 | + mw.getUserName = function( apiUrl, callback ){ |
| 1564 | + if( typeof apiUrl == 'function' ){ |
| 1565 | + var callback = apiUrl; |
| 1566 | + var apiUrl = mw.getLocalApiUrl(); |
| 1567 | + } |
| 1568 | + |
| 1569 | + // If apiUrl is local check wgUserName global |
| 1570 | + // before issuing the api request. |
| 1571 | + if( mw.isLocalDomain( apiUrl ) ){ |
| 1572 | + if( typeof wgUserName != 'undefined' && wgUserName !== null ) { |
| 1573 | + callback( wgUserName ) |
| 1574 | + return ; |
| 1575 | + } |
| 1576 | + } |
| 1577 | + |
| 1578 | + // Setup the api request |
| 1579 | + var request = { |
| 1580 | + 'action':'query', |
| 1581 | + 'meta':'userinfo' |
| 1582 | + } |
| 1583 | + |
| 1584 | + // Do request |
| 1585 | + mw.getJSON( apiUrl, request, function( data ) { |
| 1586 | + if( !data || !data.query || !data.query.userinfo || !data.query.userinfo.name ){ |
| 1587 | + // Could not get user name user is not-logged in |
| 1588 | + mw.log( " No userName in response " ); |
| 1589 | + callback( false ); |
| 1590 | + return ; |
| 1591 | + } |
| 1592 | + // Check for "not logged in" id == 0 |
| 1593 | + if( data.query.userinfo.id == 0 ){ |
| 1594 | + callback( false ); |
| 1595 | + return ; |
| 1596 | + } |
| 1597 | + // Else return the username: |
| 1598 | + callback( data.query.userinfo.name ); |
| 1599 | + }, function(){ |
| 1600 | + //Timeout also results in callback( false ); |
| 1601 | + callback( false ); |
| 1602 | + } ); |
| 1603 | + } |
| 1604 | + |
| 1605 | + /** |
1547 | 1606 | * Utility Functions |
1548 | 1607 | */ |
1549 | 1608 | |
1550 | 1609 | /** |
1551 | 1610 | * addLoaderDialog |
1552 | | - * small helper for putting a loading dialog box on top of everything |
1553 | | - * (helps block for request that |
| 1611 | + * small helper for displaying a loading dialog |
1554 | 1612 | * |
1555 | 1613 | * @param msg text text of the loader msg |
1556 | 1614 | */ |
— | — | @@ -1567,7 +1625,7 @@ |
1568 | 1626 | /** |
1569 | 1627 | * Add a (temporary) dialog window: |
1570 | 1628 | * @param {String} title Title string for the dialog |
1571 | | - * @param {String} msg_txt String to be inserted in msg box |
| 1629 | + * @param {String} msg_html String to be inserted in msg box |
1572 | 1630 | * @param {Mixed} buttons A button object for the dialog |
1573 | 1631 | * Can be 'ok' for oky button. |
1574 | 1632 | */ |
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js |
— | — | @@ -4,8 +4,8 @@ |
5 | 5 | */ |
6 | 6 | var urlparts = getRemoteEmbedPath(); |
7 | 7 | var mwEmbedHostPath = urlparts[0]; |
8 | | -var mwRemoteVersion = 'r102'; |
9 | | -var mwUseScriptLoader = true; |
| 8 | +var mwRemoteVersion = 'r103'; |
| 9 | +var mwUseScriptLoader = false; |
10 | 10 | |
11 | 11 | // Log the mwRemote version ( will determine what version of js we get ) |
12 | 12 | if( window.console ){ |
— | — | @@ -32,10 +32,10 @@ |
33 | 33 | */ |
34 | 34 | function doPageSpecificRewrite() { |
35 | 35 | // Deal with multiple doPageSpecificRewrite |
36 | | - if( typeof window.ranRewrites != 'undefined'){ |
| 36 | + if( typeof window.ranMwRewrites != 'undefined'){ |
37 | 37 | return ; |
38 | 38 | } |
39 | | - window.ranRewrites = 'done'; |
| 39 | + window.ranMwRewrites = 'done'; |
40 | 40 | |
41 | 41 | // Add media wizard |
42 | 42 | if ( wgAction == 'edit' || wgAction == 'submit' ) { |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | if ( location.search.indexOf('uploadWizard=1') != -1 ) { |
102 | 102 | scriptName = 'uploadWizard.js'; |
103 | 103 | } |
104 | | - loadMwEmbed([ |
| 104 | + loadMwEmbed( [ |
105 | 105 | 'mw.UploadHandler', |
106 | 106 | 'mw.UploadInterface', |
107 | 107 | 'mw.Firefogg', |
Index: branches/js2-work/phase3/js/uploadPage.js |
— | — | @@ -13,6 +13,8 @@ |
14 | 14 | if ( typeof wgEnableFirefogg == 'undefined' ){ |
15 | 15 | wgEnableFirefogg = true; |
16 | 16 | } |
| 17 | + // NOTE: we should unify upload handler call so we don't have to call firefogg and |
| 18 | + // UploadHandler separately. |
17 | 19 | if ( wgEnableFirefogg ) { |
18 | 20 | mw.load( 'AddMedia.firefogg', function(){ |
19 | 21 | // Set up the upload handler to Firefogg. Should work with the HTTP uploads too. |
— | — | @@ -32,9 +34,6 @@ |
33 | 35 | // Set the select file callback: |
34 | 36 | 'selectFileCb': function( fileName ) { |
35 | 37 | $j( '#wpDestFile' ).val( fileName ); |
36 | | - $j( '#wpDestFile' ).doDestCheck( { |
37 | | - 'warn_target': '#wpDestFile-warning' |
38 | | - } ); |
39 | 38 | } |
40 | 39 | } ); |
41 | 40 | } ) |
— | — | @@ -42,7 +41,14 @@ |
43 | 42 | // Add basic upload profile support ( http status monitoring, progress box for |
44 | 43 | // browsers that support it, etc.) |
45 | 44 | mw.load( 'AddMedia.UploadHandler', function(){ |
46 | | - $j( mwUploadFormSelector ).uploadHandler( ); |
| 45 | + $j( mwUploadFormSelector ).uploadHandler( { |
| 46 | + 'selectFileCb': function( fileName ) { |
| 47 | + $j( '#wpDestFile' ).val( fileName ); |
| 48 | + $j( '#wpDestFile' ).doDestCheck( { |
| 49 | + 'warn_target': '#wpDestFile-warning' |
| 50 | + } ); |
| 51 | + } |
| 52 | + }); |
47 | 53 | }); |
48 | 54 | } |
49 | 55 | |
— | — | @@ -64,6 +70,7 @@ |
65 | 71 | _this.toggleUpType( this.id == 'wpSourceTypeFile' ); |
66 | 72 | } ); |
67 | 73 | } |
| 74 | + |
68 | 75 | $j( '#wpUploadFile,#wpUploadFileURL' ) |
69 | 76 | .focus( function() { |
70 | 77 | _this.toggleUpType( this.id == 'wpUploadFile' ); |