r63371 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63370‎ | r63371 | r63372 >
Date:20:35, 7 March 2010
Author:dale
Status:deferred
Tags:
Comment:
* updated info-template output for uploaded content.
* confirmed working firefogg & non-firefogg path in firefox
Modified paths:
  • /branches/js2-work/phase3/js/editPage.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/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/ApiProxy/mw.ApiProxy.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/loader.js
@@ -89,7 +89,7 @@
9090
9191 // Default request timeout ( for cases where we inlucde js and normal browser timeout can't be used )
9292 // stored in seconds
93 - 'defaultRequestTimeout' : 10,
 93+ 'defaultRequestTimeout' : 20,
9494
9595 // Default user language is "en" Can be overwritten by:
9696 // "uselang" url param
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadHandler.js
@@ -49,10 +49,10 @@
5050 'upload_mode' : 'api',
5151
5252 // Callback for modifying form data on submit
53 - 'onsubmit_cb' : null,
 53+ 'beforeSubmitCb' : null,
5454
5555 // Equivalent to $wgUseCopyrightUpload in php ( should be set via configuration )
56 - 'useCopyrightUpload' : true,
 56+ 'rewriteDescriptionText' : true,
5757
5858 // Callback which is called when the source name changes
5959 'selectFileCb': false
@@ -223,16 +223,14 @@
224224 return true;
225225 }
226226
227 - // Call the onsubmit_cb option if set:
228 - if( this.onsubmit_cb && typeof this.onsubmit_cb == 'function' ) {
229 - this.onsubmit_cb();
 227+ // Call the beforeSubmitCb option if set:
 228+ if( this.beforeSubmitCb && typeof this.beforeSubmitCb == 'function' ) {
 229+ this.beforeSubmitCb();
230230 }
231231
232232 // Remap the upload form to the "api" form:
233 - this.remapFormToApi();
 233+ this.remapFormToApi();
234234
235 -
236 -
237235 mw.log(" about to run onSubmit try / catch: detectUploadMode" );
238236 // Put into a try catch so we are sure to return false:
239237 try {
@@ -251,6 +249,7 @@
252250 _this.upload_mode = mode;
253251 _this.doUpload();
254252 } );
 253+
255254 } catch( e ) {
256255 mw.log( '::error in this.ui or doUpload ' + e );
257256 }
@@ -497,9 +496,9 @@
498497 // Else try with the form name:
499498 comment_value = $j( "[name='comment']").val();
500499 }
501 - mw.log( 'getUploadDescription:: base:' + comment_value + ' ucr:' + this.useCopyrightUpload );
 500+ mw.log( 'getUploadDescription:: base:' + comment_value + ' ucr:' + this.rewriteDescriptionText );
502501 // Set license, copyStatus, source if available ( generally not available SpecialUpload needs some refactoring )
503 - if ( this.useCopyrightUpload ) {
 502+ if ( this.rewriteDescriptionText ) {
504503 var license = ( $j("[name='wpLicense']").length ) ? $j("[name='wpLicense']").val() : '';
505504 var copyStatus = ( $j("[name='wpUploadCopyStatus']" ).length ) ? $j("[name='wpUploadCopyStatus']" ).val() : '';
506505 var source = ( $j("[name='wpSource']").length ) ? $j("[name='wpSource']").val() : '';
@@ -513,7 +512,7 @@
514513
515514 /**
516515 * Get the comment text ( port of getInitialPageText from SpecialUpload.php
517 - * We only copy part of the check where useCopyrightUpload is enabled as
 516+ * We only copy part of the check where rewriteDescriptionText is enabled as
518517 * to not conflict with other js rewrites.
519518 *
520519 * @param {String} comment Comment string
@@ -532,7 +531,7 @@
533532 licensetxt;
534533 }
535534 if( source ){
536 - pageText += '== ' + gM( 'filesource' ) + " ==\n" . source ;
 535+ pageText += '== ' + gM( 'filesource' ) + " ==\n" + source ;
537536 }
538537 return pageText;
539538 },
@@ -735,20 +734,18 @@
736735 // Async upload, do AJAX status polling
737736 _this.upload_session_key = apiRes.upload.upload_session_key;
738737 _this.doAjaxUploadStatus();
739 - mw.log( "set upload_session_key: " + _this.upload_session_key );
 738+ mw.log( "Set upload_session_key: " + _this.upload_session_key );
740739 return true;
741740 }
742741
743742 if ( apiRes.upload && apiRes.upload.imageinfo && apiRes.upload.imageinfo.descriptionurl ) {
744743 // Call the completion callback if available.
745744 if ( typeof _this.doneUploadCb == 'function' ) {
746 - // check if the callback returns true and close up shop
747 - if( _this.doneUploadCb( apiRes ) ){
 745+ _this.doneUploadCb( apiRes )
748746 // Close the ui
749747 _this.ui.close();
750748 return true;
751 - }
752 - }
 749+ }
753750 // Else pass off the api Success to interface:
754751 _this.ui.showApiSuccess( apiRes );
755752 return true;
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/loader.js
@@ -31,11 +31,23 @@
3232 "kalturaSearch" : "modules/AddMedia/searchLibs/kalturaSearch.js"
3333 });
3434
35 - /**
36 - * Note: We should move relevant parts of these style sheets to the addMedia/css folder
37 - * phase 2: We should separate out sheet sets per sub-module:
38 - */
 35+ // Upload form includes "datapicker"
 36+ mw.addModuleLoader( 'AddMedia.UploadForm', function( callback ){
 37+ var request = [
 38+ [
 39+ 'mw.UploadForm',
 40+ '$j.ui'
 41+ ],
 42+ [
 43+ '$j.ui.datepicker'
 44+ ]
 45+ ];
 46+ mw.load( request , function() {
 47+ callback( 'AddMedia.UploadForm' );
 48+ } );
 49+ })
3950
 51+
4052 //Setup the addMediaWizard module
4153 mw.addModuleLoader( 'AddMedia.addMediaWizard', function( callback ) {
4254 // Load all the required libs:
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.Firefogg.js
@@ -99,9 +99,10 @@
100100 */
101101 ( function( $ ) {
102102 $.fn.firefogg = function( options ) {
103 - if ( !options )
 103+ if ( !options ){
104104 options = { };
105 -
 105+ }
 106+
106107 // Add the selector
107108 options[ 'selector' ] = this.selector;
108109
@@ -183,7 +184,7 @@
184185 this.showInstallFirefog();
185186 return ;
186187 }
187 - if( console.firebug ) {
 188+ if( typeof console != 'undefined' && console.firebug ) {
188189 this.appendFirebugWarning();
189190 }
190191 mw.log( "installCheckMode no firefogg init");
@@ -1225,12 +1226,11 @@
12261227 this.action_done = true;
12271228 // Call the callback
12281229 if ( typeof _this.doneUploadCb == 'function' ) {
1229 - // check if the callback returns true and close up shop
1230 - if( _this.doneUploadCb( apiRes ) ){
1231 - _this.ui.close();
1232 - return true;
1233 - }
1234 - }
 1230+ _this.doneUploadCb( apiRes )
 1231+ // Close the ui
 1232+ _this.ui.close();
 1233+ return true;
 1234+ }
12351235 // Else pass off the api Success to interface:
12361236 _this.ui.showApiSuccess( apiResult );
12371237 return true;
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js
@@ -9,7 +9,10 @@
1010 "mwe-license_cc-by-sa" : "Creative Commons Share Alike (3.0)",
1111 "mwe-upload" : "Upload file",
1212 "mwe-destfilename" : "Destination filename:",
 13+
1314 "mwe-summary" : "Summary",
 15+ "mwe-date-of-work" : "Date of the work",
 16+
1417 "mwe-error_not_loggedin" : "You do not appear to be logged in or do not have upload privileges.",
1518
1619 "mwe-error-not-loggedin-file" : "You do not appear to be logged in or there was an error in the software. You can $1 and try again",
@@ -161,6 +164,8 @@
162165
163166 // MediaWiki API supports chunk uploads:
164167 'enable_chunks' : false,
 168+ // We manually rewrite our description text
 169+ 'rewriteDescriptionText' : false,
165170
166171 'form_selector' : '#suf_upload',
167172
@@ -174,31 +179,41 @@
175180 'warn_target' : "#wpDestFile-warning"
176181 } );
177182 },
178 - 'onsubmit_cb' : function( ) {
179 - // Update with basic info template:
180 - // TODO: it would be nice to have a template generator class
181 - var desc = $j('#wpUploadDescription').val();
182 -
183 - // Update the template if the user does not already have template code:
184 - if( desc.indexOf('{{Information') == -1) {
185 - $j('#wpUploadDescription').val(
186 -'== {{int:filedesc}} ==' + "\n" +
187 -'{{Information' + "\n" +
188 -'|Description={{en|' + desc + "\n}}\n" +
189 -'|Author=[[User:' + wgUserName + '|' + wgUserName + ']]' + "\n" +
190 -'|Source=' + "\n" +
191 -'|Date=' + "\n" +
192 -'|Permission=' + "\n" +
193 -'|other_versions=' + "\n" +
194 -'}}' + "\n" +
195 -'{{self|cc-by-sa-3.0}}' + "\n"
196 - );
197 - }
 183+ 'beforeSubmitCb' : function( ) {
 184+ buildAssetDescription();
198185 }
199186 } );
200187 });
201188 }
202189 /**
 190+ * Build the Asset Description info template
 191+ * and update the wpUploadDescription value
 192+ */
 193+ function buildAssetDescription(){
 194+ // Update with basic info template:
 195+ // TODO: it would be nice to have a template generator class
 196+ // this is basicaly a simple version of the commons form hack
 197+ var desc = $j('#comment-desc').val();
 198+ var date = $j('#comment-date').val();
 199+
 200+ // Update the template if the user does not already have template code:
 201+ if( desc.indexOf('{{Information') == -1) {
 202+ $j('#wpUploadDescription').val(
 203+ '== {{int:filedesc}} ==' + "\n" +
 204+ '{{Information' + "\n" +
 205+ '|Description={{en|' + desc + "\n}}\n" +
 206+ '|Author=[[User:' + wgUserName + '|' + wgUserName + ']]' + "\n" +
 207+ '|Source=' + "\n" +
 208+ '|Date=' + date + "\n" +
 209+ '|Permission=' + "\n" +
 210+ '|other_versions=' + "\n" +
 211+ '}}' + "\n" +
 212+ '== {{int:license}} ==' + "\n" +
 213+ '{{self|cc-by-sa-3.0}}' + "\n"
 214+ );
 215+ }
 216+ }
 217+ /**
203218 * Setup a fileBrowse proxy for a given target
204219 */
205220 function setupApiFileBrowseProxy ( options ) {
@@ -233,6 +248,7 @@
234249 'warn_target': '#file-warning'
235250 } );
236251 },
 252+
237253 // Timeout callback
238254 'timeoutCb' : function(){
239255 mw.log("timed out in setting up setupApiFileBrowseProxy");
@@ -248,7 +264,19 @@
249265 } );
250266
251267 // Setup submit binding:
252 - $j('#wpUploadBtn').click( function(){
 268+ $j('#wpUploadBtn').click( function(){
 269+
 270+ // Update the asset description:
 271+ buildAssetDescription();
 272+
 273+ // Dissable upload button and add loader:
 274+ $j( '#wpUploadBtn' )
 275+ .attr( 'disabled', 'disabled' )
 276+ .before(
 277+ $j('<span />').loadingSpinner()
 278+ );
 279+
 280+
253281 // Build the output and send upload request to fileProxy
254282 mw.ApiProxy.sendServerMsg( {
255283 'apiUrl' : options.apiUrl,
@@ -262,8 +290,7 @@
263291 'ignorewarnings': ($j('#wpIgnoreWarning' ).is( ':checked' ) ) ? 'true' : 'false'
264292 }
265293 }
266 - } );
267 - // Maybe set loading to spinner
 294+ } );
268295 } );
269296
270297 // Overwide the form submit:
@@ -317,7 +344,7 @@
318345 "doneUploadCb" : function( resultData ) {
319346 if( !resultData || ! resultData.upload || ! resultData.upload['filename']){
320347 mw.log( "Error in upload form no upload data in done Upload callback ");
321 - return false;
 348+ return true;
322349 }
323350 var wTitle = resultData.upload['filename'];
324351 mw.log( 'uploadForm: doneUploadCb : '+ wTitle);
@@ -331,8 +358,8 @@
332359 // Pull up resource editor:
333360 remoteSearchDriver.showResourceEditor( resource );
334361 } );
335 - // Return false to close progress window:
336 - return false;
 362+ // Return true to close progress window:
 363+ return true;
337364 }
338365 } );
339366
@@ -497,7 +524,7 @@
498525 $j( '<br />' ),
499526 $j( '<label />' )
500527 .attr({
501 - 'for' : "wpUploadDescription"
 528+ 'for' : "comment-desc"
502529 })
503530 .text( gM( 'mwe-summary' ) ),
504531
@@ -505,16 +532,65 @@
506533
507534 $j( '<textarea />' )
508535 .attr( {
509 - 'id' : "wpUploadDescription",
 536+ 'id' : "comment-desc",
510537 'cols' : "30",
511538 'rows' : "3",
512 - 'name' : "wpUploadDescription",
 539+ 'name' : "comment-desc",
513540 'tabindex' : "3"
514541 } ),
515542
516543 $j( '<br />' )
517544 );
 545+ // Add the hidden wpUploadDescription
 546+ $uploadForm.append(
 547+ $j( '<input />' )
 548+ .attr( {
 549+ 'id' : "wpUploadDescription",
 550+ 'type' : "hidden",
 551+ 'name' : "wpUploadDescription"
 552+ } )
 553+ .val('')
 554+ )
518555
 556+ //Add date of work
 557+ $uploadForm.append(
 558+ $j( '<label />' )
 559+ .attr({
 560+ 'for' : "comment-date"
 561+ })
 562+ .text( gM( 'mwe-date-of-work' ) ),
 563+
 564+ $j( '<br />' ),
 565+
 566+ $j( '<input />' )
 567+ .attr( {
 568+ 'id' : "comment-date",
 569+ 'size' : 15,
 570+ 'name' : "comment-date",
 571+ 'tabindex' : "4"
 572+ } )
 573+ .datepicker({
 574+ changeMonth: true,
 575+ changeYear: true,
 576+ verticalOffset: 40,
 577+ dateFormat: 'yy-mm-dd',
 578+ onSelect: function( dateText ) {
 579+ $j( this ).val( dateText );
 580+ },
 581+ beforeShow: function() {
 582+ $j('#ui-datepicker-div').css({
 583+ 'z-index': 10001
 584+ });
 585+ return true;
 586+ }
 587+ }),
 588+
 589+ $j( '<br />' )
 590+ )
 591+
 592+
 593+
 594+
519595 // Add watchlist checkbox
520596 $uploadForm.append(
521597 $j('<input />')
@@ -523,7 +599,7 @@
524600 'value' : 'true',
525601 'id' : 'wpWatchthis',
526602 'name' : 'watch',
527 - 'tabindex' : 7
 603+ 'tabindex' : "5"
528604 }),
529605
530606 $j( '<label />' )
@@ -541,7 +617,7 @@
542618 'value' : "true",
543619 'id' : "wpIgnoreWarning",
544620 'name' : "ignorewarnings",
545 - 'tabindex' : "8"
 621+ 'tabindex' : "6"
546622 } ),
547623
548624 $j( '<label />' )
@@ -600,7 +676,7 @@
601677 'value' : gM( 'mwe-upload' ),
602678 'name' : "wpUploadBtn",
603679 'id' : "wpUploadBtn",
604 - 'tabindex' : "9"
 680+ 'tabindex' : "7"
605681 })
606682 );
607683
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js
@@ -1043,13 +1043,11 @@
10441044 // Show the upload form (use the standard module AddMedia.firefogg
10451045 // This way we get a high cache hit rate by using a general module
10461046 // and not grouping mw.UploadForm into the upload code set
1047 - mw.load( 'AddMedia.firefogg', function() {
1048 - mw.load( 'mw.UploadForm', function() {
1049 - var provider = _this.content_providers[ 'this_wiki' ];
1050 - // Load this_wiki search system to grab the resource
1051 - _this.loadSearchLib( provider, function() {
1052 - _this.showUploadForm( provider );
1053 - } );
 1047+ mw.load( [ 'AddMedia.firefogg', 'AddMedia.UploadForm' ], function() {
 1048+ var provider = _this.content_providers[ 'this_wiki' ];
 1049+ // Load this_wiki search system to grab the resource
 1050+ _this.loadSearchLib( provider, function() {
 1051+ _this.showUploadForm( provider );
10541052 } );
10551053 } );
10561054 },
@@ -2405,7 +2403,7 @@
24062404 }
24072405
24082406 // Load the preview text:
2409 - _this.parse(
 2407+ mw.parseWikiText(
24102408 description, _this.canonicalFileNS + ':' + resource.target_resource_title,
24112409 function( descHtml ) {
24122410 $j( '#rsd_import_desc' ).html( descHtml );
@@ -2419,12 +2417,12 @@
24202418 mw.log( " Do preview asset update" );
24212419 $j( '#rsd_import_desc' ).html( mw.loading_spinner() );
24222420 // load the preview text:
2423 - _this.parse(
 2421+ mw.parseWikiText(
24242422 $j( '#wpUploadDescription' ).val(),
24252423 _this.canonicalFileNS + ':' + resource.target_resource_title,
2426 - function( o ) {
 2424+ function( parseHtml ) {
24272425 mw.log( 'got updated preview: ' );
2428 - $j( '#rsd_import_desc' ).html( o );
 2426+ $j( '#rsd_import_desc' ).html( parseHtml );
24292427 }
24302428 );
24312429 return false;
@@ -2795,9 +2793,9 @@
27962794 var embed_code = _this.getEmbedCode( resource );
27972795 var pos = $j( _this.target_textbox ).textSelection( 'getCaretPosition' );
27982796 var editWikiText = $j( _this.target_textbox ).val();
2799 - var parseText = editWikiText.substr(0, pos) + embed_code + editWikiText.substr( pos );
2800 - _this.parse(
2801 - parseText,
 2797+ var wikiText = editWikiText.substr(0, pos) + embed_code + editWikiText.substr( pos );
 2798+ mw.parseWikiText(
 2799+ wikiText,
28022800 _this.target_title,
28032801 function( phtml ) {
28042802 $j( '#rsd_preview_display' ).html( phtml );
@@ -2826,28 +2824,9 @@
28272825 } else {
28282826 return resource.pSobj.getEmbedWikiCode( resource );
28292827 }
2830 - },
 2828+ },
28312829
28322830 /**
2833 - * issues the wikitext parse call
2834 - *
2835 - * @param {String} wikitext Wiki Text to be parsed by mediaWiki api call
2836 - * @param {String} title Context title of the content to be parsed
2837 - * @param {Function} callback Function called with api parser output
2838 - */
2839 - parse: function( wikitext, title, callback ) {
2840 - mw.getJSON( mw.getLocalApiUrl(),
2841 - {
2842 - 'action': 'parse',
2843 - 'title' : title,
2844 - 'text': wikitext
2845 - }, function( data ) {
2846 - callback( data.parse.text['*'] );
2847 - }
2848 - );
2849 - },
2850 -
2851 - /**
28522831 * Insert a resource
28532832 *
28542833 * Calls updateTextArea with the passed resource
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js
@@ -101,12 +101,8 @@
102102 if( !options.token ){
103103 mw.log( "Error: no token for file browse ");
104104 return false;
105 - }
 105+ }
106106
107 - mw.log( "browseFile:: " + $j(options.target).length );
108 -
109 - mw.log( "BROWSE FILE:: cb: " + options.doneUploadCb);
110 -
111107 if( ! options.apiUrl ) {
112108 mw.log( "Error: no api url to target" );
113109 return false;
@@ -239,9 +235,9 @@
240236 }
241237
242238 //Setup a new context
243 - var context = createContext({
 239+ var context = createContext( {
244240 'apiUrl' : options.apiUrl
245 - });
 241+ } );
246242
247243 // Send a msg to the server frameName from the server domain
248244 // Setup an object to be packaged into the frame
@@ -388,12 +384,19 @@
389385 /**
390386 * Get the client frame path
391387 */
392 - function getClientFrame( context ) {
 388+ function getClientFrame( context ) {
393389 // Check if the mwEmbed is on the same server as we are
394390 if( mw.isLocalDomain( mw.getMwEmbedPath() ) ){
395391 return mw.getMwEmbedPath() + 'modules/ApiProxy/NestedCallbackIframe.html';
396 - } else {
397 - // Use the nested callback function
 392+ } else {
 393+ // Use the nested callback function ( server frame point back )
 394+ nestedServerFrame = getServerFrame( {
 395+ 'apiUrl' : mw.getLocalApiUrl(),
 396+ 'pageName' : 'ApiProxyNestedCb'
 397+ } );
 398+
 399+ // Update the context to include the nestedCallbackFlag flag in the request
 400+ return nestedServerFrame;
398401 }
399402 }
400403
@@ -421,8 +424,10 @@
422425 }
423426 var parsedUrl = mw.parseUri( context.apiUrl );
424427
 428+ var pageName = ( context.pageName ) ? context.pageName : 'ApiProxy'
 429+
425430 return parsedUrl.protocol + '://' + parsedUrl.authority
426 - + '/w/index.php/MediaWiki:ApiProxy' + gadgetWithJS;
 431+ + '/w/index.php/MediaWiki:' + pageName + gadgetWithJS;
427432 }
428433
429434 /**
@@ -531,11 +536,11 @@
532537 * @param {Object} context
533538 */
534539 function proxyNotReadyTimeout( context ) {
535 - mw.log( 'proxyNotReadyTimeout::' + context[ 'timeoutCb' ]);
 540+ mw.log( "Error:: api proxy timeout " + context.contextKey );
536541
537542 // See if we have a callback function to call ( do not display the dialog )
538543 if( context[ 'timeoutCb' ] && typeof context[ 'timeoutCb' ] == 'function' ) {
539 - context[ 'timeoutCb' ]();
 544+ context[ 'timeoutCb' ] ( );
540545 return true;
541546 }
542547
@@ -546,7 +551,7 @@
547552 doFrameProxy( context );
548553 }
549554 buttons[ gM( 'mwe-cancel' ) ] = function() {
550 - mw.closeLoaderDialog();
 555+ mw.closeLoaderDialog ( );
551556 }
552557
553558 // Setup the login link:
@@ -595,10 +600,15 @@
596601 */
597602 function serverHandleRequest( ) {
598603 var clientRequest = getClientRequest();
599 - mw.log(" handle client request :: " + JSON.stringify( clientRequest ) );
 604+ mw.log(" Handle client request :: " + JSON.stringify( clientRequest ) );
600605 //debugger;
601606 // Process request type:
602 - switch( clientRequest['action'] ){
 607+ switch( clientRequest[ 'action' ] ){
 608+ case 'nestedCallback':
 609+ alert('nestedCallback')
 610+ // pretend this was a nested callback
 611+ return $.nested('');
 612+ break;
603613 case 'browseFile':
604614 return serverBrowseFile();
605615 break;
@@ -781,6 +791,10 @@
782792 'fileName' : fileName
783793 } );
784794 },
 795+
 796+ // Api proxy does not handle descriptionText rewrite
 797+ 'rewriteDescriptionText' : false,
 798+
785799 // Set the doneUploadCb if set in the browseFile options
786800 'doneUploadCb' : function ( apiResult ){
787801 sendClientMsg( {
@@ -862,9 +876,8 @@
863877 if( ! clientRequest.contextKey ) {
864878 mw.log( "Error: missing context key " );
865879 return false;
866 - }
 880+ }
867881
868 -
869882 var nestName = 'NestedFrame_' + $j( 'iframe' ).length;
870883
871884 // Append the iframe to body
@@ -872,7 +885,7 @@
873886 'src' : clientFrame,
874887 'request' : msgObj,
875888 // Client msgs just have the contextKey ( not the full context )
876 - 'context' : {
 889+ 'context' : {
877890 'contextKey' : clientRequest.contextKey
878891 }
879892 } );
@@ -892,10 +905,12 @@
893906 * be removed from the dom after its done loading
894907 */
895908 function appendIframe( options ){
896 -
897 -
898 - var s = '<iframe ';
899 - // check for context
 909+
 910+ // Build out iframe in string since IE throws away attributes of
 911+ // jQuery iframe buildout
 912+ var s = '<iframe ';
 913+
 914+ // Check for context
900915 if( ! options[ 'context' ] ) {
901916 mw.log("Error missing context");
902917 return false;
@@ -911,7 +926,6 @@
912927 if( ! options[ 'name' ] ) {
913928 options[ 'name' ] = 'mwApiProxyFrame_' + $j('iframe').length;
914929 }
915 -
916930
917931 // Add the frame name / id:
918932 s += 'name="' + mw.escapeQuotes( options[ 'name' ] ) + '" ';
@@ -921,16 +935,17 @@
922936 if( ! options['style'] ){
923937 options['style'] = 'display:none';
924938 }
 939+
925940 // Add style attribute:
926941 s += 'style="' + mw.escapeQuotes( options[ 'style' ] ) + '" ';
927942
928943 // Special handler for src and packaged hash request:
929 - if( options.src ){
 944+ if( options.src ) {
930945 s += 'src="' + options.src;
931 - if( options.request ){
932 -
 946+ if( options.request ) {
 947+
933948 // Add the contextKey to the request
934 - options.request[ 'contextKey' ] = context.contextKey;
 949+ options.request[ 'contextKey' ] = context.contextKey;
935950
936951 // Add the escaped version of the request:
937952 s += '#' + encodeURIComponent( JSON.stringify( options.request ) );
@@ -946,26 +961,27 @@
947962 options[ 'target' ] = 'body';
948963 }
949964 var nameTarget = ( typeof options[ 'target' ] == 'string') ? options[ 'target' ] : $j( options[ 'target' ]).length ;
950 - mw.log( "Append iframe:" + options[ 'name' ] + ' to: ' + nameTarget);
 965+ mw.log( "Append iframe:" + options[ 'src' ] + ' to: ' + nameTarget + " \n WITH REQUEST: " + JSON.stringify( options.request ) );
 966+
951967 // Append to target
952 - $j( options['target'] ).append( s );
 968+ $j( options[ 'target' ] ).append( s );
953969
954970 // Setup the onload callback
955 - $j( '#' + options['name'] ).get( 0 ).onload = function() {
 971+ $j( '#' + options[ 'name' ] ).get( 0 ).onload = function() {
956972 if( ! options.persist ){
957973 // Schedule the removal of the iframe
958 - // We don't call it directly since some browsers seem to call "ready"
959 - // before blocking code is done running
 974+ // We don't call remove directly since some browsers seem to call "ready"
 975+ // before blocking javascript code is done running
960976 setTimeout( function() {
961977 $j('#' + options[ 'name' ] ).remove();
962978 }, 10 );
963979 }
964980 };
 981+
965982 // Setupt the timeout check:
966983 setTimeout( function() {
967 - if ( context[ 'proxyLoaded'] === false ) {
 984+ if ( context[ 'proxyLoaded' ] === false ) {
968985 // We timed out no api proxy (should make sure the user is "logged in")
969 - mw.log( "Error:: api proxy timeout" + context.contextKey );
970986 proxyNotReadyTimeout( context );
971987 }
972988 }, mw.getConfig( 'defaultRequestTimeout') * 1000 );
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -1362,6 +1362,24 @@
13631363 }
13641364
13651365 /**
 1366+ * Issues the wikitext parse call
 1367+ *
 1368+ * @param {String} wikitext Wiki Text to be parsed by mediaWiki api call
 1369+ * @param {String} title Context title of the content to be parsed
 1370+ * @param {Function} callback Function called with api parser output
 1371+ */
 1372+ mw.parseWikiText = function( wikitext, title, callback ) {
 1373+ mw.getJSON( mw.getLocalApiUrl(),
 1374+ {
 1375+ 'action': 'parse',
 1376+ 'title' : title,
 1377+ 'text': wikitext
 1378+ }, function( data ) {
 1379+ callback( data.parse.text['*'] );
 1380+ }
 1381+ );
 1382+ }
 1383+ /**
13661384 * mediaWiki JSON a wrapper for jQuery getJSON:
13671385 *
13681386 * The mediaWiki version lets you skip the url part
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js
@@ -4,8 +4,8 @@
55 */
66 var urlparts = getRemoteEmbedPath();
77 var mwEmbedHostPath = urlparts[0];
8 -var mwRemoteVersion = 'r103';
9 -var mwUseScriptLoader = false;
 8+var mwRemoteVersion = 'r104';
 9+var mwUseScriptLoader = true;
1010
1111 // Log the mwRemote version ( will determine what version of js we get )
1212 if( window.console ){
@@ -121,6 +121,10 @@
122122 mw.load( mwEmbedHostPath + '/apiProxyPage.js?' + mwGetReqArgs() );
123123 } );
124124 }
 125+ if ( wgPageName == 'MediaWiki:ApiProxyNestedCb' ) {
 126+ // Note top.mw.ApiProxy.nested frame needs to be on the same domain of course
 127+ top.mw.ApiProxy.nested( window.location.href.split("#")[1] || false );
 128+ }
125129
126130 // OggHandler rewrite for view pages:
127131 var vidIdList = [];
Index: branches/js2-work/phase3/js/editPage.js
@@ -15,8 +15,8 @@
1616 'default_query': wgTitle,
1717 'target_title': wgPageName,
1818
19 - // if the info overlay per asset should be displayed
20 - 'displayResourceInfoIcons' : false,
 19+ // If the info overlay per asset should be displayed
 20+ 'displayResourceInfoIcons' : true,
2121
2222 // If we should display buttons to switch between "box" and "detailed" view
2323 'displayResultFormatButton' : false,

Status & tagging log