Index: branches/js2-work/phase3/js/uploadPage.js |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | $j( '#wpUploadFile' ).firefogg( { |
21 | 21 | |
22 | 22 | // An API URL (default is getLocalApiUrl but set here for clarity ) |
23 | | - 'api_url': mw.getLocalApiUrl(), |
| 23 | + 'apiUrl': mw.getLocalApiUrl(), |
24 | 24 | |
25 | 25 | // MediaWiki API supports chunk uploads: |
26 | 26 | 'enable_chunks' : false, |
Index: branches/js2-work/phase3/js/editPage.js |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | // Here we can setup the content provider overrides |
26 | 26 | 'enabled_providers': ['wiki_commons'], |
27 | 27 | // The local wiki API URL: |
28 | | - 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php' |
| 28 | + 'local_wiki_apiUrl': wgServer + wgScriptPath + '/api.php' |
29 | 29 | }; |
30 | 30 | |
31 | 31 | mw.ready( function() { |
Index: branches/js2-work/phase3/js/mwEmbed/loader.js |
— | — | @@ -87,12 +87,16 @@ |
88 | 88 | 'sr_ec', 'sr_el', 'sr', 'ti', 'tl', 'uk', 'wa' |
89 | 89 | ], |
90 | 90 | |
| 91 | + // Default request timeout ( for cases where we inlucde js and normal browser timeout can't be used ) |
| 92 | + // stored in seconds |
| 93 | + 'defaultRequestTimeout' : 30, |
| 94 | + |
91 | 95 | // Default user language is "en" Can be overwritten by: |
92 | 96 | // "uselang" url param |
93 | 97 | // wgUserLang global |
94 | 98 | 'userLanguage' : 'en', |
95 | 99 | |
96 | | - // Set the default providers ( you can add more provider via {provider_id}_apiurl = $api_url |
| 100 | + // Set the default providers ( you can add more provider via {provider_id}_apiurl = apiUrl |
97 | 101 | 'commons_apiurl' : 'http://commons.wikimedia.org/w/api.php' |
98 | 102 | } ); |
99 | 103 | |
Index: branches/js2-work/phase3/js/mwEmbed/tests/testApiProxy.html |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | //HARD coded local test: |
11 | 11 | var remote_wiki_host = 'http://commons.wikimedia.org'; |
12 | 12 | var remote_script_path = '/w'; |
13 | | -var remote_api_url = remote_wiki_host + remote_script_path + '/api.php'; |
| 13 | +var remote_apiUrl = remote_wiki_host + remote_script_path + '/api.php'; |
14 | 14 | |
15 | 15 | mw.ready( function(){ |
16 | 16 | $j('#hostName').text( remote_wiki_host ); |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | 'meta':'userinfo' |
37 | 37 | } |
38 | 38 | // Do request ( will automatically invoke proxy because its a proxy action and remote url ) |
39 | | - mw.getJSON( remote_api_url, rObj, function( data ){ |
| 39 | + mw.getJSON( remote_apiUrl, rObj, function( data ){ |
40 | 40 | //now we get the data back for that domain |
41 | 41 | if( !data.query || !data.query.userinfo ){ |
42 | 42 | mw.log("Error no query.userinfo "); |
— | — | @@ -50,10 +50,10 @@ |
51 | 51 | function doAppend(){ |
52 | 52 | $j('#appendTarget').html( mw.loading_spinner() ); |
53 | 53 | //get user name |
54 | | - getUserName( function(userName){ |
| 54 | + getUserName( function( userName ){ |
55 | 55 | var eTitle = 'User_talk:' + userName; |
56 | 56 | // Get a edit token |
57 | | - mw.getToken( remote_api_url, eTitle, function( token ) { |
| 57 | + mw.getToken( remote_apiUrl, eTitle, function( token ) { |
58 | 58 | mw.log("got token: " + token) ; |
59 | 59 | var request = { |
60 | 60 | 'action':'edit', |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | 'appendtext': "\n\n==== Hello from Api proxy At: " + Date() + " ====", |
64 | 64 | 'token': token |
65 | 65 | } |
66 | | - mw.getJSON( remote_api_url, request, function( result ){ |
| 66 | + mw.getJSON( remote_apiUrl, request, function( result ){ |
67 | 67 | if(result.edit && result.edit.newrevid){ |
68 | 68 | $j('#appendTarget').html( "success: " + JSON.stringify ( result) ); |
69 | 69 | url = remote_wiki_host + remote_script_path + '/index.php/'; |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | 'target' : '#browseTarget', |
90 | 90 | |
91 | 91 | // Api url to upload to |
92 | | - 'api_url' : remote_api_url, |
| 92 | + 'apiUrl' : remote_apiUrl, |
93 | 93 | |
94 | 94 | // File Destination Name change callback: |
95 | 95 | 'selectFileCb' : function( fname ){ |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | $j('#file-name').val( fname ); |
98 | 98 | // Run a destination file name check on the remote target |
99 | 99 | $j('#file-name').doDestCheck( { |
100 | | - 'api_url' : remote_api_url, |
| 100 | + 'apiUrl' : remote_apiUrl, |
101 | 101 | 'warn_target': '#file-warning' |
102 | 102 | } ); |
103 | 103 | }, |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | |
115 | 115 | // Build the output and send upload request to fileProxy |
116 | 116 | mw.ApiProxy.sendServerMsg( { |
117 | | - 'api_url' : remote_api_url, |
| 117 | + 'apiUrl' : remote_apiUrl, |
118 | 118 | 'frameName' : fileIframeName, |
119 | 119 | 'frameMsg' : { |
120 | 120 | 'action' : 'fileSubmit', |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | // Setup doDestCheck on change |
132 | 132 | $j('#file-name').change(function(){ |
133 | 133 | $j('#file-name').doDestCheck( { |
134 | | - 'api_url' : remote_api_url, |
| 134 | + 'apiUrl' : remote_apiUrl, |
135 | 135 | 'warn_target': '#file-warning' |
136 | 136 | } ); |
137 | 137 | }); |
Index: branches/js2-work/phase3/js/mwEmbed/languages/mwEmbed.i18n.php |
— | — | @@ -12,67 +12,22 @@ |
13 | 13 | |
14 | 14 | $messages['en'] = array( |
15 | 15 | /* |
16 | | - * js file: /modules/EmbedPlayer/mw.EmbedPlayer.js |
| 16 | + * js file: /skins/kskin/kskinConfig.js |
17 | 17 | */ |
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', |
| 18 | + 'mwe-credit-title' => 'Title: $1', |
75 | 19 | |
76 | 20 | /* |
| 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 | + /* |
77 | 32 | * js file: /modules/Sequencer/mw.Sequencer.js |
78 | 33 | */ |
79 | 34 | 'mwe-menu_clipedit' => 'Edit media', |
— | — | @@ -111,65 +66,12 @@ |
112 | 67 | '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>).', |
113 | 68 | |
114 | 69 | /* |
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 | | - /* |
126 | 70 | * js file: /modules/Sequencer/remotes/RemoteMwSequencer.js |
127 | 71 | */ |
128 | 72 | 'mwe-no-sequence-create' => 'No sequence exists named $1, You can $2', |
129 | 73 | 'mwe-sequence-create-one' => 'start a sequence', |
130 | 74 | |
131 | 75 | /* |
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' => 'You are not <a target="_new" href="$1">logged in</a> on $2 or mwEmbed has not been enabled. Resolve the issue, and then retry the request.', |
171 | | - 'mwe-remember-loging' => 'General security reminder: Only login to web sites when your address bar displays that site\'s address.', |
172 | | - |
173 | | - /* |
174 | 76 | * js file: /modules/TimedText/mw.TimedTextEdit.js |
175 | 77 | */ |
176 | 78 | 'mew-timedtext-editor' => 'Timed text editor', |
— | — | @@ -228,90 +130,70 @@ |
229 | 131 | 'mwe-language-no-subtitles-for-clip' => 'No $1 subtitles where found for clip: $2', |
230 | 132 | |
231 | 133 | /* |
232 | | - * js file: /modules/AddMedia/mw.RemoteSearchDriver.js |
| 134 | + * js file: /modules/EmbedPlayer/mw.EmbedPlayer.js |
233 | 135 | */ |
234 | | - 'mwe-add_media_wizard' => 'Add media wizard', |
235 | | - 'mwe-media_search' => 'Media search', |
236 | | - 'rsd_box_layout' => 'Box layout', |
237 | | - 'rsd_list_layout' => 'List layout', |
238 | | - 'rsd_results_desc' => 'Results $1 to $2', |
239 | | - 'rsd_results_desc_total' => 'Results $1 to $2 of $3', |
240 | | - 'rsd_results_next' => 'next', |
241 | | - 'rsd_results_prev' => 'previous', |
242 | | - 'rsd_no_results' => 'No search results for <b>$1</b>', |
243 | | - 'mwe-upload_tab' => 'Upload', |
244 | | - 'rsd_layout' => 'Layout:', |
245 | | - 'rsd_resource_edit' => 'Edit resource: $1', |
246 | | - 'mwe-resource_description_page' => 'Resource description page', |
247 | | - 'mwe-link' => 'link', |
248 | | - 'rsd_do_insert' => 'Do insert', |
249 | | - 'mwe-cc_title' => 'Creative Commons', |
250 | | - 'mwe-cc_by_title' => 'Attribution', |
251 | | - 'mwe-cc_nc_title' => 'Noncommercial', |
252 | | - 'mwe-cc_nd_title' => 'No Derivative Works', |
253 | | - 'mwe-cc_sa_title' => 'Share Alike', |
254 | | - 'mwe-cc_pd_title' => 'Public Domain', |
255 | | - 'mwe-unknown_license' => 'Unknown license', |
256 | | - '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>', |
257 | | - 'mwe-no-import-by-url-linktext' => '$wgAllowCopyUploads', |
258 | | - 'mwe-results_from' => 'Results from <a href="$1" target="_new" >$2</a>', |
259 | | - 'mwe-missing_desc_see_source' => 'This asset is missing a description. Please see the [$1 original source] and help describe it.', |
260 | | - 'rsd_config_error' => 'Add media wizard configuration error: $1', |
261 | | - 'mwe-your_recent_uploads' => 'Your recent uploads to $1', |
262 | | - 'mwe-no_recent_uploads' => 'No recent uploads', |
263 | | - 'mwe-upload_a_file' => 'Upload a new file to $1', |
264 | | - 'mwe-resource_page_desc' => 'Resource page description:', |
265 | | - 'mwe-edit_resource_desc' => 'Edit wiki text resource description:', |
266 | | - 'mwe-local_resource_title' => 'Local resource title:', |
267 | | - 'mwe-watch_this_page' => 'Watch this page', |
268 | | - 'mwe-do_import_resource' => 'Import resource', |
269 | | - 'mwe-update_preview' => 'Update resource page preview', |
270 | | - 'mwe-return-search-results' => 'Return to search results', |
271 | | - 'mwe-importing_asset' => 'Importing asset', |
272 | | - 'mwe-preview_insert_resource' => 'Preview insert of resource: $1', |
273 | | - 'mwe-do-more-modification' => 'Do More Modification', |
274 | | - 'mwe-checking-resource' => 'Checking for resource', |
275 | | - 'mwe-resource-needs-import' => 'Resource $1 needs to be imported to $2', |
276 | | - 'mwe-ftype-svg' => 'SVG vector file', |
277 | | - 'mwe-ftype-jpg' => 'JPEG image file', |
278 | | - 'mwe-ftype-png' => 'PNG image file', |
279 | | - 'mwe-ftype-oga' => 'Ogg audio file', |
280 | | - 'mwe-ftype-ogg' => 'Ogg video file', |
281 | | - 'mwe-ftype-unk' => 'Unknown file format', |
282 | | - 'rsd-wiki_commons-title' => 'Wikimedia Commons', |
283 | | - 'rsd-wiki_commons' => 'Wikimedia Commons, an archive of freely-licensed educational media content (images, sound and video clips)', |
284 | | - 'rsd-kaltura-title' => 'All Sources', |
285 | | - 'rsd-kaltura' => 'Kaltura agragated search for free-licensed media across multiple search providers', |
286 | | - 'rsd-this_wiki-title' => 'This wiki', |
287 | | - 'rsd-this_wiki-desc' => 'The local wiki install', |
288 | | - 'rsd-archive_org-title' => 'Archive.org', |
289 | | - 'rsd-archive_org-desc' => 'The Internet Archive, a digital library of cultural artifacts', |
290 | | - 'rsd-flickr-title' => 'Flickr.com', |
291 | | - 'rsd-flickr-desc' => 'Flickr.com, a online photo sharing site', |
292 | | - 'rsd-metavid-title' => 'Metavid.org', |
293 | | - 'rsd-metavid-desc' => 'Metavid.org, a community archive of US House and Senate floor proceedings', |
294 | | - 'rsd-search-timeout' => 'The search request did not complete. The server may be down experiencing heavy load. You can try again later', |
| 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', |
295 | 193 | |
296 | 194 | /* |
297 | | - * js file: /modules/AddMedia/jquery.simpleUploadForm.js |
298 | | - */ |
299 | | - 'mwe-select_file' => 'Select file', |
300 | | - 'mwe-select_ownwork' => 'I am uploading entirely my own work, and licensing it under:', |
301 | | - 'mwe-license_cc-by-sa' => 'Creative Commons Share Alike (3.0)', |
302 | | - 'mwe-upload' => 'Upload file', |
303 | | - 'mwe-destfilename' => 'Destination filename:', |
304 | | - 'mwe-summary' => 'Summary', |
305 | | - 'mwe-error_not_loggedin' => 'You do not appear to be logged in or do not have upload privileges.', |
306 | | - 'mwe-watch-this-file' => 'Watch this file', |
307 | | - 'mwe-ignore-any-warnings' => 'Ignore any warnings', |
308 | | - |
309 | | - /* |
310 | 195 | * js file: /modules/AddMedia/mw.UploadHandler.js |
311 | 196 | */ |
312 | | - 'mwe-upload-in-progress' => 'Upload in progress (do not close this window)', |
313 | 197 | 'mwe-upload-transcoded-status' => 'Transcoded', |
314 | | - 'mwe-uploaded-time-remaining' => 'Time remaining: $1', |
315 | | - 'mwe-uploaded-status' => 'Uploaded', |
316 | 198 | 'mwe-upload-stats-fileprogress' => '$1 of $2', |
317 | 199 | 'mwe-upload_completed' => 'Your upload is complete', |
318 | 200 | 'mwe-upload_done' => '<a href="$1">Your upload <i>should be</i> accessible</a>.', |
— | — | @@ -334,56 +216,14 @@ |
335 | 217 | 'license-header' => 'Licensing', |
336 | 218 | 'filedesc' => 'Summary', |
337 | 219 | 'filesource' => 'Source:', |
| 220 | + 'filestatus' => 'Copyright status:', |
338 | 221 | |
339 | 222 | /* |
340 | | - * js file: /modules/AddMedia/mw.Firefogg.js |
| 223 | + * js file: /modules/AddMedia/loader.js |
341 | 224 | */ |
342 | | - 'mwe-upload-transcode-in-progress' => 'Transcode and upload in progress (do not close this window)', |
343 | | - 'fogg-transcoding' => 'Encoding video to ogg', |
344 | | - 'fogg-select_file' => 'Select file', |
345 | | - 'fogg-select_new_file' => 'Select new file', |
346 | | - 'fogg-select_url' => 'Select URL', |
347 | | - 'fogg-check_for_firefogg' => 'Checking for Firefogg...', |
348 | | - 'fogg-installed' => 'Firefogg is installed,', |
349 | | - 'fogg-not-installed' => 'Firefogg is not installed', |
350 | | - 'fogg-for_improved_uploads' => 'For improved uploads:', |
351 | | - 'fogg-please-install' => '$1. More $2', |
352 | | - 'fogg-please-install-install-linktext' => 'Install firefogg', |
353 | | - 'fogg-please-install-about-linktext' => 'about firefogg', |
354 | | - '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>', |
355 | | - 'fogg-passthrough_mode' => 'Your selected file is already ogg or not a video file', |
356 | | - 'fogg-encoding-done' => 'Encoding complete', |
357 | | - 'fogg-badtoken' => 'Token is not valid', |
358 | | - 'fogg-preview' => 'Preview video', |
359 | | - 'fogg-hidepreview' => 'Hide preview', |
360 | | - 'fogg-warning-firebug' => '<b>Firebug</b> can cause conflicts with <i>Firefogg</i>. Please disable <b>Firebug</b> for this page.', |
| 225 | + 'mwe-loading-add-media-wiz' => 'Loading add media wizard', |
361 | 226 | |
362 | 227 | /* |
363 | | - * js file: /modules/AddMedia/searchLibs/metavidSearch.js |
364 | | - */ |
365 | | - 'mwe-stream_title' => '$1 $2 to $3', |
366 | | - |
367 | | - /* |
368 | | - * js file: /modules/AddMedia/searchLibs/kalturaSearch.js |
369 | | - */ |
370 | | - 'rsd-media-filter-title' => 'Media', |
371 | | - 'rsd-media-filter-videos' => 'Videos', |
372 | | - 'rsd-media-filter-images' => 'Images', |
373 | | - 'rsd-provider-filter-title' => 'Providers', |
374 | | - |
375 | | - /* |
376 | | - * js file: /modules/AddMedia/searchLibs/baseRemoteSearch.js |
377 | | - */ |
378 | | - 'mwe-imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more information.', |
379 | | - 'mwe-import-description' => '$1, imported from $2', |
380 | | - |
381 | | - /* |
382 | | - * js file: /modules/AddMedia/jquery.dragDropFile.js |
383 | | - */ |
384 | | - 'mwe-upload-multi' => 'Upload {{PLURAL:$1|file|files}}', |
385 | | - 'mwe-review-upload' => 'Review file {{PLURAL:$1|upload|uploads}}', |
386 | | - |
387 | | - /* |
388 | 228 | * js file: /modules/AddMedia/mw.FirefoggGUI.js |
389 | 229 | */ |
390 | 230 | 'fogg-save_local_file' => 'Save Ogg', |
— | — | @@ -451,11 +291,180 @@ |
452 | 292 | 'fogg-contact-help' => 'Contact link', |
453 | 293 | |
454 | 294 | /* |
455 | | - * js file: /modules/AddMedia/loader.js |
| 295 | + * js file: /modules/AddMedia/searchLibs/metavidSearch.js |
456 | 296 | */ |
457 | | - 'mwe-loading-add-media-wiz' => 'Loading add media wizard', |
| 297 | + 'mwe-stream_title' => '$1 $2 to $3', |
458 | 298 | |
459 | 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 | + |
| 329 | + /* |
| 330 | + * js file: /modules/AddMedia/mw.RemoteSearchDriver.js |
| 331 | + */ |
| 332 | + 'mwe-add_media_wizard' => 'Add media wizard', |
| 333 | + 'mwe-media_search' => 'Media search', |
| 334 | + 'rsd_box_layout' => 'Box layout', |
| 335 | + 'rsd_list_layout' => 'List layout', |
| 336 | + 'rsd_results_desc' => 'Results $1 to $2', |
| 337 | + 'rsd_results_desc_total' => 'Results $1 to $2 of $3', |
| 338 | + 'rsd_results_next' => 'next', |
| 339 | + 'rsd_results_prev' => 'previous', |
| 340 | + 'rsd_no_results' => 'No search results for <b>$1</b>', |
| 341 | + 'mwe-upload_tab' => 'Upload file', |
| 342 | + 'rsd_layout' => 'Layout:', |
| 343 | + 'rsd_resource_edit' => 'Edit resource: $1', |
| 344 | + 'mwe-resource_description_page' => 'Resource description page', |
| 345 | + 'mwe-link' => 'link', |
| 346 | + 'rsd_do_insert' => 'Do insert', |
| 347 | + 'mwe-cc_title' => 'Creative Commons', |
| 348 | + 'mwe-cc_by_title' => 'Attribution', |
| 349 | + 'mwe-cc_nc_title' => 'Noncommercial', |
| 350 | + 'mwe-cc_nd_title' => 'No Derivative Works', |
| 351 | + 'mwe-cc_sa_title' => 'Share Alike', |
| 352 | + 'mwe-cc_pd_title' => 'Public Domain', |
| 353 | + 'mwe-unknown_license' => 'Unknown license', |
| 354 | + '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>', |
| 355 | + 'mwe-no-import-by-url-linktext' => '$wgAllowCopyUploads', |
| 356 | + 'mwe-results_from' => 'Results from $1', |
| 357 | + 'mwe-missing_desc_see_source' => 'This asset is missing a description. Please see the [$1 original source] and help describe it.', |
| 358 | + 'rsd_config_error' => 'Add media wizard configuration error: $1', |
| 359 | + 'mwe-your_recent_uploads' => 'Your recent uploads to $1', |
| 360 | + 'mwe-no_recent_uploads' => 'No recent uploads', |
| 361 | + 'mwe-not-logged-in-uploads' => 'You may not be logged in so no recent uploads can be displayed. $1 login and try again', |
| 362 | + 'mwe-loggin-link' => 'Please login', |
| 363 | + 'mwe-upload_a_file' => 'Upload a new file', |
| 364 | + 'mwe-resource_page_desc' => 'Resource page description:', |
| 365 | + 'mwe-edit_resource_desc' => 'Edit wiki text resource description:', |
| 366 | + 'mwe-local_resource_title' => 'Local resource title:', |
| 367 | + 'mwe-watch_this_page' => 'Watch this page', |
| 368 | + 'mwe-do_import_resource' => 'Import resource', |
| 369 | + 'mwe-update_preview' => 'Update resource page preview', |
| 370 | + 'mwe-return-search-results' => 'Return to search results', |
| 371 | + 'mwe-importing_asset' => 'Importing asset', |
| 372 | + 'mwe-preview_insert_resource' => 'Preview insert of resource: $1', |
| 373 | + 'mwe-do-more-modification' => 'Do More Modification', |
| 374 | + 'mwe-checking-resource' => 'Checking for resource', |
| 375 | + 'mwe-resource-needs-import' => 'Resource $1 needs to be imported to $2', |
| 376 | + 'mwe-ftype-svg' => 'SVG vector file', |
| 377 | + 'mwe-ftype-jpg' => 'JPEG image file', |
| 378 | + 'mwe-ftype-png' => 'PNG image file', |
| 379 | + 'mwe-ftype-oga' => 'Ogg audio file', |
| 380 | + 'mwe-ftype-ogg' => 'Ogg video file', |
| 381 | + 'mwe-ftype-unk' => 'Unknown file format', |
| 382 | + 'rsd-wiki_commons-title' => 'Wikimedia Commons', |
| 383 | + 'rsd-wiki_commons' => 'Wikimedia Commons, an archive of freely-licensed educational media content (images, sound and video clips)', |
| 384 | + 'rsd-kaltura-title' => 'All Sources', |
| 385 | + 'rsd-kaltura' => 'Kaltura agragated search for free-licensed media across multiple search providers', |
| 386 | + 'rsd-this_wiki-title' => 'This wiki', |
| 387 | + 'rsd-this_wiki-desc' => 'The local wiki', |
| 388 | + 'rsd-archive_org-title' => 'Archive.org', |
| 389 | + 'rsd-archive_org-desc' => 'The Internet Archive, a digital library of cultural artifacts', |
| 390 | + 'rsd-flickr-title' => 'Flickr.com', |
| 391 | + 'rsd-flickr-desc' => 'Flickr.com, a online photo sharing site', |
| 392 | + 'rsd-metavid-title' => 'Metavid.org', |
| 393 | + 'rsd-metavid-desc' => 'Metavid.org, a community archive of US House and Senate floor proceedings', |
| 394 | + 'rsd-search-timeout' => 'The search request did not complete. The server may be down experiencing heavy load. You can try again later', |
| 395 | + |
| 396 | + /* |
| 397 | + * js file: /modules/AddMedia/mw.Firefogg.js |
| 398 | + */ |
| 399 | + 'mwe-upload-transcode-in-progress' => 'Transcode and upload in progress (do not close this window)', |
| 400 | + 'fogg-transcoding' => 'Encoding video to ogg', |
| 401 | + 'fogg-select_file' => 'Select file', |
| 402 | + 'fogg-select_new_file' => 'Select new file', |
| 403 | + 'fogg-select_url' => 'Select URL', |
| 404 | + 'fogg-check_for_firefogg' => 'Checking for Firefogg...', |
| 405 | + 'fogg-installed' => 'Firefogg is installed,', |
| 406 | + 'fogg-not-installed' => 'Firefogg is not installed', |
| 407 | + 'fogg-for_improved_uploads' => 'For improved uploads:', |
| 408 | + 'fogg-please-install' => '$1. More $2', |
| 409 | + 'fogg-please-install-install-linktext' => 'Install firefogg', |
| 410 | + 'fogg-please-install-about-linktext' => 'about firefogg', |
| 411 | + '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>', |
| 412 | + 'fogg-passthrough_mode' => 'Your selected file is already ogg or not a video file', |
| 413 | + 'fogg-encoding-done' => 'Encoding complete', |
| 414 | + 'fogg-badtoken' => 'Token is not valid', |
| 415 | + 'fogg-preview' => 'Preview video', |
| 416 | + 'fogg-hidepreview' => 'Hide preview', |
| 417 | + 'fogg-warning-firebug' => '<b>Firebug</b> can cause conflicts with <i>Firefogg</i>. Please disable <b>Firebug</b> for this page.', |
| 418 | + |
| 419 | + /* |
| 420 | + * js file: /modules/AddMedia/jquery.dragDropFile.js |
| 421 | + */ |
| 422 | + 'mwe-upload-multi' => 'Upload {{PLURAL:$1|file|files}}', |
| 423 | + 'mwe-review-upload' => 'Review file {{PLURAL:$1|upload|uploads}}', |
| 424 | + |
| 425 | + /* |
| 426 | + * js file: /modules/ClipEdit/mw.ClipEdit.js |
| 427 | + */ |
| 428 | + 'mwe-crop' => 'Crop image', |
| 429 | + 'mwe-apply_crop' => 'Apply crop to image', |
| 430 | + 'mwe-reset_crop' => 'Reset crop', |
| 431 | + 'mwe-insert_image_page' => 'Insert into page', |
| 432 | + 'mwe-insert_into_sequence' => 'Insert into sequence', |
| 433 | + 'mwe-preview_insert' => 'Preview insert', |
| 434 | + 'mwe-cancel_image_insert' => 'Cancel insert', |
| 435 | + 'mwe-sc_attributes' => 'Clip detail edit', |
| 436 | + 'mwe-sc_inoutpoints' => 'Set in-out points', |
| 437 | + 'mwe-sc_overlays' => 'Overlays', |
| 438 | + 'mwe-sc_audio' => 'Audio control', |
| 439 | + 'mwe-sc_duration' => 'Duration', |
| 440 | + 'mwe-template_properties' => 'Template properties', |
| 441 | + 'mwe-custom_title' => 'Custom title', |
| 442 | + 'mwe-edit_properties' => 'Edit properties', |
| 443 | + 'mwe-other_properties' => 'Other properties', |
| 444 | + 'mwe-resource_page' => 'Resource page:', |
| 445 | + 'mwe-set_in_out_points' => 'Set in-out points', |
| 446 | + 'mwe-start_time' => 'Start time', |
| 447 | + 'mwe-end_time' => 'End time', |
| 448 | + 'mwe-preview_inout' => 'Preview in-out points', |
| 449 | + 'mwe-edit-tools' => 'Edit tools', |
| 450 | + 'mwe-inline-description' => 'Caption', |
| 451 | + 'mwe-edit-video-tools' => 'Edit video tools:', |
| 452 | + 'mwe-duration' => 'Duration:', |
| 453 | + 'mwe-layout' => 'Layout', |
| 454 | + 'mwe-layout_right' => 'Right side image layout', |
| 455 | + 'mwe-layout_left' => 'Left side image layout', |
| 456 | + |
| 457 | + /* |
| 458 | + * js file: /modules/ApiProxy/mw.ApiProxy.js |
| 459 | + */ |
| 460 | + 'mwe-setting-up-proxy' => 'Setting up proxy...', |
| 461 | + 'mwe-re-try' => 'Retry API request', |
| 462 | + 'mwe-re-trying' => 'Retrying API request...', |
| 463 | + 'mwe-proxy-not-ready' => 'Proxy is not configured', |
| 464 | + 'mwe-please-login' => 'The request failed. Are you logged in on $1 ? Please $2 and try again', |
| 465 | + 'mwe-log-in-link' => 'log in', |
| 466 | + 'mwe-remember-loging' => 'General security reminder: Only login to web sites when your address bar displays that site\'s address.', |
| 467 | + |
| 468 | + /* |
460 | 469 | * js file: /mwEmbed.js |
461 | 470 | */ |
462 | 471 | 'mwe-loading_txt' => 'Loading ...', |
— | — | @@ -472,11 +481,6 @@ |
473 | 482 | 'mwe-enable-gadget-done' => 'mwEmbed gadget has been enabled', |
474 | 483 | 'mwe-must-login-gadget' => 'To enable gadget you must <a target="_new" href="$1">login</a>', |
475 | 484 | 'mwe-test-plural' => 'I ran {{PLURAL:$1|$1 test|$1 tests}}', |
476 | | - |
477 | | - /* |
478 | | - * js file: /skins/kskin/kskinConfig.js |
479 | | - */ |
480 | | - 'mwe-credit-title' => 'Title: $1', |
481 | 485 | ); |
482 | 486 | |
483 | 487 | /** Afrikaans (Afrikaans) |
Index: branches/js2-work/phase3/js/mwEmbed/skins/common/common.css |
— | — | @@ -499,4 +499,8 @@ |
500 | 500 | .fg-menu .ui-icon{ |
501 | 501 | position:relative; |
502 | 502 | top:-1px; |
| 503 | +} |
| 504 | + |
| 505 | +#rsd_upload_form { |
| 506 | + font-size: 110%; |
503 | 507 | } |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js |
— | — | @@ -340,7 +340,7 @@ |
341 | 341 | var _this = this; |
342 | 342 | var $target = embedPlayer.$interface.find( '.menu-credits' ); |
343 | 343 | |
344 | | - var api_url = mw.getApiProviderURL( embedPlayer.apiProvider ); |
| 344 | + var apiUrl = mw.getApiProviderURL( embedPlayer.apiProvider ); |
345 | 345 | var fileTitle = 'File:' + embedPlayer.apiTitleKey.replace(/File:|Image:/, ''); |
346 | 346 | |
347 | 347 | // Get the image info |
— | — | @@ -350,7 +350,7 @@ |
351 | 351 | 'iiprop' : 'url' |
352 | 352 | }; |
353 | 353 | var articleUrl = ''; |
354 | | - mw.getJSON( api_url, request, function( data ){ |
| 354 | + mw.getJSON( apiUrl, request, function( data ){ |
355 | 355 | if ( data.query.pages ) { |
356 | 356 | for ( var i in data.query.pages ) { |
357 | 357 | var imageProps = data.query.pages[i]; |
Index: branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js |
— | — | @@ -215,8 +215,7 @@ |
216 | 216 | return { |
217 | 217 | 'height': targetHeight, |
218 | 218 | 'width' : targetWidth, |
219 | | - 'top' : offsetTop, |
220 | | - 'left' : offsetLeft |
| 219 | + 'top' : offsetTop |
221 | 220 | } |
222 | 221 | }, |
223 | 222 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js |
— | — | @@ -282,16 +282,16 @@ |
283 | 283 | |
284 | 284 | // Try to get sources from text provider: |
285 | 285 | var provider_id = ( this.embedPlayer.apiProvider ) ? this.embedPlayer.apiProvider : 'local'; |
286 | | - var api_url = mw.getApiProviderURL( provider_id ); |
| 286 | + var apiUrl = mw.getApiProviderURL( provider_id ); |
287 | 287 | var assetKey = this.embedPlayer.apiTitleKey; |
288 | | - if( !api_url || !assetKey ) { |
| 288 | + if( !apiUrl || !assetKey ) { |
289 | 289 | mw.log("Error: loading source without apiProvider or apiTitleKey"); |
290 | 290 | return ; |
291 | 291 | } |
292 | 292 | //For now only support mediaWikiText provider library |
293 | 293 | this.textProvider = new mw.MediaWikiTextProvider( { |
294 | 294 | 'provider_id' : provider_id, |
295 | | - 'api_url': api_url, |
| 295 | + 'apiUrl': apiUrl, |
296 | 296 | 'embedPlayer': this.embedPlayer |
297 | 297 | } ); |
298 | 298 | |
— | — | @@ -1160,7 +1160,7 @@ |
1161 | 1161 | |
1162 | 1162 | */ |
1163 | 1163 | var default_textProvider_attr = [ |
1164 | | - 'api_url', |
| 1164 | + 'apiUrl', |
1165 | 1165 | 'provider_id', |
1166 | 1166 | 'timed_text_NS', |
1167 | 1167 | 'embedPlayer' |
— | — | @@ -1172,7 +1172,7 @@ |
1173 | 1173 | mw.MediaWikiTextProvider.prototype = { |
1174 | 1174 | |
1175 | 1175 | // The api url: |
1176 | | - api_url: null, |
| 1176 | + apiUrl: null, |
1177 | 1177 | |
1178 | 1178 | // The timed text namespace |
1179 | 1179 | timed_text_NS: null, |
— | — | @@ -1199,7 +1199,7 @@ |
1200 | 1200 | 'action': 'parse', |
1201 | 1201 | 'page': titleKey |
1202 | 1202 | }; |
1203 | | - mw.getJSON( this.api_url, request, function( data ) { |
| 1203 | + mw.getJSON( this.apiUrl, request, function( data ) { |
1204 | 1204 | if ( data && data.parse && data.parse.text['*'] ) { |
1205 | 1205 | callback( data.parse.text['*'] ); |
1206 | 1206 | return; |
— | — | @@ -1243,14 +1243,14 @@ |
1244 | 1244 | 'aplimit' : 200, |
1245 | 1245 | 'prop':'revisions' |
1246 | 1246 | }; |
1247 | | - mw.getJSON( this.api_url, request, function( sourcePages ) { |
| 1247 | + mw.getJSON( this.apiUrl, request, function( sourcePages ) { |
1248 | 1248 | //If "timedText" is not a valid namespace try "just" with prefix: |
1249 | 1249 | if ( sourcePages.error && sourcePages.error.code == 'apunknown_apnamespace' ) { |
1250 | 1250 | var request = { |
1251 | 1251 | 'list' : 'allpages', |
1252 | 1252 | 'apprefix' : _this.getCanonicalTimedTextNS() + ':' + _this.embedPlayer.apiTitleKey |
1253 | 1253 | }; |
1254 | | - mw.getJSON( _this.api_url, request, function( sourcePages ) { |
| 1254 | + mw.getJSON( _this.apiUrl, request, function( sourcePages ) { |
1255 | 1255 | callback( sourcePages ) |
1256 | 1256 | } ); |
1257 | 1257 | } else { |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -37,7 +37,11 @@ |
38 | 38 | "rsd_config_error" : "Add media wizard configuration error: $1", |
39 | 39 | "mwe-your_recent_uploads" : "Your recent uploads to $1", |
40 | 40 | "mwe-no_recent_uploads" : "No recent uploads", |
41 | | - "mwe-upload_a_file" : "Upload a new file to $1", |
| 41 | + |
| 42 | + "mwe-not-logged-in-uploads" : "You may not be logged in so no recent uploads can be displayed. $1 login and try again", |
| 43 | + "mwe-loggin-link" : "Please login", |
| 44 | + |
| 45 | + "mwe-upload_a_file" : "Upload a new file", |
42 | 46 | "mwe-resource_page_desc" : "Resource page description:", |
43 | 47 | "mwe-edit_resource_desc" : "Edit wiki text resource description:", |
44 | 48 | "mwe-local_resource_title" : "Local resource title:", |
— | — | @@ -224,7 +228,7 @@ |
225 | 229 | * |
226 | 230 | * @homepage: the homepage url for the search provider |
227 | 231 | * |
228 | | - * @api_url: the url to query against given the library type: |
| 232 | + * @apiUrl: the url to query against given the library type: |
229 | 233 | * |
230 | 234 | * @lib: the search library to use corresponding to the |
231 | 235 | * search object ie: 'mediaWiki' = new mediaWikiSearchSearch() |
— | — | @@ -251,7 +255,7 @@ |
252 | 256 | */ |
253 | 257 | 'this_wiki': { |
254 | 258 | 'enabled': 1, |
255 | | - 'api_url': ( wgServer && wgScriptPath ) ? |
| 259 | + 'apiUrl': ( wgServer && wgScriptPath ) ? |
256 | 260 | wgServer + wgScriptPath + '/api.php' : null, |
257 | 261 | 'lib': 'mediaWiki', |
258 | 262 | 'local': true, |
— | — | @@ -264,7 +268,7 @@ |
265 | 269 | 'kaltura': { |
266 | 270 | 'enabled': 1, |
267 | 271 | 'homepage': 'http://kaltura.com', |
268 | | - 'api_url': 'http://kaldev.kaltura.com/michael/aggregator.php', |
| 272 | + 'apiUrl': 'http://kaldev.kaltura.com/michael/aggregator.php', |
269 | 273 | 'lib': 'kaltura', |
270 | 274 | 'resource_prefix' : '', |
271 | 275 | 'tab_image':false |
— | — | @@ -276,7 +280,7 @@ |
277 | 281 | 'wiki_commons': { |
278 | 282 | 'enabled': 1, |
279 | 283 | 'homepage': 'http://commons.wikimedia.org/wiki/Main_Page', |
280 | | - 'api_url': 'http://commons.wikimedia.org/w/api.php', |
| 284 | + 'apiUrl': 'http://commons.wikimedia.org/w/api.php', |
281 | 285 | 'lib': 'mediaWiki', |
282 | 286 | 'tab_img': true, |
283 | 287 | |
— | — | @@ -301,7 +305,7 @@ |
302 | 306 | 'enabled': 1, |
303 | 307 | 'homepage': 'http://www.archive.org/about/about.php', |
304 | 308 | |
305 | | - 'api_url': 'http://www.archive.org/advancedsearch.php', |
| 309 | + 'apiUrl': 'http://www.archive.org/advancedsearch.php', |
306 | 310 | 'lib': 'archiveOrg', |
307 | 311 | 'local': false, |
308 | 312 | 'resource_prefix': 'AO_', |
— | — | @@ -315,7 +319,7 @@ |
316 | 320 | 'enabled': 1, |
317 | 321 | 'homepage': 'http://www.flickr.com/about/', |
318 | 322 | |
319 | | - 'api_url': 'http://www.flickr.com/services/rest/', |
| 323 | + 'apiUrl': 'http://www.flickr.com/services/rest/', |
320 | 324 | 'lib': 'flickr', |
321 | 325 | 'local': false, |
322 | 326 | // Just prefix with Flickr_ for now. |
— | — | @@ -329,7 +333,7 @@ |
330 | 334 | 'metavid': { |
331 | 335 | 'enabled': 1, |
332 | 336 | 'homepage': 'http://metavid.org/wiki/Metavid_Overview', |
333 | | - 'api_url': 'http://metavid.org/w/index.php?title=Special:MvExportSearch', |
| 337 | + 'apiUrl': 'http://metavid.org/w/index.php?title=Special:MvExportSearch', |
334 | 338 | 'lib': 'metavid', |
335 | 339 | 'local': false, |
336 | 340 | |
— | — | @@ -450,7 +454,7 @@ |
451 | 455 | // Set the provider id |
452 | 456 | provider[ 'id' ] = provider_id |
453 | 457 | |
454 | | - if ( _this.enabled_providers == 'all' && !this.current_provider && provider.api_url ) { |
| 458 | + if ( _this.enabled_providers == 'all' && !this.current_provider && provider.apiUrl ) { |
455 | 459 | this.current_provider = provider_id; |
456 | 460 | break; |
457 | 461 | } else { |
— | — | @@ -485,7 +489,7 @@ |
486 | 490 | // Set up the local API upload URL |
487 | 491 | if ( _this.upload_api_target == 'local' ) { |
488 | 492 | if ( ! mw.getLocalApiUrl() ) { |
489 | | - $j( this.target_container ).html( gM( 'rsd_config_error', 'missing_local_api_url' ) ); |
| 493 | + $j( this.target_container ).html( gM( 'rsd_config_error', 'missing_local_apiUrl' ) ); |
490 | 494 | return false; |
491 | 495 | } else { |
492 | 496 | _this.upload_api_target = mw.getLocalApiUrl(); |
— | — | @@ -928,6 +932,9 @@ |
929 | 933 | .addClass( 'rsd_search_button' ) |
930 | 934 | .buttonHover() |
931 | 935 | .click(function () { |
| 936 | + if( _this.current_provider == 'upload' ){ |
| 937 | + _this.current_provider = _this.previus_provider; |
| 938 | + } |
932 | 939 | _this.updateResults( _this.current_provider, true ); |
933 | 940 | return false; |
934 | 941 | }); |
— | — | @@ -935,14 +942,14 @@ |
936 | 943 | var $searchBox = $j( '<input />' ) |
937 | 944 | .addClass( 'ui-corner-all' ) |
938 | 945 | .attr({ |
939 | | - type: "text", |
940 | | - tabindex: 1, |
941 | | - value: this.getDefaultQuery(), |
942 | | - maxlength: 512, |
943 | | - id: "rsd_q", |
944 | | - name: "rsd_q", |
945 | | - size: 20, |
946 | | - autocomplete: "off" |
| 946 | + 'type' : "text", |
| 947 | + 'tabindex' : 1, |
| 948 | + 'value' : _this.getDefaultQuery(), |
| 949 | + 'maxlength' : 512, |
| 950 | + 'id' : "rsd_q", |
| 951 | + 'name' : "rsd_q", |
| 952 | + 'size' : 20, |
| 953 | + 'autocomplete' : "off" |
947 | 954 | }) |
948 | 955 | // Prevent searching for empty input. |
949 | 956 | .keyup(function () { |
— | — | @@ -958,7 +965,7 @@ |
959 | 966 | for ( var providerName in this.content_providers ) { |
960 | 967 | var content_providers = this.content_providers; |
961 | 968 | var provider = content_providers[ providerName ]; |
962 | | - if ( provider.enabled && provider.api_url ) { |
| 969 | + if ( provider.enabled && provider.apiUrl ) { |
963 | 970 | var $anchor = $j( '<div />' ) |
964 | 971 | .text( gM( 'rsd-' + providerName + '-title' ) ) |
965 | 972 | .attr({ |
— | — | @@ -1032,7 +1039,6 @@ |
1033 | 1040 | _this.showUploadForm( provider ); |
1034 | 1041 | } ); |
1035 | 1042 | } ); |
1036 | | - |
1037 | 1043 | }, |
1038 | 1044 | |
1039 | 1045 | /** |
— | — | @@ -1042,8 +1048,6 @@ |
1043 | 1049 | */ |
1044 | 1050 | showUploadForm: function( provider ) { |
1045 | 1051 | var _this = this; |
1046 | | - var uploadMsg = gM( 'mwe-upload_a_file', _this.upload_api_name ); |
1047 | | - var recentUploadsMsg = gM( 'mwe-your_recent_uploads', _this.upload_api_name ); |
1048 | 1052 | |
1049 | 1053 | // Do basic layout form on left upload "bin" on right |
1050 | 1054 | $uploadTableRow = $j('<tr />').append( |
— | — | @@ -1055,9 +1059,11 @@ |
1056 | 1060 | 'padding-right' : '12px' |
1057 | 1061 | }) |
1058 | 1062 | .append( |
1059 | | - $j('<h4 />').text( uploadMsg ), |
| 1063 | + $j('<h3 />') |
| 1064 | + .text( gM( 'mwe-upload_a_file' ) ), |
| 1065 | + |
1060 | 1066 | $j('<div />').attr({ |
1061 | | - 'id': 'upload_form' |
| 1067 | + 'id': 'rsd_upload_form' |
1062 | 1068 | }) |
1063 | 1069 | .loadingSpinner() |
1064 | 1070 | ), |
— | — | @@ -1073,44 +1079,18 @@ |
1074 | 1080 | $uploadTableRow |
1075 | 1081 | ) |
1076 | 1082 | ); |
1077 | | - |
1078 | | - // Fill in the user uploads: |
1079 | | - if ( typeof wgUserName != 'undefined' && wgUserName ) { |
1080 | | - // Load the upload bin with anything the current user has uploaded |
1081 | | - provider.sObj.getUserRecentUploads( wgUserName, function( ) { |
1082 | | - $j('#upload_bin').empty().append( |
1083 | | - $j('<h4 />').text( recentUploadsMsg ) |
1084 | | - ); |
1085 | | - _this.showResults(); |
1086 | | - } ); |
1087 | | - }else{ |
1088 | | - $j('#upload_bin').empty().text( gM( 'mwe-no_recent_uploads' ) ); |
1089 | | - } |
1090 | 1083 | |
1091 | | - // The api stuff: |
1092 | | - var commonsProvider = this.content_providers[ 'wiki_commons' ]; |
1093 | | - var thisWikiProvider = this.content_providers[ 'this_wiki' ]; |
| 1084 | + this.showRecentUserUploads( '#upload_bin' ); |
1094 | 1085 | |
1095 | 1086 | // Send the upload target menu from UploadForm class |
1096 | 1087 | mw.UploadForm.getUploadMenu( { |
1097 | | - 'target': '#upload_form', |
1098 | | - 'uploadTargets' : { |
1099 | | - 'commons' : { |
1100 | | - 'apiUrl' : commonsProvider.api_url, |
1101 | | - 'title' : gM( 'rsd-wiki_commons-title') |
1102 | | - }, |
1103 | | - 'this_wiki' : { |
1104 | | - 'apiUrl' : thisWikiProvider.api_url, |
1105 | | - // Unfortunally mediaWiki pages don't expose the title of the wiki |
1106 | | - // Could get in an api request ( just use domain for now) |
1107 | | - 'title' : mw.parseURI( thisWikiProvider.api_url ).host |
1108 | | - } |
1109 | | - } |
| 1088 | + 'target': '#rsd_upload_form', |
| 1089 | + 'uploadTargets' : _this.getUploadTargets() |
1110 | 1090 | } ); |
1111 | 1091 | |
1112 | 1092 | // Deal with the api form upload form directly: |
1113 | 1093 | /*mw.UploadForm.getForm( { |
1114 | | - "target" : '#upload_form', |
| 1094 | + "target" : '#rsd_upload_form', |
1115 | 1095 | "api_target" : _this.upload_api_target, |
1116 | 1096 | "ondone_callback" : function( resultData ) { |
1117 | 1097 | var wTitle = resultData['filename']; |
— | — | @@ -1131,6 +1111,162 @@ |
1132 | 1112 | }, |
1133 | 1113 | |
1134 | 1114 | /** |
| 1115 | + * Show recent user uploads |
| 1116 | + */ |
| 1117 | + showRecentUserUploads: function( target ){ |
| 1118 | + var _this = this; |
| 1119 | + var uploadTargets = this.getUploadTargets(); |
| 1120 | + |
| 1121 | + $j( target ).empty(); |
| 1122 | + |
| 1123 | + // Show recent uploads for each upload target |
| 1124 | + for( var uploadTargetId in uploadTargets ){ |
| 1125 | + var uploadTarget = uploadTargets[ uploadTargetId ]; |
| 1126 | + |
| 1127 | + $j( target ).append( |
| 1128 | + $j( '<h3 />' ) |
| 1129 | + .append( |
| 1130 | + gM( 'mwe-your_recent_uploads', uploadTarget.title ) |
| 1131 | + ), |
| 1132 | + |
| 1133 | + // Add the targetUpload container |
| 1134 | + $j('<div />') |
| 1135 | + .attr( 'id', 'user-results-' + uploadTargetId ) |
| 1136 | + .loadingSpinner() |
| 1137 | + ) |
| 1138 | + // Issue the call to get the recent uploads: |
| 1139 | + _this.showUserRecentUploads( uploadTargetId ); |
| 1140 | + } |
| 1141 | + |
| 1142 | + }, |
| 1143 | + |
| 1144 | + showUserRecentUploads: function( uploadTargetId ){ |
| 1145 | + var _this = this; |
| 1146 | + var provider = _this.content_providers[ uploadTargetId ]; |
| 1147 | + var uploadTargets = _this.getUploadTargets(); |
| 1148 | + var uploadApiUrl = uploadTargets[ uploadTargetId ].apiUrl ; |
| 1149 | + |
| 1150 | + // If the target is not local or we don't have a userName |
| 1151 | + // ( try and grab the user name via api call (will be a proxy call if remote) ) |
| 1152 | + if( ! mw.isLocalDomain( uploadApiUrl ) ) { |
| 1153 | + // Garb the userName via api call |
| 1154 | + var request = { |
| 1155 | + 'action':'query', |
| 1156 | + 'meta':'userinfo' |
| 1157 | + } |
| 1158 | + // Do request ( will automatically invoke proxy because its a proxy action and remote url ) |
| 1159 | + mw.getJSON( uploadApiUrl, request, function( data ){ |
| 1160 | + // Now we get the data back for that domain |
| 1161 | + if( !data || !data.query || !data.query.userinfo ){ |
| 1162 | + // Could not get user name user is not-logge |
| 1163 | + mw.log( " No user data in resposne " ); |
| 1164 | + return false; |
| 1165 | + } |
| 1166 | + var userName = data.query.userinfo.name; |
| 1167 | + _this.showUserRecentUploadsWithUser( uploadTargetId, userName ); |
| 1168 | + |
| 1169 | + }, |
| 1170 | + // Add a timeout function for getting the user-name |
| 1171 | + function(){ |
| 1172 | + var logInLink = uploadApiUrl.replace( 'api.php', 'index.php' ) + '?title=Special:UserLogin'; |
| 1173 | + // Timed out or proxy not setup ( for remotes ) |
| 1174 | + $j( '#user-results-' + uploadTargetId ).html( |
| 1175 | + gM( "mwe-not-logged-in-uploads", |
| 1176 | + $j( '<a />' ) |
| 1177 | + .attr( 'href', logInLink ) |
| 1178 | + .append( gM( 'mwe-loggin-link' ) ) |
| 1179 | + ) |
| 1180 | + ); |
| 1181 | + } ); |
| 1182 | + } else { |
| 1183 | + // No user name, since every page outputs wgUserName assume the user is not logged in ) |
| 1184 | + if( !wgUserName ) { |
| 1185 | + $j( '#user-results-' + uploadTargetId ) |
| 1186 | + .text( gM( 'mwe-not-logged-in-uploads' ) ); |
| 1187 | + }else{ |
| 1188 | + _this.showUserRecentUploadsWithUser( uploadTargetId, wgUserName ); |
| 1189 | + } |
| 1190 | + } |
| 1191 | + }, |
| 1192 | + |
| 1193 | + showUserRecentUploadsWithUser: function( uploadTargetId, userId ){ |
| 1194 | + var _this = this; |
| 1195 | + var provider = this.content_providers[ uploadTargetId ]; |
| 1196 | + |
| 1197 | + // Setup a local scope function to call the search |
| 1198 | + // ( since we may have to load the provider search lib ) |
| 1199 | + function doProviderSearch(){ |
| 1200 | + provider.sObj.getUserRecentUploads( userId, function( ) { |
| 1201 | + _this.showResults( { |
| 1202 | + 'resultsContainer' : $j( '#user-results-' + uploadTargetId ), |
| 1203 | + 'provider' : provider, |
| 1204 | + 'hideResultsHeader' : true |
| 1205 | + }); |
| 1206 | + } ); |
| 1207 | + } |
| 1208 | + |
| 1209 | + // Make sure the provider has a search object: |
| 1210 | + if (!provider.sObj) { |
| 1211 | + this.loadSearchLib( provider, function() { |
| 1212 | + doProviderSearch(); |
| 1213 | + } ); |
| 1214 | + } else { |
| 1215 | + doProviderSearch(); |
| 1216 | + } |
| 1217 | + }, |
| 1218 | + |
| 1219 | + /** |
| 1220 | + * Get the upload targets |
| 1221 | + * NOTE: this should be configurable |
| 1222 | + */ |
| 1223 | + getUploadTargets: function(){ |
| 1224 | + // Setup upload targets |
| 1225 | + var uploadTargets = { }; |
| 1226 | + |
| 1227 | + // Always include commons upload target: |
| 1228 | + // Setup commons upload target |
| 1229 | + var commonsProvider = this.content_providers[ 'wiki_commons' ]; |
| 1230 | + // Check for commons upload page |
| 1231 | + var commonsUploadPage = 'Commons:Upload'; |
| 1232 | + |
| 1233 | + // Add the user language of the commonsUploadPage link |
| 1234 | + if( typeof wgUserLanguage != 'undefined' && wgUserLanguage != 'en' ) { |
| 1235 | + commonsUploadPage += '/' + wgUserLanguage; |
| 1236 | + } |
| 1237 | + |
| 1238 | + uploadTargets['wiki_commons']= { |
| 1239 | + 'apiUrl' : commonsProvider.apiUrl, |
| 1240 | + 'title' : gM( 'rsd-wiki_commons-title'), |
| 1241 | + 'uploadPage' : commonsProvider.apiUrl.replace( 'api.php', 'index.php' ) + '?title=' + commonsUploadPage |
| 1242 | + } |
| 1243 | + |
| 1244 | + // If we are ~on commons~ no other links needed: |
| 1245 | + if( mw.parseUri( document.URL ).host == 'commons.wikimedia.org' ) { |
| 1246 | + return uploadTargets; |
| 1247 | + } |
| 1248 | + |
| 1249 | + // check if we have a link to commons for our t-upload toolbox link: |
| 1250 | + // ( ie the project does not support local uploads ) |
| 1251 | + $uploadLink = $j( '#t-upload' ).find('a'); |
| 1252 | + if( $uploadLink.length |
| 1253 | + && mw.parseUri( $uploadLink.attr('href') ).host == 'commons.wikimedia.org' ) |
| 1254 | + { |
| 1255 | + return uploadTargets; |
| 1256 | + } |
| 1257 | + |
| 1258 | + // Elese this_wiki accepts uploads setup upload links: |
| 1259 | + var thisWikiProvider = this.content_providers[ 'this_wiki' ]; |
| 1260 | + /* uploadTargets[ 'this_wiki' ] = { |
| 1261 | + 'apiUrl' : thisWikiProvider.apiUrl, |
| 1262 | + // Unfortunately mediaWiki pages don't expose the title of the wiki |
| 1263 | + // Could get in an api request ( just use domain for now) |
| 1264 | + 'title' : mw.parseUri( thisWikiProvider.apiUrl ).host, |
| 1265 | + 'uploadPage' : $uploadLink.attr('href') |
| 1266 | + } */ |
| 1267 | + return uploadTargets; |
| 1268 | + }, |
| 1269 | + |
| 1270 | + /** |
1135 | 1271 | * Refresh the results container ( based on current_provider var ) |
1136 | 1272 | */ |
1137 | 1273 | updateResults: function() { |
— | — | @@ -1161,8 +1297,10 @@ |
1162 | 1298 | mw.log( 'last query is: ' + provider.sObj.last_query + |
1163 | 1299 | ' matches: ' + $j( '#rsd_q' ).val() + ' no search needed'); |
1164 | 1300 | |
1165 | | - // Show search results directly |
1166 | | - this.showResults(); |
| 1301 | + // Show search results directly |
| 1302 | + this.showResults( ); |
| 1303 | + // Done with processing |
| 1304 | + return true; |
1167 | 1305 | } |
1168 | 1306 | } |
1169 | 1307 | |
— | — | @@ -1204,7 +1342,7 @@ |
1205 | 1343 | } |
1206 | 1344 | // If we don't have the local wiki api defined we can't auto-detect use "link" |
1207 | 1345 | if ( ! _this.upload_api_target ) { |
1208 | | - mw.log( 'import mode: remote link (no import_wiki_api_url)' ); |
| 1346 | + mw.log( 'import mode: remote link (no import_wiki_apiUrl)' ); |
1209 | 1347 | _this.import_url_mode = 'remote_link'; |
1210 | 1348 | callback(); |
1211 | 1349 | } |
— | — | @@ -1348,7 +1486,7 @@ |
1349 | 1487 | |
1350 | 1488 | // If we are given a result location, we hide them. |
1351 | 1489 | if ($location) { |
1352 | | - $location.html( mw.loading_spinner("float: left") ); |
| 1490 | + $location.loadingSpinner(); |
1353 | 1491 | } |
1354 | 1492 | |
1355 | 1493 | var d = new Date(); |
— | — | @@ -1356,16 +1494,15 @@ |
1357 | 1495 | _this.currentRequest = context(); |
1358 | 1496 | mw.log( "ProviderCallBack Generated " + context() ) |
1359 | 1497 | provider.sObj.getSearchResults( $j( '#rsd_q' ).val() , |
1360 | | - function( resultStatus ) { |
1361 | | - |
| 1498 | + function( resultStatus ) { |
1362 | 1499 | mw.log( "ProviderCallBack Received " + context() ); |
1363 | 1500 | if( _this.currentRequest != context() ) { |
| 1501 | + mw.log( "Context mismatch for request " + _this.currentRequest + ' != ' + context ); |
1364 | 1502 | // do not update the results this.currentRequest |
1365 | 1503 | // does not match the interface request state. |
1366 | 1504 | return false; |
1367 | | - } |
1368 | | - |
1369 | | - //else update search results |
| 1505 | + } |
| 1506 | + //else update search results |
1370 | 1507 | _this.showResults(); |
1371 | 1508 | }); |
1372 | 1509 | |
— | — | @@ -1462,17 +1599,32 @@ |
1463 | 1600 | }, |
1464 | 1601 | |
1465 | 1602 | /** |
1466 | | - * Show Results for the current_provider |
| 1603 | + * Show Results and apply bindings |
| 1604 | + * |
| 1605 | + * @param {Object} options Configuration optiosn can inclue: |
| 1606 | + * 'resultsContainer' - {jQuery Object} $resultsContainer The container for the results |
| 1607 | + * 'provider' - {Object} provider The search provider to grab results from. |
1467 | 1608 | */ |
1468 | | - showResults: function() { |
1469 | | - mw.log( 'f:showResults::' + this.current_provider ); |
| 1609 | + showResults: function( options ) { |
1470 | 1610 | var _this = this; |
1471 | 1611 | |
1472 | | - var provider = this.content_providers[ this.current_provider ]; |
| 1612 | + if( !options ) { |
| 1613 | + options = { }; |
| 1614 | + } |
1473 | 1615 | |
| 1616 | + // Set all the option defaults if not provided: |
| 1617 | + var $resultsContainer = ( options.resultsContainer ) |
| 1618 | + ? options.resultsContainer |
| 1619 | + : _this.$resultsContainer; |
| 1620 | + |
| 1621 | + var provider = ( options.provider ) |
| 1622 | + ? options.provider |
| 1623 | + : _this.content_providers[ _this.current_provider ]; |
| 1624 | + |
| 1625 | + mw.log( 'f:showResults::' + provider.id ); |
1474 | 1626 | // Result page structure: |
1475 | 1627 | // |
1476 | | - // resultContainer |
| 1628 | + // resultsContainer |
1477 | 1629 | // header |
1478 | 1630 | // resultBody |
1479 | 1631 | // filter form |
— | — | @@ -1480,33 +1632,26 @@ |
1481 | 1633 | // resultList |
1482 | 1634 | // results... |
1483 | 1635 | // footer |
1484 | | - |
1485 | | - var $resultsContainer; |
| 1636 | + |
1486 | 1637 | var $resultsBody = $j( '<div />' ).addClass( 'rsd_results_body' ); |
1487 | 1638 | var $resultsList = $j( '<div />' ).addClass( 'rsd_results_list' ); |
1488 | 1639 | |
1489 | | - // The "upload" tab has special results output target rather than top level |
1490 | | - // resutls container. |
1491 | | - if ( this.current_provider == 'upload' ) { |
1492 | | - $resultsContainer = $j('#upload_bin'); |
1493 | | - var provider = _this.content_providers['this_wiki']; |
1494 | | - } else { |
1495 | | - var provider = this.content_providers[ this.current_provider ]; |
1496 | | - $resultsContainer = this.$resultsContainer; |
1497 | | - |
1498 | | - // Add the results header: |
1499 | | - $resultsContainer.empty().append( this.createResultsHeader() ) |
| 1640 | + // Add the results header: |
| 1641 | + $resultsContainer.empty(); |
1500 | 1642 | |
1501 | | - // Enable search filters, if the provider supports them. |
1502 | | - if ( provider.sObj.filters && !(provider.disable_filters) ) { |
1503 | | - provider.sObj.filters.filterChangeCallBack = |
1504 | | - this.curry( this.getProviderCallback(), provider, $resultsList ); |
1505 | | - $resultsBody.append( provider.sObj.filters.getHTML().attr ({ |
1506 | | - id: 'rsd_filters_container' |
1507 | | - })); |
1508 | | - } |
| 1643 | + if( ! options.hideResultsHeader ){ |
| 1644 | + $resultsContainer.append( this.createResultsHeader() ) |
1509 | 1645 | } |
1510 | 1646 | |
| 1647 | + // Enable search filters, if the provider supports them. |
| 1648 | + if ( provider.sObj.filters && !(provider.disable_filters) ) { |
| 1649 | + provider.sObj.filters.filterChangeCallBack = |
| 1650 | + this.curry( this.getProviderCallback(), provider, $resultsList ); |
| 1651 | + $resultsBody.append( provider.sObj.filters.getHTML().attr ({ |
| 1652 | + id: 'rsd_filters_container' |
| 1653 | + })); |
| 1654 | + } |
| 1655 | + |
1511 | 1656 | var numResults = 0; |
1512 | 1657 | |
1513 | 1658 | // Output all the results for the current current_provider |
— | — | @@ -1820,31 +1965,49 @@ |
1821 | 1966 | _this.removeResourceEditor(); |
1822 | 1967 | |
1823 | 1968 | var mediaType = _this.getMediaType( resource ); |
1824 | | - var maxWidth = _this.getMaxEditWidth( resource ); |
1825 | | - |
| 1969 | + var width = _this.getMaxEditWidth( resource ); |
| 1970 | + |
| 1971 | + // if maxWidth makes height > available height resize request: |
| 1972 | + var width = resource.width; |
| 1973 | + var height = parseInt( width * ( resource.width / resource.height ) ); |
| 1974 | + |
| 1975 | + // Update the resource size constrained by clip_edit_disp |
| 1976 | + if( width > $j('#clip_edit_disp').width() ){ |
| 1977 | + width = $j('#clip_edit_disp').width(); |
| 1978 | + height = width * ( width / height ); |
| 1979 | + } |
| 1980 | + if( height > $j('#clip_edit_disp').height() ){ |
| 1981 | + height = $j('#clip_edit_disp').height(); |
| 1982 | + width = height * ( height / width ); |
| 1983 | + } |
| 1984 | + mw.log(" set height to: " + height + ' width to: ' + width ); |
| 1985 | + |
| 1986 | + |
1826 | 1987 | // Append to the top level of model window: |
1827 | | - _this.addResourceEditLoader( maxWidth ); |
1828 | | - // update add media wizard title: |
| 1988 | + _this.addResourceEditLoader( width ); |
| 1989 | + |
| 1990 | + // Update add media wizard title: |
1829 | 1991 | var dialogTitle = gM( 'mwe-add_media_wizard' ) + ': ' + |
1830 | 1992 | gM( 'rsd_resource_edit', resource.title ); |
| 1993 | + |
1831 | 1994 | $j( _this.target_container ).dialog( 'option', 'title', dialogTitle ); |
1832 | 1995 | |
1833 | 1996 | mw.log( 'did append to: ' + _this.target_container ); |
1834 | 1997 | |
1835 | 1998 | if ( mediaType == 'image' ) { |
1836 | 1999 | _this.loadHighQualityImage( |
1837 | | - resource, |
1838 | | - { 'width': maxWidth }, |
| 2000 | + resource, { |
| 2001 | + 'width': width |
| 2002 | + }, |
1839 | 2003 | 'rsd_edit_img', |
1840 | 2004 | function( img_src ) { |
1841 | | - $j( '.loading_spinner' ).remove(); |
| 2005 | + $j( '.loading_spinner' ).remove(); |
1842 | 2006 | $j( '<img />' ) |
1843 | 2007 | .attr( { |
1844 | | - id: 'rsd_edit_img', |
1845 | | - src: img_src |
| 2008 | + 'id' : 'rsd_edit_img', |
| 2009 | + 'src' : img_src |
1846 | 2010 | } ) |
1847 | | - .appendTo( '#clip_edit_disp' ); |
1848 | | - |
| 2011 | + .appendTo( '#clip_edit_disp' ); |
1849 | 2012 | } |
1850 | 2013 | ); |
1851 | 2014 | } |
— | — | @@ -1872,6 +2035,7 @@ |
1873 | 2036 | * @param {Function} callback the function to be calle once the image is loaded |
1874 | 2037 | */ |
1875 | 2038 | loadHighQualityImage: function( resource, size, target_img_id, callback ) { |
| 2039 | + mw.log( "loadHighQualityImage" ); |
1876 | 2040 | // Get the high quality image url: |
1877 | 2041 | resource.pSobj.getImageObj( resource, size, function( imObj ) { |
1878 | 2042 | resource['edit_url'] = imObj.url; |
— | — | @@ -1880,31 +2044,20 @@ |
1881 | 2045 | // Update the resource |
1882 | 2046 | resource['width'] = imObj.width; |
1883 | 2047 | resource['height'] = imObj.height; |
1884 | | - |
1885 | | - // See if we need to animate some transition |
1886 | | - if ( size.width != imObj.width ) { |
1887 | | - mw.log( 'loadHighQualityImage:size mismatch: ' + size.width + ' != ' + imObj.width ); |
1888 | | - // Set the target id to the new size: |
1889 | | - $j( '#' + target_img_id ).animate( { |
1890 | | - 'width': imObj.width + 'px', |
1891 | | - 'height': imObj.height + 'px' |
1892 | | - }); |
1893 | | - } else { |
1894 | | - mw.log( 'use req size: ' + imObj.width + 'x' + imObj.height ); |
1895 | | - $j( '#' + target_img_id ).animate( { |
1896 | | - 'width': imObj.width + 'px', |
1897 | | - 'height': imObj.height + 'px' |
1898 | | - }); |
1899 | | - } |
| 2048 | + |
| 2049 | + var width = imObj.width; |
| 2050 | + var height = imObj.height; |
| 2051 | + |
| 2052 | + |
1900 | 2053 | // Don't swap it in until its loaded |
1901 | 2054 | var img = new Image(); |
1902 | 2055 | // Load the image |
1903 | 2056 | $j( img ).load( function () { |
1904 | | - // Update changes using the callback |
1905 | | - callback( resource.edit_url ); |
1906 | | - } ).error( function () { |
1907 | | - mw.log( "Error with: " + resource.edit_url ); |
1908 | | - } ).attr( 'src', resource.edit_url ); |
| 2057 | + // Update changes using the callback |
| 2058 | + callback( resource.edit_url ); |
| 2059 | + } ).error( function () { |
| 2060 | + mw.log( "Error with: " + resource.edit_url ); |
| 2061 | + } ).attr( 'src', resource.edit_url ); |
1909 | 2062 | } ); |
1910 | 2063 | }, |
1911 | 2064 | |
— | — | @@ -2526,7 +2679,7 @@ |
2527 | 2680 | // Initiate a upload object ( similar to url copy ): |
2528 | 2681 | // ( mvBaseUploadInterface handles upload errors ) |
2529 | 2682 | var uploader = new mw.BaseUploadInterface( { |
2530 | | - 'api_url' : _this.upload_api_target, |
| 2683 | + 'apiUrl' : _this.upload_api_target, |
2531 | 2684 | 'done_upload_cb':function() { |
2532 | 2685 | mw.log( 'doApiImport:: run callback::' ); |
2533 | 2686 | // We have finished the upload: |
— | — | @@ -2849,10 +3002,10 @@ |
2850 | 3003 | 'href' : provider.homepage, |
2851 | 3004 | 'target' : '_new' |
2852 | 3005 | } ) |
2853 | | - .text( gM( 'rsd-' + this.current_provider + '-title' ) ) |
2854 | | - ) |
| 3006 | + .append( gM( 'rsd-' + provider.id + '-title' ) ) |
| 3007 | + ); |
2855 | 3008 | |
2856 | | - var $searchContent = $j( '<span />' ).html(resultsFromMsg); |
| 3009 | + var $searchContent = $j( '<span />' ).html( resultsFromMsg ); |
2857 | 3010 | var $searchDescription = $j( '<span />' ).addClass( 'rsd_search_description' ) |
2858 | 3011 | .attr({ |
2859 | 3012 | id: 'rsd_search_description' |
— | — | @@ -2861,6 +3014,7 @@ |
2862 | 3015 | |
2863 | 3016 | return $searchDescription; |
2864 | 3017 | }, |
| 3018 | + |
2865 | 3019 | /** |
2866 | 3020 | * Results Header controls like box vs list view |
2867 | 3021 | * & search description |
— | — | @@ -2991,7 +3145,7 @@ |
2992 | 3146 | if ( this.current_provider == 'upload' ) { |
2993 | 3147 | this.showUploadTab(); |
2994 | 3148 | } else { |
2995 | | - // update the search results: |
| 3149 | + // Update the search results: |
2996 | 3150 | this.updateResults(); |
2997 | 3151 | } |
2998 | 3152 | }, |
— | — | @@ -3003,7 +3157,7 @@ |
3004 | 3158 | setDisplayMode: function( mode ) { |
3005 | 3159 | mw.log( 'setDisplayMode:' + mode ); |
3006 | 3160 | this.displayMode = mode; |
3007 | | - // run /update search display: |
3008 | | - this.showResults(); |
| 3161 | + // Run / update search display: |
| 3162 | + this.showResults( ); |
3009 | 3163 | } |
3010 | 3164 | }; |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | |
39 | 39 | var default_bui_options = { |
40 | 40 | // Target api to upload to |
41 | | - 'api_url' : null, |
| 41 | + 'apiUrl' : null, |
42 | 42 | |
43 | 43 | // The selected form |
44 | 44 | 'form' : null, |
— | — | @@ -128,9 +128,9 @@ |
129 | 129 | options = {}; |
130 | 130 | $j.extend( this, default_bui_options, options ); |
131 | 131 | |
132 | | - // Set a api_url if unset |
133 | | - if( !this.api_url ) { |
134 | | - this.api_url = mw.getLocalApiUrl(); |
| 132 | + // Set a apiUrl if unset |
| 133 | + if( !this.apiUrl ) { |
| 134 | + this.apiUrl = mw.getLocalApiUrl(); |
135 | 135 | } |
136 | 136 | |
137 | 137 | // We can't pass around actual function refrences since sometimes the interface |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | // Setup ui uploadHandler pointer |
147 | 147 | this.ui.uploadHandler = this; |
148 | 148 | |
149 | | - mw.log( "init mvUploadHandler:: " + this.api_url + ' interface: ' + this.ui ); |
| 149 | + mw.log( "init mvUploadHandler:: " + this.apiUrl + ' interface: ' + this.ui ); |
150 | 150 | }, |
151 | 151 | |
152 | 152 | /** |
— | — | @@ -255,8 +255,8 @@ |
256 | 256 | } else if ( !_this.isCopyUpload() ) { |
257 | 257 | callback( 'post' ); |
258 | 258 | } else if ( _this.upload_mode == 'autodetect' ) { |
259 | | - mw.log( 'detectUploadMode::' + _this.upload_mode + ' api:' + _this.api_url ); |
260 | | - if( !_this.api_url ) { |
| 259 | + mw.log( 'detectUploadMode::' + _this.upload_mode + ' api:' + _this.apiUrl ); |
| 260 | + if( !_this.apiUrl ) { |
261 | 261 | mw.log( 'Error: can\'t autodetect mode without api url' ); |
262 | 262 | return; |
263 | 263 | } |
— | — | @@ -265,7 +265,7 @@ |
266 | 266 | _this.upload_mode = 'detect_in_progress'; |
267 | 267 | |
268 | 268 | // FIXME: move this to configuration and avoid this API request |
269 | | - mw.getJSON( _this.api_url, { 'action' : 'paraminfo', 'modules' : 'upload' }, function( data ) { |
| 269 | + mw.getJSON( _this.apiUrl, { 'action' : 'paraminfo', 'modules' : 'upload' }, function( data ) { |
270 | 270 | if ( typeof data.paraminfo == 'undefined' |
271 | 271 | || typeof data.paraminfo.modules == 'undefined' ) |
272 | 272 | { |
— | — | @@ -326,9 +326,9 @@ |
327 | 327 | remapFormToApi: function() { |
328 | 328 | var _this = this; |
329 | 329 | // |
330 | | - mw.log("remapFormToApi:: " + this.api_url + ' form: ' + this.form); |
| 330 | + mw.log("remapFormToApi:: " + this.apiUrl + ' form: ' + this.form); |
331 | 331 | |
332 | | - if ( !this.api_url ) { |
| 332 | + if ( !this.apiUrl ) { |
333 | 333 | mw.log( 'Error: no api url target' ); |
334 | 334 | return false; |
335 | 335 | } |
— | — | @@ -336,7 +336,7 @@ |
337 | 337 | |
338 | 338 | // Set the form action |
339 | 339 | try { |
340 | | - $form.attr('action', _this.api_url); |
| 340 | + $form.attr('action', _this.apiUrl); |
341 | 341 | } catch( e ) { |
342 | 342 | mw.log( "IE sometimes errors out when you change the action" ); |
343 | 343 | } |
— | — | @@ -576,7 +576,7 @@ |
577 | 577 | } |
578 | 578 | |
579 | 579 | // Add the edit token (if available) |
580 | | - if( !_this.editToken && _this.api_url ) { |
| 580 | + if( !_this.editToken && _this.apiUrl ) { |
581 | 581 | mw.log( 'Error:doHttpUpload: missing token' ); |
582 | 582 | } else { |
583 | 583 | request['token'] =_this.editToken; |
— | — | @@ -586,7 +586,7 @@ |
587 | 587 | _this.action_done = false; |
588 | 588 | |
589 | 589 | // Do the api request: |
590 | | - mw.getJSON(_this.api_url, request, function( data ) { |
| 590 | + mw.getJSON(_this.apiUrl, request, function( data ) { |
591 | 591 | _this.processApiResult( data ); |
592 | 592 | }); |
593 | 593 | }, |
— | — | @@ -621,7 +621,7 @@ |
622 | 622 | onAjaxUploadStatusTimer: function() { |
623 | 623 | var _this = this; |
624 | 624 | //do the api request: |
625 | | - mw.getJSON( this.api_url, this.upload_status_request, function ( data ) { |
| 625 | + mw.getJSON( this.apiUrl, this.upload_status_request, function ( data ) { |
626 | 626 | _this.onAjaxUploadStatusResponse( data ); |
627 | 627 | } ); |
628 | 628 | }, |
— | — | @@ -782,7 +782,7 @@ |
783 | 783 | 'comment' : _this.getUploadDescription() |
784 | 784 | }; |
785 | 785 | //run the upload from stash request |
786 | | - mw.getJSON(_this.api_url, request, function( data ) { |
| 786 | + mw.getJSON(_this.apiUrl, request, function( data ) { |
787 | 787 | _this.processApiResult( data ); |
788 | 788 | } ); |
789 | 789 | } else { |
— | — | @@ -826,7 +826,7 @@ |
827 | 827 | * @selector (jquery selector) The target destination name to check for conflits |
828 | 828 | * @param {Object} options Options that define: |
829 | 829 | * warn_target target for display of warning |
830 | | - * api_url Api url to check for destination |
| 830 | + * apiUrl Api url to check for destination |
831 | 831 | */ |
832 | 832 | $.fn.doDestCheck = function( options ) { |
833 | 833 | var _this = this; |
— | — | @@ -837,8 +837,8 @@ |
838 | 838 | options.warn_target = '#wpDestFile-warning'; |
839 | 839 | } |
840 | 840 | |
841 | | - if( ! options.api_url ) { |
842 | | - options.api_url = mw.getLocalApiUrl(); |
| 841 | + if( ! options.apiUrl ) { |
| 842 | + options.apiUrl = mw.getLocalApiUrl(); |
843 | 843 | } |
844 | 844 | |
845 | 845 | // Add the wpDestFile-warning row ( if in mediaWiki upload page ) |
— | — | @@ -872,7 +872,7 @@ |
873 | 873 | }; |
874 | 874 | |
875 | 875 | // Do the destination check ( on the local wiki ) |
876 | | - mw.getJSON( options.api_url, request, function( data ) { |
| 876 | + mw.getJSON( options.apiUrl, request, function( data ) { |
877 | 877 | // Remove spinner |
878 | 878 | $j( '#mw-spinner-wpDestFile' ).remove(); |
879 | 879 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/kalturaSearch.js |
— | — | @@ -244,7 +244,7 @@ |
245 | 245 | } |
246 | 246 | |
247 | 247 | mw.log( "Kaltura::getProviderResults query: " + request['s'] + " page: " + request['page']); |
248 | | - mw.getJSON( this.provider.api_url + '?callback=?', request, function( data ) { |
| 248 | + mw.getJSON( this.provider.apiUrl + '?callback=?', request, function( data ) { |
249 | 249 | _this.addResults( data ); |
250 | 250 | callback( 'ok' ); |
251 | 251 | } ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | 'iiurlwidth': parseInt( this.rsd.thumb_width ), |
49 | 49 | 'rvprop':'content' |
50 | 50 | } |
51 | | - mw.getJSON(this.provider.api_url, request, function( data ) { |
| 51 | + mw.getJSON(this.provider.apiUrl, request, function( data ) { |
52 | 52 | // check for redirect |
53 | 53 | for ( var i in data.query.pages ) { |
54 | 54 | var page = data.query.pages[i]; |
— | — | @@ -76,15 +76,15 @@ |
77 | 77 | * @param {String} user Name of the user |
78 | 78 | * @param {Function} callback Function to call once user upload list has been populated |
79 | 79 | */ |
80 | | - getUserRecentUploads: function( user, callback ) { |
| 80 | + getUserRecentUploads: function( user, callback, timeoutCallback ) { |
81 | 81 | var _this = this; |
82 | 82 | var request = { |
83 | | - 'list':'recentchanges', |
84 | | - 'rcnamespace':6, // only files |
85 | | - 'rcuser': user, |
86 | | - 'rclimit':15 // get last 15 uploaded files |
| 83 | + 'list' : 'recentchanges', |
| 84 | + 'rcnamespace' : 6, // only files |
| 85 | + 'rcuser' : user, |
| 86 | + 'rclimit' : 10 // get last 10 uploaded files |
87 | 87 | }; |
88 | | - mw.getJSON( this.provider.api_url, request, function( data ) { |
| 88 | + mw.getJSON( this.provider.apiUrl, request, function( data ) { |
89 | 89 | var titleSet = { }; |
90 | 90 | var titleStr = '' |
91 | 91 | var pound = ''; |
— | — | @@ -108,13 +108,13 @@ |
109 | 109 | 'iiurlwidth': parseInt( _this.rsd.thumb_width ), |
110 | 110 | 'rvprop':'content' |
111 | 111 | }; |
112 | | - mw.getJSON( _this.provider.api_url, resourceQuery, function( data ) { |
| 112 | + mw.getJSON( _this.provider.apiUrl, resourceQuery, function( data ) { |
113 | 113 | _this.clearResults(); |
114 | 114 | _this.addResults( data ); |
115 | 115 | if ( callback ) |
116 | 116 | callback(); |
117 | 117 | } ); |
118 | | - } ); |
| 118 | + }, timeoutCallback ); |
119 | 119 | }, |
120 | 120 | |
121 | 121 | /** |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | }; |
146 | 146 | |
147 | 147 | // Do the api request: |
148 | | - mw.getJSON( this.provider.api_url, request, function( data ) { |
| 148 | + mw.getJSON( this.provider.apiUrl, request, function( data ) { |
149 | 149 | // Add result data: |
150 | 150 | _this.addResults( data ); |
151 | 151 | callback(); |
— | — | @@ -174,6 +174,7 @@ |
175 | 175 | if ( typeof data['query-continue'].search != 'undefined' ) |
176 | 176 | this.more_results = true; |
177 | 177 | } |
| 178 | + |
178 | 179 | // Make sure we have pages to iterate: |
179 | 180 | if ( data.query && data.query.pages ) { |
180 | 181 | for ( var page_id in data.query.pages ) { |
— | — | @@ -267,7 +268,7 @@ |
268 | 269 | } |
269 | 270 | } else { |
270 | 271 | mw.log( 'no results:' + data ); |
271 | | - } |
| 272 | + } |
272 | 273 | }, |
273 | 274 | |
274 | 275 | /* |
— | — | @@ -289,10 +290,12 @@ |
290 | 291 | * @param {Object} size Requested size: .width and .height |
291 | 292 | * @param {Function} callbcak Function to be called once image has been reqeusted |
292 | 293 | */ |
293 | | - getImageObj:function( resource, size, callback ) { |
294 | | - if ( resource.mime == 'application/ogg' ) |
| 294 | + getImageObj: function( resource, size, callback ) { |
| 295 | + mw.log( 'mediaWiki: getImageObj' ); |
| 296 | + if ( resource.mime == 'application/ogg' ){ |
295 | 297 | return callback( { 'url':resource.src, 'poster' : resource.url } ); |
296 | | - |
| 298 | + } |
| 299 | + |
297 | 300 | // This could be depreciated if thumb.php support is standard |
298 | 301 | var request = { |
299 | 302 | 'action':'query', |
— | — | @@ -301,13 +304,13 @@ |
302 | 305 | 'prop':'imageinfo', |
303 | 306 | 'iiprop':'url|size|mime' |
304 | 307 | } |
| 308 | + |
305 | 309 | // Set the width: |
306 | | - if ( size.width ) |
| 310 | + if ( size.width ) { |
307 | 311 | request['iiurlwidth'] = size.width; |
308 | | - |
309 | | - mw.log( 'going to do req: ' + this.provider.api_url + ' ' + resource.titleKey ); |
| 312 | + } |
310 | 313 | |
311 | | - mw.getJSON( this.provider.api_url, request, function( data ) { |
| 314 | + mw.getJSON( this.provider.apiUrl, request, function( data ) { |
312 | 315 | var imObj = { }; |
313 | 316 | for ( var page_id in data.query.pages ) { |
314 | 317 | if( page_id == -1 ) { |
— | — | @@ -316,11 +319,15 @@ |
317 | 320 | } |
318 | 321 | |
319 | 322 | var iminfo = data.query.pages[ page_id ].imageinfo[0]; |
320 | | - // store the original width: |
| 323 | + |
| 324 | + // Store the original width: |
321 | 325 | imObj['org_width'] = iminfo.width; |
322 | | - // check if thumb size > than image size and is jpeg or png (it will not scale well above its max res) |
323 | | - if ( ( iminfo.mime == 'image/jpeg' || iminfo == 'image/png' ) && |
324 | | - iminfo.thumbwidth > iminfo.width ) { |
| 326 | + |
| 327 | + // Check if thumb size > than image size and is jpeg or png (it will not scale well above its max res) |
| 328 | + if ( ( iminfo.mime == 'image/jpeg' || iminfo == 'image/png' ) |
| 329 | + && iminfo.thumbwidth > iminfo.width |
| 330 | + || !iminfo.thumburl ) |
| 331 | + { |
325 | 332 | imObj['url'] = iminfo.url; |
326 | 333 | imObj['width'] = iminfo.width; |
327 | 334 | imObj['height'] = iminfo.height; |
— | — | @@ -329,7 +336,8 @@ |
330 | 337 | imObj['width'] = iminfo.thumbwidth; |
331 | 338 | imObj['height'] = iminfo.thumbheight; |
332 | 339 | } |
333 | | - } |
| 340 | + } |
| 341 | + |
334 | 342 | mw.log( 'getImageObj: get: ' + size.width + ' got url:' + imObj.url ); |
335 | 343 | callback( imObj ); |
336 | 344 | } ); |
— | — | @@ -340,7 +348,7 @@ |
341 | 349 | * |
342 | 350 | * @param {Object} resource Resource to get description of. |
343 | 351 | */ |
344 | | - getInlineDescWiki:function( resource ) { |
| 352 | + getInlineDescWiki: function( resource ) { |
345 | 353 | var desc = this.parent_getInlineDescWiki( resource ); |
346 | 354 | |
347 | 355 | // Strip categories for inline Desc: (should strip license tags too but not as easy) |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/archiveOrgSearch.js |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | getProviderResults: function( search_query, callback ) { |
40 | 40 | |
41 | 41 | var _this = this; |
42 | | - mw.log( 'archive_org:getProviderResults for:' + search_query + ' from: ' + this.provider.api_url ); |
| 42 | + mw.log( 'archive_org:getProviderResults for:' + search_query + ' from: ' + this.provider.apiUrl ); |
43 | 43 | |
44 | 44 | |
45 | 45 | // For now force (Ogg video) & url based license |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | 'page' : page_number, |
57 | 57 | 'xmlsearch' : 'Search' |
58 | 58 | } |
59 | | - mw.getJSON( this.provider.api_url + '?json.wrf=?', request, function( data ) { |
| 59 | + mw.getJSON( this.provider.apiUrl + '?json.wrf=?', request, function( data ) { |
60 | 60 | _this.addResults( data ); |
61 | 61 | callback( 'ok' ); |
62 | 62 | } ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/metavidSearch.js |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | mw.log( 'metavidSearch::getProviderResults()' ); |
39 | 39 | |
40 | 40 | // Process all options |
41 | | - var url = this.provider.api_url; |
| 41 | + var url = this.provider.apiUrl; |
42 | 42 | var request = $j.extend( {}, this.defaultReq ); |
43 | 43 | request[ 'f[0][t]' ] = 'match'; |
44 | 44 | request[ 'f[0][v]' ] = search_query; |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/flickrSearch.js |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | 'text': search_query, |
69 | 69 | 'extras' : 'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_m, url_o' |
70 | 70 | } |
71 | | - $j.getJSON( this.provider.api_url + '?jsoncallback=?', request, function( data ) { |
| 71 | + $j.getJSON( this.provider.apiUrl + '?jsoncallback=?', request, function( data ) { |
72 | 72 | _this.addResults( data ); |
73 | 73 | callback( 'ok' ); |
74 | 74 | } ); |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | 'done_upload_cb': false, |
38 | 38 | |
39 | 39 | // The API URL to upload to |
40 | | - 'api_url': null, |
| 40 | + 'apiUrl': null, |
41 | 41 | |
42 | 42 | // True when a file is uploaded without re-encoding |
43 | 43 | 'passthrough': false, |
— | — | @@ -152,8 +152,8 @@ |
153 | 153 | if ( !options ) |
154 | 154 | options = {}; |
155 | 155 | |
156 | | - // If we have no api_url, set upload mode to "post" |
157 | | - if ( !options.api_url ) |
| 156 | + // If we have no apiUrl, set upload mode to "post" |
| 157 | + if ( !options.apiUrl ) |
158 | 158 | options.upload_mode = 'post'; |
159 | 159 | |
160 | 160 | // Set options |
— | — | @@ -932,7 +932,7 @@ |
933 | 933 | } |
934 | 934 | |
935 | 935 | // No edit token. Fetch it asynchronously and then do the upload. |
936 | | - mw.getToken( _this.api_url, 'File:'+ _this.formData['filename'], function( editToken ) { |
| 936 | + mw.getToken( _this.apiUrl, 'File:'+ _this.formData['filename'], function( editToken ) { |
937 | 937 | if( !editToken || editToken == '+\\' ) { |
938 | 938 | _this.ui.setPrompt( gM( 'fogg-badtoken' ), gM( 'fogg-badtoken' ) ); |
939 | 939 | return false; |
— | — | @@ -960,9 +960,9 @@ |
961 | 961 | function /* onDone */ () { |
962 | 962 | var uploadRequest = _this.getUploadApiRequest(); |
963 | 963 | |
964 | | - mw.log( 'Do POST upload to:' +_this.api_url + ' with data:\n' + JSON.stringify( uploadRequest ) ); |
| 964 | + mw.log( 'Do POST upload to:' +_this.apiUrl + ' with data:\n' + JSON.stringify( uploadRequest ) ); |
965 | 965 | |
966 | | - _this.fogg.post( _this.api_url, 'file', JSON.stringify( uploadRequest ) ); |
| 966 | + _this.fogg.post( _this.apiUrl, 'file', JSON.stringify( uploadRequest ) ); |
967 | 967 | |
968 | 968 | _this.doUploadStatus(); |
969 | 969 | } |
— | — | @@ -1040,9 +1040,9 @@ |
1041 | 1041 | var uploadRequest = this.getUploadApiRequest( { 'enable_chunks' : true } ); |
1042 | 1042 | |
1043 | 1043 | var encoderSettings = this.getEncoderSettings(); |
1044 | | - mw.log( 'do fogg upload/encode call: ' + _this.api_url + ' :: ' + JSON.stringify( uploadRequest ) ); |
| 1044 | + mw.log( 'do fogg upload/encode call: ' + _this.apiUrl + ' :: ' + JSON.stringify( uploadRequest ) ); |
1045 | 1045 | mw.log( 'foggEncode: ' + JSON.stringify( encoderSettings ) ); |
1046 | | - _this.fogg.upload( JSON.stringify( encoderSettings ), _this.api_url, |
| 1046 | + _this.fogg.upload( JSON.stringify( encoderSettings ), _this.apiUrl, |
1047 | 1047 | JSON.stringify( uploadRequest ) ); |
1048 | 1048 | |
1049 | 1049 | // Start polling the upload status |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js |
— | — | @@ -26,8 +26,9 @@ |
27 | 27 | 'api_target' : false, |
28 | 28 | 'ondone_callback' : null |
29 | 29 | }; |
| 30 | +mw.UploadForm = { }; |
30 | 31 | |
31 | | -( function( mw.UploadForm ) { |
| 32 | +( function( $ ) { |
32 | 33 | /** |
33 | 34 | * Add a upload target selection menu |
34 | 35 | * with binding to build update form target |
— | — | @@ -51,7 +52,7 @@ |
52 | 53 | for( var i in options.uploadTargets ){ |
53 | 54 | var provider = options.uploadTargets[ i ] |
54 | 55 | $uploadTargetsList.append( |
55 | | - getProviderUploadLinks( provider ); |
| 56 | + getProviderUploadLinks( provider ) |
56 | 57 | ); |
57 | 58 | } |
58 | 59 | |
— | — | @@ -86,7 +87,7 @@ |
87 | 88 | } |
88 | 89 | // Add the upload form html: |
89 | 90 | $j( options.target ).html( |
90 | | - getUploadForm( options ); |
| 91 | + getUploadForm( options ) |
91 | 92 | ); |
92 | 93 | |
93 | 94 | |
— | — | @@ -120,8 +121,10 @@ |
121 | 122 | fname = path.substring( backslash + 1, 10000 ); |
122 | 123 | } |
123 | 124 | fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / /g, '_' ); |
| 125 | + |
124 | 126 | // Output result |
125 | 127 | $j( "#wpDestFile" ).val( fname ); |
| 128 | + |
126 | 129 | // Do destination check |
127 | 130 | $j( "#wpDestFile" ).doDestCheck( { |
128 | 131 | 'warn_target':'#wpDestFile-warning' |
— | — | @@ -144,7 +147,7 @@ |
145 | 148 | mw.load( 'AddMedia.firefogg', function() { |
146 | 149 | $j( "#wpUploadFile" ).firefogg( { |
147 | 150 | // An api url (we won't submit directly to action of the form) |
148 | | - 'api_url' : options.api_target, |
| 151 | + 'apiUrl' : options.api_target, |
149 | 152 | |
150 | 153 | // MediaWiki API supports chunk uploads: |
151 | 154 | 'enable_chunks' : false, |
— | — | @@ -187,33 +190,37 @@ |
188 | 191 | * Get a provider upload links for local upload and remote |
189 | 192 | */ |
190 | 193 | function getProviderUploadLinks( provider ){ |
191 | | - var api_url = provider.api_url; |
| 194 | + var apiUrl = provider.apiUrl; |
192 | 195 | |
193 | | - $uploadLinks = $j( '<li />' ); |
| 196 | + $uploadLinks = $j( '<div />' ); |
194 | 197 | |
195 | 198 | // Upload your own file |
196 | 199 | $uploadLinks.append( |
197 | | - $j( '<a />' ) |
198 | | - .attr( { |
199 | | - 'href' : '#' |
200 | | - } ) |
201 | | - .text( |
202 | | - gM( 'mwe-upload-own-file', provider.title ) |
| 200 | + $j('<li />').append( |
| 201 | + $j( '<a />' ) |
| 202 | + .attr( { |
| 203 | + 'href' : '#' |
| 204 | + } ) |
| 205 | + .text( |
| 206 | + gM( 'mwe-upload-own-file', provider.title ) |
| 207 | + ) |
| 208 | + .click( function(){ |
| 209 | + mw.log(" do interface for:" + provider.apiUrl ); |
| 210 | + }) |
203 | 211 | ) |
204 | | - .click( function(){ |
205 | | - mw.log(" do interface for:" + provider.api_url ); |
206 | | - }); |
207 | 212 | ); |
208 | 213 | |
209 | 214 | // Upload a file not your own ( link to special:upload for that api url ) |
210 | | - $uploadLinks.append ( |
211 | | - $j( '<a />' ) |
212 | | - .attr( { |
213 | | - 'href' : provider.api_url.replace( 'api.php', 'index.php' ) + '?title=Special:Upload', |
214 | | - 'target' : '_new' |
215 | | - } ) |
216 | | - .text( |
217 | | - gM( 'mwe-upload-not-my-file', provider.title ) |
| 215 | + $uploadLinks.append ( |
| 216 | + $j('<li />').append( |
| 217 | + $j( '<a />' ) |
| 218 | + .attr( { |
| 219 | + 'href' : provider.uploadPage, |
| 220 | + 'target' : '_new' |
| 221 | + } ) |
| 222 | + .text( |
| 223 | + gM( 'mwe-upload-not-my-file', provider.title ) |
| 224 | + ) |
218 | 225 | ) |
219 | 226 | ); |
220 | 227 | |
— | — | @@ -293,12 +300,13 @@ |
294 | 301 | 'id' : "wpUploadDescription", |
295 | 302 | 'cols' : "30", |
296 | 303 | 'rows' : "3", |
297 | | - 'name' : "wpUploadDescription" |
| 304 | + 'name' : "wpUploadDescription", |
298 | 305 | 'tabindex' : "3" |
299 | | - } ) |
| 306 | + } ), |
300 | 307 | |
301 | 308 | $j( '<br />' ) |
302 | 309 | ); |
| 310 | + |
303 | 311 | // Add watchlist checkbox |
304 | 312 | $uploadForm.append( |
305 | 313 | $j('<input />') |
— | — | @@ -388,5 +396,6 @@ |
389 | 397 | ); |
390 | 398 | return $uploadFrom; |
391 | 399 | } |
392 | | - |
393 | | -} )( window.mw.UploadForm ); |
| 400 | + |
| 401 | + |
| 402 | +} )( window.mw.UploadForm ); |
\ No newline at end of file |
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -1754,7 +1754,7 @@ |
1755 | 1755 | 'iiprop' : 'url', |
1756 | 1756 | 'iiurlwidth': '80' |
1757 | 1757 | }; |
1758 | | - mw.getJSON( mw.commons_api_url, request, function( data ) { |
| 1758 | + mw.getJSON( mw.commons_apiUrl, request, function( data ) { |
1759 | 1759 | // empty the videos: |
1760 | 1760 | $j( '#' + _this.id + ' .related_vids ul' ).html( ' ' ); |
1761 | 1761 | |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js |
— | — | @@ -23,7 +23,8 @@ |
24 | 24 | "mwe-re-try" : "Retry API request", |
25 | 25 | "mwe-re-trying" : "Retrying API request...", |
26 | 26 | "mwe-proxy-not-ready" : "Proxy is not configured", |
27 | | - "mwe-please-login" : "You are not <a target=\"_new\" href=\"$1\">logged in<\/a> on $2 or mwEmbed has not been enabled. Resolve the issue, and then retry the request.", |
| 27 | + "mwe-please-login" : "The request failed. Are you logged in on $1 ? Please $2 and try again", |
| 28 | + "mwe-log-in-link" : "log in", |
28 | 29 | "mwe-remember-loging" : "General security reminder: Only login to web sites when your address bar displays that site's address." |
29 | 30 | } ); |
30 | 31 | |
— | — | @@ -49,7 +50,9 @@ |
50 | 51 | |
51 | 52 | // Callback function for client requests |
52 | 53 | var proxyCallback = null; |
53 | | - |
| 54 | + |
| 55 | + var proxyTimeoutCallback = null; |
| 56 | + |
54 | 57 | // FrameProxy Flag: |
55 | 58 | var frameProxyOk = false; |
56 | 59 | |
— | — | @@ -72,13 +75,15 @@ |
73 | 76 | * |
74 | 77 | * @param {String} apiUrl Url to the api we want to do the request on. |
75 | 78 | * @param {Object} requestQuery Api request object |
76 | | - * @param {Function} callback Function called once the request is complete |
| 79 | + * @param {Function} callback Function called once the request is complete |
| 80 | + * @param {Function} [callbackTimeout] Optional Function called on api timeout |
77 | 81 | */ |
78 | | - $.doRequest = function( apiUrl, requestQuery, callback ) { |
| 82 | + $.doRequest = function( apiUrl, requestQuery, callback , callbackTimeout ) { |
79 | 83 | |
80 | 84 | // Reset local vars: |
81 | 85 | proxyCallback = false; |
82 | 86 | frameProxyOk = false; |
| 87 | + proxyTimeoutCallback = false; |
83 | 88 | |
84 | 89 | // Sanity check: |
85 | 90 | if ( mw.isLocalDomain( apiUrl ) ) { |
— | — | @@ -90,13 +95,17 @@ |
91 | 96 | |
92 | 97 | // Set local scope current request |
93 | 98 | // ( presently the api proxy only support sequential requests |
94 | | - // for multiple simultaneous requests we will need to do some minor refactoring ) |
| 99 | + // for multiple simultaneous requests we will need to do some refactoring ) |
| 100 | + |
95 | 101 | currentApiReq = requestQuery; |
96 | 102 | currentServerApiUrl = apiUrl; |
97 | 103 | |
98 | | - // Setup the callback: |
| 104 | + // Setup the callback: |
99 | 105 | proxyCallback = callback; |
100 | 106 | |
| 107 | + // Setup the timeout callback: |
| 108 | + proxyTimeoutCallback = callbackTimeout; |
| 109 | + |
101 | 110 | // Do the proxy req: |
102 | 111 | doFrameProxy( requestQuery ); |
103 | 112 | } |
— | — | @@ -140,8 +149,11 @@ |
141 | 150 | */ |
142 | 151 | $.browseFile = function( options ) { |
143 | 152 | |
144 | | - // Set frame proxy ok state flag: |
| 153 | + // Reset local vars: |
| 154 | + // NOTE: ( Again this makes the system not work with multiple concurent proxy requests ) |
| 155 | + proxyCallback = false; |
145 | 156 | frameProxyOk = false; |
| 157 | + proxyTimeoutCallback = false; |
146 | 158 | |
147 | 159 | if( ! options ) { |
148 | 160 | options = {}; |
— | — | @@ -151,13 +163,13 @@ |
152 | 164 | mw.log( "Error: no target for file browse iframe" ) ; |
153 | 165 | return false; |
154 | 166 | } |
155 | | - if( ! options.api_url ) { |
| 167 | + if( ! options.apiUrl ) { |
156 | 168 | mw.log( "Error: no api url to target" ); |
157 | 169 | return false; |
158 | 170 | } |
159 | 171 | |
160 | 172 | // Update the current apiUrl: |
161 | | - currentServerApiUrl = options.api_url; |
| 173 | + currentServerApiUrl = options.apiUrl; |
162 | 174 | |
163 | 175 | if( ! options.width ) { |
164 | 176 | options.width = 270; |
— | — | @@ -184,7 +196,7 @@ |
185 | 197 | 'persist' : true, |
186 | 198 | 'style' : frameStyle, |
187 | 199 | 'name' : iFrameName, |
188 | | - 'src' : getServerFrame( options.api_url ), |
| 200 | + 'src' : getServerFrame( options.apiUrl ), |
189 | 201 | 'request' : iFrameRequest, |
190 | 202 | 'target' : options.target |
191 | 203 | }, function( ) { |
— | — | @@ -207,7 +219,7 @@ |
208 | 220 | mw.log( 'apiProxy uploadActionHandler:: ' + action ); |
209 | 221 | // Send action to remote frame |
210 | 222 | mw.ApiProxy.sendServerMsg( { |
211 | | - 'api_url' : options.api_url, |
| 223 | + 'apiUrl' : options.apiUrl, |
212 | 224 | 'frameName' : iFrameName, |
213 | 225 | 'frameMsg' : { |
214 | 226 | 'action' : 'uploadHandlerAction', |
— | — | @@ -262,12 +274,12 @@ |
263 | 275 | * ( such as a hosted browse file or dialog prompt ) |
264 | 276 | * |
265 | 277 | * @param {Object} options Arguments to setup send server msg |
266 | | - * api_url The api url of the server to send the frame msg to |
| 278 | + * apiUrl The api url of the server to send the frame msg to |
267 | 279 | * frameName The frame name to send the msg to |
268 | 280 | * frameMsg The msg object to send to frame |
269 | 281 | */ |
270 | 282 | $.sendServerMsg = function( options ){ |
271 | | - if( !options.api_url || ! options.frameMsg || !options.frameName ){ |
| 283 | + if( !options.apiUrl || ! options.frameMsg || !options.frameName ){ |
272 | 284 | mw.log( "Error missing required option"); |
273 | 285 | return false; |
274 | 286 | } |
— | — | @@ -284,7 +296,7 @@ |
285 | 297 | // Send the iframe request: |
286 | 298 | appendIframe( { |
287 | 299 | 'persist' : true, |
288 | | - 'src' : getServerFrame( options.api_url ), |
| 300 | + 'src' : getServerFrame( options.apiUrl ), |
289 | 301 | 'request' : iFrameRequest, |
290 | 302 | 'target' : options.target |
291 | 303 | }, function( ) { |
— | — | @@ -490,6 +502,13 @@ |
491 | 503 | * Dialog to send the user if a proxy to the remote server could not be created |
492 | 504 | */ |
493 | 505 | function proxyNotReadyDialog() { |
| 506 | + // See if we have a callback function to call ( do not display the dialog ) |
| 507 | + if( proxyTimeoutCallback ){ |
| 508 | + proxyTimeoutCallback(); |
| 509 | + return ; |
| 510 | + } |
| 511 | + |
| 512 | + |
494 | 513 | var buttons = { }; |
495 | 514 | buttons[ gM( 'mwe-re-try' ) ] = function() { |
496 | 515 | mw.addLoaderDialog( gM( 'mwe-re-trying' ) ); |
— | — | @@ -504,12 +523,28 @@ |
505 | 524 | var login_url = pUri.protocol + '://' + pUri.host; |
506 | 525 | login_url += pUri.path.replace( 'MediaWiki:ApiProxy', 'Special:UserLogin' ); |
507 | 526 | |
| 527 | + var $dialogMsg = $j('<p />'); |
| 528 | + $dialogMsg.append( |
| 529 | + gM( 'mwe-please-login', |
| 530 | + pUri.host, |
| 531 | + |
| 532 | + // Add log-in link: |
| 533 | + $j( '<a />') |
| 534 | + .attr( { |
| 535 | + 'href' : login_url, |
| 536 | + 'target' : '_new' |
| 537 | + } ) |
| 538 | + .text( gM('mwe-log-in-link') ) |
| 539 | + ) |
| 540 | + ) |
| 541 | + // Add the sequrity note as well: |
| 542 | + $dialogMsg.append( |
| 543 | + gM( 'mwe-remember-loging' ) |
| 544 | + ) |
| 545 | + |
508 | 546 | mw.addDialog( |
509 | 547 | gM( 'mwe-proxy-not-ready' ), |
510 | | - gM( 'mwe-please-login', [ login_url, pUri.host] ) + |
511 | | - '<p style="font-size:small">' + |
512 | | - gM( 'mwe-remember-loging' ) + |
513 | | - '</p>', |
| 548 | + $dialogMsg, |
514 | 549 | buttons |
515 | 550 | ) |
516 | 551 | } |
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/mw.ClipEdit.js |
— | — | @@ -258,9 +258,9 @@ |
259 | 259 | 'rvprop':'content' |
260 | 260 | }; |
261 | 261 | // get the interface uri from the plObject |
262 | | - var api_url = _this.parentSequence.plObj.interface_url; |
| 262 | + var apiUrl = _this.parentSequence.plObj.interface_url; |
263 | 263 | // first check |
264 | | - mw.getJSON( api_url, request, function( data ) { |
| 264 | + mw.getJSON( apiUrl, request, function( data ) { |
265 | 265 | if ( typeof data.query.pages == 'undefined' ) |
266 | 266 | return _this.showEditOptions( target ); |
267 | 267 | for ( var i in data.query.pages ) { |
— | — | @@ -403,8 +403,8 @@ |
404 | 404 | }; |
405 | 405 | $j( _this.resource.embed ).html( mw.loading_spinner() ); |
406 | 406 | |
407 | | - var api_url = _this.parentSequence.plObj.interface_url; |
408 | | - mw.getJSON( api_url, request, function( data ) { |
| 407 | + var apiUrl = _this.parentSequence.plObj.interface_url; |
| 408 | + mw.getJSON( apiUrl, request, function( data ) { |
409 | 409 | if ( data.parse.text['*'] ) { |
410 | 410 | // update the target |
411 | 411 | $j( _this.resource.embed ).html( data.parse.text['*'] ); |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -215,24 +215,44 @@ |
216 | 216 | * the user msg. |
217 | 217 | * |
218 | 218 | * @param {String} msgKey The msg key as set by mw.addMessages |
219 | | - * @param {Array} args An array of replacement strings or jQuery objects |
| 219 | + * @param {Mixed} args A string|jQuery Object or array of string|jQuery Objects |
| 220 | + * |
| 221 | + * extra paramaters are appended to the args array as numbered replacements |
| 222 | + * |
220 | 223 | * @return string |
221 | 224 | */ |
222 | | - mw.getMsg = function( msgKey , args ) { |
223 | | - |
| 225 | + mw.getMsg = function( msgKey , args ) { |
| 226 | + |
224 | 227 | // Check for missing message key |
225 | | - if ( ! messageCache[ msgKey ] ) |
226 | | - return '<' + msgKey + '>'; |
227 | | - |
228 | | - var ms = mw.lang.msgReplaceArgs( messageCache[ msgKey ], args ); |
| 228 | + if ( ! messageCache[ msgKey ] ){ |
| 229 | + return '<' + msgKey + '>'; |
| 230 | + } |
| 231 | + |
| 232 | + // Check if we need to do args replacements: |
| 233 | + if( typeof args != 'undefined' ) { |
| 234 | + // Make sure args are of type array |
| 235 | + if ( typeof args == 'string' || typeof args == 'number' ) { |
| 236 | + args = [ args ]; |
| 237 | + } |
| 238 | + // Put any extra arguments into the args array |
| 239 | + var extraArgs = $j.makeArray( arguments ); |
| 240 | + for(var i=2; i < extraArgs.length; i ++ ){ |
| 241 | + args.push( extraArgs[ i ] ); |
| 242 | + } |
| 243 | + var ms = mw.lang.msgReplaceArgs( messageCache[ msgKey ], args ); |
| 244 | + }else{ |
| 245 | + var ms = messageCache[ msgKey ]; |
| 246 | + } |
| 247 | + |
229 | 248 | // A quick check to see if we need to send the msg to the 'parser' |
230 | 249 | if ( ms.indexOf( '{{' ) === -1 && ms.indexOf( '[' ) === -1 ) { |
231 | 250 | return ms; |
232 | 251 | } |
233 | | - |
| 252 | + |
234 | 253 | // Send the msg key through the parser |
235 | 254 | var pObj = mw.parser( ms ); |
236 | | - // return the transformed msg |
| 255 | + |
| 256 | + // Return the transformed msg |
237 | 257 | return pObj.getHTML(); |
238 | 258 | } |
239 | 259 | |
— | — | @@ -240,41 +260,33 @@ |
241 | 261 | * Swap in an array of values for $1, $2, $n for a given msg key |
242 | 262 | * |
243 | 263 | * @param string msgKey The msg key to lookup |
244 | | - * @param [mixed] args An array of string or jquery objects to be swapped in |
| 264 | + * @param [Array] args An array of string or jquery objects to be swapped in |
245 | 265 | * @return string |
246 | 266 | */ |
247 | 267 | mw.lang.msgReplaceArgs = function( message , args ) { |
248 | 268 | // Replace Values |
249 | | - if ( typeof args == 'object' || typeof args == 'array' ) { |
250 | | - for ( var v =0; v < args.length; v++ ) { |
251 | | - if( typeof args[v] == 'undefined' ) { |
252 | | - continue; |
253 | | - } |
254 | | - var replaceValue = args[ v ]; |
255 | | - |
256 | | - // Convert number if applicable |
257 | | - if( parseInt( replaceValue ) == replaceValue ) { |
258 | | - replaceValue = mw.lang.convertNumber( replaceValue ); |
259 | | - } |
260 | | - |
261 | | - // Message test replace arguments start at 1 instead of zero: |
262 | | - var rep = new RegExp( '\\$' + ( parseInt( v ) + 1 ), 'g' ); |
263 | | - |
264 | | - // Check if we got passed in a jQuery object: |
265 | | - if( typeof args[v]['html'] == 'function' ) { |
266 | | - message = message.replace( rep, $j('<div />').append( replaceValue ).html() ); |
267 | | - }else{ |
268 | | - // Assume replaceValue string |
269 | | - message = message.replace( rep, replaceValue ); |
270 | | - } |
271 | | - } |
272 | | - } else if ( typeof args == 'string' || typeof args == 'number' ) { |
| 269 | + for ( var v =0; v < args.length; v++ ) { |
| 270 | + if( typeof args[v] == 'undefined' ) { |
| 271 | + continue; |
| 272 | + } |
| 273 | + var replaceValue = args[ v ]; |
| 274 | + |
273 | 275 | // Convert number if applicable |
274 | | - if( parseInt( args ) == args ) { |
275 | | - args = mw.lang.convertNumber( args ); |
| 276 | + if( parseInt( replaceValue ) == replaceValue ) { |
| 277 | + replaceValue = mw.lang.convertNumber( replaceValue ); |
276 | 278 | } |
277 | | - message = message.replace( /\$1/g, args ); |
278 | | - } |
| 279 | + |
| 280 | + // Message test replace arguments start at 1 instead of zero: |
| 281 | + var rep = new RegExp( '\\$' + ( parseInt( v ) + 1 ), 'g' ); |
| 282 | + |
| 283 | + // Check if we got passed in a jQuery object: |
| 284 | + if( typeof replaceValue[ 'tagName' ] != 'undefined' ) { |
| 285 | + message = message.replace( rep, $j('<div />').append( replaceValue ).html() ); |
| 286 | + } else { |
| 287 | + // Assume replaceValue is a string |
| 288 | + message = message.replace( rep, replaceValue ); |
| 289 | + } |
| 290 | + } |
279 | 291 | return message; |
280 | 292 | } |
281 | 293 | |
— | — | @@ -1346,41 +1358,49 @@ |
1347 | 1359 | * mediaWiki JSON a wrapper for jQuery getJSON: |
1348 | 1360 | * |
1349 | 1361 | * The mediaWiki version lets you skip the url part |
1350 | | - * mw.getJSON( [url], data, callback ); |
| 1362 | + * mw.getJSON( [url], data, callback, [timeoutCallback] ); |
1351 | 1363 | * |
1352 | 1364 | * Lets you assume: |
1353 | 1365 | * url is optional |
1354 | 1366 | * ( If the first argument is not a string we assume a local mediaWiki api request ) |
1355 | | - * callback parameter is not needed we setup the callback automatically |
| 1367 | + * callback parameter is not needed for the request data |
1356 | 1368 | * url param 'action'=>'query' is assumed ( if not set to something else in the "data" param |
1357 | 1369 | * format is set to "json" automatically |
1358 | | - * automatically issues request over "POST" |
1359 | | - * ( If the api specifices the action must be done over a post request ) |
| 1370 | + * automatically issues request over "POST" if the request requires a post |
1360 | 1371 | * automatically will setup apiProxy where needed. |
1361 | 1372 | * |
1362 | 1373 | * @param {Mixed} url or data request |
1363 | 1374 | * @param {Mixed} data or callback |
1364 | | - * @param {Mixed} callbcak |
| 1375 | + * @param {Function} callbcak function called on success |
| 1376 | + * @param {Function} callbackTimeout - optional function called on timeout |
| 1377 | + * Setting timeout callback also avoids dialog display for timed out proxy calls. |
1365 | 1378 | * |
1366 | 1379 | */ |
1367 | | - mw.getJSON = function( arg1, arg2, arg3 ) { |
1368 | | - // Set up the url |
| 1380 | + mw.getJSON = function() { |
| 1381 | + // Set up the url |
| 1382 | + |
1369 | 1383 | var url = false; |
1370 | | - url = ( typeof arg1 == 'string' ) ? arg1 : mw.getLocalApiUrl(); |
| 1384 | + url = ( typeof arguments[0] == 'string' ) ? arguments[0] : mw.getLocalApiUrl(); |
1371 | 1385 | |
1372 | 1386 | // Set up the data: |
1373 | 1387 | var data = null; |
1374 | | - data = ( typeof arg1 == 'object' ) ? arg1 : null; |
1375 | | - if( !data && typeof arg2 == 'object' ) { |
1376 | | - data = arg2; |
| 1388 | + data = ( typeof arguments[0] == 'object' ) ? arguments[0] : null; |
| 1389 | + if( !data && typeof arguments[1] == 'object' ) { |
| 1390 | + data = arguments[1]; |
1377 | 1391 | } |
1378 | 1392 | |
1379 | 1393 | // Setup the callback |
1380 | 1394 | var callback = false; |
1381 | | - callback = ( typeof arg2 == 'function') ? arg2 : false; |
1382 | | - if( ! callback && ( typeof arg3 == 'function') ) { |
1383 | | - callback = arg3; |
| 1395 | + callback = ( typeof arguments[1] == 'function') ? arguments[1] : false; |
| 1396 | + var cbinx = 1; |
| 1397 | + if( ! callback && ( typeof arguments[2] == 'function') ) { |
| 1398 | + callback = arguments[2]; |
| 1399 | + cbinx = 2; |
1384 | 1400 | } |
| 1401 | + |
| 1402 | + // Setup the timeoutCallback ( function after callback index ) |
| 1403 | + var timeoutCallback = false; |
| 1404 | + timeoutCallback = ( typeof arguments[ cbinx + 1 ] == 'function' ) ? arguments[ cbinx + 1 ] : false; |
1385 | 1405 | |
1386 | 1406 | // Make sure we got a url: |
1387 | 1407 | if( !url ) { |
— | — | @@ -1398,6 +1418,26 @@ |
1399 | 1419 | data['format'] = 'json'; |
1400 | 1420 | } |
1401 | 1421 | |
| 1422 | + // Setup callback wrapper for timeout |
| 1423 | + var requestTimeOutFlag = false; |
| 1424 | + var ranCallback = false; |
| 1425 | + var myCallback = function( data ){ |
| 1426 | + if( ! requestTimeOutFlag ){ |
| 1427 | + ranCallback = true; |
| 1428 | + callback( data ); |
| 1429 | + } |
| 1430 | + } |
| 1431 | + // Set the local timeout call based on defaultRequestTimeout |
| 1432 | + setTimeout( function( ) { |
| 1433 | + if( ! ranCallback ){ |
| 1434 | + requestTimeOutFlag = true; |
| 1435 | + mw.log( "Error:: request timed out: " + url ) ; |
| 1436 | + if( timeoutCallback ) { |
| 1437 | + timeoutCallback(); |
| 1438 | + } |
| 1439 | + } |
| 1440 | + }, mw.getConfig( 'defaultRequestTimeout' ) * 1000 ); |
| 1441 | + |
1402 | 1442 | mw.log("run getJSON: " + mw.replaceUrlParams( url, data ) ); |
1403 | 1443 | // Check if the request requires a "post" |
1404 | 1444 | if( mw.checkRequestPost( data ) ) { |
— | — | @@ -1405,11 +1445,11 @@ |
1406 | 1446 | if( ! mw.isLocalDomain( url ) ) { |
1407 | 1447 | // Load the proxy and issue the request |
1408 | 1448 | mw.load( 'ApiProxy', function() { |
1409 | | - mw.ApiProxy.doRequest( url, data, callback ); |
| 1449 | + mw.ApiProxy.doRequest( url, data, myCallback, timeoutCallback); |
1410 | 1450 | }); |
1411 | 1451 | }else{ |
1412 | 1452 | // Do the request an ajax post |
1413 | | - $j.post( url, data, callback, 'json'); |
| 1453 | + $j.post( url, data, myCallback, 'json'); |
1414 | 1454 | } |
1415 | 1455 | return ; |
1416 | 1456 | } |
— | — | @@ -1421,7 +1461,7 @@ |
1422 | 1462 | } |
1423 | 1463 | } |
1424 | 1464 | // Pass off the jQuery getJSON request: |
1425 | | - $j.getJSON( url, data, callback ); |
| 1465 | + $j.getJSON( url, data, myCallback ); |
1426 | 1466 | } |
1427 | 1467 | |
1428 | 1468 | /** |
— | — | @@ -1464,16 +1504,16 @@ |
1465 | 1505 | /** |
1466 | 1506 | * Simple api helper to grab an edit token |
1467 | 1507 | * |
1468 | | - * @param {String} [api_url] Optional target API URL (uses default local api if unset) |
| 1508 | + * @param {String} [apiUrl] Optional target API URL (uses default local api if unset) |
1469 | 1509 | * @param {String} title The wiki page title you want to edit |
1470 | 1510 | * @param {callback} callback Function to pass the token to |
1471 | 1511 | */ |
1472 | | - mw.getToken = function( api_url, title, callback ) { |
1473 | | - // Make the api_url be optional: |
| 1512 | + mw.getToken = function( apiUrl, title, callback ) { |
| 1513 | + // Make the apiUrl be optional: |
1474 | 1514 | if( typeof title == 'function' ) { |
1475 | 1515 | callback = title; |
1476 | | - title = api_url; |
1477 | | - api_url = mw.getLocalApiUrl(); |
| 1516 | + title = apiUrl; |
| 1517 | + apiUrl = mw.getLocalApiUrl(); |
1478 | 1518 | } |
1479 | 1519 | |
1480 | 1520 | mw.log( 'mw:getToken' ); |
— | — | @@ -1482,8 +1522,8 @@ |
1483 | 1523 | 'prop': 'info', |
1484 | 1524 | 'intoken': 'edit', |
1485 | 1525 | 'titles': title |
1486 | | - }; |
1487 | | - mw.getJSON( api_url, request, function( data ) { |
| 1526 | + }; |
| 1527 | + mw.getJSON( apiUrl, request, function( data ) { |
1488 | 1528 | for ( var i in data.query.pages ) { |
1489 | 1529 | if ( data.query.pages[i]['edittoken'] ) { |
1490 | 1530 | if ( typeof callback == 'function' ) |
— | — | @@ -1495,7 +1535,6 @@ |
1496 | 1536 | } ); |
1497 | 1537 | } |
1498 | 1538 | |
1499 | | - |
1500 | 1539 | /** |
1501 | 1540 | * Utility Functions |
1502 | 1541 | */ |