From 0f9e7ec7a7ca83e44f3e2d53fb9e452d24ef66fc Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Tue, 13 Oct 2009 20:04:03 +0000 Subject: [PATCH] * added file type display inline with media asset display --- js2/mwEmbed/libAddMedia/remoteSearchDriver.js | 48 ++++++++++++++++++- js2/mwEmbed/skins/mvpcf/styles.css | 13 +++-- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js index fe34b9707f..a89b61dbca 100644 --- a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js +++ b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js @@ -30,7 +30,7 @@ loadGM({ "mwe-cc_sa_title" : "Share Alike", "mwe-cc_pd_title" : "Public Domain", "mwe-unknown_license" : "Unknown license", - "mwe-no_import_by_url" : "This user or wiki can not<\/b> import assets from remote URLs.

Do you need to login?<\/p>

If permissions are set, you may have to enable $wgAllowCopyUploads<\/a>.<\/p>", + "mwe-no_import_by_url" : "This user or wiki can not<\/b> import assets from remote URLs.

Do you need to login?<\/p>

Is upload_by_url permission set for you?<\/br> Do you need may have to enable $wgAllowCopyUploads<\/a>.<\/p>", "mwe-results_from" : "Results from $2<\/a>", "mwe-missing_desc_see_source" : "This asset is missing a description. Please see the [$1 orginal source] and help describe it.", "rsd_config_error" : "Add media wizard configuration error: $1", @@ -46,7 +46,13 @@ loadGM({ "mwe-importing_asset" : "Importing asset", "mwe-preview_insert_resource" : "Preview insert of resource: $1", "mwe-checking-resource": "Checking for resource", - "mwe-resource-needs-import": "Resource $1 needs to be imported" + "mwe-resource-needs-import": "Resource $1 needs to be imported", + "mwe-ftype-svg" : "SVG vector file", + "mwe-ftype-jpg" : "JPEG image file", + "mwe-ftype-png" : "PNG image file", + "mwe-ftype-oga" : "Ogg audio file", + "mwe-ftype-ogg" : "Ogg video file", + "mwe-ftype-unk" : "Unknown File Format" }); var default_remote_search_options = { @@ -269,6 +275,37 @@ remoteSearchDriver.prototype = { ''+ ''; }, + /** + * getTypeIcon + * @param str mime type of the reqeusted file + */ + getTypeIcon:function( mimetype) { + var typestr = 'unk'; + switch( mimetype ){ + case 'image/svg+xml': + typestr = 'svg'; + break; + case 'image/jpeg': + typestr = 'jpg' + break; + case 'image/png': + typestr = 'png'; + break; + case 'audio/ogg': + typestr = 'oga'; + case 'video/ogg': + case 'application/ogg': + typestr = 'ogg'; + break; + } + + if(typestr=='unk') + js_log("unkown ftype: " + mimetype ); + + return '

' + + typestr + + '
' + }, /* * getLicenceKeyFromKey * @param license_key the key of the license (must be defined in: this.licenses.cc.licenses) @@ -966,9 +1003,16 @@ remoteSearchDriver.prototype = { o+=''; + + //add file type icon if known + if( rItem.mime ){ + o+= _this.getTypeIcon( rItem.mime ); + } + //add license icons if present if( rItem.license ) o+= _this.getlicenseImgSet( rItem.license ); + o+=''; }else if(_this.result_display_mode == 'list'){ o+='
'; diff --git a/js2/mwEmbed/skins/mvpcf/styles.css b/js2/mwEmbed/skins/mvpcf/styles.css index a79fb58e0b..49d3866e22 100644 --- a/js2/mwEmbed/skins/mvpcf/styles.css +++ b/js2/mwEmbed/skins/mvpcf/styles.css @@ -505,10 +505,17 @@ div.floatleft, table.floatleft { #rsd_resource_edit{ z-index:2; } +.rsd_file_type{ + position : absolute; + bottom : 0px; + left : 3px; + font-size: x-small; + background:#FFF; +} .rsd_license{ - position:absolute; - bottom:0px; - left:0px; + position : absolute; + bottom : 0px; + right : 0px; } .rsd_license img{ float:left; -- 2.20.1