From 8d87692a2fe257795ad096277ee668d78cbc1546 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Fri, 24 Jul 2009 22:50:20 +0000 Subject: [PATCH] depreciated mwAddOnloadHook in favor of js2AddOnloadHook naming minor add Media Wizard updates (bug 19863) --- js2/editPage.js | 2 +- .../example_usage/Firefogg_ReWriteForm.php | 54 ------------------- js2/mwEmbed/libAddMedia/remoteSearchDriver.js | 22 +++++--- .../searchLibs/baseRemoteSearch.js | 10 ++-- .../libAddMedia/searchLibs/mediaWikiSearch.js | 7 +++ .../libAddMedia/searchLibs/metavidSearch.js | 2 +- js2/mwEmbed/mv_embed.js | 10 ++-- js2/mwEmbed/php/languages/mwEmbed.i18n.php | 31 ++--------- js2/uploadPage.js | 2 +- 9 files changed, 42 insertions(+), 98 deletions(-) delete mode 100644 js2/mwEmbed/example_usage/Firefogg_ReWriteForm.php diff --git a/js2/editPage.js b/js2/editPage.js index 0ddd1e9c64..b2c6498ebb 100644 --- a/js2/editPage.js +++ b/js2/editPage.js @@ -17,7 +17,7 @@ if(!mwAddMediaConfig) }; -mwAddOnloadHook( function(){ +js2AddOnloadHook( function(){ mwEditPageHelper.init(); }); var mwEditPageHelper = { diff --git a/js2/mwEmbed/example_usage/Firefogg_ReWriteForm.php b/js2/mwEmbed/example_usage/Firefogg_ReWriteForm.php deleted file mode 100644 index b90a048543..0000000000 --- a/js2/mwEmbed/example_usage/Firefogg_ReWriteForm.php +++ /dev/null @@ -1,54 +0,0 @@ -"; - print_r($_FILES); - print ""; - die(); -} -?> - - - - - Firefogg - Make Ogg Video in your Browser - - - - - -
-

Rewrite Form example

-


-
-
- -
- - - - - - - - - -
- Video Name:
Video File :
- -
-
-

-
-
- diff --git a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js index 3da6010643..2ee256c621 100644 --- a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js +++ b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js @@ -32,7 +32,9 @@ loadGM({ "cc_pd_title": "Public Domain", "unknown_license": "Unknown License", "no_import_by_url": "This User or Wiki can not import assets from remote URLs.

Do you need to Login?

If permissions are set you may have to enable $wgAllowCopyUploads, more info

", - "results_from": "Results from $2" + "results_from": "Results from $2", + + "missing_desc_see_soruce": "This Asset is missing a description. Please see the [$1 orginal source] and help describe it" }); var default_remote_search_options = { 'profile':'mediawiki_edit', @@ -123,8 +125,8 @@ remoteSearchDriver.prototype = { //@@todo should query wgForeignFileRepos setting maybe interwikimap from the api */ 'this_wiki':{ - 'enabled': 0, - 'checked': 0, + 'enabled': 1, + 'checked': 1, 'title' : 'This Wiki', 'desc' : '(should be updated with the proper text) maybe import from some config value', 'api_url': wgServer + wgScriptPath + '/api.php', @@ -958,7 +960,7 @@ remoteSearchDriver.prototype = { var overflow_style = ( mediaType =='video' )?'':'overflow:auto;'; //append to the top level of model window: $j( _this.target_container ).append('
' + + 'style="position:absolute;top:0px;left:0px;bottom:75px;right:4px;background-color:#FFF;">' + '
' + mv_get_loading_img('position:absolute;top:30px;left:30px') + @@ -1200,10 +1202,16 @@ remoteSearchDriver.prototype = { rObj.pSobj.updateDataForImport( rObj ); //setup the resource description from resource description: - var wt = '{{Information '+"\n"+ - '|Description= ' + rObj.pSobj.getImportResourceDescWiki( rObj ); + var wt = '{{Information '+"\n"; + + if( rObj.desc ){ + wt += '|Description= ' + rObj.desc + "\n"; + }else{ + wt += '|Description= ' + gM('missing_desc_see_soruce', rObj.link ) + "\n"; + } + //output person and bill info if - wt+='|Source=' + '[' + $j.trim( rObj.link ) + ' Original Source]'+ "\n"; + wt+='|Source=' + rObj.pSobj.getImportResourceDescWiki( rObj ) + "\n"; if( rObj.author ) wt+='|Author=' + rObj.author +"\n"; diff --git a/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js b/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js index c21426c1aa..610fd41269 100644 --- a/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js +++ b/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js @@ -1,5 +1,8 @@ //base remote search obj +loadGM({ + "imported_from" : "$1 imported from [$2 $3]. See the original [$4 resource page] for more info" +}) // @key is name of rObj variable // @value is where to find the value in the item xml // @@ -99,11 +102,11 @@ baseRemoteSearch.prototype = { } if( node!=null && attr_name != null){ if(typeof attr_name == 'string'){ - tag_val = $j.trim( $j(node).attr( attr_name ) ); + tag_val = $j.trim( $j( node ).attr( attr_name ) ); }else{ var attr_vals = {}; for(var j in attr_name){ - if( $j(node).attr( attr_name[j]).length != 0) + if( $j(node).attr( attr_name[j] ).length != 0) attr_vals[ attr_name[j] ] = $j.trim( $j(node).attr( attr_name[j]) ).replace(/(<([^>]+)>)/ig,""); } tag_val = attr_vals ; @@ -168,8 +171,7 @@ baseRemoteSearch.prototype = { }, getImportResourceDescWiki:function(rObj){ - return rObj.title + ' imported from ' + '[' + this.cp.homepage + - ' ' + this.cp.title+']'; + return gM('imported_from', [rObj.title, this.cp.homepage, this.cp.title, rObj.link]); }, //for thigns like categories and the like getExtraResourceDescWiki:function( rObj ){ diff --git a/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js b/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js index 3832d26816..1f08af31ab 100644 --- a/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js +++ b/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js @@ -101,6 +101,13 @@ mediaWikiSearch.prototype = { 'categories':page.categories } } + //attempt to parse out some stuff from the teplate: + var desc = this.resultsObj[page_id].desc.match(/\|Description=(([^\n]*\n)*)\|Source=/) + if( desc && desc[1] ){ + this.resultsObj[page_id].desc = $j.trim( desc[1] ); + } + + //likely a audio clip if no poster and type application/ogg //@@todo we should return audio/ogg for the mime type or some other way to specify its "audio" diff --git a/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js b/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js index ded2210f27..5fcc4586e0 100644 --- a/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js +++ b/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js @@ -83,7 +83,7 @@ metavidSearch.prototype = { return '{{PD-USGov}}'; }, getExtraResourceDescWiki:function( rObj ){ - var o = ''; + var o = "\n"; //check for person if( rObj.person && rObj.person['label']) o += '* featuring [[' + rObj.person['label'] + ']]' + "\n"; diff --git a/js2/mwEmbed/mv_embed.js b/js2/mwEmbed/mv_embed.js index 159eaab17f..090ec023b1 100644 --- a/js2/mwEmbed/mv_embed.js +++ b/js2/mwEmbed/mv_embed.js @@ -577,7 +577,7 @@ var mvJsLoader = { this.onReadyEvents.push(fn); }, //checks the jQuery flag (this way when remote embeding we don't load jQuery - // unless mwAddOnloadHook was used or there is video on the page + // unless js2AddOnloadHook was used or there is video on the page runQuededFunctions:function(){ var _this = this; this.doneReadyEvents=true; @@ -634,8 +634,8 @@ function mwdomReady(force){ mvJsLoader.runQuededFunctions(); } } -//mwAddOnloadHook: ensure jQuery and the DOM are ready: -function mwAddOnloadHook( func ) { +//js2AddOnloadHook: ensure jQuery and the DOM are ready: +function js2AddOnloadHook( func ) { //make sure the skin/style sheets are avaliable always: loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css'); @@ -647,11 +647,13 @@ function mwAddOnloadHook( func ) { func(); }); }else{ - //if using mwAddOnloadHook we need to get jQuery into place (if its not already included) + //if using js2AddOnloadHook we need to get jQuery into place (if its not already included) mvJsLoader.jQueryCheckFlag = true; mvJsLoader.addLoadEvent( func ); }; } +//depreciated mwAddOnloadHook in favor of js2 naming (for clear seperation of js2 code from old mw code +var mwAddOnloadHook = js2AddOnloadHook; /* * this function allows for targeted rewriting */ diff --git a/js2/mwEmbed/php/languages/mwEmbed.i18n.php b/js2/mwEmbed/php/languages/mwEmbed.i18n.php index d5e3f7ee4f..5e2f1b50fe 100644 --- a/js2/mwEmbed/php/languages/mwEmbed.i18n.php +++ b/js2/mwEmbed/php/languages/mwEmbed.i18n.php @@ -57,36 +57,14 @@ $messages['en'] = array( 'fogg-preset-custom' => 'Custom Settings', /* - * js file: /libAddMedia/mediaWikiUploadHelper.OFF.js + * js file: /libAddMedia/searchLibs/metavidSearch.js */ - 'upload-enable-converter' => 'Enable video converter (to upload source video not yet converted to theora format) more info', - 'upload-fogg_not_installed' => 'If you want to upload video consider installing firefogg.org, more info', - 'upload-transcode-in-progress' => 'Doing Transcode & Upload (do not close this window)', - 'upload-in-progress' => 'Upload in Progress (do not close this window)', - 'upload-transcoded-status' => 'Transcoded', - 'uploaded-status' => 'Uploaded', - 'upload-select-file' => 'Select File...', - 'wgfogg_wrong_version' => 'You have firefogg installed but its outdated, please upgrade ', - 'wgfogg_waring_ogg_upload' => 'You have selected an ogg file for conversion to ogg (this is probably unnessesary). Maybe disable the video converter?', - 'wgfogg_waring_bad_extension' => 'You have selected a file with an unsuported extension. More help', - 'upload-stats-fileprogres' => '$1 of $2', - 'mv_upload_done' => 'Your upload should be accessible here', - 'upload-unknown-size' => 'Unknown size', - 'successfulupload' => 'Successful upload', - 'uploaderror' => 'Upload error', - 'uploadwarning' => 'Upload warning', - 'unknown-error' => 'Unknown Error', - 'return-to-form' => 'Return to form', - 'file-exists-duplicate' => 'This file is a duplicate of the following file', - 'fileexists' => 'A file with this name exists already, please check $1 if you are not sure if you want to change it.', - 'fileexists-thumb' => '
Existing file
', - 'ignorewarning' => 'Ignore warning and save file anyway', - 'file-thumbnail-no' => 'The filename begins with $1', + 'mv_stream_title' => '$1 $2 to $3', /* - * js file: /libAddMedia/searchLibs/metavidSearch.js + * js file: /libAddMedia/searchLibs/baseRemoteSearch.js */ - 'mv_stream_title' => '$1 $2 to $3', + 'imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more info', /* * js file: /libAddMedia/mvFirefogg.js @@ -129,6 +107,7 @@ $messages['en'] = array( 'unknown_license' => 'Unknown License', 'no_import_by_url' => 'This User or Wiki can not import assets from remote URLs.

Do you need to Login?

If permissions are set you may have to enable $wgAllowCopyUploads, more info

', 'results_from' => 'Results from $2', + 'missing_desc_see_soruce' => 'This Asset is missing a description. Please see the [$1 orginal source] and help describe it', /* * js file: /libSequencer/mvSequencer.js diff --git a/js2/uploadPage.js b/js2/uploadPage.js index 2dc5e484c1..ea532825dc 100644 --- a/js2/uploadPage.js +++ b/js2/uploadPage.js @@ -2,7 +2,7 @@ * uploadPage.js to be run on specialUpload page. * controls the invocation of the mvUploader class based on local config. */ -mwAddOnloadHook( function(){ +js2AddOnloadHook( function(){ mwUploadHelper.init(); }); //set up the upoload form bindings once all dom manipluation is done -- 2.20.1