r57414 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57413‎ | r57414 | r57415 >
Date:01:38, 6 October 2009
Author:dale
Status:deferred
Tags:
Comment:
* fixed add-media-wizard centering issue on scrolling page.
* fixed add-media-wizard layout size on resize
* added check for double add-media button adding
Modified paths:
  • /trunk/phase3/js2/editPage.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
@@ -176,7 +176,7 @@
177177 }
178178 };
179179 //attempt to parse out some stuff from the template:
180 - var desc = rObj.desc.match(/\|Description=(([^\n]*\n)*)\|Source=/)
 180+ var desc = rObj.desc.match(/\|Description\s*=\s*(([^\n]*\n)*)\|Source=/)
181181 if( desc && desc[1] ){
182182 rObj.desc = $j.trim( desc[1] );
183183 }
Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -50,8 +50,6 @@
5151 var default_remote_search_options = {
5252 'profile':'mediawiki_edit',
5353 'target_container':null, //the div that will hold the search interface
54 - //if using a modeal dialog (instead of target_container) how close to the edge of the window should we go:
55 - 'modal_edge_padding':'20px',
5654
5755 'target_invocation': null, //the button or link that will invoke the search interface
5856
@@ -107,7 +105,7 @@
108106 },
109107 /** the default content providers list.
110108 *
111 - * (should be note that special tabs like "upload" and "combined" don't go into the content proviers list:
 109+ * (should be note that special tabs like "upload" and "combined" don't go into the content providers list:
112110 * @note do not use double underscore in content providers names (used for id lookup)
113111 *
114112 * @@todo we will want to load more per user-preference and per category lookup
@@ -345,17 +343,7 @@
346344 this.content_providers[i].enabled = false;
347345 }
348346 }
349 - }
350 -
351 - //set up the default model config:
352 - this.dmodalCss = {
353 - 'width':'auto',
354 - 'height':'auto',
355 - 'top' : this.modal_edge_padding,
356 - 'left' : this.modal_edge_padding,
357 - 'right' : this.modal_edge_padding,
358 - 'bottom': this.modal_edge_padding
359 - }
 347+ }
360348
361349
362350 //set up the target invocation:
@@ -386,6 +374,8 @@
387375 _this.getTexboxSelection();
388376 //$j(_this.target_container).dialog("open");
389377 $j(_this.target_container).parents('.ui-dialog').fadeIn('slow');
 378+ //re-center the dialog:
 379+ $j(_this.target_container).dialog('option', 'position','center');
390380 });
391381 },
392382 //gets the in and out points for insert position or grabs the selected text for search
@@ -440,48 +430,40 @@
441431 //js_log('added target id:' + $j(_this.target_container).attr('id'));
442432 //get layout
443433 //layout = _this.getMaxModalLayout();
 434+ js_log( 'width: ' + $j(window).width() + ' height: ' + $j(window).height());
 435+ var cConf = {};
 436+ cConf['cancel'] = function(){
 437+ _this.cancelClipEditCB()
 438+ }
 439+ function doResize(){
 440+ js_log('do resize:: ' + _this.target_container);
 441+ $j( '#rsd_modal_target').dialog('option', 'width', $j(window).width()-50 );
 442+ $j( '#rsd_modal_target').dialog('option', 'height', $j(window).height()-50 );
 443+ $j( '#rsd_modal_target').dialog('option', 'position','center');
 444+ }
 445+
444446 $j(_this.target_container).dialog({
445447 bgiframe: true,
446448 autoOpen: true,
447449 modal: true,
448450 draggable:false,
449451 resizable:false,
450 - buttons: {
451 - '_': function() {
452 - //just a place-holder
453 - }
454 - },
 452+ buttons:cConf,
455453 close: function() {
456454 //if we are 'editing' a item close that
457455 _this.cancelClipEditCB();
458456 js_log('closed modal');
459457 $j(this).parents('.ui-dialog').fadeOut('slow');
460458 }
461 - }).parent('.ui-dialog').css( _this.dmodalCss );
 459+ });
 460+ doResize();
 461+ $j(window).resize(function(){
 462+ doResize();
 463+ });
462464
463 - //@@bind on resize to disable css dialog to update dmodelCss
464 - //(resize and drag presently disabled)
465 - /*.bind('resizestart', function(event, ui) {
466 - _this.dmodalCss = {};
467 - $j(this).css({});
468 - })
469 - //bind on drag to remove preset style as well
470 - .bind('dragstart', function(event, ui) {
471 - _this.dmodalCss = {};
472 - $j(this).css({});
473 - });*/
474465
475 - /*var resizeTimer = false;
476 - $j(window).bind('resize', function() {
477 - var adjustModal = function(){
478 - var layout = _this.getMaxModalLayout();
479 - //js_log("should adjust: h " + layout.h + ' width:' + layout.w);
480 - $j(_this.target_container).dialog('option', 'width', layout.w);
481 - $j(_this.target_container).dialog('option', 'height', layout.h);
482 - }
483 - if (resizeTimer) clearTimeout(resizeTimer);
484 - var resizeTimer = setTimeout(adjustModal, 100);
485 - });*/
 466+ //re add cancel button
 467+ _this.cancelClipEditCB();
486468
487469 //update the child position: (some of this should be pushed up-stream via dialog config options
488470 $j(_this.target_container +'~ .ui-dialog-buttonpane').css({
@@ -490,11 +472,12 @@
491473 'right':'0px',
492474 'bottom':'0px'
493475 });
494 - //re add cancel button
495 - _this.cancelClipEditCB();
 476+ /*
 477+
 478+
496479 js_log('done setup of target_container: ' +
497480 $j(_this.target_container +'~ .ui-dialog-buttonpane').length);
498 -
 481+ */
499482
500483 }
501484 },
Index: trunk/phase3/js2/editPage.js
@@ -31,11 +31,13 @@
3232 }, 100 );
3333 } else {
3434 // Add the add-media-wizard button for old toolbar:
35 - $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' +
36 - mv_skin_img_path + 'Button_add_media.png">' );
37 - $j( '#btn-add-media-wiz' ).addMediaWiz(
38 - amwConf
39 - );
 35+ if( $j('#btn-add-media-wiz').length == 0 ){
 36+ $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' +
 37+ mv_skin_img_path + 'Button_add_media.png">' );
 38+ $j( '#btn-add-media-wiz' ).addMediaWiz(
 39+ amwConf
 40+ );
 41+ }
4042 }
4143
4244 // Add to new toolbar (need to use api)

Status & tagging log