From 491a6e2901938f49c1e14907f9da615286c81719 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 16 Sep 2008 09:58:17 -0400
Subject: [PATCH] - Allow and use spellcheck attribute for input/textarea fields (#1485060)

---
 CHANGELOG                                |    1 +
 program/include/html.php                 |    4 ++--
 program/steps/mail/compose.inc           |    3 ++-
 program/js/editor.js                     |    1 +
 program/steps/settings/edit_identity.inc |    4 +++-
 5 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index dbf6224..efe8760 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,7 @@
 ----------
 - Reduced memory footprint when forwarding attachments (#1485345)
 - Fix inline images handling when replying/forwarding html messages
+- Allow and use spellcheck attribute for input/textarea fields (#1485060)
 
 2008/09/15 (thomasb)
 ----------
diff --git a/program/include/html.php b/program/include/html.php
index 87c9c17..8d3144d 100644
--- a/program/include/html.php
+++ b/program/include/html.php
@@ -248,7 +248,7 @@
 {
     protected $tagname = 'input';
     protected $type = 'text';
-    protected $allowed = array('type','name','value','size','tabindex','autocomplete','checked','onchange','onclick','disabled','readonly');
+    protected $allowed = array('type','name','value','size','tabindex','autocomplete','checked','onchange','onclick','disabled','readonly','spellcheck');
 
     public function __construct($attrib = array())
     {
@@ -416,7 +416,7 @@
 class html_textarea extends html
 {
     protected $tagname = 'textarea';
-    protected $allowed = array('name','rows','cols','wrap','tabindex','onchange','disabled','readonly');
+    protected $allowed = array('name','rows','cols','wrap','tabindex','onchange','disabled','readonly','spellcheck');
 
     /**
      * Get HTML code for this object
diff --git a/program/js/editor.js b/program/js/editor.js
index c4f449c..ceab021 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -34,6 +34,7 @@
     content_css : skin_path + "/editor_content.css",
     external_image_list_url : "program/js/editor_images.js",
     spellchecker_languages : (rcmail.env.spellcheck_langs ? rcmail.env.spellcheck_langs : "Dansk=da,Deutsch=de,+English=en,Espanol=es,Francais=fr,Italiano=it,Nederlands=nl,Polski=pl,Portugues=pt,Suomi=fi,Svenska=sv"),
+    gecko_spellcheck : true,
     rc_client: rcube_webmail_client
   });
 }
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 02d062c..151b461 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -241,7 +241,7 @@
   if ($fname && $field_type)
   {
     // pass the following attributes to the form class
-    $field_attrib = array('name' => $fname);
+    $field_attrib = array('name' => $fname, 'spellcheck' => 'false');
     foreach ($attrib as $attr => $value)
       if (in_array($attr, $allow_attrib))
         $field_attrib[$attr] = $value;
@@ -650,6 +650,7 @@
   unset($attrib['form']);
   
   $attrib['name'] = '_subject';
+  $attrib['spellcheck'] = 'true';
   $textfield = new html_inputfield($attrib);
 
   $subject = '';
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc
index 1e3fa34..dbb3ece 100644
--- a/program/steps/settings/edit_identity.inc
+++ b/program/steps/settings/edit_identity.inc
@@ -58,7 +58,8 @@
                                     "theme_advanced_toolbar_align : 'left'," .
                                     "theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,charmap,hr'," .
                                     "theme_advanced_buttons2 : 'link,unlink,code,forecolor,fontselect,fontsizeselect'," .
-                                    "theme_advanced_buttons3 : '' });");
+                                    "theme_advanced_buttons3 : '',".
+				    "gecko_spellcheck : true });");
 
   if (!$IDENTITY_RECORD && $RCMAIL->action != 'add-identity')
     return rcube_label('notfound');
@@ -113,6 +114,7 @@
       {
       $attrib['size'] = $colprop['size'];
       $attrib['rows'] = $colprop['rows'];
+      $attrib['spellcheck'] = true;
       if ($IDENTITY_RECORD['html_signature'])
         {
         $attrib['class'] = "mce_editor";

--
Gitblit v1.9.1