r63382 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63381‎ | r63382 | r63383 >
Date:09:40, 8 March 2010
Author:dale
Status:deferred
Tags:
Comment:
* updated gadget include in apiProxy for release
* added IE privacy warning
* language msg update
* fixed IE extra comma in clipEdit.js
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/languages/mwEmbed.i18n.php (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.UploadInterface.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/kplayerEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/skins/common/images/cookies_blocked_MSIE_eye.png (added) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/languages/mwEmbed.i18n.php
@@ -300,6 +300,14 @@
301301 'rsd-search-timeout' => 'The search request did not complete. The server may be down experiencing heavy load. You can try again later',
302302
303303 /*
 304+ * js file: /modules/AddMedia/mw.UploadInterface.js
 305+ */
 306+ 'mwe-upload-in-progress' => 'Upload in progress (do not close this window)',
 307+ 'mwe-uploaded-status' => 'Uploaded',
 308+ 'mwe-uploaded-time-remaining' => 'Time remaining: $1',
 309+ 'mwe-upload-done' => 'Your upload <i>should be</i> accessible.',
 310+
 311+ /*
304312 * js file: /modules/AddMedia/mw.UploadHandler.js
305313 */
306314 'mwe-upload-stats-fileprogress' => '$1 of $2',
@@ -383,6 +391,7 @@
384392 'mwe-upload' => 'Upload file',
385393 'mwe-destfilename' => 'Destination filename:',
386394 'mwe-summary' => 'Summary',
 395+ 'mwe-date-of-work' => 'Date of the work',
387396 'mwe-error_not_loggedin' => 'You do not appear to be logged in or do not have upload privileges.',
388397 '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',
389398 'mwe-link-login' => 'login',
@@ -394,6 +403,7 @@
395404 'mwe-upload-once-done' => 'Please $1. Once you have completed your upload, $2',
396405 'mwe-upload-in-new-win-link' => 'upload in the new window or tab',
397406 'mwe-upload-refresh' => 'refresh your upload list',
 407+ 'mwe-ie-inline-upload' => 'Inline uploading is currently disabled for Internet Exploer. You can $1 then $2',
398408
399409 /*
400410 * js file: /modules/AddMedia/mw.FirefoggGUI.js
Index: branches/js2-work/phase3/js/mwEmbed/skins/common/images/cookies_blocked_MSIE_eye.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: branches/js2-work/phase3/js/mwEmbed/skins/common/images/cookies_blocked_MSIE_eye.png
___________________________________________________________________
Name: svn:mime-type
401411 + application/octet-stream
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadInterface.js
@@ -48,6 +48,10 @@
4949 setup: function( options ) {
5050 var _this = this;
5151
 52+ if( ! options ){
 53+ options = { };
 54+ }
 55+
5256 // Start the "upload" time
5357 this.uploadBeginTime = ( new Date() ).getTime();
5458
@@ -62,7 +66,7 @@
6367 .attr( 'id', "upProgressDialog" )
6468 );
6569
66 - if( typeof options == 'undefined' || !options.title ) {
 70+ if( !options.title ) {
6771 options.title = gM('mwe-upload-in-progress');
6872 }
6973
@@ -255,7 +259,7 @@
256260 };
257261
258262
259 - if ( apiRes.error || ( apiRes.upload && apiRes.upload.result == "Failure" ) ) {
 263+ if ( apiRes && apiRes.error || ( apiRes.upload && apiRes.upload.result == "Failure" ) ) {
260264
261265 // Check a few places for the error code
262266 var error_code = 0;
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.UploadForm.js
@@ -26,7 +26,9 @@
2727 "mwe-upload-not-my-file" : "Upload media that is not my own work to $1",
2828 "mwe-upload-once-done" : "Please $1. Once you have completed your upload, $2",
2929 "mwe-upload-in-new-win-link" : "upload in the new window or tab",
30 - "mwe-upload-refresh" : "refresh your upload list"
 30+ "mwe-upload-refresh" : "refresh your upload list",
 31+
 32+ "mwe-ie-inline-upload" : "Inline uploading is currently disabled for Internet Exploer. You can $1 then $2"
3133 } );
3234
3335 var default_form_options = {
@@ -185,6 +187,7 @@
186188 } );
187189 });
188190 }
 191+
189192 /**
190193 * Build the Asset Description info template
191194 * and update the wpUploadDescription value
@@ -258,8 +261,7 @@
259262 .text( gM('mwe-link-login') )
260263 .attr('attr', options.apiUrl.replace( 'api.php', 'index.php' ) + '?title=Special:UserLogin' )
261264 )
262 - );
263 -
 265+ );
264266 }
265267 } );
266268
@@ -330,6 +332,12 @@
331333 gM( 'mwe-upload-own-file', uploadProvider.title )
332334 )
333335 .click( function( ) {
 336+ // Check for IE ( requires p3p policy and requires more porting work. )
 337+ if( $j.browser.msie ) {
 338+ showUploadInTab( uploadProvider, uploadMenuTarget, "mwe-ie-inline-upload" );
 339+ return false;
 340+ }
 341+
334342 $j( uploadMenuTarget ).empty().loadingSpinner();
335343
336344 // if selectUploadProviderCb is set run the callback
@@ -378,35 +386,7 @@
379387 .text(
380388 gM( 'mwe-upload-not-my-file', uploadProvider.title )
381389 ).click( function ( ) {
382 - //Show refresh link
383 - $j( uploadMenuTarget ).empty().html(
384 - gM( "mwe-upload-once-done",
385 - $j('<a />')
386 - .attr( {
387 - 'href' : uploadProvider.uploadPage,
388 - 'target' : "_new"
389 - } )
390 - .text(
391 - gM("mwe-upload-in-new-win-link")
392 - ),
393 -
394 - $j('<a />')
395 - .attr( {
396 - 'href' : '#'
397 - } )
398 - .addClass('user-upload-refresh')
399 - .text(
400 - gM('mwe-upload-refresh')
401 - )
402 - )
403 - );
404 - // NOTE: if gM supported jquery object a bit better
405 - // we could bind the link above in the gM call
406 - $j( uploadMenuTarget ).find( '.user-upload-refresh' )
407 - .click( function( ) {
408 - remoteSearchDriver.showUserRecentUploads( uploadTargetId );
409 - return false;
410 - } );
 390+ showUploadInTab( uploadProvider, uploadMenuTarget, "mwe-upload-once-done" );
411391 } )
412392 )
413393 );
@@ -414,6 +394,40 @@
415395 };
416396
417397 /**
 398+ * Handles the very similar layout of IE and non-inline upload
 399+ */
 400+ function showUploadInTab(uploadProvider, uploadMenuTarget, msgKey ){
 401+ //Show refresh link
 402+ $j( uploadMenuTarget ).empty().html(
 403+ gM( msgKey,
 404+ $j('<a />')
 405+ .attr( {
 406+ 'href' : uploadProvider.uploadPage,
 407+ 'target' : "_new"
 408+ } )
 409+ .text(
 410+ gM("mwe-upload-in-new-win-link")
 411+ ),
 412+
 413+ $j('<a />')
 414+ .attr( {
 415+ 'href' : '#'
 416+ } )
 417+ .addClass('user-upload-refresh')
 418+ .text(
 419+ gM('mwe-upload-refresh')
 420+ )
 421+ )
 422+ );
 423+ // NOTE: if gM supported jquery object a bit better
 424+ // we could bind the link above in the gM call
 425+ $j( uploadMenuTarget ).find( '.user-upload-refresh' )
 426+ .click( function( ) {
 427+ remoteSearchDriver.showUserRecentUploads( uploadTargetId );
 428+ return false;
 429+ } );
 430+ }
 431+ /**
418432 * Get a jquery built upload form
419433 */
420434 function addUploadForm( options ){
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js
@@ -40,6 +40,8 @@
4141 "mwe-no_recent_uploads" : "No recent uploads",
4242
4343 "mwe-not-logged-in-uploads" : "You may not be logged in so no recent uploads can be displayed. $1 login and $2",
 44+ "mwe-ie-eye-permision" : "If using Internet Exploer and logged in, you may need to adjust your privacy settings",
 45+
4446 "mwe-loggin-link" : "Please login",
4547 "mwe-try-again-link" : "try again",
4648
@@ -1168,6 +1170,25 @@
11691171 .append( gM( 'mwe-try-again-link' ) )
11701172 )
11711173 );
 1174+
 1175+ // If using internet exploer it could be IE privacy settings ( aka "evil eye" )
 1176+ // http://stackoverflow.com/questions/389456/cookie-blocked-not-saved-in-iframe-in-internet-explorer
 1177+ if( $j.browser.msie ){
 1178+ $j( '#user-results-' + uploadTargetId ).append(
 1179+ $j('<br />'),
 1180+ $j('<br />'),
 1181+
 1182+ $j('<span />')
 1183+ .text( gM('mwe-ie-eye-permision' ) ),
 1184+
 1185+ $j('<img />' )
 1186+ .attr( {
 1187+ 'src': mw.getConfig('images_path' ) + 'cookies_blocked_MSIE_eye.png',
 1188+ 'alt' : gM('mwe-ie-eye-permision' )
 1189+ })
 1190+ );
 1191+ }
 1192+
11721193 // Note if we updated gM to return jQuery ojbects then we could
11731194 // bind above
11741195 $j( '#user-results-' + uploadTargetId )
@@ -1869,15 +1890,14 @@
18701891 * Add Resource edit layout and display a loader.
18711892 */
18721893 addResourceEditLoader: function( ) {
 1894+ mw.log()
18731895 var _this = this;
18741896 editWidth = 400;
18751897 // Remove any old instance:
18761898 $j( _this.target_container ).find( '#rsd_resource_edit' ).remove();
1877 -
 1899+
18781900 // Hide the results container
1879 - this.$resultsContainer.hide();
1880 -
1881 - var pt = $j( _this.target_container ).html();
 1901+ this.$resultsContainer.hide();
18821902
18831903 // Set up the interface compoents:
18841904 var $clipEditControl = $j('<div />')
@@ -1893,21 +1913,22 @@
18941914 'padding' : '5px'
18951915 } )
18961916 .loadingSpinner();
 1917+
 1918+ mw.log(" clip edit control ");
18971919
18981920 var $clipEditDisplay = $j('<div />')
18991921 .attr( 'id', 'clip_edit_disp' )
19001922 .addClass( 'ui-widget ui-widget-content ui-corner-all' )
19011923 .css({
19021924 'position' : 'absolute',
1903 - 'overflow' : 'auto;',
 1925+ 'overflow' : 'auto',
19041926 'left' : ( editWidth + 25 ) + 'px',
19051927 'right' :'0px',
19061928 'top' : '5px',
19071929 'bottom' : '10px',
19081930 'padding' : '5px'
19091931 })
1910 - .loadingSpinner();
1911 -
 1932+ .loadingSpinner();
19121933
19131934 // Add the edit layout window with loading place holders
19141935 $j( _this.target_container ).append(
@@ -1920,7 +1941,8 @@
19211942 'bottom' : '0px',
19221943 'right' : '4px',
19231944 'background-color' : '#FFF'
1924 - } ).append(
 1945+ } )
 1946+ .append(
19251947 $clipEditControl,
19261948 $clipEditDisplay
19271949 )
@@ -1977,9 +1999,11 @@
19782000
19792001 // Remove any existing resource edit interface
19802002 _this.removeResourceEditor();
1981 -
 2003+ mw.log(" removed old resource ");
 2004+
19822005 // Append to the top level of model window:
19832006 _this.addResourceEditLoader();
 2007+ mw.log("done adding resource editor");
19842008
19852009 var mediaType = _this.getMediaType( resource );
19862010 var width = _this.getMaxEditWidth( resource );
@@ -2197,10 +2221,10 @@
21982222 mw.log( 'append html: ' + embedHtml );
21992223 $j( '#clip_edit_disp' ).html( embedHtml );
22002224
2201 - mw.log( "about to call $j.embedPlayer::embed_vid" );
 2225+ mw.log( "about to call $j.embedPlayer::embed_vid" );
 2226+
22022227 // Rewrite by id
2203 - $j( '#embed_vid').embedPlayer ( function() {
2204 -
 2228+ $j( '#embed_vid').embedPlayer ( function() {
22052229 // Add extra space at the top if the embed player is less than 90px high
22062230 // bug 22189
22072231 if( $j('#embed_vid').get(0).getPlayerHeight() < 90 ) {
@@ -2219,9 +2243,8 @@
22202244 // Add libraries resizable and hoverIntent to support video edit tools
22212245 var librarySet = [
22222246 'mw.ClipEdit',
2223 - '$j.ui.resizable',
2224 - '$j.fn.hoverIntent'
2225 - ]
 2247+ '$j.ui.resizable'
 2248+ ];
22262249 mw.load( librarySet, function() {
22272250 // Make sure the rsd_edit_img is removed:
22282251 $j( '#rsd_edit_img' ).remove();
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js
@@ -81,7 +81,7 @@
8282 this.getPlayerElement();
8383
8484 //alert( this.playerElement );
85 - if( this.playerElement ) {
 85+ if( this.playerElement && this.playerElement.addJsListener ) {
8686 // Add KDP listeners
8787 _this.bindPlayerFunction( 'doPause', 'onPause' );
8888 _this.bindPlayerFunction( 'doPlay', 'play' );
Index: branches/js2-work/phase3/js/mwEmbed/modules/ApiProxy/mw.ApiProxy.js
@@ -25,7 +25,8 @@
2626 "mwe-proxy-not-ready" : "Proxy is not configured",
2727 "mwe-please-login" : "The request failed. Are you logged in on $1 ? Please $2 and try again",
2828 "mwe-log-in-link" : "log in",
29 - "mwe-remember-loging" : "General security reminder: Only login to web sites when your address bar displays that site's address."
 29+ "mwe-remember-loging" : "General security reminder: Only login to web sites when your address bar displays that site's address."
 30+
3031 } );
3132
3233
@@ -415,8 +416,8 @@
416417 * @param {URL} apiUrl The url of the api server
417418 */
418419 // Include gadget js ( in case the user has not enabled the gadget on that domain )
419 - //var gadgetWithJS = '?withJS=MediaWiki:Gadget-mwEmbed.js';
420 - var gadgetWithJS = '';
 420+ var gadgetWithJS = '?withJS=MediaWiki:Gadget-mwEmbed.js';
 421+ //var gadgetWithJS = '';
421422 function getServerFrame( context ) {
422423 if( ! context || ! context.apiUrl ){
423424 mw.log( "Error no context api url " );
@@ -932,9 +933,9 @@
933934 s += 'id="' + mw.escapeQuotes( options[ 'name' ] ) + '" ';
934935
935936 // Check for style:
936 - if( ! options['style'] ){
 937+ if( ! options['style'] ) {
937938 options['style'] = 'display:none';
938 - }
 939+ }
939940
940941 // Add style attribute:
941942 s += 'style="' + mw.escapeQuotes( options[ 'style' ] ) + '" ';
@@ -963,6 +964,7 @@
964965 var targetName = ( typeof options[ 'target' ] == 'string') ? options[ 'target' ] : $j( options[ 'target' ]).length ;
965966
966967 mw.log( "Append iframe:" + options[ 'src' ] + ' to: ' + targetName + " \n WITH REQUEST: " + JSON.stringify( options.request ) );
 968+
967969 // Append to target
968970 $j( options[ 'target' ] ).append( s );
969971
Index: branches/js2-work/phase3/js/mwEmbed/modules/ClipEdit/mw.ClipEdit.js
@@ -795,7 +795,7 @@
796796
797797 $j( '<a />')
798798 .attr({
799 - 'href': '#',
 799+ 'href': '#'
800800 })
801801 .addClass( 'mw_crop_msg' )
802802 .text( gM( 'mwe-crop' ) ),
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js
@@ -5,7 +5,7 @@
66 var urlparts = getRemoteEmbedPath();
77 var mwEmbedHostPath = urlparts[0];
88 var mwRemoteVersion = 'r104';
9 -var mwUseScriptLoader = false;
 9+var mwUseScriptLoader = true;
1010
1111 // Log the mwRemote version ( will determine what version of js we get )
1212 if( window.console ){
@@ -116,8 +116,7 @@
117117
118118 // Special api proxy page
119119 if ( wgPageName == 'MediaWiki:ApiProxy' ) {
120 - var wgEnableIframeApiProxy = true;
121 - alert( " MediaWiki:ApiProxy rewrite " );
 120+ var wgEnableIframeApiProxy = true;
122121 loadMwEmbed( [ 'mw.ApiProxy' ], function() {
123122 mw.load( mwEmbedHostPath + '/apiProxyPage.js?' + mwGetReqArgs() );
124123 } );

Status & tagging log