r55207 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55206‎ | r55207 | r55208 >
Date:21:43, 17 August 2009
Author:catrope
Status:deferred
Tags:
Comment:
EditToolbar: Add table CGD
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.i18n.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php
@@ -46,6 +46,9 @@
4747 UsabilityInitiativeHooks::addScript(
4848 'EditToolbar/EditToolbar.js', $wgEditToolbarStyleVersion
4949 );
 50+ UsabilityInitiativeHooks::addStyle(
 51+ 'EditToolbar/EditToolbar.css', $wgEditToolbarStyleVersion
 52+ );
5053 // Internationalization
5154 wfLoadExtensionMessages( 'EditToolbar' );
5255 // Adds messages to page
@@ -108,6 +111,15 @@
109112 'edittoolbar-tool-newline',
110113 'edittoolbar-tool-table',
111114 'edittoolbar-tool-table-example',
 115+ 'edittoolbar-tool-table-example-header',
 116+ 'edittoolbar-tool-table-title',
 117+ 'edittoolbar-tool-table-dimensions',
 118+ 'edittoolbar-tool-table-dimensions-rows',
 119+ 'edittoolbar-tool-table-dimensions-columns',
 120+ 'edittoolbar-tool-table-dimensions-headerrows',
 121+ 'edittoolbar-tool-table-dimensions-headercolumns',
 122+ 'edittoolbar-tool-table-insert',
 123+ 'edittoolbar-tool-table-cancel',
112124 'edittoolbar-tool-replace',
113125 'edittoolbar-tool-replace-title',
114126 'edittoolbar-tool-replace-search',
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -70,7 +70,7 @@
7171 html: '<div id="edittoolbar-link-tabs"><ul><li><a href="#edittoolbar-link-dialog-tab-int" rel="edittoolbar-tool-link-int"></a></li><li><a href="#edittoolbar-link-dialog-tab-ext" rel="edittoolbar-tool-link-ext"></a></li></ul><div id="edittoolbar-link-dialog-tab-int"><form><label for="edittoolbar-link-int-target" rel="edittoolbar-tool-link-int-target"></label> <input type="text" id="edittoolbar-link-int-target" /> <div id="edittoolbar-link-int-target-status" style="display: inline;"></div><br /><label for="edittoolbar-link-int-text" rel="edittoolbar-tool-link-int-text"></label> <input type="text" id="edittoolbar-link-int-text" /></form></div><div id="edittoolbar-link-dialog-tab-ext"><form><label for="edittoolbar-link-ext-target" rel="edittoolbar-tool-link-ext-target"></label> <input type="text" id="edittoolbar-link-ext-target" /><br /><label for="edittoolbar-link-ext-text" rel="edittoolbar-tool-link-ext-text"></label> <input type="text" id="edittoolbar-link-ext-text" /></form></div></div>',
7272 init: function() {
7373 $j(this).find( '[rel]' ).each( function() {
74 - $j(this).html( gM( $j(this).attr( 'rel' ) ) );
 74+ $j(this).text( gM( $j(this).attr( 'rel' ) ) );
7575 });
7676 $j( '#edittoolbar-link-tabs' ).tabs();
7777
@@ -523,12 +523,70 @@
524524 type: 'button',
525525 icon: 'insert-table.png',
526526 action: {
527 - type: 'encapsulate',
528 - options: {
529 - pre: "{| class=\"wikitable\" border=\"1\"\n|",
530 - periMsg: 'edittoolbar-tool-table-example',
531 - post: "\n|}",
532 - ownline: true
 527+ type: 'dialog',
 528+ titleMsg: 'edittoolbar-tool-table-title',
 529+ id: 'edittoolbar-table-dialog',
 530+ html: '<form><fieldset><legend rel="edittoolbar-tool-table-dimensions"></legend>' +
 531+ '<table><tr><td class="label"><label for="edittoolbar-table-dimensions-columns"' +
 532+ ' rel="edittoolbar-tool-table-dimensions-columns"></label></td>' +
 533+ '<td><input type="text" id="edittoolbar-table-dimensions-columns" size="2" /></td>' +
 534+ '<td class="label"><label for="edittoolbar-table-dimensions-rows"' +
 535+ ' rel="edittoolbar-tool-table-dimensions-rows"></label></td>' +
 536+ '<td><input type="text" id="edittoolbar-table-dimensions-rows" size="2" /></td></tr>' +
 537+ '<tr><td class="label"><label for="edittoolbar-table-dimensions-headercolumns"' +
 538+ ' rel="edittoolbar-tool-table-dimensions-headercolumns"></label></td>' +
 539+ '<td><input type="text" id="edittoolbar-table-dimensions-headercolumns" size="2" /></td>' +
 540+ '<td class="label"><label for="edittoolbar-table-dimensions-headerrows"' +
 541+ ' rel="edittoolbar-tool-table-dimensions-headerrows"></label></td>' +
 542+ '<td><input type="text" id="edittoolbar-table-dimensions-headerrows" size="2" /></td></tr>' +
 543+ '</table></fieldset></form>',
 544+ init: function() {
 545+ $j(this).find( '[rel]' ).each( function() {
 546+ $j(this).text( gM( $j(this).attr( 'rel' ) ) );
 547+ });
 548+ },
 549+ dialog: {
 550+ width: 350, // FIXME: autoresize
 551+ buttons: {
 552+ 'edittoolbar-tool-table-insert': function() {
 553+ var rows = parseInt( $j( '#edittoolbar-table-dimensions-rows' ).val() );
 554+ var cols = parseInt( $j( '#edittoolbar-table-dimensions-columns' ).val() );
 555+ var hrows = parseInt( $j( '#edittoolbar-table-dimensions-headerrows' ).val() );
 556+ var hcols = parseInt( $j( '#edittoolbar-table-dimensions-headercolumns' ).val() );
 557+
 558+ var table = "{|\n";
 559+ for ( var r = 0; r < rows; r++ ) {
 560+ table += "|-\n";
 561+ for ( var c = 0; c < cols; c++ ) {
 562+ var isHeader = ( r < hrows && c < hcols );
 563+ var delim = isHeader ? '!' : '|';
 564+ if ( c > 0 )
 565+ delim += delim;
 566+ table += delim + ' ' +
 567+ gM( isHeader ?
 568+ 'edittoolbar-tool-table-example-header' :
 569+ 'edittoolbar-tool-table-example',
 570+ [ r + 1, c + 1 ] ) + ' ';
 571+ }
 572+ // Replace trailing space by newline
 573+ // table[table.length - 1] is read-only
 574+ table = table.substr( 0, table.length - 1 ) + "\n";
 575+ }
 576+ table += "|}";
 577+ $j.wikiEditor.modules.toolbar.fn.doAction(
 578+ $j(this).data( 'context' ), {
 579+ type: 'encapsulate',
 580+ options: {
 581+ pre: table,
 582+ ownline: true
 583+ }
 584+ });
 585+ $j(this).dialog( 'close' );
 586+ },
 587+ 'edittoolbar-tool-table-cancel': function() {
 588+ $j(this).dialog( 'close' );
 589+ }
 590+ }
533591 }
534592 }
535593 },
@@ -559,7 +617,7 @@
560618 html: '<form><fieldset><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label> <input type="text" id="edittoolbar-replace-search" /><br /><label for="edittoolbar-replace-replace" rel="edittoolbar-tool-replace-replace"></label> <input type="text" id="edittoolbar-replace-replace" /><br /><input type="checkbox" id="edittoolbar-replace-case" /><label for="edittoolbar-replace-case" rel="edittoolbar-tool-replace-case"></label><br /><input type="checkbox" id="edittoolbar-replace-regex" /><label for="edittoolbar-replace-regex" rel="edittoolbar-tool-replace-regex"></label><br /><input type="checkbox" id="edittoolbar-replace-all" /><label for="edittoolbar-replace-all" rel="edittoolbar-tool-replace-all"></label></fieldset></form>',
561619 init: function() {
562620 $j(this).find( '[rel]' ).each( function() {
563 - $j(this).html( gM( $j(this).attr( 'rel' ) ) );
 621+ $j(this).text( gM( $j(this).attr( 'rel' ) ) );
564622 });
565623 },
566624 dialog: {
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.i18n.php
@@ -72,18 +72,16 @@
7373 {{ns:file}}:Example.jpg|Caption2",
7474 'edittoolbar-tool-newline' => 'New line',
7575 'edittoolbar-tool-table' => 'Table',
76 - 'edittoolbar-tool-table-example' => "-
77 -! header 1
78 -! header 2
79 -! header 3
80 -|-
81 -| row 1, cell 1
82 -| row 1, cell 2
83 -| row 1, cell 3
84 -|-
85 -| row 2, cell 1
86 -| row 2, cell 2
87 -| row 2, cell 3",
 76+ 'edittoolbar-tool-table-example' => 'Row $1, cell $2',
 77+ 'edittoolbar-tool-table-example-header' => 'Row $1, cell $2 (header)',
 78+ 'edittoolbar-tool-table-title' => 'Insert table',
 79+ 'edittoolbar-tool-table-dimensions' => 'Dimensions',
 80+ 'edittoolbar-tool-table-dimensions-rows' => 'Rows',
 81+ 'edittoolbar-tool-table-dimensions-columns' => 'Columns',
 82+ 'edittoolbar-tool-table-dimensions-headerrows' => 'Header rows',
 83+ 'edittoolbar-tool-table-dimensions-headercolumns' => 'Header columns',
 84+ 'edittoolbar-tool-table-insert' => 'Insert',
 85+ 'edittoolbar-tool-table-cancel' => 'Cancel',
8886 'edittoolbar-tool-replace' => 'Replace',
8987 'edittoolbar-tool-replace-title' => 'Search and replace',
9088 'edittoolbar-tool-replace-search' => 'Search for:',
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php
@@ -19,7 +19,7 @@
2020 /* Configuration */
2121
2222 // Bump the version number every time you change any of the .css/.js files
23 -$wgEditToolbarStyleVersion = 25;
 23+$wgEditToolbarStyleVersion = 26;
2424
2525 // Set this to true to simply override the stock toolbar for everyone
2626 $wgEditToolbarGlobalEnable = false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r56417UsabilityInitiative:...catrope15:33, 16 September 2009

Status & tagging log