r82784 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82783‎ | r82784 | r82785 >
Date:07:42, 25 February 2011
Author:wikibhasha.msr
Status:deferred (Comments)
Tags:
Comment:
bug#25848-copy/paste should be allowed, bug#27520 upgrade to scratchpad feature
Modified paths:
  • /trunk/extensions/WikiBhasha/src/images/icnLoad.jpg (added) (history)
  • /trunk/extensions/WikiBhasha/src/js/core/globalSettings.js (modified) (history)
  • /trunk/extensions/WikiBhasha/src/js/core/mainWindow.js (modified) (history)
  • /trunk/extensions/WikiBhasha/src/js/core/paneManagement.js (modified) (history)
  • /trunk/extensions/WikiBhasha/src/js/core/scratchpadWindow.js (modified) (history)
  • /trunk/extensions/WikiBhasha/src/js/core/utils.js (modified) (history)
  • /trunk/extensions/WikiBhasha/src/lang/de/strings.js (modified) (history)
  • /trunk/extensions/WikiBhasha/src/lang/en/strings.js (modified) (history)
  • /trunk/extensions/WikiBhasha/src/styles/themes/wikiBhasha.black.css (modified) (history)
  • /trunk/extensions/WikiBhasha/src/styles/themes/wikiBhasha.blue.css (modified) (history)
  • /trunk/extensions/WikiBhasha/src/styles/themes/wikiBhasha.silver.css (modified) (history)
  • /trunk/extensions/WikiBhasha/src/styles/wikiBhasha.css (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiBhasha/src/lang/en/strings.js
@@ -88,8 +88,10 @@
8989 shareMessage: "edited {0} in {1} Wikipedia using WikiBhasha http://www.wikibhasha.org.",
9090 shareMesgTitle: "Share Message",
9191 shareToolTip: "Share On",
92 - copyToClipboard: "(Copy to clipboard)",
93 -
 92+ newWindowMessage: "<center><h2>Your edited content has been loaded into a Wikipedia edit page in the new window. <br>Please use that new window to save the content. Once you save the content to Wikipedia, you will be redirected back here.</h2></center>",
 93+ transleteButton: "Translate {0} to {1}",
 94+ copyToClipboard: "(Copy to clipboard)",
 95+ pasteMessage: "To use the WikiBhasha Copy/Paste feature in mozilla/firefox you need to use scratchpad.\nDo you want to invoke scratchpad?",
9496 //tooptip strings
9597 searchInputTooltip: "Search",
9698 collapseTooltip: "Collapse",
@@ -117,7 +119,7 @@
118120 waitUntilTranslationComplete: "Please wait till the translation completes.",
119121 thanksMessage: "Thank you for your contribution to Wikipedia. Would you like to give feedback?",
120122 nonEditableMessage: "WikiBhasha may be invoked only on editable articles; this article is protected in Wikipedia."
121 - };
 123+ }
122124
123125 //short cut to call local strings
124126 wbLocal = wikiBhasha.localStrings;
Index: trunk/extensions/WikiBhasha/src/lang/de/strings.js
@@ -87,7 +87,10 @@
8888 shareMessage: "edited {0} in {1} Wikipedia using WikiBhasha http://www.wikibhasha.org.",
8989 shareMesgTitle: "Share Message",
9090 shareToolTip: "Share On",
 91+ newWindowMessage: "<center><h2>Your edited content has been loaded into a Wikipedia edit page in the new window. <br>Please use that new window to save the content. Once you save the content to Wikipedia, you will be redirected back here.</h2></center>",
 92+ transleteButton: "Translate {0} to {1}",
9193 copyToClipboard: "(Copy to clipboard)",
 94+ pasteMessage: "To use the WikiBhasha Copy/Paste feature in mozilla/firefox you need to use scratchpad.\nDo you want to invoke scratchpad?",
9295
9396 //tooptip strings
9497 searchInputTooltip: "Search",
@@ -116,7 +119,7 @@
117120 waitUntilTranslationComplete: "Please wait till the translation completes.",
118121 thanksMessage: "Thank you for your contribution to Wikipedia. Would you like to give feedback?",
119122 nonEditableMessage: "WikiBhasha may be invoked only on editable articles; this article is protected in Wikipedia."
120 - };
 123+ }
121124
122125 //short cut to call local strings
123126 wbLocal = wikiBhasha.localStrings;
Index: trunk/extensions/WikiBhasha/src/styles/wikiBhasha.css
@@ -449,7 +449,6 @@
450450 display:none;
451451 float:left;
452452 height: 25px;
453 -
454453 font-size:12px;
455454 font-weight :bold;
456455 }
@@ -783,4 +782,59 @@
784783 padding-left:4px;
785784 float:left;
786785 text-align:left;
 786+}
 787+
 788+/* scratchpad */
 789+
 790+#wbScratchPadWindow {
 791+ visibility: visible;
 792+ z-index: 100000;
 793+ position: absolute;
 794+ width:700px;
 795+ direction:ltr;
 796+}
 797+.scratchTopLayout
 798+{
 799+ float:left;
 800+ width:250px;
 801+ min-width:250px;
 802+}
 803+.scratchTopButtonLayout
 804+{
 805+ text-align:center;
 806+ float:left;
 807+ margin:5px;
 808+ width:75px;
 809+ display:block;
 810+}
 811+.scratchContentLayout{
 812+ float:left;
 813+ width:240px;
 814+ min-width:240px;
 815+ border:1px solid #DDE1E3;
 816+ height:50px;
 817+ overflow:auto;
 818+}
 819+#scratchPadLimitNoteHolder
 820+{
 821+ clear:both;
 822+}
 823+.wbScratchPadSection {
 824+ margin:10px 5px 10px 5px;
 825+}
 826+.wbScratchPadSectionContent {
 827+ padding:0px;
 828+ width:100%;
 829+ float:left;
 830+ clear:left;
 831+ margin-bottom:2px;
 832+}
 833+.scratchContentLayoutRow
 834+{
 835+ margin:5px;
 836+ overflow:hidden;
 837+}
 838+.scratchTopButtonLayout INPUT
 839+{
 840+ width: 75px !important;
787841 }
\ No newline at end of file
Index: trunk/extensions/WikiBhasha/src/styles/themes/wikiBhasha.silver.css
@@ -25,13 +25,6 @@
2626 font-size:12px;
2727 direction:ltr;
2828 }
29 -#wbScratchPadWindow {
30 - visibility: visible;
31 - z-index: 100000;
32 - position: absolute;
33 - width:300px;
34 - direction:ltr;
35 -}
3629 #wbSplitHelperDiv
3730 {
3831 opacity:0.0;
@@ -41,9 +34,9 @@
4235 position:absolute;
4336 z-index:1000;
4437 }
45 -#wbWrapperContextMenu
 38+#wbWrapperScratchPad
4639 {
47 - width:300px;
 40+ width:700px;
4841 }
4942 #wbSplitter {
5043 height: 480px;
@@ -192,13 +185,6 @@
193186 height:35px;
194187 border-left:1px solid #90a9b8;
195188 }
196 -.wbWindowToolbarCenter {
197 - background-image: url('../../images/themes/silver/toolbarBg.png');
198 - background-repeat:repeat-x;
199 - background-position:top;
200 - height:35px;
201 - border:1px solid #dde1e3;
202 -}
203189 .wbWindowToolbarRight {
204190 background-image: url('../../images/themes/silver/toolbarBg.png');
205191 background-repeat:repeat-x;
@@ -334,12 +320,22 @@
335321 display:block;
336322 width:22px;
337323 height:17px;
338 - background: url('../../images/themes/blue/delete.png') no-repeat;
 324+ background: url('../../images/themes/silver/delete.png') no-repeat;
339325 float:left;
340326 padding:0px 0px 0px 0px;
341327 cursor:pointer;
342328 font-size:1px;
343329 }
 330+a.wbEdit {
 331+ display:block;
 332+ width:22px;
 333+ height:17px;
 334+ background: url('../../images/icnLoad.jpg') no-repeat;
 335+ float:left;
 336+ padding:0px 0px 0px 0px;
 337+ cursor:pointer;
 338+ font-size:1px;
 339+}
344340 /* mouseover state */
345341 a.wbHelp:hover
346342 {
@@ -508,8 +504,22 @@
509505 {
510506 background-position: -22px -22px;
511507 }
 508+.wbTranslatedAreaHead
 509+{
 510+ background-image: url('../../images/themes/silver/toolbarBg.png');
 511+ background-repeat:repeat-x;
 512+ background-position:top;
 513+ height:25px;
 514+ border:1px solid #dde1e3;
 515+}
512516 /*top right icon layout END*/
513 -
 517+.wbWindowToolbarCenter {
 518+ background-image: url("../../images/themes/blue/toolbarBg.png");
 519+ background-position: center top;
 520+ background-repeat: repeat-x;
 521+ border: 1px solid #DDE1E3;
 522+ height: 35px;
 523+}
514524 input.wbTranslateButton
515525 {
516526 padding: 2px 10px 2px 30px;
@@ -605,11 +615,6 @@
606616 border-top-color: #9ea3a7;
607617 border-left-color: #9ea3a7;
608618 }
609 -#wbSourceText
610 -{
611 - width: 441px;
612 - height: 90px;
613 -}
614619 .wbAddAletnateTable {
615620 margin-bottom:5px;
616621 width:100%;
@@ -787,32 +792,6 @@
788793 .wbContextMenu LI.delete A { background-image: url('../../images/page_white_delete.png'); }
789794 .wbContextMenu LI.quit A { background-image: url('../../images/door.png'); }
790795
791 -.wbScratchPadRowDeleteRow {
792 - padding:5px;
793 - vertical-align:top;
794 - width:10%;
795 - border-left:1px solid #dde1e3;
796 - border-bottom:1px solid #dde1e3;
797 - border-right:1px solid #dde1e3;
798 -}
799 -
800 -.wbScratchPadRow {
801 - padding:5px;
802 - vertical-align:top;
803 - width:45%;
804 - border:1px solid #dde1e3;
805 -}
806 -.wbScratchPadSectionContent {
807 - padding:0px;
808 - width:450px;
809 - float:left;
810 - clear:left;
811 - margin-bottom:2px;
812 -}
813 -.wbScratchPadSection {
814 - margin:10px 5px 10px 5px;
815 - width:450px;
816 -}
817796 .wbTutorial
818797 {
819798 float:left;
Index: trunk/extensions/WikiBhasha/src/styles/themes/wikiBhasha.blue.css
@@ -24,13 +24,6 @@
2525 font-size:12px;
2626 direction:ltr;
2727 }
28 -#wbScratchPadWindow {
29 - visibility: visible;
30 - z-index: 100000;
31 - position: absolute;
32 - width:300px;
33 - direction:ltr;
34 -}
3528 #wbSplitHelperDiv
3629 {
3730 opacity:0.0;
@@ -40,9 +33,9 @@
4134 position:absolute;
4235 z-index:1000;
4336 }
44 -#wbWrapperContextMenu
 37+#wbWrapperScratchPad
4538 {
46 - width:300px;
 39+ width:700px;
4740 }
4841 #wbSplitter {
4942 height: 480px;
@@ -191,13 +184,6 @@
192185 height:35px;
193186 border-left:1px solid #90a9b8;
194187 }
195 -.wbWindowToolbarCenter {
196 - background-image: url('../../images/themes/blue/toolbarBg.png');
197 - background-repeat:repeat-x;
198 - background-position:top;
199 - height:35px;
200 - border:1px solid #dde1e3;
201 -}
202188 .wbWindowToolbarRight {
203189 background-image: url('../../images/themes/blue/toolbarBg.png');
204190 background-repeat:repeat-x;
@@ -339,6 +325,16 @@
340326 cursor:pointer;
341327 font-size:1px;
342328 }
 329+a.wbEdit {
 330+ display:block;
 331+ width:22px;
 332+ height:17px;
 333+ background: url('../../images/icnLoad.jpg') no-repeat;
 334+ float:left;
 335+ padding:0px 0px 0px 0px;
 336+ cursor:pointer;
 337+ font-size:1px;
 338+}
343339 /* mouseover state */
344340 a.wbHelp:hover
345341 {
@@ -507,8 +503,22 @@
508504 {
509505 background-position: -22px -22px;
510506 }
 507+.wbTranslatedAreaHead
 508+{
 509+ background-image: url('../../images/themes/blue/toolbarBg.png');
 510+ background-repeat:repeat-x;
 511+ background-position:top;
 512+ height:25px;
 513+ border:1px solid #dde1e3;
 514+}
511515 /*top right icon layout END*/
512 -
 516+.wbWindowToolbarCenter {
 517+ background-image: url("../../images/themes/blue/toolbarBg.png");
 518+ background-position: center top;
 519+ background-repeat: repeat-x;
 520+ border: 1px solid #DDE1E3;
 521+ height: 35px;
 522+}
513523 input.wbTranslateButton
514524 {
515525 padding: 2px 10px 2px 30px;
@@ -604,11 +614,6 @@
605615 border-top-color: #9ea3a7;
606616 border-left-color: #9ea3a7;
607617 }
608 -#wbSourceText
609 -{
610 - width: 441px;
611 - height: 90px;
612 -}
613618 .wbAddAletnateTable {
614619 margin-bottom:5px;
615620 width:100%;
@@ -787,32 +792,6 @@
788793 .wbContextMenu LI.delete A { background-image: url('../../images/page_white_delete.png'); }
789794 .wbContextMenu LI.quit A { background-image: url('../../images/door.png'); }
790795
791 -.wbScratchPadRowDeleteRow {
792 - padding:5px;
793 - vertical-align:top;
794 - width:10%;
795 - border-left:1px solid #dde1e3;
796 - border-bottom:1px solid #dde1e3;
797 - border-right:1px solid #dde1e3;
798 -}
799 -
800 -.wbScratchPadRow {
801 - padding:5px;
802 - vertical-align:top;
803 - width:45%;
804 - border:1px solid #dde1e3;
805 -}
806 -.wbScratchPadSectionContent {
807 - padding:0px;
808 - width:450px;
809 - float:left;
810 - clear:left;
811 - margin-bottom:2px;
812 -}
813 -.wbScratchPadSection {
814 - margin:10px 5px 10px 5px;
815 - width:450px;
816 -}
817796 .wbTutorial
818797 {
819798 float:left;
Index: trunk/extensions/WikiBhasha/src/styles/themes/wikiBhasha.black.css
@@ -24,13 +24,6 @@
2525 font-size:12px;
2626 direction:ltr;
2727 }
28 -#wbScratchPadWindow {
29 - visibility: visible;
30 - z-index: 100000;
31 - position: absolute;
32 - width:300px;
33 - direction:ltr;
34 -}
3528 #wbSplitHelperDiv
3629 {
3730 opacity:0.0;
@@ -40,9 +33,9 @@
4134 position:absolute;
4235 z-index:1000;
4336 }
44 -#wbWrapperContextMenu
 37+#wbWrapperScratchPad
4538 {
46 - width:300px;
 39+ width:700px;
4740 }
4841 #wbSplitter {
4942 height: 480px;
@@ -191,13 +184,6 @@
192185 height:35px;
193186 border-left:1px solid #90a9b8;
194187 }
195 -.wbWindowToolbarCenter {
196 - background-image: url('../../images/themes/black/toolbarBg.png');
197 - background-repeat:repeat-x;
198 - background-position:top;
199 - height:35px;
200 - border:1px solid #dde1e3;
201 -}
202188 .wbWindowToolbarRight {
203189 background-image: url('../../images/themes/black/toolbarBg.png');
204190 background-repeat:repeat-x;
@@ -333,12 +319,22 @@
334320 display:block;
335321 width:22px;
336322 height:17px;
337 - background: url('../../images/themes/blue/delete.png') no-repeat;
 323+ background: url('../../images/themes/black/delete.png') no-repeat;
338324 float:left;
339325 padding:0px 0px 0px 0px;
340326 cursor:pointer;
341327 font-size:1px;
342328 }
 329+a.wbEdit {
 330+ display:block;
 331+ width:22px;
 332+ height:17px;
 333+ background: url('../../images/icnLoad.jpg') no-repeat;
 334+ float:left;
 335+ padding:0px 0px 0px 0px;
 336+ cursor:pointer;
 337+ font-size:1px;
 338+}
343339 /* mouseover state */
344340 a.wbHelp:hover
345341 {
@@ -507,8 +503,22 @@
508504 {
509505 background-position: -22px -22px;
510506 }
 507+.wbTranslatedAreaHead
 508+{
 509+ background-image: url('../../images/themes/black/toolbarBg.png');
 510+ background-repeat:repeat-x;
 511+ background-position:top;
 512+ height:25px;
 513+ border:1px solid #dde1e3;
 514+}
511515 /*top right icon layout END*/
512 -
 516+.wbWindowToolbarCenter {
 517+ background-image: url("../../images/themes/blue/toolbarBg.png");
 518+ background-position: center top;
 519+ background-repeat: repeat-x;
 520+ border: 1px solid #DDE1E3;
 521+ height: 35px;
 522+}
513523 input.wbTranslateButton
514524 {
515525 padding: 2px 10px 2px 30px;
@@ -603,11 +613,6 @@
604614 border-top-color: #9ea3a7;
605615 border-left-color: #9ea3a7;
606616 }
607 -#wbSourceText
608 -{
609 - width: 441px;
610 - height: 90px;
611 -}
612617 .wbAddAletnateTable {
613618 margin-bottom:5px;
614619 width:100%;
@@ -787,32 +792,6 @@
788793 .wbContextMenu LI.delete A { background-image: url('../../images/page_white_delete.png'); }
789794 .wbContextMenu LI.quit A { background-image: url('../../images/door.png'); }
790795
791 -.wbScratchPadRowDeleteRow {
792 - padding:5px;
793 - vertical-align:top;
794 - width:10%;
795 - border-left:1px solid #dde1e3;
796 - border-bottom:1px solid #dde1e3;
797 - border-right:1px solid #dde1e3;
798 -}
799 -
800 -.wbScratchPadRow {
801 - padding:5px;
802 - vertical-align:top;
803 - width:45%;
804 - border:1px solid #dde1e3;
805 -}
806 -.wbScratchPadSectionContent {
807 - padding:0px;
808 - width:450px;
809 - float:left;
810 - clear:left;
811 - margin-bottom:2px;
812 -}
813 -.wbScratchPadSection {
814 - margin:10px 5px 10px 5px;
815 - width:450px;
816 -}
817796 .wbTutorial
818797 {
819798 float:left;
Index: trunk/extensions/WikiBhasha/src/images/icnLoad.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/WikiBhasha/src/images/icnLoad.jpg
___________________________________________________________________
Added: svn:mime-type
820799 + application/octet-stream
Index: trunk/extensions/WikiBhasha/src/js/core/scratchpadWindow.js
@@ -45,6 +45,7 @@
4646
4747 $clearAllButton: null,
4848 $sourceTextBox: null,
 49+ $targetTextBox: null,
4950
5051 //initializes scratchpad window
5152 initialize: function() {
@@ -70,9 +71,13 @@
7172 $scratchPadWindowElement = $("#" + this.windowId);
7273 this.$clearAllButton = $("#wbClearAllBtn");
7374 this.$sourceTextBox = $("#wbSourceText");
 75+ this.$targetTextBox = $("#wbTargetText");
7476
7577 $("#scratchPadLimitNoteText").html(wbUtil.stringFormat(wbLocal.scratchPadTextLimitNote, wbGlobalSettings.scratchpadTextMaxLength));
76 -
 78+ $("#wbScratchpadHeadLabelLeft").html(wbUtil.stringFormat("<h4>{0} Text</h4>", wbLocal.english));
 79+ $("#wbScratchpadHeadLabelRight").html(wbUtil.stringFormat("<h4>{0} Text</h4>", wbGlobalSettings.targetLanguageDisplayName));
 80+ $('#wbSourceToTargetBtn').val(wbUtil.stringFormat("{0} >> {1}", wbGlobalSettings.sourceLanguageCode, wbGlobalSettings.mtTargetLanguageCode));
 81+ $('#wbTargetToSourceBtn').val(wbUtil.stringFormat("{0} << {1}", wbGlobalSettings.sourceLanguageCode, wbGlobalSettings.mtTargetLanguageCode));
7782 wbUIHelper.makeDraggable(this.windowId, "wbSPDraggableHandle");
7883
7984 //set focus on text area
@@ -84,6 +89,10 @@
8590 wbScratchPad.hide();
8691 });
8792
 93+ $("#wbSaveScratchPadContentBtn").click(function() {
 94+ wbScratchPad.saveScratchPadText(wbGlobalSettings.sourceLanguageCode, wbGlobalSettings.mtTargetLanguageCode);
 95+ });
 96+
8897 //clear the text area when user clicks on 'clearAll' button
8998 this.$clearAllButton.click(function() {
9099 wbScratchPad.clearAll();
@@ -99,14 +108,18 @@
100109 $("#wbSourceToTargetBtn").click(function() {
101110 wbScratchPad.translateScratchPadText("wbSourceText", wbGlobalSettings.sourceLanguageCode, wbGlobalSettings.mtTargetLanguageCode);
102111 });
 112+ //set title for the button
 113+ $("#wbSourceToTargetBtn").attr("Title", wbUtil.stringFormat(wbLocal.transleteButton, wbLocal.english, wbGlobalSettings.targetLanguageDisplayName));
 114+ //when user clicks, translates the given string from target to source language
103115
104 - //when user clicks, translates the given string from target to source language
105116 $("#wbTargetToSourceBtn").click(function() {
106 - wbScratchPad.translateScratchPadText("wbSourceText", wbGlobalSettings.mtTargetLanguageCode, wbGlobalSettings.sourceLanguageCode);
 117+ wbScratchPad.translateScratchPadText("wbTargetText", wbGlobalSettings.mtTargetLanguageCode, wbGlobalSettings.sourceLanguageCode);
107118 });
 119+ //set title for the button
 120+ $("#wbTargetToSourceBtn").attr("Title", wbUtil.stringFormat(wbLocal.transleteButton, wbGlobalSettings.targetLanguageDisplayName, wbLocal.english));
108121
109122 //handle the resizing for scratchpad window
110 - var scratchPad = $("#wbWrapperContextMenu"),
 123+ var scratchPad = $("#wbWrapperScratchPad"),
111124 $scratchPadTableElement = $("#scratchPadTable");
112125 //assign the width and height.
113126 scratchPad.css("width", $scratchPadTableElement.width());
@@ -133,6 +146,7 @@
134147 resize: function() {
135148 var $translateArea = $("#wbTranslatedArea"),
136149 sourceTextArea = wbScratchPad.$sourceTextBox,
 150+ targetTextArea = wbScratchPad.$targetTextBox,
137151 offset = $translateArea.offset(),
138152 $scratchPadTableElement = $("#scratchPadTable"),
139153
@@ -140,12 +154,12 @@
141155 contentMargin = 32,
142156 contentHeightMargin = 136;
143157
144 - // resize the text area width
145 - sourceTextArea.css("width", $scratchPadTableElement.width() - contentMargin);
146 - // resize the translated table height and width
147 - $translateArea.css({ "width": $scratchPadTableElement.width() - contentMargin,
148 - "height": ($("#wbWrapperContextMenu").height() - sourceTextArea.height() - contentHeightMargin)
149 - });
 158+ // resize the textarea and listint div width
 159+ $(".scratchTopLayout").css({"width": ($scratchPadTableElement.width()/2)-120,"display":"block"});
 160+ $(".scratchContentLayout").css({"width": ($scratchPadTableElement.width()/2)-120,"display":"block"});
 161+
 162+ // resize the translated div height
 163+ $translateArea.css({"height": ($("#wbWrapperScratchPad").height() - sourceTextArea.height() - contentHeightMargin)});
150164 },
151165 // this event is fired while resizing of the scratchpad is stopped
152166 stop: function() {
@@ -178,19 +192,28 @@
179193
180194 //deletes given row from the translation history
181195 deleteRow: function(rowId) {
182 - $(rowId).remove();
 196+ $('#wbTargetRow'+rowId).remove();
183197 this.rowCount = this.rowCount - 1;
184198 if (this.rowCount === 1) {
185199 this.$clearAllButton.attr("disabled", "true");
186200 }
 201+ return true;
187202 },
188203
 204+ //loads given row from the translation history to the edit/add form
 205+ editRow: function(rowId) {
 206+ this.$sourceTextBox.val($('#wbSourceCol'+rowId).text());
 207+ this.$targetTextBox.val($('#wbTargetCol'+rowId).text());
 208+ return true;
 209+ },
 210+
189211 //clears text from the scratchpad text area and translation history
190212 clearAll: function() {
191213 this.$sourceTextBox.val("");
 214+ this.$targetTextBox.val("");
192215 //disable clear button
193216 this.$clearAllButton.attr("disabled", "true");
194 - $("#wbTargetTable tr:gt(0)").remove();
 217+ $('#wbTranslatedArea').html("");
195218 this.rowCount = 1;
196219 this.currentRowId = 1;
197220 },
@@ -221,16 +244,14 @@
222245 //call the translate function to translate the given text
223246 wbLanguageServices.translate($sourceText, sourceCode, targetCode, function(translatedText) {
224247 if (translatedText && translatedText.length) {
225 - //add new row with source text and translated text
226 - wbScratchPad.addRow($sourceText, translatedText, sourceCode, targetCode);
227 - wbScratchPad.$clearAllButton.removeAttr("disabled");
228 - wbUIHelper.hideElement("wbTranslationLoading");
229 - return;
 248+ if(sourceCode!='en'){
 249+ $('#wbSourceText').val(translatedText);
 250+ }else{
 251+ $('#wbTargetText').val(translatedText);
 252+ }
230253 }
231 - else {
232 - wbUIHelper.hideElement("wbTranslationLoading");
233 - return;
234 - }
 254+ wbUIHelper.hideElement("wbTranslationLoading");
 255+ return;
235256 });
236257 }
237258 else {
@@ -240,6 +261,20 @@
241262 }
242263 },
243264
 265+ //saves the scratchpad text for future use
 266+ saveScratchPadText: function(sourceCode, targetCode){
 267+ //add new row with source text and translated text
 268+ if($.trim($('#wbSourceText').val()).length === 0 && $.trim($('#wbTargetText').val()).length === 0){
 269+ window.alert(wbLocal.emptyInputText, wbGlobalSettings.applicationName);
 270+ }else{
 271+ wbScratchPad.addRow($('#wbSourceText').val(), $('#wbTargetText').val(), sourceCode, targetCode);
 272+ $('#wbSourceText').val("");
 273+ $('#wbTargetText').val("")
 274+ wbScratchPad.$clearAllButton.removeAttr("disabled");
 275+ }
 276+ return;
 277+ },
 278+
244279 //adds row in to the scratchpad's translation history table
245280 addRow: function($sourceText, translatedText, sourceCode, targetCode) {
246281 //target row element id
@@ -250,25 +285,27 @@
251286 targetColId = "wbTargetCol" + this.currentRowId,
252287 //delete image row element id
253288 deleteRowBtn = "wbDeleteRowBtn" + this.currentRowId,
254 -
 289+ //load image row element id
 290+ editRowBtn = "wbEditRowBtn" + this.currentRowId,
 291+ //scratchpad content box element
 292+ $scratchPadTableElement = $("#scratchPadTable"),
255293 //create new translation history row
256 - newRow = wbUtil.stringFormat("<tr id={0} class='wbScratchPadTarget'><td class='wbScratchPadRow'" +
257 - "id={1}></td><td class='wbScratchPadRow' id={2} style='vertical-align:top;'></td>" +
258 - "<td class='wbScratchPadRowDeleteRow' style='vertical-align:top;'>" +
259 - "<a id={3} class='wbDelete' href='#' name='{0}' title='Delete this row' >" +
260 - "</a></td></tr>", targetRowId, sourceColId, targetColId, deleteRowBtn);
 294+ newRow = wbUtil.stringFormat("<div id={0} class='scratchContentLayoutRow'><div class='scratchContentLayout' id={1}></div>"+
 295+ "<div class='scratchTopButtonLayout'>&nbsp;</div>"+
 296+ "<div class='scratchContentLayout' id={2} ></div>" +
 297+ "<div class='scratchTopButtonLayout'>" +
 298+ "<a id={3} class='wbDelete' href='#' name='{5}' title='Delete this row' class='scratchContentLayout'></a>" +
 299+ "<a id={4} class='wbEdit' href='#' name='{5}' title='Load this row' class='scratchContentLayout'></a>" +
 300+ "</div></div>", targetRowId, sourceColId, targetColId, deleteRowBtn, editRowBtn, this.currentRowId);
261301
262 - //show scratchpad target area header
263 - $("#wbHeaderRow").css({ 'visibility': 'visible' });
 302+
264303 //append row if the row contained in scratchpad is equal to 1
265304 if (this.rowCount === 1) {
266 - $("#wbTargetTable").append(newRow);
 305+ $("#wbTranslatedArea").append(newRow);
267306 }
268307 else if (this.rowCount > 1) {
269 - // find the second TR (1st TR is for header of the table)
270 - var $targetTable = $("#wbTargetTable"),
271 - $secondRow = $targetTable.get(0).getElementsByTagName("tr")[1];
272 - $(newRow).insertBefore("#" + $secondRow.id);
 308+ // find the second TR (1st TR is for header of the table)
 309+ $(newRow).insertBefore("#" + $("#wbTranslatedArea").get(0).getElementsByTagName("div")[0].id);
273310 }
274311
275312 // Warning! Do not use html() or innerHTML, which could cause script injection.
@@ -288,9 +325,17 @@
289326 this.$sourceTextBox.val("");
290327 //delete the row when user clicks on delete image
291328 $("#" + deleteRowBtn).bind('click', function() {
292 - wbScratchPad.deleteRow("#" + this.name);
 329+ wbScratchPad.deleteRow(this.name);
293330 });
294331
 332+ //Load the row when user clicks on load image
 333+ $("#" + editRowBtn).bind('click', function() {
 334+ wbScratchPad.editRow(this.name);
 335+ });
 336+ // resize the textarea and listint div width
 337+ $(".scratchTopLayout").css({"width": ($scratchPadTableElement.width()/2)-120,"display":"block"});
 338+ $(".scratchContentLayout").css({"width": ($scratchPadTableElement.width()/2)-120,"display":"block"});
 339+
295340 this.rowCount = this.rowCount + 1;
296341 this.currentRowId = this.currentRowId + 1;
297342 this.$clearAllButton.removeAttr("disabled");
@@ -299,8 +344,6 @@
300345
301346 //applies localization on scratchpad window
302347 applyLocalization: function() {
303 - $("#wbSourceToTargetBtn").attr("value", wbUtil.stringFormat("{1}{0}{2}{0}{3}", wbLocal.space, wbLocal.english, wbLocal.toText, wbGlobalSettings.$targetLanguageName));
304 - $("#wbTargetToSourceBtn").attr("value", wbUtil.stringFormat("{1}{0}{2}{0}{3}", wbLocal.space, wbGlobalSettings.$targetLanguageName, wbLocal.toText, wbLocal.english));
305348 $("#wbScratchPadHeader").html(wbLocal.scratchPad);
306349 wbScratchPad.$clearAllButton.attr("value", wbLocal.clearAll);
307350 $("#wbSourceTextHeader").html(wbLocal.sourceTextHeader);
Index: trunk/extensions/WikiBhasha/src/js/core/mainWindow.js
@@ -52,9 +52,11 @@
5353 wbUIHelper.hideScroll();
5454
5555 wbUIHelper.createWindow(this.windowId, wbGlobalSettings.applicationWindowHTML);
 56+
5657 this.adjustWindowPosition();
5758 wbMainWindow.applyLocalization();
58 -
 59+
 60+
5961 //initialize various UI components
6062 wikiBhasha.windowManagement.resizeManager.initialize();
6163 wikiBhasha.windowManagement.splitterManager.initialize();
@@ -109,7 +111,7 @@
110112 });
111113
112114 //restrict user from selecting text from UI elements as IE doesn't have any predefined HTML attribute to do the same.
113 - $(".wbWindowToolbarCenter, .wbHeader, .wbLeftWindowCollapsed, .wbRightWindowCollapsed, .wbLogoContainer, .wbTopButtonsDiv, .workflowNavigationBtns, .wbWindowContentLeft, .wbWindowContentRight").each(function() {
 115+ $("#wbSPDraggableHandle, #wbTranslationTable, #wbWrapperScratchPad, #wbScratchPadWindow, #scratchPadTable, .scratchContentLayoutRow, .scratchTopButtonLayout, .wbScratchPadSection, .scratchContentLayout, .scratchTopLayout, .wbWindowToolbarCenter, .wbHeader, .wbLeftWindowCollapsed, .wbRightWindowCollapsed, .wbLogoContainer, .wbTopButtonsDiv, .workflowNavigationBtns, .wbWindowContentLeft, .wbWindowContentRight").each(function() {
114116 this.onselectstart = function() { return false; };
115117 });
116118 }
@@ -435,7 +437,23 @@
436438 $documentBodyElement.bind("paste", function(event) {
437439 //if cut/copy events are not registered earlier from this window or user trying to paste the content other than scratch pad text area then prevent this action.
438440 if (!isCopyFromCurrentApp) {
439 - return (wbScratchPad.$sourceTextBox) ? (event.target.id === wbScratchPad.$sourceTextBox.attr("id")) : false;
 441+ if((wbScratchPad.$sourceTextBox && event.target.id === wbScratchPad.$sourceTextBox.attr("id")) || (wbScratchPad.$targetTextBox && event.target.id === wbScratchPad.$targetTextBox.attr("id"))){
 442+ return true;
 443+ }else{
 444+ var paneDivID = wbDisplayPaneManager.getPaneForId(wbDisplayPaneHelper.getElementsPaneDivId(event.target));
 445+ if(paneDivID.paneConfigInfo.isContentEditable){
 446+ if ($.browser.msie) {
 447+ var copiedtext=window.clipboardData.getData("Text");
 448+ window.clipboardData.setData("Text", wbUtil.stripTags(copiedtext));
 449+ return true;
 450+ }else{
 451+ if(confirm(wbLocal.pasteMessage)){
 452+ wbScratchPad.show();
 453+ }
 454+ }
 455+ }
 456+ return false;
 457+ }
440458 }
441459 return true;
442460 });
@@ -461,7 +479,7 @@
462480
463481 //removes cloned HTML elements(during Drag-Drop or Copy-Paste) from the element"#wbRightWindowContentDiv"
464482 removeNonContentElements: function() {
465 - var $elementsToBeRemoved = $("#wbTranslationTable, .wbExit, .wbLeftWindowContent, .wbLogoContainer, .wbContentContainer, #wbTwoPaneOuterWrapper, #wbLeftWindow, .wbTableBackground, .wbTopButtonsDiv, #wbTopIcons, #wbHistoryInfo, .workflowNavigationBtns, #workFlowStepBtns, .wbTable, .wbHeader, #wbWorkingArticleLabel, .tabs_li, .wbWikiMarkupEditBottomLinks, .tab_content", $("#wbRightWindowContentDiv"));
 483+ var $elementsToBeRemoved = $("#wbTranslationTable, #wbScratchPadWindow, #scratchPadTable, .scratchContentLayoutRow, .scratchTopButtonLayout, .wbScratchPadSection, .scratchContentLayout, .scratchTopLayout, .wbExit, .wbLeftWindowContent, .wbLogoContainer, .wbContentContainer, #wbTwoPaneOuterWrapper, #wbLeftWindow, .wbTableBackground, .wbTopButtonsDiv, #wbTopIcons, #wbHistoryInfo, .workflowNavigationBtns, #workFlowStepBtns, .wbTable, .wbHeader, #wbWorkingArticleLabel, .tabs_li, .wbWikiMarkupEditBottomLinks, .tab_content", $("#wbRightWindowContentDiv"));
466484 var removeCloneNodes = function() {
467485 //jQuery '.remove()' method actually removes the events on original elements
468486 //to avoid this we need to use native DOM method to remove only the cloned elements
Index: trunk/extensions/WikiBhasha/src/js/core/paneManagement.js
@@ -136,12 +136,12 @@
137137 },
138138 loadWikiEditPage : function () {
139139 wbDisplayPaneHelper.setPaneTitleFromConfig(wbPublishDisplayPane.$contentElem, wbPublishDisplayPane.paneConfigInfo);
140 - wbPublishDisplayPane.$contentElem.html("<center><h2>Your edited content has been loaded into a Wikipedia edit page in the new window. <br>Please use that new window to save the content. Once you save the content to Wikipedia, you will be redirected back here.</h2></center>");
141 - // get the existance of the text area in the iFrame.
 140+ wbPublishDisplayPane.$contentElem.html(wbLocal.newWindowMessage);
 141+ // get the existance of the text area in the child window.
142142 var noOfTextAreas = wbPublishDisplayPane.getWikiTextareaElement().length;
143143
144144 // Check the state of the content and the text area. If the content is already moved to
145 - // Wikipedia and there is no text area present in the iFrame, then close the application
 145+ // Wikipedia and there is no text area present in the window, then close the application
146146 // and load the updated Wikipedia page.
147147 if (wbPublishDisplayPane.isContentMovedToWikipedia && (noOfTextAreas === 0)) {
148148 var currentPageUrl = window.location.href;
@@ -149,8 +149,6 @@
150150 wbPublishDisplayPane.wbChildWikipedia.close();
151151 clearTimeout(wbPublishDisplayPane.timeoutObj);
152152 wbPublishDisplayPane.$contentElem.html(" ");
153 - //window.location.href = currentPageUrl;
154 - //wbMainWindow.hide();
155153 //show WikiBhasha share exit popup.
156154 wbShareOnExternSystem.show();
157155 return;
@@ -174,10 +172,10 @@
175173 // into wikipedia article content when user clicks the save button.
176174 addSnippetInjectCodeToSaveButton : function () {
177175
178 - // get the iFrame which contains the wikipedia text area and the save button
179 - var iFrameDoc = wbPublishDisplayPane.wbChildWikipedia.document,
180 - // get the save button from the iFrame
181 - saveButton = iFrameDoc.getElementById(wbWikiSite.wikiSaveButton);
 176+ // get the child window which contains the wikipedia text area and the save button
 177+ var childWindowDoc = wbPublishDisplayPane.wbChildWikipedia.document,
 178+ // get the save button from the childWindowDoc
 179+ saveButton = childWindowDoc.getElementById(wbWikiSite.wikiSaveButton);
182180 if (saveButton) {
183181 // bind the click event to the save button
184182 saveButton.onclick = function() {
@@ -1042,15 +1040,15 @@
10431041
10441042 //configures the compose area for wikipedia edit page pane
10451043 configureComposeArea: function() {
1046 - //iframe document object
1047 - var iframeDoc = wbPublishDisplayPane.wbChildWikipedia.document;
 1044+ //child window document object
 1045+ var childWindowDoc = wbPublishDisplayPane.wbChildWikipedia.document;
10481046
10491047 //removing unwanted divs from compose area
1050 - $(wbWikiSite.wikiEditPageNonCriticalDivs, iframeDoc).hide();
 1048+ $(wbWikiSite.wikiEditPageNonCriticalDivs, childWindowDoc).hide();
10511049 //set margin
1052 - $(wbWikiSite.wikiComposeDiv, iframeDoc).css("margin-left", 0).css("margin-right", 0);
 1050+ $(wbWikiSite.wikiComposeDiv, childWindowDoc).css("margin-left", 0).css("margin-right", 0);
10531051 //disable links inside compose area
1054 - $(wbWikiSite.wikiComposeLinks, iframeDoc).click(function() { return false; });
 1052+ $(wbWikiSite.wikiComposeLinks, childWindowDoc).click(function() { return false; });
10551053 },
10561054
10571055 //checks the translateion status and returns true if it was done otherwise it returns false.
Index: trunk/extensions/WikiBhasha/src/js/core/globalSettings.js
@@ -86,7 +86,7 @@
8787
8888 //cutoff length to be used for pane titles
8989 paneTitleCutoffLength: 100,
90 -
 90+
9191 //cutoff length to be used for edit page summery field
9292 summeryFieldCutoffLength: 200,
9393
@@ -136,6 +136,7 @@
137137
138138 //array of microsoft translator supported languages. [language name, language code, display text]
139139 mtlLanguages: [ ['Arabic', 'ar', 'العربية'],
 140+ ['Bangala', 'bn', 'বাংলা'],
140141 ['Bulgarian', 'bg', 'български'],
141142 ['Czech', 'cs', 'čeština'],
142143 ['Danish', 'da', 'Dansk'],
@@ -165,6 +166,7 @@
166167 ['Slovenian', 'sl', 'Slovenščina'],
167168 ['Finnish', 'fi', 'Suomi'],
168169 ['Swedish', 'sv', 'Svenska'],
 170+ ['Tamil', 'ta', 'தமிழ்'],
169171 ['Thai', 'th', 'ไทย'],
170172 ['Turkish', 'tr', 'Türkçe'],
171173 ['Ukrainian', 'uk', 'Українська'],
@@ -736,8 +738,8 @@
737739 </div>',
738740
739741
740 -scratchpadWindowHTML:'<div id="wbWrapperContextMenu" >\
741 -<table height="100%" border="0" cellspacing="0" cellpadding="0" id="scratchPadTable" class="wbTableBackground">\
 742+scratchpadWindowHTML:'<div id="wbWrapperScratchPad" >\
 743+<table height="100%" border="0" cellspacing="0" cellpadding="0" id="scratchPadTable" width="100%">\
742744 <tr>\
743745 <td class="wbWindowTopLeft"><img src="../images/trans.gif" width="4" height="4" alt="" /></td>\
744746 <td class="wbWindowTopCenter"><img src="../images/trans.gif" width="4" height="3" alt="" /></td>\
@@ -759,50 +761,36 @@
760762 <td class="wbWindowContentLeft"><img src="../images/trans.gif" width="3" height="3" alt="" /></td>\
761763 <td class="wbWindowContentCenter">\
762764 <div class="wbScratchPadSection">\
763 -<div class="wbScratchPadSectionContent">\
764 -<table border="0" cellspacing="0" cellpadding="0" class="wbAddAletnateTable">\
765 -<tr valign="top">\
766 -<td width="100%">\
767 -<textarea id="wbSourceText" rows="5" cols="25" tabindex="0" style="resize:none;">\
 765+<form><div class="wbTranslatedAreaHead" id="wbHeaderRow"><div class="scratchTopLayout" id="wbScratchpadHeadLabelLeft"><h4>Source Text</h4></div>\
 766+<div class="scratchTopButtonLayout"><div style="float:left;width:75px;display:none;text-align:center" id="wbTranslationLoading">\
 767+<img src="../images/loading.gif" alt="Translating"/>\
 768+</div></div>\
 769+<div class="scratchTopLayout" id="wbScratchpadHeadLabelRight"><h4>Translated Text</h4></div><div class="scratchTopButtonLayout">&nbsp;</div></div>\
 770+<div><div class="scratchTopLayout">\
 771+<textarea id="wbSourceText" rows="5" tabindex="0">\
768772 </textarea>\
769 -</td>\
770 -</tr>\
771 -<tr valign="top">\
772 -<td width="100%">\
 773+</div><div class="scratchTopButtonLayout">\
 774+<input id="wbSourceToTargetBtn" type="button" value=">>" /><br />\
 775+<input id="wbTargetToSourceBtn" type="button" value="<<" />\
 776+</div><div class="scratchTopLayout">\
 777+<textarea id="wbTargetText" rows="5" tabindex="0">\
 778+</textarea>\
 779+</div>\
 780+<div class="scratchTopButtonLayout">\
 781+<input id="wbSaveScratchPadContentBtn" type="button" value="Save" tabindex="0"/><br/>\
 782+<input type="reset" value="Reset" tabindex="0"/><br/>\
 783+<input id="wbClearAllBtn" type="button" value="Clear All" tabindex="0" />\
 784+</div>\
 785+</div></form>\
773786 <div id="scratchPadLimitNoteHolder">\
774787 <span class="scratchPadLimitNotePrefix">Note:&nbsp;</span><span id="scratchPadLimitNoteText"></span>\
775788 </div>\
776 -</td>\
777 -</tr>\
778 -</table>\
779789 </div>\
780 -</div>\
781 -<div class="wbScratchPadSection">\
782 -<div>\
783 -<div>\
784 -<div style="float:left;padding-right:6px;"><input id="wbSourceToTargetBtn" type="button" value="English to German" class="wbTranslateButton" tabindex="0"/></div>\
785 -<div style="float:left;padding-right:6px;"><input id="wbTargetToSourceBtn" type="button" value="German to English" class="wbTranslateButton" tabindex="0"/></div>\
786 -<div style="float:left;padding-right:6px;"><input id="wbClearAllBtn" type="button" value="Clear All" class="wbClearButton" tabindex="0" /></div>\
787 -<div style="float:left;" id="wbTranslationLoading" class="wbLoadingDiv">\
788 -<img src="../images/loading.gif" alt="Translating"/>\
789 -</div>\
790 -</div>\
791 -</div>\
792 -</div>\
793790 <div class="wbScratchPadSectionContent">\
794 -<table width="100%" border="0" cellspacing="0" cellpadding="0" >\
795 -<tr valign="top"><td width="50%" ></td></tr>\
796 -</table>\
797 -<div id="wbTranslatedArea" style="height:155px; overflow-x: auto; overflow-y: auto;">\
798 -<table id="wbTargetTable" width="98%" border="0" cellspacing="0" cellpadding="0" style="margin-left:3px">\
799 -<tr id="wbHeaderRow" style="visibility:visible;height:3px" class="wbWindowToolbarCenter">\
800 -<td style="border-right:1px solid #dde1e3;width:45%"><h4 id="wbSourceTextHeader" style="text-align:center">Source Text</h4></td>\
801 -<td style="border-right:1px solid #dde1e3;width:45%"><h4 id="wbTranslatedTextHeader" style="text-align:center">Translated Text</h4></td>\
802 -<td style="width:10%"></td>\
803 -</tr>\
804 -</table>\
 791+<div id="wbTranslatedArea" style="clear:both;overflow-x: auto; overflow-y: auto; height:150px">\
805792 </div>\
806793 </div>\
 794+</div>\
807795 </td>\
808796 <td class="wbWindowContentRight"><img src="../images/trans.gif" width="3" height="3" alt="" /></td>\
809797 </tr>\
Index: trunk/extensions/WikiBhasha/src/js/core/utils.js
@@ -136,6 +136,16 @@
137137 } else {
138138 return false;
139139 }
 140+ },
 141+
 142+ //remove html tags from the target object content
 143+ stripTags: function (htmlContent) {
 144+ $("body").append("<div id='tmpData'></div>");
 145+ $('#tmpData').hide();
 146+ $('#tmpData').html(htmlContent);
 147+ var text = $('#tmpData').text();
 148+ $('#tmpData').remove();
 149+ return text
140150 }
141151 };
142152

Comments

#Comment by P858snake (talk | contribs)   07:51, 25 February 2011

When writing bug numbers in commit messages, just write "bug <number>" (eg: bug 27520) so they automatically link.

Status & tagging log