Revision: 8044
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=8044&view=rev
Author:   dnaber
Date:     2012-09-15 09:18:46 +0000 (Sat, 15 Sep 2012)
Log Message:
-----------
online check: add support for language selection

Modified Paths:
--------------
    trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/demo.html
    trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/editor_plugin.js
    
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/editor_plugin.js

Modified: trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/demo.html
===================================================================
--- trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/demo.html       
2012-09-15 08:17:19 UTC (rev 8043)
+++ trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/demo.html       
2012-09-15 09:18:46 UTC (rev 8044)
@@ -16,16 +16,14 @@
         atd_rpc_id                  : "dashnine",
         /* edit this file to customize how AtD shows errors */
         atd_css_url                 : "css/content.css",
-        /* this list contains the categories of errors we want to show */
-        atd_show_types              : "Bias Language,Cliches,Complex 
Expression,Diacritical Marks,Double Negatives,Hidden Verbs,Jargon 
Language,Passive voice,Phrases to Avoid,Redundant Expression",
         /* strings this plugin should ignore */
-        atd_ignore_strings          : "AtD,rsmudge",
+        atd_ignore_strings          : "",
         /* enable "Ignore Always" menu item, uses cookies by default. Set 
atd_ignore_rpc_url to a URL AtD should send ignore requests to. */
         atd_ignore_enable           : "false",
         /* add the AtD button to the first row of the advanced theme */
         theme_advanced_buttons1_add : "AtD",
         /*
-         * this stuff is a matter of preference 
+         * this stuff is a matter of preference
          */
         theme                              : "advanced",
         //theme_advanced_buttons1            : 
"bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator",
@@ -42,7 +40,8 @@
     });
 
     function doit() {
-        tinyMCE.activeEditor.execCommand('mceWritingImprovementTool');
+        var langCode = document.checkform.lang.value;
+        tinyMCE.activeEditor.execCommand('mceWritingImprovementTool', 
langCode);
     }
 
    </script>
@@ -55,12 +54,52 @@
 
   <p>*** WORK IN PROGRESS ***</p>
 
-  <p><textarea name="content" style="width: 760px" rows="16">The purpoce of a 
spell checker is to check the text four spelling and
-    typeing errors. The checker finds errors througout the text. When the 
spell checker finds an questionable word, it highlights
-    it and suggests the mpst likely variants too replace the questionable 
word. You can select the variant and replace the
-    wrrd or leave the word unanged.</textarea></p>
+  <form action="#" name="checkform">
 
-  <input type="button" value="Check" onClick="javascript:doit()">
+    <p><textarea name="content" style="width: 760px" rows="6">Paste your own 
text here... or check this text too see an few of of the problems that 
LanguageTool can detecd.</textarea></p>
 
- </body>             
+    <select name="lang">
+        <option value="ast-ES">Asturian</option>
+        <option value="be-BY">Belarusian</option>
+        <option value="br-FR">Breton</option>
+        <option value="ca-ES">Catalan</option>
+        <option value="zh-CN">Chinese</option>
+        <option value="da-DK">Danish</option>
+        <option value="nl">Dutch</option>
+        <option value="en-AU">English (Australian)</option>
+        <option value="en-CA">English (Canadian)</option>
+        <option value="en-GB">English (GB)</option>
+        <option value="en-NZ">English (New Zealand)</option>
+        <option value="en-ZA">English (South African)</option>
+        <option selected value="en-US">English (US)</option>
+        <option value="eo">Esperanto</option>
+        <option value="fr">French</option>
+        <option value="gl-ES">Galician</option>
+        <option value="de-AT">German (Austria)</option>
+        <option value="de-DE">German (Germany)</option>
+        <option value="de-CH">German (Swiss)</option>
+        <option value="el-GR">Greek</option>
+        <option value="is-IS">Icelandic</option>
+        <option value="it">Italian</option>
+        <option value="ja-JP">Japanese</option>
+        <option value="km-KM">Khmer</option>
+        <option value="lt-LT">Lithuanian</option>
+        <option value="ml-IN">Malayalam</option>
+        <option value="pl-PL">Polish</option>
+        <option value="pt-BR">Portuguese (Brazil)</option>
+        <option value="pt-PT">Portuguese (Portugal)</option>
+        <option value="ro-RO">Romanian</option>
+        <option value="ru-RU">Russian</option>
+        <option value="sk-SK">Slovak</option>
+        <option value="sl-SI">Slovenian</option>
+        <option value="es">Spanish</option>
+        <option value="sv">Swedish</option>
+        <option value="tl-PH">Tagalog</option>
+        <option value="uk-UA">Ukrainian</option>
+    </select>
+
+    <input type="button" value="Check" onClick="javascript:doit()">
+  </form>
+
+ </body>
 </html>

Modified: 
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/editor_plugin.js
===================================================================
--- 
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/editor_plugin.js    
    2012-09-15 08:17:19 UTC (rev 8043)
+++ 
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/editor_plugin.js    
    2012-09-15 09:18:46 UTC (rev 8044)
@@ -730,7 +730,7 @@
          }
 
          /* add a command to request a document check and process the results. 
*/
-         editor.addCommand('mceWritingImprovementTool', function(callback) 
+         editor.addCommand('mceWritingImprovementTool', function(languageCode)
          {
             /* checks if a global var for click stats exists and increments it 
if it does... */
             if (typeof AtD_proofread_click_count != "undefined")
@@ -745,7 +745,7 @@
             /* send request to our service */
             //plugin.sendRequest('checkDocument', ed.getContent({ format: 
'raw' }), function(data, request, someObject)
             var textContent = ed.getContent().replace(/<.*?>/g, "");
-            plugin.sendRequest('checkDocument', textContent, function(data, 
request, someObject)
+            plugin.sendRequest('checkDocument', textContent, languageCode, 
function(data, request, someObject)
             {
                /* turn off the spinning thingie */
                plugin.editor.setProgressState(0);
@@ -773,10 +773,10 @@
                   ed.suggestions = results.suggestions; 
                }
 
-               if (ecount == 0 && (!callback || callback == undefined))
+               /*if (ecount == 0 && (!callback || callback == undefined))
                   
ed.windowManager.alert(plugin.editor.getLang('AtD.message_no_errors_found', 'No 
writing errors were found.'));
                else if (callback)
-                  callback(ecount);
+                  callback(ecount);*/
             });
          });
           
@@ -1059,7 +1059,7 @@
          plugin.editor.nodeChanged();
       },
 
-      sendRequest : function(file, data, success)
+      sendRequest : function(file, data, languageCode, success)
       {
          var id  = this.editor.getParam("atd_rpc_id",  "12345678");
          var url = this.editor.getParam("atd_rpc_url", "{backend}");
@@ -1077,7 +1077,7 @@
             content_type : 'text/xml',
             type         : "POST",
             data         : "text=" + encodeURI(data).replace(/&/g, '%26')
-                           + "&language=" + "en-US",   // TODO: take language 
from select box
+                           + "&language=" + encodeURI(languageCode),
             async        : true,
             success      : success,
             error        : function( type, req, o )

Modified: 
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/editor_plugin.js
===================================================================
--- 
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/editor_plugin.js
    2012-09-15 08:17:19 UTC (rev 8043)
+++ 
trunk/website/www/online-check/tiny_mce/plugins/atd-tinymce/src/editor_plugin.js
    2012-09-15 09:18:46 UTC (rev 8044)
@@ -115,8 +115,9 @@
          }
 
          /* add a command to request a document check and process the results. 
*/
-         editor.addCommand('mceWritingImprovementTool', function(callback) 
+         editor.addCommand('mceWritingImprovementTool', function(languageCode)
          {
+
             /* checks if a global var for click stats exists and increments it 
if it does... */
             if (typeof AtD_proofread_click_count != "undefined")
                AtD_proofread_click_count++;
@@ -130,7 +131,7 @@
             /* send request to our service */
             //plugin.sendRequest('checkDocument', ed.getContent({ format: 
'raw' }), function(data, request, someObject)
             var textContent = ed.getContent().replace(/<.*?>/g, "");
-            plugin.sendRequest('checkDocument', textContent, function(data, 
request, someObject)
+            plugin.sendRequest('checkDocument', textContent, languageCode, 
function(data, request, someObject)
             {
                /* turn off the spinning thingie */
                plugin.editor.setProgressState(0);
@@ -158,10 +159,10 @@
                   ed.suggestions = results.suggestions; 
                }
 
-               if (ecount == 0 && (!callback || callback == undefined))
+               /*if (ecount == 0 && (!callback || callback == undefined))
                   
ed.windowManager.alert(plugin.editor.getLang('AtD.message_no_errors_found', 'No 
writing errors were found.'));
                else if (callback)
-                  callback(ecount);
+                  callback(ecount);*/
             });
          });
           
@@ -444,7 +445,7 @@
          plugin.editor.nodeChanged();
       },
 
-      sendRequest : function(file, data, success)
+      sendRequest : function(file, data, languageCode, success)
       {
          var id  = this.editor.getParam("atd_rpc_id",  "12345678");
          var url = this.editor.getParam("atd_rpc_url", "{backend}");
@@ -462,7 +463,7 @@
             content_type : 'text/xml',
             type         : "POST",
             data         : "text=" + encodeURI(data).replace(/&/g, '%26')
-                           + "&language=" + "en-US",   // TODO: take language 
from select box
+                           + "&language=" + encodeURI(languageCode),
             async        : true,
             success      : success,
             error        : function( type, req, o )

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Languagetool-cvs mailing list
Languagetool-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs

Reply via email to