Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php |
— | — | @@ -46,6 +46,9 @@ |
47 | 47 | UsabilityInitiativeHooks::addScript( |
48 | 48 | 'EditToolbar/EditToolbar.js', $wgEditToolbarStyleVersion |
49 | 49 | ); |
| 50 | + UsabilityInitiativeHooks::addStyle( |
| 51 | + 'EditToolbar/EditToolbar.css', $wgEditToolbarStyleVersion |
| 52 | + ); |
50 | 53 | // Internationalization |
51 | 54 | wfLoadExtensionMessages( 'EditToolbar' ); |
52 | 55 | // Adds messages to page |
— | — | @@ -108,6 +111,15 @@ |
109 | 112 | 'edittoolbar-tool-newline', |
110 | 113 | 'edittoolbar-tool-table', |
111 | 114 | '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', |
112 | 124 | 'edittoolbar-tool-replace', |
113 | 125 | 'edittoolbar-tool-replace-title', |
114 | 126 | 'edittoolbar-tool-replace-search', |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | 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>', |
72 | 72 | init: function() { |
73 | 73 | $j(this).find( '[rel]' ).each( function() { |
74 | | - $j(this).html( gM( $j(this).attr( 'rel' ) ) ); |
| 74 | + $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
75 | 75 | }); |
76 | 76 | $j( '#edittoolbar-link-tabs' ).tabs(); |
77 | 77 | |
— | — | @@ -523,12 +523,70 @@ |
524 | 524 | type: 'button', |
525 | 525 | icon: 'insert-table.png', |
526 | 526 | 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 | + } |
533 | 591 | } |
534 | 592 | } |
535 | 593 | }, |
— | — | @@ -559,7 +617,7 @@ |
560 | 618 | 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>', |
561 | 619 | init: function() { |
562 | 620 | $j(this).find( '[rel]' ).each( function() { |
563 | | - $j(this).html( gM( $j(this).attr( 'rel' ) ) ); |
| 621 | + $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
564 | 622 | }); |
565 | 623 | }, |
566 | 624 | dialog: { |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.i18n.php |
— | — | @@ -72,18 +72,16 @@ |
73 | 73 | {{ns:file}}:Example.jpg|Caption2", |
74 | 74 | 'edittoolbar-tool-newline' => 'New line', |
75 | 75 | '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', |
88 | 86 | 'edittoolbar-tool-replace' => 'Replace', |
89 | 87 | 'edittoolbar-tool-replace-title' => 'Search and replace', |
90 | 88 | 'edittoolbar-tool-replace-search' => 'Search for:', |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | /* Configuration */ |
21 | 21 | |
22 | 22 | // Bump the version number every time you change any of the .css/.js files |
23 | | -$wgEditToolbarStyleVersion = 25; |
| 23 | +$wgEditToolbarStyleVersion = 26; |
24 | 24 | |
25 | 25 | // Set this to true to simply override the stock toolbar for everyone |
26 | 26 | $wgEditToolbarGlobalEnable = false; |