* missing api_url removes tab from add-media-wizard
authorMichael Dale <dale@users.mediawiki.org>
Mon, 3 Aug 2009 08:02:07 +0000 (08:02 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Mon, 3 Aug 2009 08:02:07 +0000 (08:02 +0000)
* support crop output to html
* language updates
* multiple use of add-media css clean up

js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/php/languages/mwEmbed.i18n.php

index 45ef3da..5ba1e56 100644 (file)
@@ -129,7 +129,7 @@ remoteSearchDriver.prototype = {
                        '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',
+                       'api_url':  ( wgServer && wgScriptPath )? wgServer + wgScriptPath+ '/api.php': null,
                        'lib'    : 'mediaWiki', 
                        'local'  : true,
                        'tab_img': false
@@ -321,14 +321,26 @@ remoteSearchDriver.prototype = {
                   _this.getTexboxSelection();
                                
                //set up the content provider config:
-               if(this.cpconfig){
+               if( this.cpconfig ){
                        for(var cpc in cpconfig){
                                for(var cinx in this.cpconfig[cpc]){
                                        if( this.content_providers[cpc] )                                       
                                                this.content_providers[ cpc ][ cinx ] = this.cpconfig[cpc][ cinx];                              
                                }
                        }
+               }       
+               
+               //make sure the selected cp has an api to query against: 
+               if(! this.content_providers[ this.disp_item ].api_url  ){
+                       for(var inx in this.content_providers){
+                               if( this.content_providers[ inx ].api_url ){
+                                       this.disp_item = inx;
+                                       break;
+                               }
+                       }
                }
+                       
+               
                //set up the default model config: 
                this.dmodalCss = {
                        'width':'auto',
@@ -362,10 +374,10 @@ remoteSearchDriver.prototype = {
                $j(this.target_invocation).unbind().click(function(){
                          js_log("re-open");
                          //update the base text:
-                         if(_this.target_textbox)
+                         if( _this.target_textbox )
                                        _this.getTexboxSelection();
-               
-                         $j(_this.target_container).dialog('open').parent('.ui-dialog').css( _this.dmodalCss );
+                         //$j(_this.target_container).dialog("open");
+                         $j(_this.target_container).parents('.ui-dialog').fadeIn('slow');
                 });    
        },
        //gets the in and out points for insert position or grabs the selected text for search
@@ -414,10 +426,10 @@ remoteSearchDriver.prototype = {
                var _this = this;
                //add the parent target_container if not provided or missing
                if(!_this.target_container || $j(_this.target_container).length==0){
-                       $j('body').append('<div id="rsd_modal_target" style="position:absolute;top:30px;left:0px;bottom:45px;right:0px" title="' + gM('add_media_wizard') + '" ></div>');
+                       $j('body').append('<div id="rsd_modal_target" style="position:absolute;top:30px;left:0px;bottom:45px;right:0px;" title="' + gM('add_media_wizard') + '" ></div>');
                        _this.target_container = '#rsd_modal_target';
-                       js_log('appended: #rsd_modal_target' + $j(_this.target_container).attr('id'));
-                               js_log('added target id:' + $j(_this.target_container).attr('id'));
+                       //js_log('appended: #rsd_modal_target' + $j(_this.target_container).attr('id'));
+                       //js_log('added target id:' + $j(_this.target_container).attr('id'));
                        //get layout                    
                        //layout = _this.getMaxModalLayout();                   
                        $j(_this.target_container).dialog({
@@ -431,6 +443,7 @@ remoteSearchDriver.prototype = {
                                },
                                close: function() {
                                        js_log('closed modal');
+                                       $j(this).parents('.ui-dialog').fadeOut('slow');
                                }               
                        }).css({'height':'100%'}).parent('.ui-dialog').css( _this.dmodalCss )
                        //@@bind on resize to disable css dialog to update dmodelCss 
@@ -452,7 +465,8 @@ remoteSearchDriver.prototype = {
                        });
                        //re add cancel button 
                        _this.cancelClipEditCB();
-                       js_log('done setup of target_container: ' + $j(_this.target_container +'~ .ui-dialog-buttonpane').length);
+                       js_log('done setup of target_container: ' + 
+                               $j(_this.target_container +'~ .ui-dialog-buttonpane').length);
                        
                        
                        /*var resizeTimer = false;
@@ -564,7 +578,7 @@ remoteSearchDriver.prototype = {
                js_log("f:runSearch::" + this.disp_item);
                //draw_direct_flag
                var draw_direct_flag = true;                                    
-               if(!this.content_providers[this.disp_item])     {
+               if( !this.content_providers[this.disp_item] ){
                        js_log("can't run search for:" + this.disp_item);
                        return false;
                }                       
@@ -755,7 +769,7 @@ remoteSearchDriver.prototype = {
                        var tabc = '';          
                        for(var cp_id in  this.content_providers){
                                        var cp = this.content_providers[cp_id];
-                                       if( cp.enabled && cp.checked){                                  
+                                       if( cp.enabled && cp.checked && cp.api_url){                                    
                                                //add selected default if set
                                                if( this.disp_item == cp_id)
                                                        selected_tab=inx;
@@ -1545,7 +1559,8 @@ remoteSearchDriver.prototype = {
                 js_log("close all");
                 $j('#rsd_resource_preview').remove();
                 $j('#rsd_resource_edit').remove();
-                $j(_this.target_container).dialog('close');             
+                //$j(_this.target_container).dialog('close');
+                $j(_this.target_container).hide();              
        },
        setResultBarControl:function( ){
                var _this = this;
index 1f08af3..5a26fe5 100644 (file)
@@ -215,7 +215,16 @@ mediaWikiSearch.prototype = {
                var cat = rObj;         
                //return the html type: 
                if(rObj.mime.indexOf('image')!=-1){
-                       return '<img ' + id_attr + ' src="' + rObj.edit_url  + '"' + style_attr + ' >';
+                       //if crop is null do base output: 
+                       var imgHtml = '<img ' + id_attr + ' src="' + rObj.edit_url  + '"' + style_attr + ' >';
+                       if( rObj.crop == null)
+                               return imgHtml
+                       //else do crop output:  
+                       return '<div style="width:' + rObj.crop.wpx +'">' +                             
+                               '<div style="width:'+rObj.crop.w +'px;height: ' + rObj.crop.h +'px;overflow:hidden;position:relative">' +
+                               '<div style="position:relative;top:-' + rObj.crop.y +'px;left:-' + rObj.crop.x +'px">'+
+                                       imgHtml + 
+                               '</div>';                       
                }
                var ahtml='';
                if(rObj.mime == 'application/ogg' || rObj.mime == 'audio/ogg'){
@@ -230,7 +239,7 @@ mediaWikiSearch.prototype = {
                        if(rObj.mime.indexOf('audio/ogg')!=-1){
                                return '<audio ' + ahtml + '></audio>';
                        }
-               }               
+               }                                               
                js_log('ERROR:unsupored mime type: ' + rObj.mime);
        },
        getInlineDescWiki:function( rObj ){                                             
index 32c08f3..3fdb0e0 100644 (file)
@@ -47,8 +47,8 @@ loadGM({
        "mv_ogg-player-omtkplayer" : "OMTK Flash Vorbis",
        "mv_generic_missing_plugin" : "You browser does not appear to support playback type: <b>$1</b><br> visit the <a href=\"http://commons.wikimedia.org/wiki/Commons:Media_help\">Playback Methods</a> page to download a player<br>",
        
-       "mv_for_best_experience": "For a better video playback experience we recommend <b><a href=\"http://www.mozilla.com/en-US/firefox/upgrade.html?from=mv_embed\">Firefox 3.5</a></b>",
-       "mv_do_not_warn_again": "Do not warn me again." 
+       "mv_for_best_experience": "For a better video playback experience we recommend:<br> <b><a href=\"http://www.mozilla.com/en-US/firefox/upgrade.html?from=mwEmbed\">Firefox 3.5</a></b>",
+       "mv_do_not_warn_again": "Dissmiss for now."     
                
 });
 
@@ -107,6 +107,8 @@ var mv_default_source_attr= new Array(
        'default',
        'lang'
 );
+//set the dismissNativeWarn flag: 
+_global['dismissNativeWarn'] = false;
 /*
 * Converts all occurrences of <video> tag into video object
 */
@@ -346,15 +348,21 @@ var ctrlBuilder = {
                                                        gM('mv_do_not_warn_again') + 
                                                '</div>');                                                      
                                                $j('#ffwarn_'+embedObj.id).click(function(){
-                                                       if( $j(this).checked ){
-                                                               $j.cookie('dismissNativeWarn', true);
+                                                       if( $j(this).is(':checked') ){
+                                                               //set up a cookie for 7 days:
+                                                               $j.cookie('dismissNativeWarn', true, { expires: 5 });
+                                                               //set the current instance
+                                                               _global['dismissNativeWarn'] = true;
+                                                               $j('#gnp_' + embedObj.id).fadeOut('slow');
                                                        }else{
+                                                               _global['adismissNativeWarn'] = false;
                                                                $j.cookie('dismissNativeWarn', false);
                                                        }
                                                        
                                                });     
-                                       }
-                                       if( $j.cookie('dismissNativeWarn')!== true){
+                                       }                                       
+                                       if( ($j.cookie('dismissNativeWarn') !== true) &&
+                                               _global['dismissNativeWarn'] === false  ){
                                                $j('#gnp_' + embedObj.id).fadeIn('slow');
                                        }
                                },
index dc96783..e86cf8a 100644 (file)
@@ -58,7 +58,7 @@ var parseUri=function(d){var o=parseUri.options,value=o.parser[o.strictMode?"str
 if( !mv_embed_path ){
        var mv_embed_path = getMvEmbedPath();
 }
-jQueryUiVN = 'jquery.ui-1.7.1'; 
+var jQueryUiVN = 'jquery.ui-1.7.1'; 
 
 
 //setup the skin path: 
index e140a00..8d60fdf 100644 (file)
@@ -223,7 +223,7 @@ $messages['en'] = array(
        'mv_ogg-player-selected' => ' (selected)',
        'mv_ogg-player-omtkplayer' => 'OMTK Flash Vorbis',
        'mv_generic_missing_plugin' => 'You browser does not appear to support playback type: <b>$1</b><br> visit the <a href="http://commons.wikimedia.org/wiki/Commons:Media_help">Playback Methods</a> page to download a player<br>',
-       'mv_for_best_experience' => 'For a better video playback experience we recommend <b><a href="http://www.mozilla.com/en-US/firefox/upgrade.html?from=mv_embed">Firefox 3.5</a></b>',
-       'mv_do_not_warn_again' => 'Do not warn me again.',
+       'mv_for_best_experience' => 'For a better video playback experience we recommend:<br> <b><a href="http://www.mozilla.com/en-US/firefox/upgrade.html?from=mwEmbed">Firefox 3.5</a></b>',
+       'mv_do_not_warn_again' => 'Dissmiss for now.',
 );
 #</JAVASCRIPT EN REPLACE>
\ No newline at end of file