r63193 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63192‎ | r63193 | r63194 >
Date:02:09, 3 March 2010
Author:dale
Status:deferred
Tags:
Comment:
* updated add-media-wizard uploadTargets support ( for commons and local wiki )
* updated apiUrl var name
* updated msgs
Modified paths:
  • /branches/js2-work/phase3/js/editPage.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/languages/mwEmbed.i18n.php (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/archiveOrgSearch.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/flickrSearch.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/kalturaSearch.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/mediaWikiSearch.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/metavidSearch.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/mw.ClipEdit.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/common/common.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/tests/testApiProxy.html (modified) (history)
  • /branches/js2-work/phase3/js/uploadPage.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/uploadPage.js
@@ -19,7 +19,7 @@
2020 $j( '#wpUploadFile' ).firefogg( {
2121
2222 // An API URL (default is getLocalApiUrl but set here for clarity )
23 - 'api_url': mw.getLocalApiUrl(),
 23+ 'apiUrl': mw.getLocalApiUrl(),
2424
2525 // MediaWiki API supports chunk uploads:
2626 'enable_chunks' : false,
Index: branches/js2-work/phase3/js/editPage.js
@@ -24,7 +24,7 @@
2525 // Here we can setup the content provider overrides
2626 'enabled_providers': ['wiki_commons'],
2727 // The local wiki API URL:
28 - 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php'
 28+ 'local_wiki_apiUrl': wgServer + wgScriptPath + '/api.php'
2929 };
3030
3131 mw.ready( function() {
Index: branches/js2-work/phase3/js/mwEmbed/loader.js
@@ -87,12 +87,16 @@
8888 'sr_ec', 'sr_el', 'sr', 'ti', 'tl', 'uk', 'wa'
8989 ],
9090
 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+
9195 // Default user language is "en" Can be overwritten by:
9296 // "uselang" url param
9397 // wgUserLang global
9498 'userLanguage' : 'en',
9599
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
97101 'commons_apiurl' : 'http://commons.wikimedia.org/w/api.php'
98102 } );
99103
Index: branches/js2-work/phase3/js/mwEmbed/tests/testApiProxy.html
@@ -9,7 +9,7 @@
1010 //HARD coded local test:
1111 var remote_wiki_host = 'http://commons.wikimedia.org';
1212 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';
1414
1515 mw.ready( function(){
1616 $j('#hostName').text( remote_wiki_host );
@@ -35,7 +35,7 @@
3636 'meta':'userinfo'
3737 }
3838 // 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 ){
4040 //now we get the data back for that domain
4141 if( !data.query || !data.query.userinfo ){
4242 mw.log("Error no query.userinfo ");
@@ -50,10 +50,10 @@
5151 function doAppend(){
5252 $j('#appendTarget').html( mw.loading_spinner() );
5353 //get user name
54 - getUserName( function(userName){
 54+ getUserName( function( userName ){
5555 var eTitle = 'User_talk:' + userName;
5656 // Get a edit token
57 - mw.getToken( remote_api_url, eTitle, function( token ) {
 57+ mw.getToken( remote_apiUrl, eTitle, function( token ) {
5858 mw.log("got token: " + token) ;
5959 var request = {
6060 'action':'edit',
@@ -62,7 +62,7 @@
6363 'appendtext': "\n\n==== Hello from Api proxy At: " + Date() + " ====",
6464 'token': token
6565 }
66 - mw.getJSON( remote_api_url, request, function( result ){
 66+ mw.getJSON( remote_apiUrl, request, function( result ){
6767 if(result.edit && result.edit.newrevid){
6868 $j('#appendTarget').html( "success: " + JSON.stringify ( result) );
6969 url = remote_wiki_host + remote_script_path + '/index.php/';
@@ -88,7 +88,7 @@
8989 'target' : '#browseTarget',
9090
9191 // Api url to upload to
92 - 'api_url' : remote_api_url,
 92+ 'apiUrl' : remote_apiUrl,
9393
9494 // File Destination Name change callback:
9595 'selectFileCb' : function( fname ){
@@ -96,7 +96,7 @@
9797 $j('#file-name').val( fname );
9898 // Run a destination file name check on the remote target
9999 $j('#file-name').doDestCheck( {
100 - 'api_url' : remote_api_url,
 100+ 'apiUrl' : remote_apiUrl,
101101 'warn_target': '#file-warning'
102102 } );
103103 },
@@ -113,7 +113,7 @@
114114
115115 // Build the output and send upload request to fileProxy
116116 mw.ApiProxy.sendServerMsg( {
117 - 'api_url' : remote_api_url,
 117+ 'apiUrl' : remote_apiUrl,
118118 'frameName' : fileIframeName,
119119 'frameMsg' : {
120120 'action' : 'fileSubmit',
@@ -130,7 +130,7 @@
131131 // Setup doDestCheck on change
132132 $j('#file-name').change(function(){
133133 $j('#file-name').doDestCheck( {
134 - 'api_url' : remote_api_url,
 134+ 'apiUrl' : remote_apiUrl,
135135 'warn_target': '#file-warning'
136136 } );
137137 });
Index: branches/js2-work/phase3/js/mwEmbed/languages/mwEmbed.i18n.php
@@ -12,67 +12,22 @@
1313
1414 $messages['en'] = array(
1515 /*
16 - * js file: /modules/EmbedPlayer/mw.EmbedPlayer.js
 16+ * js file: /skins/kskin/kskinConfig.js
1717 */
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',
7519
7620 /*
 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+ /*
7732 * js file: /modules/Sequencer/mw.Sequencer.js
7833 */
7934 'mwe-menu_clipedit' => 'Edit media',
@@ -111,65 +66,12 @@
11267 '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>).',
11368
11469 /*
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 - /*
12670 * js file: /modules/Sequencer/remotes/RemoteMwSequencer.js
12771 */
12872 'mwe-no-sequence-create' => 'No sequence exists named $1, You can $2',
12973 'mwe-sequence-create-one' => 'start a sequence',
13074
13175 /*
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 - /*
17476 * js file: /modules/TimedText/mw.TimedTextEdit.js
17577 */
17678 'mew-timedtext-editor' => 'Timed text editor',
@@ -228,90 +130,70 @@
229131 'mwe-language-no-subtitles-for-clip' => 'No $1 subtitles where found for clip: $2',
230132
231133 /*
232 - * js file: /modules/AddMedia/mw.RemoteSearchDriver.js
 134+ * js file: /modules/EmbedPlayer/mw.EmbedPlayer.js
233135 */
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',
295193
296194 /*
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 - /*
310195 * js file: /modules/AddMedia/mw.UploadHandler.js
311196 */
312 - 'mwe-upload-in-progress' => 'Upload in progress (do not close this window)',
313197 'mwe-upload-transcoded-status' => 'Transcoded',
314 - 'mwe-uploaded-time-remaining' => 'Time remaining: $1',
315 - 'mwe-uploaded-status' => 'Uploaded',
316198 'mwe-upload-stats-fileprogress' => '$1 of $2',
317199 'mwe-upload_completed' => 'Your upload is complete',
318200 'mwe-upload_done' => '<a href="$1">Your upload <i>should be</i> accessible</a>.',
@@ -334,56 +216,14 @@
335217 'license-header' => 'Licensing',
336218 'filedesc' => 'Summary',
337219 'filesource' => 'Source:',
 220+ 'filestatus' => 'Copyright status:',
338221
339222 /*
340 - * js file: /modules/AddMedia/mw.Firefogg.js
 223+ * js file: /modules/AddMedia/loader.js
341224 */
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',
361226
362227 /*
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 - /*
388228 * js file: /modules/AddMedia/mw.FirefoggGUI.js
389229 */
390230 'fogg-save_local_file' => 'Save Ogg',
@@ -451,11 +291,180 @@
452292 'fogg-contact-help' => 'Contact link',
453293
454294 /*
455 - * js file: /modules/AddMedia/loader.js
 295+ * js file: /modules/AddMedia/searchLibs/metavidSearch.js
456296 */
457 - 'mwe-loading-add-media-wiz' => 'Loading add media wizard',
 297+ 'mwe-stream_title' => '$1 $2 to $3',
458298
459299 /*
 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+ /*
460469 * js file: /mwEmbed.js
461470 */
462471 'mwe-loading_txt' => 'Loading ...',
@@ -472,11 +481,6 @@
473482 'mwe-enable-gadget-done' => 'mwEmbed gadget has been enabled',
474483 'mwe-must-login-gadget' => 'To enable gadget you must <a target="_new" href="$1">login</a>',
475484 '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',
481485 );
482486
483487 /** Afrikaans (Afrikaans)
Index: branches/js2-work/phase3/js/mwEmbed/skins/common/common.css
@@ -499,4 +499,8 @@
500500 .fg-menu .ui-icon{
501501 position:relative;
502502 top:-1px;
 503+}
 504+
 505+#rsd_upload_form {
 506+ font-size: 110%;
503507 }
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/skins/kskin/kskinConfig.js
@@ -340,7 +340,7 @@
341341 var _this = this;
342342 var $target = embedPlayer.$interface.find( '.menu-credits' );
343343
344 - var api_url = mw.getApiProviderURL( embedPlayer.apiProvider );
 344+ var apiUrl = mw.getApiProviderURL( embedPlayer.apiProvider );
345345 var fileTitle = 'File:' + embedPlayer.apiTitleKey.replace(/File:|Image:/, '');
346346
347347 // Get the image info
@@ -350,7 +350,7 @@
351351 'iiprop' : 'url'
352352 };
353353 var articleUrl = '';
354 - mw.getJSON( api_url, request, function( data ){
 354+ mw.getJSON( apiUrl, request, function( data ){
355355 if ( data.query.pages ) {
356356 for ( var i in data.query.pages ) {
357357 var imageProps = data.query.pages[i];
Index: branches/js2-work/phase3/js/mwEmbed/skins/ctrlBuilder.js
@@ -215,8 +215,7 @@
216216 return {
217217 'height': targetHeight,
218218 'width' : targetWidth,
219 - 'top' : offsetTop,
220 - 'left' : offsetLeft
 219+ 'top' : offsetTop
221220 }
222221 },
223222
Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js
@@ -282,16 +282,16 @@
283283
284284 // Try to get sources from text provider:
285285 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 );
287287 var assetKey = this.embedPlayer.apiTitleKey;
288 - if( !api_url || !assetKey ) {
 288+ if( !apiUrl || !assetKey ) {
289289 mw.log("Error: loading source without apiProvider or apiTitleKey");
290290 return ;
291291 }
292292 //For now only support mediaWikiText provider library
293293 this.textProvider = new mw.MediaWikiTextProvider( {
294294 'provider_id' : provider_id,
295 - 'api_url': api_url,
 295+ 'apiUrl': apiUrl,
296296 'embedPlayer': this.embedPlayer
297297 } );
298298
@@ -1160,7 +1160,7 @@
11611161
11621162 */
11631163 var default_textProvider_attr = [
1164 - 'api_url',
 1164+ 'apiUrl',
11651165 'provider_id',
11661166 'timed_text_NS',
11671167 'embedPlayer'
@@ -1172,7 +1172,7 @@
11731173 mw.MediaWikiTextProvider.prototype = {
11741174
11751175 // The api url:
1176 - api_url: null,
 1176+ apiUrl: null,
11771177
11781178 // The timed text namespace
11791179 timed_text_NS: null,
@@ -1199,7 +1199,7 @@
12001200 'action': 'parse',
12011201 'page': titleKey
12021202 };
1203 - mw.getJSON( this.api_url, request, function( data ) {
 1203+ mw.getJSON( this.apiUrl, request, function( data ) {
12041204 if ( data && data.parse && data.parse.text['*'] ) {
12051205 callback( data.parse.text['*'] );
12061206 return;
@@ -1243,14 +1243,14 @@
12441244 'aplimit' : 200,
12451245 'prop':'revisions'
12461246 };
1247 - mw.getJSON( this.api_url, request, function( sourcePages ) {
 1247+ mw.getJSON( this.apiUrl, request, function( sourcePages ) {
12481248 //If "timedText" is not a valid namespace try "just" with prefix:
12491249 if ( sourcePages.error && sourcePages.error.code == 'apunknown_apnamespace' ) {
12501250 var request = {
12511251 'list' : 'allpages',
12521252 'apprefix' : _this.getCanonicalTimedTextNS() + ':' + _this.embedPlayer.apiTitleKey
12531253 };
1254 - mw.getJSON( _this.api_url, request, function( sourcePages ) {
 1254+ mw.getJSON( _this.apiUrl, request, function( sourcePages ) {
12551255 callback( sourcePages )
12561256 } );
12571257 } else {
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js
@@ -37,7 +37,11 @@
3838 "rsd_config_error" : "Add media wizard configuration error: $1",
3939 "mwe-your_recent_uploads" : "Your recent uploads to $1",
4040 "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",
4246 "mwe-resource_page_desc" : "Resource page description:",
4347 "mwe-edit_resource_desc" : "Edit wiki text resource description:",
4448 "mwe-local_resource_title" : "Local resource title:",
@@ -224,7 +228,7 @@
225229 *
226230 * @homepage: the homepage url for the search provider
227231 *
228 - * @api_url: the url to query against given the library type:
 232+ * @apiUrl: the url to query against given the library type:
229233 *
230234 * @lib: the search library to use corresponding to the
231235 * search object ie: 'mediaWiki' = new mediaWikiSearchSearch()
@@ -251,7 +255,7 @@
252256 */
253257 'this_wiki': {
254258 'enabled': 1,
255 - 'api_url': ( wgServer && wgScriptPath ) ?
 259+ 'apiUrl': ( wgServer && wgScriptPath ) ?
256260 wgServer + wgScriptPath + '/api.php' : null,
257261 'lib': 'mediaWiki',
258262 'local': true,
@@ -264,7 +268,7 @@
265269 'kaltura': {
266270 'enabled': 1,
267271 'homepage': 'http://kaltura.com',
268 - 'api_url': 'http://kaldev.kaltura.com/michael/aggregator.php',
 272+ 'apiUrl': 'http://kaldev.kaltura.com/michael/aggregator.php',
269273 'lib': 'kaltura',
270274 'resource_prefix' : '',
271275 'tab_image':false
@@ -276,7 +280,7 @@
277281 'wiki_commons': {
278282 'enabled': 1,
279283 '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',
281285 'lib': 'mediaWiki',
282286 'tab_img': true,
283287
@@ -301,7 +305,7 @@
302306 'enabled': 1,
303307 'homepage': 'http://www.archive.org/about/about.php',
304308
305 - 'api_url': 'http://www.archive.org/advancedsearch.php',
 309+ 'apiUrl': 'http://www.archive.org/advancedsearch.php',
306310 'lib': 'archiveOrg',
307311 'local': false,
308312 'resource_prefix': 'AO_',
@@ -315,7 +319,7 @@
316320 'enabled': 1,
317321 'homepage': 'http://www.flickr.com/about/',
318322
319 - 'api_url': 'http://www.flickr.com/services/rest/',
 323+ 'apiUrl': 'http://www.flickr.com/services/rest/',
320324 'lib': 'flickr',
321325 'local': false,
322326 // Just prefix with Flickr_ for now.
@@ -329,7 +333,7 @@
330334 'metavid': {
331335 'enabled': 1,
332336 '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',
334338 'lib': 'metavid',
335339 'local': false,
336340
@@ -450,7 +454,7 @@
451455 // Set the provider id
452456 provider[ 'id' ] = provider_id
453457
454 - if ( _this.enabled_providers == 'all' && !this.current_provider && provider.api_url ) {
 458+ if ( _this.enabled_providers == 'all' && !this.current_provider && provider.apiUrl ) {
455459 this.current_provider = provider_id;
456460 break;
457461 } else {
@@ -485,7 +489,7 @@
486490 // Set up the local API upload URL
487491 if ( _this.upload_api_target == 'local' ) {
488492 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' ) );
490494 return false;
491495 } else {
492496 _this.upload_api_target = mw.getLocalApiUrl();
@@ -928,6 +932,9 @@
929933 .addClass( 'rsd_search_button' )
930934 .buttonHover()
931935 .click(function () {
 936+ if( _this.current_provider == 'upload' ){
 937+ _this.current_provider = _this.previus_provider;
 938+ }
932939 _this.updateResults( _this.current_provider, true );
933940 return false;
934941 });
@@ -935,14 +942,14 @@
936943 var $searchBox = $j( '<input />' )
937944 .addClass( 'ui-corner-all' )
938945 .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"
947954 })
948955 // Prevent searching for empty input.
949956 .keyup(function () {
@@ -958,7 +965,7 @@
959966 for ( var providerName in this.content_providers ) {
960967 var content_providers = this.content_providers;
961968 var provider = content_providers[ providerName ];
962 - if ( provider.enabled && provider.api_url ) {
 969+ if ( provider.enabled && provider.apiUrl ) {
963970 var $anchor = $j( '<div />' )
964971 .text( gM( 'rsd-' + providerName + '-title' ) )
965972 .attr({
@@ -1032,7 +1039,6 @@
10331040 _this.showUploadForm( provider );
10341041 } );
10351042 } );
1036 -
10371043 },
10381044
10391045 /**
@@ -1042,8 +1048,6 @@
10431049 */
10441050 showUploadForm: function( provider ) {
10451051 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 );
10481052
10491053 // Do basic layout form on left upload "bin" on right
10501054 $uploadTableRow = $j('<tr />').append(
@@ -1055,9 +1059,11 @@
10561060 'padding-right' : '12px'
10571061 })
10581062 .append(
1059 - $j('<h4 />').text( uploadMsg ),
 1063+ $j('<h3 />')
 1064+ .text( gM( 'mwe-upload_a_file' ) ),
 1065+
10601066 $j('<div />').attr({
1061 - 'id': 'upload_form'
 1067+ 'id': 'rsd_upload_form'
10621068 })
10631069 .loadingSpinner()
10641070 ),
@@ -1073,44 +1079,18 @@
10741080 $uploadTableRow
10751081 )
10761082 );
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 - }
10901083
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' );
10941085
10951086 // Send the upload target menu from UploadForm class
10961087 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()
11101090 } );
11111091
11121092 // Deal with the api form upload form directly:
11131093 /*mw.UploadForm.getForm( {
1114 - "target" : '#upload_form',
 1094+ "target" : '#rsd_upload_form',
11151095 "api_target" : _this.upload_api_target,
11161096 "ondone_callback" : function( resultData ) {
11171097 var wTitle = resultData['filename'];
@@ -1131,6 +1111,162 @@
11321112 },
11331113
11341114 /**
 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+ /**
11351271 * Refresh the results container ( based on current_provider var )
11361272 */
11371273 updateResults: function() {
@@ -1161,8 +1297,10 @@
11621298 mw.log( 'last query is: ' + provider.sObj.last_query +
11631299 ' matches: ' + $j( '#rsd_q' ).val() + ' no search needed');
11641300
1165 - // Show search results directly
1166 - this.showResults();
 1301+ // Show search results directly
 1302+ this.showResults( );
 1303+ // Done with processing
 1304+ return true;
11671305 }
11681306 }
11691307
@@ -1204,7 +1342,7 @@
12051343 }
12061344 // If we don't have the local wiki api defined we can't auto-detect use "link"
12071345 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)' );
12091347 _this.import_url_mode = 'remote_link';
12101348 callback();
12111349 }
@@ -1348,7 +1486,7 @@
13491487
13501488 // If we are given a result location, we hide them.
13511489 if ($location) {
1352 - $location.html( mw.loading_spinner("float: left") );
 1490+ $location.loadingSpinner();
13531491 }
13541492
13551493 var d = new Date();
@@ -1356,16 +1494,15 @@
13571495 _this.currentRequest = context();
13581496 mw.log( "ProviderCallBack Generated " + context() )
13591497 provider.sObj.getSearchResults( $j( '#rsd_q' ).val() ,
1360 - function( resultStatus ) {
1361 -
 1498+ function( resultStatus ) {
13621499 mw.log( "ProviderCallBack Received " + context() );
13631500 if( _this.currentRequest != context() ) {
 1501+ mw.log( "Context mismatch for request " + _this.currentRequest + ' != ' + context );
13641502 // do not update the results this.currentRequest
13651503 // does not match the interface request state.
13661504 return false;
1367 - }
1368 -
1369 - //else update search results
 1505+ }
 1506+ //else update search results
13701507 _this.showResults();
13711508 });
13721509
@@ -1462,17 +1599,32 @@
14631600 },
14641601
14651602 /**
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.
14671608 */
1468 - showResults: function() {
1469 - mw.log( 'f:showResults::' + this.current_provider );
 1609+ showResults: function( options ) {
14701610 var _this = this;
14711611
1472 - var provider = this.content_providers[ this.current_provider ];
 1612+ if( !options ) {
 1613+ options = { };
 1614+ }
14731615
 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 );
14741626 // Result page structure:
14751627 //
1476 - // resultContainer
 1628+ // resultsContainer
14771629 // header
14781630 // resultBody
14791631 // filter form
@@ -1480,33 +1632,26 @@
14811633 // resultList
14821634 // results...
14831635 // footer
1484 -
1485 - var $resultsContainer;
 1636+
14861637 var $resultsBody = $j( '<div />' ).addClass( 'rsd_results_body' );
14871638 var $resultsList = $j( '<div />' ).addClass( 'rsd_results_list' );
14881639
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();
15001642
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() )
15091645 }
15101646
 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+
15111656 var numResults = 0;
15121657
15131658 // Output all the results for the current current_provider
@@ -1820,31 +1965,49 @@
18211966 _this.removeResourceEditor();
18221967
18231968 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+
18261987 // 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:
18291991 var dialogTitle = gM( 'mwe-add_media_wizard' ) + ': ' +
18301992 gM( 'rsd_resource_edit', resource.title );
 1993+
18311994 $j( _this.target_container ).dialog( 'option', 'title', dialogTitle );
18321995
18331996 mw.log( 'did append to: ' + _this.target_container );
18341997
18351998 if ( mediaType == 'image' ) {
18361999 _this.loadHighQualityImage(
1837 - resource,
1838 - { 'width': maxWidth },
 2000+ resource, {
 2001+ 'width': width
 2002+ },
18392003 'rsd_edit_img',
18402004 function( img_src ) {
1841 - $j( '.loading_spinner' ).remove();
 2005+ $j( '.loading_spinner' ).remove();
18422006 $j( '<img />' )
18432007 .attr( {
1844 - id: 'rsd_edit_img',
1845 - src: img_src
 2008+ 'id' : 'rsd_edit_img',
 2009+ 'src' : img_src
18462010 } )
1847 - .appendTo( '#clip_edit_disp' );
1848 -
 2011+ .appendTo( '#clip_edit_disp' );
18492012 }
18502013 );
18512014 }
@@ -1872,6 +2035,7 @@
18732036 * @param {Function} callback the function to be calle once the image is loaded
18742037 */
18752038 loadHighQualityImage: function( resource, size, target_img_id, callback ) {
 2039+ mw.log( "loadHighQualityImage" );
18762040 // Get the high quality image url:
18772041 resource.pSobj.getImageObj( resource, size, function( imObj ) {
18782042 resource['edit_url'] = imObj.url;
@@ -1880,31 +2044,20 @@
18812045 // Update the resource
18822046 resource['width'] = imObj.width;
18832047 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+
19002053 // Don't swap it in until its loaded
19012054 var img = new Image();
19022055 // Load the image
19032056 $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 );
19092062 } );
19102063 },
19112064
@@ -2526,7 +2679,7 @@
25272680 // Initiate a upload object ( similar to url copy ):
25282681 // ( mvBaseUploadInterface handles upload errors )
25292682 var uploader = new mw.BaseUploadInterface( {
2530 - 'api_url' : _this.upload_api_target,
 2683+ 'apiUrl' : _this.upload_api_target,
25312684 'done_upload_cb':function() {
25322685 mw.log( 'doApiImport:: run callback::' );
25332686 // We have finished the upload:
@@ -2849,10 +3002,10 @@
28503003 'href' : provider.homepage,
28513004 'target' : '_new'
28523005 } )
2853 - .text( gM( 'rsd-' + this.current_provider + '-title' ) )
2854 - )
 3006+ .append( gM( 'rsd-' + provider.id + '-title' ) )
 3007+ );
28553008
2856 - var $searchContent = $j( '<span />' ).html(resultsFromMsg);
 3009+ var $searchContent = $j( '<span />' ).html( resultsFromMsg );
28573010 var $searchDescription = $j( '<span />' ).addClass( 'rsd_search_description' )
28583011 .attr({
28593012 id: 'rsd_search_description'
@@ -2861,6 +3014,7 @@
28623015
28633016 return $searchDescription;
28643017 },
 3018+
28653019 /**
28663020 * Results Header controls like box vs list view
28673021 * & search description
@@ -2991,7 +3145,7 @@
29923146 if ( this.current_provider == 'upload' ) {
29933147 this.showUploadTab();
29943148 } else {
2995 - // update the search results:
 3149+ // Update the search results:
29963150 this.updateResults();
29973151 }
29983152 },
@@ -3003,7 +3157,7 @@
30043158 setDisplayMode: function( mode ) {
30053159 mw.log( 'setDisplayMode:' + mode );
30063160 this.displayMode = mode;
3007 - // run /update search display:
3008 - this.showResults();
 3161+ // Run / update search display:
 3162+ this.showResults( );
30093163 }
30103164 };
\ No newline at end of file
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js
@@ -37,7 +37,7 @@
3838
3939 var default_bui_options = {
4040 // Target api to upload to
41 - 'api_url' : null,
 41+ 'apiUrl' : null,
4242
4343 // The selected form
4444 'form' : null,
@@ -128,9 +128,9 @@
129129 options = {};
130130 $j.extend( this, default_bui_options, options );
131131
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();
135135 }
136136
137137 // We can't pass around actual function refrences since sometimes the interface
@@ -145,7 +145,7 @@
146146 // Setup ui uploadHandler pointer
147147 this.ui.uploadHandler = this;
148148
149 - mw.log( "init mvUploadHandler:: " + this.api_url + ' interface: ' + this.ui );
 149+ mw.log( "init mvUploadHandler:: " + this.apiUrl + ' interface: ' + this.ui );
150150 },
151151
152152 /**
@@ -255,8 +255,8 @@
256256 } else if ( !_this.isCopyUpload() ) {
257257 callback( 'post' );
258258 } 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 ) {
261261 mw.log( 'Error: can\'t autodetect mode without api url' );
262262 return;
263263 }
@@ -265,7 +265,7 @@
266266 _this.upload_mode = 'detect_in_progress';
267267
268268 // 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 ) {
270270 if ( typeof data.paraminfo == 'undefined'
271271 || typeof data.paraminfo.modules == 'undefined' )
272272 {
@@ -326,9 +326,9 @@
327327 remapFormToApi: function() {
328328 var _this = this;
329329 //
330 - mw.log("remapFormToApi:: " + this.api_url + ' form: ' + this.form);
 330+ mw.log("remapFormToApi:: " + this.apiUrl + ' form: ' + this.form);
331331
332 - if ( !this.api_url ) {
 332+ if ( !this.apiUrl ) {
333333 mw.log( 'Error: no api url target' );
334334 return false;
335335 }
@@ -336,7 +336,7 @@
337337
338338 // Set the form action
339339 try {
340 - $form.attr('action', _this.api_url);
 340+ $form.attr('action', _this.apiUrl);
341341 } catch( e ) {
342342 mw.log( "IE sometimes errors out when you change the action" );
343343 }
@@ -576,7 +576,7 @@
577577 }
578578
579579 // Add the edit token (if available)
580 - if( !_this.editToken && _this.api_url ) {
 580+ if( !_this.editToken && _this.apiUrl ) {
581581 mw.log( 'Error:doHttpUpload: missing token' );
582582 } else {
583583 request['token'] =_this.editToken;
@@ -586,7 +586,7 @@
587587 _this.action_done = false;
588588
589589 // Do the api request:
590 - mw.getJSON(_this.api_url, request, function( data ) {
 590+ mw.getJSON(_this.apiUrl, request, function( data ) {
591591 _this.processApiResult( data );
592592 });
593593 },
@@ -621,7 +621,7 @@
622622 onAjaxUploadStatusTimer: function() {
623623 var _this = this;
624624 //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 ) {
626626 _this.onAjaxUploadStatusResponse( data );
627627 } );
628628 },
@@ -782,7 +782,7 @@
783783 'comment' : _this.getUploadDescription()
784784 };
785785 //run the upload from stash request
786 - mw.getJSON(_this.api_url, request, function( data ) {
 786+ mw.getJSON(_this.apiUrl, request, function( data ) {
787787 _this.processApiResult( data );
788788 } );
789789 } else {
@@ -826,7 +826,7 @@
827827 * @selector (jquery selector) The target destination name to check for conflits
828828 * @param {Object} options Options that define:
829829 * warn_target target for display of warning
830 - * api_url Api url to check for destination
 830+ * apiUrl Api url to check for destination
831831 */
832832 $.fn.doDestCheck = function( options ) {
833833 var _this = this;
@@ -837,8 +837,8 @@
838838 options.warn_target = '#wpDestFile-warning';
839839 }
840840
841 - if( ! options.api_url ) {
842 - options.api_url = mw.getLocalApiUrl();
 841+ if( ! options.apiUrl ) {
 842+ options.apiUrl = mw.getLocalApiUrl();
843843 }
844844
845845 // Add the wpDestFile-warning row ( if in mediaWiki upload page )
@@ -872,7 +872,7 @@
873873 };
874874
875875 // 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 ) {
877877 // Remove spinner
878878 $j( '#mw-spinner-wpDestFile' ).remove();
879879
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/kalturaSearch.js
@@ -244,7 +244,7 @@
245245 }
246246
247247 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 ) {
249249 _this.addResults( data );
250250 callback( 'ok' );
251251 } );
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/mediaWikiSearch.js
@@ -47,7 +47,7 @@
4848 'iiurlwidth': parseInt( this.rsd.thumb_width ),
4949 'rvprop':'content'
5050 }
51 - mw.getJSON(this.provider.api_url, request, function( data ) {
 51+ mw.getJSON(this.provider.apiUrl, request, function( data ) {
5252 // check for redirect
5353 for ( var i in data.query.pages ) {
5454 var page = data.query.pages[i];
@@ -76,15 +76,15 @@
7777 * @param {String} user Name of the user
7878 * @param {Function} callback Function to call once user upload list has been populated
7979 */
80 - getUserRecentUploads: function( user, callback ) {
 80+ getUserRecentUploads: function( user, callback, timeoutCallback ) {
8181 var _this = this;
8282 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
8787 };
88 - mw.getJSON( this.provider.api_url, request, function( data ) {
 88+ mw.getJSON( this.provider.apiUrl, request, function( data ) {
8989 var titleSet = { };
9090 var titleStr = ''
9191 var pound = '';
@@ -108,13 +108,13 @@
109109 'iiurlwidth': parseInt( _this.rsd.thumb_width ),
110110 'rvprop':'content'
111111 };
112 - mw.getJSON( _this.provider.api_url, resourceQuery, function( data ) {
 112+ mw.getJSON( _this.provider.apiUrl, resourceQuery, function( data ) {
113113 _this.clearResults();
114114 _this.addResults( data );
115115 if ( callback )
116116 callback();
117117 } );
118 - } );
 118+ }, timeoutCallback );
119119 },
120120
121121 /**
@@ -144,7 +144,7 @@
145145 };
146146
147147 // Do the api request:
148 - mw.getJSON( this.provider.api_url, request, function( data ) {
 148+ mw.getJSON( this.provider.apiUrl, request, function( data ) {
149149 // Add result data:
150150 _this.addResults( data );
151151 callback();
@@ -174,6 +174,7 @@
175175 if ( typeof data['query-continue'].search != 'undefined' )
176176 this.more_results = true;
177177 }
 178+
178179 // Make sure we have pages to iterate:
179180 if ( data.query && data.query.pages ) {
180181 for ( var page_id in data.query.pages ) {
@@ -267,7 +268,7 @@
268269 }
269270 } else {
270271 mw.log( 'no results:' + data );
271 - }
 272+ }
272273 },
273274
274275 /*
@@ -289,10 +290,12 @@
290291 * @param {Object} size Requested size: .width and .height
291292 * @param {Function} callbcak Function to be called once image has been reqeusted
292293 */
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' ){
295297 return callback( { 'url':resource.src, 'poster' : resource.url } );
296 -
 298+ }
 299+
297300 // This could be depreciated if thumb.php support is standard
298301 var request = {
299302 'action':'query',
@@ -301,13 +304,13 @@
302305 'prop':'imageinfo',
303306 'iiprop':'url|size|mime'
304307 }
 308+
305309 // Set the width:
306 - if ( size.width )
 310+ if ( size.width ) {
307311 request['iiurlwidth'] = size.width;
308 -
309 - mw.log( 'going to do req: ' + this.provider.api_url + ' ' + resource.titleKey );
 312+ }
310313
311 - mw.getJSON( this.provider.api_url, request, function( data ) {
 314+ mw.getJSON( this.provider.apiUrl, request, function( data ) {
312315 var imObj = { };
313316 for ( var page_id in data.query.pages ) {
314317 if( page_id == -1 ) {
@@ -316,11 +319,15 @@
317320 }
318321
319322 var iminfo = data.query.pages[ page_id ].imageinfo[0];
320 - // store the original width:
 323+
 324+ // Store the original width:
321325 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+ {
325332 imObj['url'] = iminfo.url;
326333 imObj['width'] = iminfo.width;
327334 imObj['height'] = iminfo.height;
@@ -329,7 +336,8 @@
330337 imObj['width'] = iminfo.thumbwidth;
331338 imObj['height'] = iminfo.thumbheight;
332339 }
333 - }
 340+ }
 341+
334342 mw.log( 'getImageObj: get: ' + size.width + ' got url:' + imObj.url );
335343 callback( imObj );
336344 } );
@@ -340,7 +348,7 @@
341349 *
342350 * @param {Object} resource Resource to get description of.
343351 */
344 - getInlineDescWiki:function( resource ) {
 352+ getInlineDescWiki: function( resource ) {
345353 var desc = this.parent_getInlineDescWiki( resource );
346354
347355 // 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 @@
3939 getProviderResults: function( search_query, callback ) {
4040
4141 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 );
4343
4444
4545 // For now force (Ogg video) & url based license
@@ -55,7 +55,7 @@
5656 'page' : page_number,
5757 'xmlsearch' : 'Search'
5858 }
59 - mw.getJSON( this.provider.api_url + '?json.wrf=?', request, function( data ) {
 59+ mw.getJSON( this.provider.apiUrl + '?json.wrf=?', request, function( data ) {
6060 _this.addResults( data );
6161 callback( 'ok' );
6262 } );
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/metavidSearch.js
@@ -37,7 +37,7 @@
3838 mw.log( 'metavidSearch::getProviderResults()' );
3939
4040 // Process all options
41 - var url = this.provider.api_url;
 41+ var url = this.provider.apiUrl;
4242 var request = $j.extend( {}, this.defaultReq );
4343 request[ 'f[0][t]' ] = 'match';
4444 request[ 'f[0][v]' ] = search_query;
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/searchLibs/flickrSearch.js
@@ -67,7 +67,7 @@
6868 'text': search_query,
6969 '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'
7070 }
71 - $j.getJSON( this.provider.api_url + '?jsoncallback=?', request, function( data ) {
 71+ $j.getJSON( this.provider.apiUrl + '?jsoncallback=?', request, function( data ) {
7272 _this.addResults( data );
7373 callback( 'ok' );
7474 } );
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js
@@ -36,7 +36,7 @@
3737 'done_upload_cb': false,
3838
3939 // The API URL to upload to
40 - 'api_url': null,
 40+ 'apiUrl': null,
4141
4242 // True when a file is uploaded without re-encoding
4343 'passthrough': false,
@@ -152,8 +152,8 @@
153153 if ( !options )
154154 options = {};
155155
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 )
158158 options.upload_mode = 'post';
159159
160160 // Set options
@@ -932,7 +932,7 @@
933933 }
934934
935935 // 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 ) {
937937 if( !editToken || editToken == '+\\' ) {
938938 _this.ui.setPrompt( gM( 'fogg-badtoken' ), gM( 'fogg-badtoken' ) );
939939 return false;
@@ -960,9 +960,9 @@
961961 function /* onDone */ () {
962962 var uploadRequest = _this.getUploadApiRequest();
963963
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 ) );
965965
966 - _this.fogg.post( _this.api_url, 'file', JSON.stringify( uploadRequest ) );
 966+ _this.fogg.post( _this.apiUrl, 'file', JSON.stringify( uploadRequest ) );
967967
968968 _this.doUploadStatus();
969969 }
@@ -1040,9 +1040,9 @@
10411041 var uploadRequest = this.getUploadApiRequest( { 'enable_chunks' : true } );
10421042
10431043 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 ) );
10451045 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,
10471047 JSON.stringify( uploadRequest ) );
10481048
10491049 // Start polling the upload status
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js
@@ -26,8 +26,9 @@
2727 'api_target' : false,
2828 'ondone_callback' : null
2929 };
 30+mw.UploadForm = { };
3031
31 -( function( mw.UploadForm ) {
 32+( function( $ ) {
3233 /**
3334 * Add a upload target selection menu
3435 * with binding to build update form target
@@ -51,7 +52,7 @@
5253 for( var i in options.uploadTargets ){
5354 var provider = options.uploadTargets[ i ]
5455 $uploadTargetsList.append(
55 - getProviderUploadLinks( provider );
 56+ getProviderUploadLinks( provider )
5657 );
5758 }
5859
@@ -86,7 +87,7 @@
8788 }
8889 // Add the upload form html:
8990 $j( options.target ).html(
90 - getUploadForm( options );
 91+ getUploadForm( options )
9192 );
9293
9394
@@ -120,8 +121,10 @@
121122 fname = path.substring( backslash + 1, 10000 );
122123 }
123124 fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / /g, '_' );
 125+
124126 // Output result
125127 $j( "#wpDestFile" ).val( fname );
 128+
126129 // Do destination check
127130 $j( "#wpDestFile" ).doDestCheck( {
128131 'warn_target':'#wpDestFile-warning'
@@ -144,7 +147,7 @@
145148 mw.load( 'AddMedia.firefogg', function() {
146149 $j( "#wpUploadFile" ).firefogg( {
147150 // An api url (we won't submit directly to action of the form)
148 - 'api_url' : options.api_target,
 151+ 'apiUrl' : options.api_target,
149152
150153 // MediaWiki API supports chunk uploads:
151154 'enable_chunks' : false,
@@ -187,33 +190,37 @@
188191 * Get a provider upload links for local upload and remote
189192 */
190193 function getProviderUploadLinks( provider ){
191 - var api_url = provider.api_url;
 194+ var apiUrl = provider.apiUrl;
192195
193 - $uploadLinks = $j( '<li />' );
 196+ $uploadLinks = $j( '<div />' );
194197
195198 // Upload your own file
196199 $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+ })
203211 )
204 - .click( function(){
205 - mw.log(" do interface for:" + provider.api_url );
206 - });
207212 );
208213
209214 // 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+ )
218225 )
219226 );
220227
@@ -293,12 +300,13 @@
294301 'id' : "wpUploadDescription",
295302 'cols' : "30",
296303 'rows' : "3",
297 - 'name' : "wpUploadDescription"
 304+ 'name' : "wpUploadDescription",
298305 'tabindex' : "3"
299 - } )
 306+ } ),
300307
301308 $j( '<br />' )
302309 );
 310+
303311 // Add watchlist checkbox
304312 $uploadForm.append(
305313 $j('<input />')
@@ -388,5 +396,6 @@
389397 );
390398 return $uploadFrom;
391399 }
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 @@
17551755 'iiprop' : 'url',
17561756 'iiurlwidth': '80'
17571757 };
1758 - mw.getJSON( mw.commons_api_url, request, function( data ) {
 1758+ mw.getJSON( mw.commons_apiUrl, request, function( data ) {
17591759 // empty the videos:
17601760 $j( '#' + _this.id + ' .related_vids ul' ).html( ' ' );
17611761
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js
@@ -23,7 +23,8 @@
2424 "mwe-re-try" : "Retry API request",
2525 "mwe-re-trying" : "Retrying API request...",
2626 "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",
2829 "mwe-remember-loging" : "General security reminder: Only login to web sites when your address bar displays that site's address."
2930 } );
3031
@@ -49,7 +50,9 @@
5051
5152 // Callback function for client requests
5253 var proxyCallback = null;
53 -
 54+
 55+ var proxyTimeoutCallback = null;
 56+
5457 // FrameProxy Flag:
5558 var frameProxyOk = false;
5659
@@ -72,13 +75,15 @@
7376 *
7477 * @param {String} apiUrl Url to the api we want to do the request on.
7578 * @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
7781 */
78 - $.doRequest = function( apiUrl, requestQuery, callback ) {
 82+ $.doRequest = function( apiUrl, requestQuery, callback , callbackTimeout ) {
7983
8084 // Reset local vars:
8185 proxyCallback = false;
8286 frameProxyOk = false;
 87+ proxyTimeoutCallback = false;
8388
8489 // Sanity check:
8590 if ( mw.isLocalDomain( apiUrl ) ) {
@@ -90,13 +95,17 @@
9196
9297 // Set local scope current request
9398 // ( 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+
95101 currentApiReq = requestQuery;
96102 currentServerApiUrl = apiUrl;
97103
98 - // Setup the callback:
 104+ // Setup the callback:
99105 proxyCallback = callback;
100106
 107+ // Setup the timeout callback:
 108+ proxyTimeoutCallback = callbackTimeout;
 109+
101110 // Do the proxy req:
102111 doFrameProxy( requestQuery );
103112 }
@@ -140,8 +149,11 @@
141150 */
142151 $.browseFile = function( options ) {
143152
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;
145156 frameProxyOk = false;
 157+ proxyTimeoutCallback = false;
146158
147159 if( ! options ) {
148160 options = {};
@@ -151,13 +163,13 @@
152164 mw.log( "Error: no target for file browse iframe" ) ;
153165 return false;
154166 }
155 - if( ! options.api_url ) {
 167+ if( ! options.apiUrl ) {
156168 mw.log( "Error: no api url to target" );
157169 return false;
158170 }
159171
160172 // Update the current apiUrl:
161 - currentServerApiUrl = options.api_url;
 173+ currentServerApiUrl = options.apiUrl;
162174
163175 if( ! options.width ) {
164176 options.width = 270;
@@ -184,7 +196,7 @@
185197 'persist' : true,
186198 'style' : frameStyle,
187199 'name' : iFrameName,
188 - 'src' : getServerFrame( options.api_url ),
 200+ 'src' : getServerFrame( options.apiUrl ),
189201 'request' : iFrameRequest,
190202 'target' : options.target
191203 }, function( ) {
@@ -207,7 +219,7 @@
208220 mw.log( 'apiProxy uploadActionHandler:: ' + action );
209221 // Send action to remote frame
210222 mw.ApiProxy.sendServerMsg( {
211 - 'api_url' : options.api_url,
 223+ 'apiUrl' : options.apiUrl,
212224 'frameName' : iFrameName,
213225 'frameMsg' : {
214226 'action' : 'uploadHandlerAction',
@@ -262,12 +274,12 @@
263275 * ( such as a hosted browse file or dialog prompt )
264276 *
265277 * @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
267279 * frameName The frame name to send the msg to
268280 * frameMsg The msg object to send to frame
269281 */
270282 $.sendServerMsg = function( options ){
271 - if( !options.api_url || ! options.frameMsg || !options.frameName ){
 283+ if( !options.apiUrl || ! options.frameMsg || !options.frameName ){
272284 mw.log( "Error missing required option");
273285 return false;
274286 }
@@ -284,7 +296,7 @@
285297 // Send the iframe request:
286298 appendIframe( {
287299 'persist' : true,
288 - 'src' : getServerFrame( options.api_url ),
 300+ 'src' : getServerFrame( options.apiUrl ),
289301 'request' : iFrameRequest,
290302 'target' : options.target
291303 }, function( ) {
@@ -490,6 +502,13 @@
491503 * Dialog to send the user if a proxy to the remote server could not be created
492504 */
493505 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+
494513 var buttons = { };
495514 buttons[ gM( 'mwe-re-try' ) ] = function() {
496515 mw.addLoaderDialog( gM( 'mwe-re-trying' ) );
@@ -504,12 +523,28 @@
505524 var login_url = pUri.protocol + '://' + pUri.host;
506525 login_url += pUri.path.replace( 'MediaWiki:ApiProxy', 'Special:UserLogin' );
507526
 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+
508546 mw.addDialog(
509547 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,
514549 buttons
515550 )
516551 }
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/mw.ClipEdit.js
@@ -258,9 +258,9 @@
259259 'rvprop':'content'
260260 };
261261 // get the interface uri from the plObject
262 - var api_url = _this.parentSequence.plObj.interface_url;
 262+ var apiUrl = _this.parentSequence.plObj.interface_url;
263263 // first check
264 - mw.getJSON( api_url, request, function( data ) {
 264+ mw.getJSON( apiUrl, request, function( data ) {
265265 if ( typeof data.query.pages == 'undefined' )
266266 return _this.showEditOptions( target );
267267 for ( var i in data.query.pages ) {
@@ -403,8 +403,8 @@
404404 };
405405 $j( _this.resource.embed ).html( mw.loading_spinner() );
406406
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 ) {
409409 if ( data.parse.text['*'] ) {
410410 // update the target
411411 $j( _this.resource.embed ).html( data.parse.text['*'] );
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -215,24 +215,44 @@
216216 * the user msg.
217217 *
218218 * @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+ *
220223 * @return string
221224 */
222 - mw.getMsg = function( msgKey , args ) {
223 -
 225+ mw.getMsg = function( msgKey , args ) {
 226+
224227 // Check for missing message key
225 - if ( ! messageCache[ msgKey ] )
226 - return '&lt;' + msgKey + '&gt;';
227 -
228 - var ms = mw.lang.msgReplaceArgs( messageCache[ msgKey ], args );
 228+ if ( ! messageCache[ msgKey ] ){
 229+ return '&lt;' + msgKey + '&gt;';
 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+
229248 // A quick check to see if we need to send the msg to the 'parser'
230249 if ( ms.indexOf( '{{' ) === -1 && ms.indexOf( '[' ) === -1 ) {
231250 return ms;
232251 }
233 -
 252+
234253 // Send the msg key through the parser
235254 var pObj = mw.parser( ms );
236 - // return the transformed msg
 255+
 256+ // Return the transformed msg
237257 return pObj.getHTML();
238258 }
239259
@@ -240,41 +260,33 @@
241261 * Swap in an array of values for $1, $2, $n for a given msg key
242262 *
243263 * @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
245265 * @return string
246266 */
247267 mw.lang.msgReplaceArgs = function( message , args ) {
248268 // 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+
273275 // 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 );
276278 }
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+ }
279291 return message;
280292 }
281293
@@ -1346,41 +1358,49 @@
13471359 * mediaWiki JSON a wrapper for jQuery getJSON:
13481360 *
13491361 * The mediaWiki version lets you skip the url part
1350 - * mw.getJSON( [url], data, callback );
 1362+ * mw.getJSON( [url], data, callback, [timeoutCallback] );
13511363 *
13521364 * Lets you assume:
13531365 * url is optional
13541366 * ( 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
13561368 * url param 'action'=>'query' is assumed ( if not set to something else in the "data" param
13571369 * 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
13601371 * automatically will setup apiProxy where needed.
13611372 *
13621373 * @param {Mixed} url or data request
13631374 * @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.
13651378 *
13661379 */
1367 - mw.getJSON = function( arg1, arg2, arg3 ) {
1368 - // Set up the url
 1380+ mw.getJSON = function() {
 1381+ // Set up the url
 1382+
13691383 var url = false;
1370 - url = ( typeof arg1 == 'string' ) ? arg1 : mw.getLocalApiUrl();
 1384+ url = ( typeof arguments[0] == 'string' ) ? arguments[0] : mw.getLocalApiUrl();
13711385
13721386 // Set up the data:
13731387 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];
13771391 }
13781392
13791393 // Setup the callback
13801394 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;
13841400 }
 1401+
 1402+ // Setup the timeoutCallback ( function after callback index )
 1403+ var timeoutCallback = false;
 1404+ timeoutCallback = ( typeof arguments[ cbinx + 1 ] == 'function' ) ? arguments[ cbinx + 1 ] : false;
13851405
13861406 // Make sure we got a url:
13871407 if( !url ) {
@@ -1398,6 +1418,26 @@
13991419 data['format'] = 'json';
14001420 }
14011421
 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+
14021442 mw.log("run getJSON: " + mw.replaceUrlParams( url, data ) );
14031443 // Check if the request requires a "post"
14041444 if( mw.checkRequestPost( data ) ) {
@@ -1405,11 +1445,11 @@
14061446 if( ! mw.isLocalDomain( url ) ) {
14071447 // Load the proxy and issue the request
14081448 mw.load( 'ApiProxy', function() {
1409 - mw.ApiProxy.doRequest( url, data, callback );
 1449+ mw.ApiProxy.doRequest( url, data, myCallback, timeoutCallback);
14101450 });
14111451 }else{
14121452 // Do the request an ajax post
1413 - $j.post( url, data, callback, 'json');
 1453+ $j.post( url, data, myCallback, 'json');
14141454 }
14151455 return ;
14161456 }
@@ -1421,7 +1461,7 @@
14221462 }
14231463 }
14241464 // Pass off the jQuery getJSON request:
1425 - $j.getJSON( url, data, callback );
 1465+ $j.getJSON( url, data, myCallback );
14261466 }
14271467
14281468 /**
@@ -1464,16 +1504,16 @@
14651505 /**
14661506 * Simple api helper to grab an edit token
14671507 *
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)
14691509 * @param {String} title The wiki page title you want to edit
14701510 * @param {callback} callback Function to pass the token to
14711511 */
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:
14741514 if( typeof title == 'function' ) {
14751515 callback = title;
1476 - title = api_url;
1477 - api_url = mw.getLocalApiUrl();
 1516+ title = apiUrl;
 1517+ apiUrl = mw.getLocalApiUrl();
14781518 }
14791519
14801520 mw.log( 'mw:getToken' );
@@ -1482,8 +1522,8 @@
14831523 'prop': 'info',
14841524 'intoken': 'edit',
14851525 'titles': title
1486 - };
1487 - mw.getJSON( api_url, request, function( data ) {
 1526+ };
 1527+ mw.getJSON( apiUrl, request, function( data ) {
14881528 for ( var i in data.query.pages ) {
14891529 if ( data.query.pages[i]['edittoken'] ) {
14901530 if ( typeof callback == 'function' )
@@ -1495,7 +1535,6 @@
14961536 } );
14971537 }
14981538
1499 -
15001539 /**
15011540 * Utility Functions
15021541 */

Status & tagging log