r57696 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57695‎ | r57696 | r57697 >
Date:00:50, 14 October 2009
Author:dale
Status:deferred
Tags:
Comment:
* add-media-wizard license display updates
* consistent link-back look
Modified paths:
  • /trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/php/languages/mwEmbed.i18n.php (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/mvpcf/styles.css (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -21,6 +21,7 @@
2222 "rsd_layout" : "Layout:",
2323 "rsd_resource_edit" : "Edit resource: $1",
2424 "mwe-resource_description_page" : "Resource description page",
 25+ "mwe-link" : "link",
2526 "rsd_local_resource_title" : "Local resource title",
2627 "rsd_do_insert" : "Do insert",
2728 "mwe-cc_title" : "Creative Commons",
@@ -233,16 +234,16 @@
234235 'cc':{
235236 'base_img_url':'http://upload.wikimedia.org/wikipedia/commons/thumb/',
236237 'base_license_url': 'http://creativecommons.org/licenses/',
237 - 'licenses':{
238 - 'by': 'by/3.0/',
239 - 'by-sa': 'by-sa/3.0/',
240 - 'by-nc-nd': 'by-nc-nd/3.0/',
241 - 'by-nc': 'by-nc/3.0/',
242 - 'by-nd': 'by-nd/3.0/',
243 - 'by-nc-sa': 'by-nc-sa/3.0/',
244 - 'by-sa': 'by-nc/3.0',
245 - 'pd': 'publicdomain/'
246 - },
 238+ 'licenses':[
 239+ 'by',
 240+ 'by-sa',
 241+ 'by-nc-nd',
 242+ 'by-nc',
 243+ 'by-nd',
 244+ 'by-nc-sa',
 245+ 'by-sa',
 246+ 'pd'
 247+ ],
247248 'license_img':{
248249 'by':{
249250 'im':'1/11/Cc-by_new_white.svg/20px-Cc-by_new_white.svg.png'
@@ -274,55 +275,26 @@
275276 licenseObj.img_html +
276277 '</a>'+
277278 '</div>';
278 - },
279 - /**
280 - * getTypeIcon
281 - * @param str mime type of the reqeusted file
282 - */
283 - getTypeIcon:function( mimetype) {
284 - var typestr = 'unk';
285 - switch( mimetype ){
286 - case 'image/svg+xml':
287 - typestr = 'svg';
288 - break;
289 - case 'image/jpeg':
290 - typestr = 'jpg'
291 - break;
292 - case 'image/png':
293 - typestr = 'png';
294 - break;
295 - case 'audio/ogg':
296 - typestr = 'oga';
297 - case 'video/ogg':
298 - case 'application/ogg':
299 - typestr = 'ogg';
300 - break;
301 - }
302 -
303 - if(typestr=='unk')
304 - js_log("unkown ftype: " + mimetype );
305 -
306 - return '<div class="rsd_file_type ui-corner-all ui-state-default ui-widget-content" title="' + gM('mwe-ftype-' + typestr) + '">' +
307 - typestr +
308 - '</div>'
309 - },
 279+ },
310280 /*
311281 * getLicenceKeyFromKey
312282 * @param license_key the key of the license (must be defined in: this.licenses.cc.licenses)
313283 */
314 - getLicenceFromKey:function( license_key , force_url){
315 - if( typeof( this.licenses.cc.licenses[ license_key ]) == 'undefined')
316 - return js_error('could not find:' + license_key);
 284+ getLicenceFromKey:function( license_key , force_url){
317285 //set the current license pointer:
318286 var cl = this.licenses.cc;
319287 var title = gM('mwe-cc_title');
320288 var imgs = '';
321289 var license_set = license_key.split('-');
322290 for(var i=0;i < license_set.length; i++){
323 - lkey = license_set[i];
 291+ var lkey = license_set[i];
 292+ if(! cl.license_img[ lkey ] ){
 293+ js_log("MISSING::" + lkey );
 294+ }
 295+
324296 title += ' ' + gM( 'mwe-cc_' + lkey + '_title');
325 - imgs +='<img class="license_desc" width="20" src="' + cl.base_img_url +
326 - cl.license_img[ lkey ].im + '">';
 297+ imgs +='<img class="license_desc" width="20" src="'
 298+ + cl.base_img_url + cl.license_img[ lkey ].im + '">';
327299 }
328300 var url = (force_url) ? force_url : cl.base_license_url + cl.licenses[ license_key ];
329301 return {
@@ -337,15 +309,20 @@
338310 * @param licence_url the url of the license
339311 */
340312 getLicenceFromUrl: function( license_url ){
341 - //js_log("getLicenceFromUrl::" + license_url);
 313+ //js_log("getLicenceFromUrl::" + license_url);
342314 //first do a direct lookup check:
343 - for(var i in this.licenses.cc.licenses){
344 - var lkey = this.licenses.cc.licenses[i].split('/')[0];
345 - //guess by url trim
346 - if( parseUri(license_url).path.indexOf('/'+ lkey +'/') != -1){
347 - return this.getLicenceFromKey( i , license_url);
 315+ for(var j =0; j < this.licenses.cc.licenses.length; j++){
 316+ var jL = this.licenses.cc.licenses[ j ];
 317+ //special 'pd' case:
 318+ if( jL == 'pd'){
 319+ var keyCheck = 'publicdomain';
 320+ }else{
 321+ var keyCheck = jL;
 322+ }
 323+ if( parseUri(license_url).path.indexOf('/'+ keyCheck +'/') != -1){
 324+ return this.getLicenceFromKey(jL , license_url);
348325 }
349 - }
 326+ };
350327 //could not find it return mwe-unknown_license
351328 return {
352329 'title' : gM('mwe-unknown_license'),
@@ -353,6 +330,37 @@
354331 'lurl' : license_url
355332 };
356333 },
 334+ /**
 335+ * getTypeIcon
 336+ * @param str mime type of the requested file
 337+ */
 338+ getTypeIcon:function( mimetype) {
 339+ var typestr = 'unk';
 340+ switch( mimetype ){
 341+ case 'image/svg+xml':
 342+ typestr = 'svg';
 343+ break;
 344+ case 'image/jpeg':
 345+ typestr = 'jpg'
 346+ break;
 347+ case 'image/png':
 348+ typestr = 'png';
 349+ break;
 350+ case 'audio/ogg':
 351+ typestr = 'oga';
 352+ case 'video/ogg':
 353+ case 'application/ogg':
 354+ typestr = 'ogg';
 355+ break;
 356+ }
 357+
 358+ if(typestr=='unk')
 359+ js_log("unkown ftype: " + mimetype );
 360+
 361+ return '<div class="rsd_file_type ui-corner-all ui-state-default ui-widget-content" title="' + gM('mwe-ftype-' + typestr) + '">' +
 362+ typestr +
 363+ '</div>'
 364+ },
357365 //some default layout values:
358366 thumb_width : 80,
359367 image_edit_width : 400,
@@ -1007,9 +1015,10 @@
10081016 + '">';
10091017 //add a linkback to resource page in upper right:
10101018 if( rItem.link )
1011 - o+='<a target="_new" style="position:absolute;top:0px;right:0px" title="' +
1012 - gM('mwe-resource_description_page') +
1013 - '" href="' + rItem.link + '"><img src="http://upload.wikimedia.org/wikipedia/commons/6/6b/Magnify-clip.png"></a>';
 1019+ o+='<div class="rsd_linkback ui-corner-all ui-state-default ui-widget-content" >' +
 1020+ '<a target="_new" title="' + gM('mwe-resource_description_page') +
 1021+ '" href="' + rItem.link + '">'+ gM('mwe-link') + '</a>' +
 1022+ '</div>';
10141023
10151024 //add file type icon if known
10161025 if( rItem.mime ){
Index: trunk/phase3/js2/mwEmbed/php/languages/mwEmbed.i18n.php
@@ -161,6 +161,7 @@
162162 'rsd_layout' => 'Layout:',
163163 'rsd_resource_edit' => 'Edit resource: $1',
164164 'mwe-resource_description_page' => 'Resource description page',
 165+ 'mwe-link' => 'link',
165166 'rsd_local_resource_title' => 'Local resource title',
166167 'rsd_do_insert' => 'Do insert',
167168 'mwe-cc_title' => 'Creative Commons',
Index: trunk/phase3/js2/mwEmbed/skins/mvpcf/styles.css
@@ -509,9 +509,14 @@
510510 position : absolute;
511511 bottom : 0px;
512512 left : 3px;
513 - font-size: x-small;
514 - background:#FFF;
 513+ font-size: x-small;
515514 }
 515+.rsd_linkback{
 516+ position: absolute;
 517+ top: 0px;
 518+ right: 0px;
 519+ font-size: x-small;
 520+}
516521 .rsd_license{
517522 position : absolute;
518523 bottom : 0px;
Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -1441,6 +1441,8 @@
14421442 ], function() {
14431443 $('#mwe_tmp_loader').dialog({
14441444 bgiframe: true,
 1445+ draggable: false,
 1446+ resizable: false,
14451447 height: 140,
14461448 modal: true
14471449 });

Status & tagging log