From 569fbf98599db4fcb27a8f2578e7bd432899cd4b Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Wed, 4 Nov 2009 01:44:28 +0000 Subject: [PATCH] * ( bug 21373 ) improved mwEmbed localization support ** switched to uselang param to specificity language ** fixed outputpage and mv_embed url language param handling accordingly * added msg version check to script-loader (checks the latest version of any msg text and updates the unique request key) * added associated configuration flag: $wgScriptModifiedMsgCheck * general msg updates and centralization of mwe-cancel and mwe-ok --- RELEASE-NOTES | 6 +- includes/DefaultSettings.php | 9 +- includes/OutputPage.php | 69 ++++--- js2/mwEmbed/jsScriptLoader.php | 195 ++++++++++-------- .../libAddMedia/mvBaseUploadInterface.js | 8 +- js2/mwEmbed/libAddMedia/remoteSearchDriver.js | 142 ++++++------- js2/mwEmbed/libAddMedia/simpleUploadForm.js | 12 +- js2/mwEmbed/libClipEdit/mvClipEdit.js | 11 +- js2/mwEmbed/libMwApi/mw.proxy.js | 1 - js2/mwEmbed/libSequencer/mvSequencer.js | 80 +++---- .../libSequencer/mvTimedEffectsEdit.js | 10 +- .../libSequencer/seqRemoteSearchDriver.js | 11 +- js2/mwEmbed/mv_embed.js | 55 ++--- js2/mwEmbed/php/languages/mwEmbed.i18n.php | 9 +- js2/mwEmbed/tests/testLang.html | 4 +- js2/remoteMwEmbed.js | 2 +- 16 files changed, 351 insertions(+), 273 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fb95ca64c0..488f92fe40 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -19,7 +19,11 @@ Those wishing to use the latest code instead of a branch release can obtain it from source control: http://www.mediawiki.org/wiki/Download_from_SVN === Configuration changes in 1.16 === - +* $wgScriptModifiedMsgCheck Checks the mediawiki namespace recent changes to +ensure a updated urid for script-loader +* $wgScriptModifiedCheck Checks script file modified time for unique request id) +* $wgEnableAsyncDownload (lets you disable Async download for windows. +Hopefully we will remove this configuration var soon) * $wgEnableFirefogg enable support for firefogg extension, firefogg supports in-browser transcoding, chunk uploads and client side hash checking. * $wgEnableTemporalOggUrls enable oggz_chop support a server side ogg seeking diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 6f03c8b1bd..16921ce894 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2800,7 +2800,14 @@ $wgEnableScriptLoader = false; * * and or you can update $wgStyleVersion */ -$wgScriptModifiedCheck = true; +$wgScriptModifiedFileCheck = true; + +/* + * $wgScriptModifiedMsgCheck Checks MediaWiki NS for latest + * Revision for generating the request id. + * + */ +$wgScriptModifiedMsgCheck = true; /* * enable js2 Script System diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 146269b0e3..93fbb1ab15 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -41,6 +41,7 @@ class OutputPage { var $mParseWarnings = array(); var $mSquidMaxage = 0; var $mRevisionId = null; + var $mScriptLoader = null; protected $mTitle = null; /** @@ -227,9 +228,12 @@ class OutputPage { } $this->addScript( Html::linkedScript( $path . "?" . $this->getURIDparam( $js_class ) ) ); - //merge in language text (if js2 is on and we have loadGM function) + // Merge in language text (if js2 is on and we have loadGM function & scriptLoader is "off") if( $wgEnableJS2system ){ - $inlineMsg = jsScriptLoader::getInlineLoadGMFromClass( $js_class ); + if( !$this->mScriptLoader ) + $this->mScriptLoader = new jsScriptLoader(); + + $inlineMsg = $this->mScriptLoader->getInlineLoadGMFromClass( $js_class ); if( $inlineMsg != '' ) $this->addScript( Html::inlineScript( $inlineMsg )); } @@ -266,12 +270,14 @@ class OutputPage { * Get the unique request ID parameter for the script-loader request */ function getURIDparam( $classAry = array() ) { - global $wgDebugJavaScript, $wgStyleVersion, $IP, $wgScriptModifiedCheck; - global $wgContLanguageCode; + global $wgDebugJavaScript, $wgStyleVersion, $IP, $wgScriptModifiedFileCheck; + global $wgLang, $wgScriptModifiedMsgCheck; + //Always the language key param to keep urls distinct per language + $uriParam = 'uselang=' . $wgLang->getCode(); if( $wgDebugJavaScript ) { - return 'urid=' . time(); + return $uriParam . '&urid=' . time(); } else { //support single class_name attr if( gettype( $classAry) == 'string' ){ @@ -279,14 +285,6 @@ class OutputPage { } $ftime = $frev = 0; foreach( $classAry as $class ) { - if( $wgScriptModifiedCheck ) { - $js_path = jsScriptLoader::getJsPathFromClass( $class ); - if( $js_path ) { - $cur_ftime = filemtime ( $IP ."/". $js_path ); - if( $cur_ftime > $ftime ) - $ftime = $cur_ftime; - } - } // Add the latest revision ID if the class set includes a WT (wiki title) if( substr($class, 0, 3) == 'WT:'){ $title_str = substr($class, 3); @@ -295,27 +293,52 @@ class OutputPage { if( $t->getLatestRevID() > $frev ) $frev = $t->getLatestRevID(); } + }else{ + //check for file modified time: + if( $wgScriptModifiedFileCheck ) { + $js_path = jsScriptLoader::getJsPathFromClass( $class ); + if( $js_path ) { + $cur_ftime = filemtime ( $IP ."/". $js_path ); + if( $cur_ftime > $ftime ) + $ftime = $cur_ftime; + } + } } } //build the actual unique request id: - $urid = "urid={$wgStyleVersion}"; + $uriParam = "&urid={$wgStyleVersion}"; // Add the file modification time if set if( $ftime != 0 ) - $urid .= "_" . $ftime; + $uriParam .= "_" . $ftime; //add the wiki rev id if set if( $frev != 0 ) - $urid.= "_" . $frev; - - - //Always the language key param to keep urls distinct per language - $urid.='&lang='.$wgContLanguageCode; - - return $urid; + $uriParam.= "_" . $frev; + + //add the latest msg rev id if $wgScriptModifiedMsgCheck is enabled: + if( $wgScriptModifiedMsgCheck ){ + $dbr = wfGetDB( DB_SLAVE ); + // Grab the latest mediaWiki msg rev id: + $res = $dbr->select( 'recentchanges', + 'rc_id', + array( 'rc_namespace'=> NS_MEDIAWIKI ), + __METHOD__, + array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => 1 , + 'USE INDEX' => array('recentchanges' => 'rc_timestamp' ) + ) + ); + if( $dbr->numRows($res) != 0){ + $rc = $dbr->fetchObject( $res ); + if( $rc->rc_id ){ + $uriParam.= '_' . $rc->rc_id; + } + } + //@@todo we could otherwise use the the SVN version if not already covered by $wgStyleVersion above + } + return $uriParam; } } - /** * Given a script path, get the JS class name, or false if no such path is registered. * @param $path string diff --git a/js2/mwEmbed/jsScriptLoader.php b/js2/mwEmbed/jsScriptLoader.php index d65b1dd77e..a8e60cc4b8 100644 --- a/js2/mwEmbed/jsScriptLoader.php +++ b/js2/mwEmbed/jsScriptLoader.php @@ -57,6 +57,9 @@ class jsScriptLoader { $this->sFileCache->getCacheFileName(); // Setup script loader header info + // @@todo we might want to put these into the $mw var per class request set + // and or include a callback to avoid pulling in old browsers that don't support + // the onLoad attribute for script elements. $this->jsout .= 'var mwSlScript = "' . $_SERVER['SCRIPT_NAME'] . '";' . "\n"; $this->jsout .= 'var mwSlGenISODate = "' . date( 'c' ) . '";' . "\n"; $this->jsout .= 'var mwSlURID = "' . htmlspecialchars( $this->urid ) . '";' . "\n"; @@ -65,70 +68,13 @@ class jsScriptLoader { // Swap in the appropriate language per js_file foreach ( $this->jsFileList as $classKey => $file_name ) { - // Special case: title classes - if ( substr( $classKey, 0, 3 ) == 'WT:' ) { - global $wgUser; - // Get just the title part - $title_block = substr( $classKey, 3 ); - if ( $title_block[0] == '-' && strpos( $title_block, '|' ) !== false ) { - // Special case of "-" title with skin - $parts = explode( '|', $title_block ); - $title = array_shift( $parts ); - foreach ( $parts as $tparam ) { - list( $key, $val ) = explode( '=', $tparam ); - if ( $key == 'useskin' ) { - $skin = $val; - } - } - $sk = $wgUser->getSkin(); - // Make sure the skin name is valid - $skinNames = Skin::getSkinNames(); - $skinNames = array_keys( $skinNames ); - if ( in_array( strtolower( $skin ), $skinNames ) ) { - $this->jsout .= $sk->generateUserJs( $skin ) . "\n"; - // success - continue; - } - } else { - // Make sure the wiki title ends with .js - if ( substr( $title_block, - 3 ) != '.js' ) { - $this->error_msg .= 'WikiTitle includes should end with .js'; - continue; - } - // It's a wiki title, append the output of the wikitext: - $t = Title::newFromText( $title_block ); - $a = new Article( $t ); - // Only get the content if the page is not empty: - if ( $a->getID() !== 0 ) { - $this->jsout .= $a->getContent() . "\n"; - } - continue; - } - } - - // Dealing with files - - // Check that the filename ends with .js and does not include ../ traversing - if ( substr( $file_name, - 3 ) != '.js' ) { - $this->error_msg .= "\nError file name must end with .js: " . htmlspecialchars( $file_name ) . " \n "; - continue; - } - if ( strpos( $file_name, '../' ) !== false ) { - $this->error_msg .= "\nError file name must not traverse paths: " . htmlspecialchars( $file_name ) . " \n "; - continue; - } - - if ( trim( $file_name ) != '' ) { - // If in debug mode, add a comment with the file name - if ( $this->debug ) - $this->jsout .= "\n/** -* File: " . htmlspecialchars( $file_name ) . " -*/\n"; - $this->jsout .= ( $this->doProcessJsFile( $file_name ) ) . "\n"; + //get the script content + $jstxt = $this->getScriptText($classKey, $file_name); + if( $jstxt ){ + $this->jsout .= $this->doProcessJs( $jstxt ); } } - - // Check if we should minify + // Check if we should minify the whole thing: if ( !$this->debug ) { // do the minification and output $this->jsout = JSMin::minify( $this->jsout ); @@ -141,14 +87,90 @@ class jsScriptLoader { } // Check for an error msg if ( $this->error_msg != '' ) { + //just set the content type (don't send cache header) + header( 'Content-Type: text/javascript' ); echo 'alert(\'Error With ScriptLoader.php ::' . str_replace( "\n", '\'+"\n"+' . "\n'", $this->error_msg ) . '\');'; echo trim( $this->jsout ); } else { - // All good, let's output "cache forever" headers + // All good, let's output "cache" headers $this->outputJsWithHeaders(); } } + function getScriptText($classKey, $file_name=''){ + $jsout = ''; + // Special case: title classes + if ( substr( $classKey, 0, 3 ) == 'WT:' ) { + global $wgUser; + // Get just the title part + $title_block = substr( $classKey, 3 ); + if ( $title_block[0] == '-' && strpos( $title_block, '|' ) !== false ) { + // Special case of "-" title with skin + $parts = explode( '|', $title_block ); + $title = array_shift( $parts ); + foreach ( $parts as $tparam ) { + list( $key, $val ) = explode( '=', $tparam ); + if ( $key == 'useskin' ) { + $skin = $val; + } + } + $sk = $wgUser->getSkin(); + // Make sure the skin name is valid + $skinNames = Skin::getSkinNames(); + $skinNames = array_keys( $skinNames ); + if ( in_array( strtolower( $skin ), $skinNames ) ) { + // If in debug mode, add a comment with wiki title and rev: + if ( $this->debug ) + $jsout .= "\n/**\n* GenerateUserJs: \n*/\n"; + return $jsout . $sk->generateUserJs( $skin ) . "\n"; + } + } else { + // Make sure the wiki title ends with .js + if ( substr( $title_block, - 3 ) != '.js' ) { + $this->error_msg .= 'WikiTitle includes should end with .js'; + return false; + } + // It's a wiki title, append the output of the wikitext: + $t = Title::newFromText( $title_block ); + $a = new Article( $t ); + // Only get the content if the page is not empty: + if ( $a->getID() !== 0 ) { + // If in debug mode, add a comment with wiki title and rev: + if ( $this->debug ) + $jsout .= "\n/**\n* WikiJSPage: " . htmlspecialchars( $title_block ) . " rev: " . $a->getID() . " \n*/\n"; + + return $jsout . $a->getContent() . "\n"; + } + } + }else{ + // Dealing with files + + // Check that the filename ends with .js and does not include ../ traversing + if ( substr( $file_name, - 3 ) != '.js' ) { + $this->error_msg .= "\nError file name must end with .js: " . htmlspecialchars( $file_name ) . " \n "; + return false; + } + if ( strpos( $file_name, '../' ) !== false ) { + $this->error_msg .= "\nError file name must not traverse paths: " . htmlspecialchars( $file_name ) . " \n "; + return false; + } + if ( trim( $file_name ) != '' ) { + if ( $this->debug ) + $jsout .= "\n/**\n* File: " . htmlspecialchars( $file_name ) . "\n*/\n"; + + $jsFileStr = $this->doGetJsFile( $file_name ) . "\n"; + if( $jsFileStr ){ + return $jsout . $jsFileStr; + }else{ + $this->error_msg .= "\nError could not read file: ". htmlspecialchars( $file_name ) ."\n"; + return false; + } + } + } + //if we did not return some js + $this->error_msg .= "\nUnknown error\n"; + return false; + } function outputJsHeaders() { // Output JS MIME type: header( 'Content-Type: text/javascript' ); @@ -209,9 +231,9 @@ class jsScriptLoader { } //get the language code (if not provided use the "default" language - if ( isset( $_GET['lang'] ) && $_GET['lang'] != '' ) { + if ( isset( $_GET['uselang'] ) && $_GET['uselang'] != '' ) { //make sure its a valid lang code: - $this->langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['lang']); + $this->langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['uselang']); }else{ //set english as default $this->langCode = 'en'; @@ -277,7 +299,8 @@ class jsScriptLoader { } } /** - * Pre-process request variables without configuration to get a rKey for cache file check + * Pre-process request variables ~without configuration~ or much utility function~ + * This is to quickly get a rKey that we can check against the cache */ function preProcRequestVars() { $rKey = ''; @@ -295,9 +318,9 @@ class jsScriptLoader { } //get the language code (if not provided use the "default" language - if ( isset( $_GET['lang'] ) && $_GET['lang'] != '' ) { + if ( isset( $_GET['uselang'] ) && $_GET['uselang'] != '' ) { //make sure its a valid lang code: - $langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['lang']); + $langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['uselang']); }else{ //set english as default $langCode = 'en'; @@ -346,21 +369,25 @@ class jsScriptLoader { return false; } } - function doProcessJsFile( $file_path ) { - global $IP, $wgEnableScriptLocalization, $IP; + function doGetJsFile( $file_path ) { + global $IP; // Load the file $str = @file_get_contents( "{$IP}/{$file_path}" ); if ( $str === false ) { // @@todo check PHP error level. Don't want to expose paths if errors are hidden. $this->error_msg .= 'Requested File: ' . htmlspecialchars( $file_path ) . ' could not be read' . "\n"; - return ''; + return false; } + return $str; + } + function doProcessJs( $str ){ + global $wgEnableScriptLocalization; // Strip out js_log debug lines. Not much luck with this regExp yet: // if( !$this->debug ) // $str = preg_replace('/\n\s*js_log\s*\([^\)]([^;]|\n])*;/', "\n", $str); - // Do language swap + // Do language swap by index: if ( $wgEnableScriptLocalization ){ $inx = self::getLoadGmIndex( $str ); if($inx){ @@ -369,6 +396,7 @@ class jsScriptLoader { return substr($str, 0, $inx['s']-1) . $translated . substr($str, $inx['e']+1); } } + //return the js str unmodified if we did not transform with the localization. return $str; } static public function getLoadGmIndex( $str ){ @@ -409,23 +437,26 @@ class jsScriptLoader { } } - static public function getInlineLoadGMFromClass( $class ){ - global $IP; - $file_path = self::getJsPathFromClass( $class ); - $str = @file_get_contents( "{$IP}/{$file_path}" ); - - $inx = self::getLoadGmIndex( $str ); - if(!$inx) - return ''; - $jsmsg = FormatJson::decode( '{' . substr($str, $inx['s'], ($inx['e']-$inx['s'])) . '}', true); + function getInlineLoadGMFromClass( $class ){ + $jsmsg = $this->getMsgKeysFromClass( $class ); if( $jsmsg ){ self::getMsgKeys ( $jsmsg ); - return 'loadGM('. FormatJson::encode( $jsmsg ) . ')'; + return 'loadGM(' . FormatJson::encode( $jsmsg ) . ');'; }else{ //if could not parse return empty string: return ''; } } + function getMsgKeysFromClass( $class ){ + $file_path = self::getJsPathFromClass( $class ); + $str = $this->getScriptText($class, $file_path); + + $inx = self::getLoadGmIndex( $str ); + if(!$inx) + return ''; + return FormatJson::decode( '{' . substr($str, $inx['s'], ($inx['e']-$inx['s'])) . '}', true); + } + static public function getMsgKeys(& $jmsg, $langCode = false){ global $wgContLanguageCode; if(!$langCode) diff --git a/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js b/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js index 9f18412b70..06be8ce21b 100644 --- a/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js +++ b/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js @@ -27,9 +27,7 @@ loadGM({ "mwe-file-thumbnail-no" : "The filename begins with $1<\/tt><\/b>", "mwe-go-to-resource" : "Go to resource page", "mwe-upload-misc-error" : "Unknown upload error", - "mwe-wgfogg_warning_bad_extension" : "You have selected a file with an unsuported extension (more information<\/a>).", - "mwe-cancel-button" : "Cancel", - "mwe-ok-button" : "OK" + "mwe-wgfogg_warning_bad_extension" : "You have selected a file with an unsuported extension (more information<\/a>)." }); var default_bui_options = { @@ -633,7 +631,7 @@ mvBaseUploadInterface.prototype = { }else{ //@@todo should fix jquery ui to not use object keys as user msg's var bObj = {}; - bObj[ gM('mwe-ok-button') ] = function(){ + bObj[ gM('mwe-ok') ] = function(){ $j(this).dialog('close'); }; $j('#upProgressDialog').dialog('option','buttons', bObj); @@ -702,7 +700,7 @@ mvBaseUploadInterface.prototype = { cancel_button:function(){ var _this = this; var cancelBtn = new Array(); - cancelBtn[ gM('mwe-cancel-button') ] = function(){ + cancelBtn[ gM('mwe-cancel') ] = function(){ return _this.cancel_action(this) }; return cancelBtn; diff --git a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js index 534f8c3c4b..f6a94a5ce8 100644 --- a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js +++ b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js @@ -236,12 +236,75 @@ remoteSearchDriver.prototype = { 'checked':1, 'title' :'Upload' } + }, + //some default layout values: + thumb_width : 80, + image_edit_width : 400, + video_edit_width : 400, + insert_text_pos : 0, //insert at the start (will be overwritten by the user cursor pos) + result_display_mode : 'box', //box or list + + cUpLoader : null, + cEdit : null, + proxySetupDone : null, + dmodalCss : {}, + + init: function( options ){ + var _this = this; + js_log('remoteSearchDriver:init'); + + //merge in the options: + //@@todo for cleaner config we should set _this.opt to the provided options) + $j.extend( _this, default_remote_search_options, options); + + //update the base text: + if(_this.target_textbox) + _this.getTexboxSelection(); + + //modify the content provider config based on options: + if(_this.enabled_cps != 'all'){ + for(var i in this.content_providers){ + if( $j.inArray(i, _this.enabled_cps) != -1 ){ + this.content_providers[i].enabled = true; + }else{ + this.content_providers[i].enabled = false; + } + } + } + //set the upload target name if unset + if( _this.upload_api_target == 'local' && ! _this.upload_api_name && typeof wgSiteName != 'undefined') + _this.upload_api_name = wgSiteName; + + //if the upload_api_proxy_frame is set _this.upload_api_target to "proxy" + if( _this.upload_api_proxy_frame ) + _this.upload_api_target = 'proxy'; + + //map "local" to the local api + if( _this.upload_api_target == 'local' ){ + if( ! _this.local_wiki_api_url ){ + $j('#tab-upload').html( gM( 'rsd_config_error', 'missing_local_api_url' ) ); + return false; + }else{ + _this.upload_api_target = _this.local_wiki_api_url; + } + } + + //set up the target invocation: + if( $j( this.target_invocation ).length==0 ){ + js_log("RemoteSearchDriver:: no target invocation provided (will have to run your own doInitDisplay() )"); + }else{ + if( this.target_invocation ){ + $j(this.target_invocation).css('cursor','pointer').attr('title', gM('mwe-add_media_wizard')).click(function(){ + _this.doInitDisplay(); + }); + } + } }, //define the licenses // ... this will get complicated quick... - // (just look at complexity for creative commons without exessive "duplicate data") + // (just look at complexity for creative commons without excessive "duplicate data") // ie cc_by could be "by/3.0/us/" or "by/2.1/jp/" to infinitum... - // some complexity should be negated by license equivalances. + // some complexity should be negated by license equivalences. // but we will have to abstract into another class let content providers provide license urls // and we have to clone the license object and allow local overrides @@ -385,69 +448,6 @@ remoteSearchDriver.prototype = { typestr + '' }, - //some default layout values: - thumb_width : 80, - image_edit_width : 400, - video_edit_width : 400, - insert_text_pos : 0, //insert at the start (will be overwritten by the user cursor pos) - result_display_mode : 'box', //box or list - - cUpLoader : null, - cEdit : null, - proxySetupDone : null, - dmodalCss : {}, - - init: function( options ){ - var _this = this; - js_log('remoteSearchDriver:init'); - - //merge in the options: - //@@todo for cleaner config we should set _this.opt to the provided options) - $j.extend( _this, default_remote_search_options, options); - - //update the base text: - if(_this.target_textbox) - _this.getTexboxSelection(); - - //modify the content provider config based on options: - if(_this.enabled_cps != 'all'){ - for(var i in this.content_providers){ - if( $j.inArray(i, _this.enabled_cps) != -1 ){ - this.content_providers[i].enabled = true; - }else{ - this.content_providers[i].enabled = false; - } - } - } - //set the upload target name if unset - if( _this.upload_api_target == 'local' && ! _this.upload_api_name && typeof wgSiteName != 'undefined') - _this.upload_api_name = wgSiteName; - - //if the upload_api_proxy_frame is set _this.upload_api_target to "proxy" - if( _this.upload_api_proxy_frame ) - _this.upload_api_target = 'proxy'; - - //map "local" to the local api - if( _this.upload_api_target == 'local' ){ - if( ! _this.local_wiki_api_url ){ - $j('#tab-upload').html( gM( 'rsd_config_error', 'missing_local_api_url' ) ); - return false; - }else{ - _this.upload_api_target = _this.local_wiki_api_url; - } - } - - //set up the target invocation: - if( $j( this.target_invocation ).length==0 ){ - js_log("RemoteSearchDriver:: no target invocation provided (will have to run your own doInitDisplay() )"); - }else{ - if( this.target_invocation ){ - $j(this.target_invocation).css('cursor','pointer').attr('title', gM('mwe-add_media_wizard')).click(function(){ - _this.doInitDisplay(); - }); - } - } - }, doInitDisplay:function(){ var _this = this; //setup the parent container: @@ -528,10 +528,10 @@ remoteSearchDriver.prototype = { //js_log('added target id:' + $j(_this.target_container).attr('id')); //get layout js_log( 'width: ' + $j(window).width() + ' height: ' + $j(window).height()); - var cConf = {}; - cConf['cancel'] = function(){ + var cBtn = {}; + cBtn[ gM('mwe-cancel') ] = function(){ _this.cancelClipEditCB(); - } + } function doResize(){ js_log('do resize:: ' + _this.target_container); $j( '#rsd_modal_target').dialog('option', 'width', $j(window).width()-50 ); @@ -545,7 +545,7 @@ remoteSearchDriver.prototype = { modal: true, draggable:false, resizable:false, - buttons:cConf, + buttons:cBtn, close: function() { //if we are 'editing' a item close that //@@todo maybe prompt the user? @@ -559,7 +559,7 @@ remoteSearchDriver.prototype = { }); - //re add cancel button + //add cancel callback and updated button with icon _this.cancelClipEditCB(); //update the child position: (some of this should be pushed up-stream via dialog config options @@ -1225,7 +1225,7 @@ remoteSearchDriver.prototype = { $j( _this.target_container ).dialog( 'option', 'title', gM('mwe-add_media_wizard')); js_log("should update: " + b_target + ' with: cancel'); //restore the buttons: - $j(b_target).html( $j.btnHtml( 'Cancel' , 'mv_cancel_rsd', 'close')) + $j(b_target).html( $j.btnHtml( gM('mwe-cancel') , 'mv_cancel_rsd', 'close')) .children('.mv_cancel_rsd') .btnBind() .click(function(){ diff --git a/js2/mwEmbed/libAddMedia/simpleUploadForm.js b/js2/mwEmbed/libAddMedia/simpleUploadForm.js index 70325b2fd4..53b99993a8 100644 --- a/js2/mwEmbed/libAddMedia/simpleUploadForm.js +++ b/js2/mwEmbed/libAddMedia/simpleUploadForm.js @@ -12,7 +12,9 @@ loadGM({ "mwe-upload" : "Upload file", "mwe-destfilename" : "Destination filename:", "mwe-summary" : "Summary", - "mwe-error_not_loggedin" : "You do not appear to be logged in or do not have upload privileges." + "mwe-error_not_loggedin" : "You do not appear to be logged in or do not have upload privileges.", + "mwe-watch-this-file" : "Watch this file", + "mwe-ignore-any-warnings" : "Ignore any warnings" }); var default_form_options = { @@ -64,16 +66,16 @@ var default_form_options = { '