depreciated mwAddOnloadHook in favor of js2AddOnloadHook naming
authorMichael Dale <dale@users.mediawiki.org>
Fri, 24 Jul 2009 22:50:20 +0000 (22:50 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Fri, 24 Jul 2009 22:50:20 +0000 (22:50 +0000)
minor add Media Wizard updates (bug 19863)

js2/editPage.js
js2/mwEmbed/example_usage/Firefogg_ReWriteForm.php [deleted file]
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js
js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/php/languages/mwEmbed.i18n.php
js2/uploadPage.js

index 0ddd1e9..b2c6498 100644 (file)
@@ -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 (file)
index b90a048..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-if($_FILES){
-       print "file uploaded oky:<pre>";
-       print_r($_FILES);
-       print "</pre>";
-       die();
-}
-?>
-
-<!DOCTYPE HTML>
-<html><head>
-<meta http-equiv="content-type" content="text/html; charset=UTF-8">
-    <title>Firefogg - Make Ogg Video in your Browser</title>   
-       <script type="text/javascript" src="../mv_embed.js?debug=true"></script> 
-<style type="text/css" media="all">@import "http://www.firefogg.org/css/style.css";</style>
-<style type="text/css" media="all">
-.install{
-display:none;
-}
-input{
-font-size:110%;
-}
-</style>
-<script type="text/javascript">
-mwAddOnloadHook(function(){
-       $j('#fogg-file').firefogg();    
-});
-</script>
-</head><body>
-<div id="main">
-  <h1>Rewrite Form example</h1>
-<br><br><br>
-<center>
-       <div style="width:500px">               
-               <!--  we submit it to ourselves (ie do nothing)  -->
-               <form action="Firefogg_ReWriteForm.php" method="POST" enctype='multipart/form-data'>
-               <table> 
-                       <tr><td>
-                 Video Name:</td><td> <input type="text" name="fname" /></td>
-                       </tr>
-                       <tr>
-                 <td>Video File :</td><td> <input type="file" name="fogg-file" id="fogg-file"/></td>
-                 </tr>
-                 <tr>
-                 <td>
-                 <input type="submit" value="Submit" />
-                 </td>
-                 </tr>
-                </table>
-               </form>
-       <br><br>
-       </div>
-</center>
-</body></html>
index 3da6010..2ee256c 100644 (file)
@@ -32,7 +32,9 @@ loadGM({
        "cc_pd_title": "Public Domain",
        "unknown_license": "Unknown License",   
        "no_import_by_url": "This User or Wiki <b>can not</b> import assets from remote URLs. </p><p> Do you need to Login? </p><p> If permissions are set you may have to enable $wgAllowCopyUploads, <a href=\"http://www.mediawiki.org/wiki/Manual:$wgAllowCopyUploads\">more info</a></p>",
-       "results_from": "Results from <a href=\"$1\" target=\"_new\" >$2</a>"
+       "results_from": "Results from <a href=\"$1\" target=\"_new\" >$2</a>",
+       
+       "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('<div id="rsd_resource_edit" '+
-                       'style="position:absolute;top:0px;left:0px;bottom:85px;right:4px;background-color:#FFF;">' +                     
+                       'style="position:absolute;top:0px;left:0px;bottom:75px;right:4px;background-color:#FFF;">' +                     
                                '<div id="clip_edit_disp" style="position:absolute;' + overflow_style + 'width:100%;height:100%;padding:5px;'+
                                        'width:' + (maxWidth) + 'px;" >' +
                                                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";                                                                     
index c21426c..610fd41 100644 (file)
@@ -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 ){
index 3832d26..1f08af3 100644 (file)
@@ -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" 
index ded2210..5fcc458 100644 (file)
@@ -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";
index 159eaab..090ec02 100644 (file)
@@ -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 
  */
index d5e3f7e..5e2f1b5 100644 (file)
@@ -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) <a href="http://commons.wikimedia.org/wiki/Commons:Firefogg">more info</a>',
-       'upload-fogg_not_installed' => 'If you want to upload video consider installing <a href="http://firefogg.org">firefogg.org</a>, <a href="http://commons.wikimedia.org/wiki/Commons:Firefogg">more info</a>',
-       '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, <a href="http://firefogg.org">please upgrade</a> ',
-       '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. <a href="http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types">More help</a>',
-       'upload-stats-fileprogres' => '$1 of $2',
-       'mv_upload_done' => 'Your upload <i>should be</i> accessible <a href="$1">here</a>',
-       '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 <b><tt>$1</tt></b> if you are not sure if you want to change it.',
-       'fileexists-thumb' => '<center><b>Existing file</b></center>',
-       'ignorewarning' => 'Ignore warning and save file anyway',
-       'file-thumbnail-no' => 'The filename begins with <b><tt>$1</tt></b>',
+       '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 <b>can not</b> import assets from remote URLs. </p><p> Do you need to Login? </p><p> If permissions are set you may have to enable $wgAllowCopyUploads, <a href="http://www.mediawiki.org/wiki/Manual:$wgAllowCopyUploads">more info</a></p>',
        'results_from' => 'Results from <a href="$1" target="_new" >$2</a>',
+       '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
index 2dc5e48..ea53282 100644 (file)
@@ -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