Some small bugfixes. Still testing.
authorgraf25 <graf25@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 31 Jan 2002 03:45:53 +0000 (03:45 +0000)
committergraf25 <graf25@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 31 Jan 2002 03:45:53 +0000 (03:45 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2301 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/squirrelspell/js/crypto_settings.js
plugins/squirrelspell/js/decrypt_error.js
plugins/squirrelspell/js/init.js
plugins/squirrelspell/modules/enc_setup.mod
plugins/squirrelspell/sqspell_functions.php

index 9de86ea87be5e9955af5ae3d82536625302f72c3..604a7cf29a8f8b0f805ed0eeb1de6333d6e676b5 100644 (file)
@@ -1,17 +1,26 @@
 /**
 /**
-   CRYPTO_SETTINGS.JS
-   -------------------
-   Some client-side checks. Nothing fancy.
-                                                               **/
+ * crypto_settings.js
+ * -------------------
+ * Some client-side checks. Nothing fancy.
+ *
+ * $Id$
+ *
+ * @author Konstantin Riabitsev <icon@duke.edu> ($Author$)
+ * @version $Date$
+ */
 
 
+/**
+ * This function is the only thing. It is called on form submit and
+ * asks the user some questions.
+ */
 function checkMe(){
 function checkMe(){
- if (!document.forms[0].action.checked){
-       alert ("Please make a selection first.");
-       return false;
- }
- if (document.forms[0].action.value=="encrypt")
-       cmsg="This will encrypt your personal dictionary and store it in an encrypted format. Proceed?";
- if (document.forms[0].action.value=="decrypt")
-       cmsg="This will decrypt your personal dictionary and store it in a clear-text format. Proceed?";
- return confirm(cmsg);
 if (!document.forms[0].action.checked){
+    alert (ui_makesel);
+    return false;
 }
 if (document.forms[0].action.value=="encrypt")
+    cmsg=ui_encrypt;
 if (document.forms[0].action.value=="decrypt")
+    cmsg=ui_decrypt;
 return confirm(cmsg);
 }
 }
index 56ec95e3a6f012457606c9e1917ecab376f48143..a8f188d851a3ee9bed10b2429dfd96344578da64 100644 (file)
@@ -1,21 +1,26 @@
 /**
 /**
-   DECRYPT_ERROR.JS
-   -----------------
-   Some client-side form-checks. Trivial stuff.
-                                                               **/
+ * decrypt_error.js
+ * -----------------
+ * Some client-side form-checks. Trivial stuff.
+ *
+ * $Id$
+ *
+ * @author Konstantin Riabitsev <icon@duke.edu> ($Author$)
+ * @version $Date$
+ */
 
 function AYS(){
   if (document.forms[0].delete_words.checked && document.forms[0].old_key.value){
 
 function AYS(){
   if (document.forms[0].delete_words.checked && document.forms[0].old_key.value){
-    alert ("You can either delete your dictionary or type in the old password. Not both.");
+    alert (ui_candel);
     return false;
   }
     return false;
   }
-
+  
   if (!document.forms[0].delete_words.checked && !document.forms[0].old_key.value){
   if (!document.forms[0].delete_words.checked && !document.forms[0].old_key.value){
-    alert("First make a choice.");
+    alert(ui_choice);
     return false;
   }
   if (document.forms[0].delete_words.checked)
     return false;
   }
   if (document.forms[0].delete_words.checked)
-    return confirm("This will delete your personal dictionary file. Proceed?");
+    return confirm(ui_willdel);
   return true;
 }
 
   return true;
 }
 
index ca2a368fd1e1ebc2d8a823014637cf568cd2ae14..a7448c31fe9e1d2419ba913a715fafc5abe1c14e 100644 (file)
@@ -1,12 +1,24 @@
 /**
 /**
-   INIT.JS
-   -------
-   Grabs the text from the SquirrelMail field and submits it to
-   the squirrelspell.
-                                                               **/
+ * init.js
+ * -------
+ * Grabs the text from the SquirrelMail field and submits it to
+ * the squirrelspell.
+ *
+ * $Id$
+ *
+ * @author Konstantin Riabitsev <icon@duke.edu> ($Author$)
+ * @version $Date$
+ */
+
+/**
+ * This is the work function.
+ *
+ * @param  flag tells the function whether to automatically submit the
+ *              form, or wait for user input. True submits the form, while
+ *              false doesn't.
+ * @return      void 
+ */
 function sqspell_init(flag){
 function sqspell_init(flag){
-  // flag tells the function whether to automatically submit the form, or
-  // wait for user input. True submits the form, while False doesn't.
   textToSpell = opener.document.forms[0].subject.value + "\n" + opener.document.forms[0].body.value;
   document.forms[0].sqspell_text.value = textToSpell;
   if (flag) document.forms[0].submit();
   textToSpell = opener.document.forms[0].subject.value + "\n" + opener.document.forms[0].body.value;
   document.forms[0].sqspell_text.value = textToSpell;
   if (flag) document.forms[0].submit();
index 5311303891b82fdc786214e73de200d832d9f0b5..bee872410814d860b0d5190b490de93c1bdc2028 100644 (file)
 
 global $SQSPELL_CRYPTO; 
 
 
 global $SQSPELL_CRYPTO; 
 
+/**
+ * Set up some i18n'able wrappers for javascript.
+ */
+$msg = "<script type='text/javascript'><!--\n"
+  . "var ui_makesel = \"" . _("Please make your selection first.") . "\";\n"
+  . "var ui_encrypt = \"" 
+  . _("This will encrypt your personal dictionary and store it in an encrypted format. Proceed?") 
+  . "\";\n"
+  . "var ui_decrypt = \""
+  . _("This will decrypt your personal dictionary and store it in a clear-text format. Proceed?")
+  . "\";\n"
+  . "//-->\n</script>";
+
 $words=sqspell_getWords();
 /**
  * When getting the user dictionary, the SQSPELL_CRYPTO flag will be
 $words=sqspell_getWords();
 /**
  * When getting the user dictionary, the SQSPELL_CRYPTO flag will be
@@ -30,7 +43,7 @@ if ($SQSPELL_CRYPTO){
    * Unfortunately, the following text needs to be all on one line,
    * unless someone fixes xgettext. ;(
    */
    * Unfortunately, the following text needs to be all on one line,
    * unless someone fixes xgettext. ;(
    */
-  $msg = 
+  $msg .
      _("<p>Your personal dictionary is <strong>currently encrypted</strong>. This helps protect your privacy in case the web-mail system gets compromized and your personal dictionary ends up stolen. It is currently encrypted with the password you use to access your mailbox, making it hard for anyone to see what is stored in your personal dictionary.</p> <p><strong>ATTENTION:</strong> If you forget your password, your personal dictionary will become unaccessible, since it can no longer be decrypted. If you change your mailbox password, SquirrelSpell will recognize it and prompt you for your old password in order to re-encrypt the dictionary with a new key.</p>")
      . '<form method="post" onsubmit="return checkMe()">'
      . '<input type="hidden" name="MOD" value="crypto">'
      _("<p>Your personal dictionary is <strong>currently encrypted</strong>. This helps protect your privacy in case the web-mail system gets compromized and your personal dictionary ends up stolen. It is currently encrypted with the password you use to access your mailbox, making it hard for anyone to see what is stored in your personal dictionary.</p> <p><strong>ATTENTION:</strong> If you forget your password, your personal dictionary will become unaccessible, since it can no longer be decrypted. If you change your mailbox password, SquirrelSpell will recognize it and prompt you for your old password in order to re-encrypt the dictionary with a new key.</p>")
      . '<form method="post" onsubmit="return checkMe()">'
      . '<input type="hidden" name="MOD" value="crypto">'
@@ -48,7 +61,7 @@ if ($SQSPELL_CRYPTO){
    * Unfortunately, the following text needs to be all on one line,
    * unless someone fixes xgettext. ;(
    */
    * Unfortunately, the following text needs to be all on one line,
    * unless someone fixes xgettext. ;(
    */
-  $msg = 
+  $msg .
      _("<p>Your personal dictionary is <strong>currently not encrypted</strong>. You may wish to encrypt your personal dictionary to protect your privacy in case the webmail system gets compromized and your personal dictionary file gets stolen. When encrypted, the file's contents look garbled and are hard to decrypt without knowing the correct key (which is your mailbox password).</p> <strong>ATTENTION:</strong> If you decide to encrypt your personal dictionary, you must remember that it gets &quot;hashed&quot; with your mailbox password. If you forget your mailbox password and the administrator changes it to a new value, your personal dictionary will become useless and will have to be created anew. However, if you or your system administrator change your mailbox password but you still have the old password at hand, you will be able to enter the old key to re-encrypt the dictionary with the new value.</p>")
      . '<form method="post" onsubmit="return checkMe()">'
      . '<input type="hidden" name="MOD" value="crypto">'
      _("<p>Your personal dictionary is <strong>currently not encrypted</strong>. You may wish to encrypt your personal dictionary to protect your privacy in case the webmail system gets compromized and your personal dictionary file gets stolen. When encrypted, the file's contents look garbled and are hard to decrypt without knowing the correct key (which is your mailbox password).</p> <strong>ATTENTION:</strong> If you decide to encrypt your personal dictionary, you must remember that it gets &quot;hashed&quot; with your mailbox password. If you forget your mailbox password and the administrator changes it to a new value, your personal dictionary will become useless and will have to be created anew. However, if you or your system administrator change your mailbox password but you still have the old password at hand, you will be able to enter the old key to re-encrypt the dictionary with the new value.</p>")
      . '<form method="post" onsubmit="return checkMe()">'
      . '<input type="hidden" name="MOD" value="crypto">'
index 00b031bde17627741e9fe4723cec3cdd1a6527e8..189a0e206ccd2fbaef62c09894c718355d624a9b 100644 (file)
@@ -367,6 +367,14 @@ function sqspell_getWords(){
         . '<p align="center"><input type="submit" value="' 
         . _("Proceed") . ' &gt;&gt;"></p>'
         . '</form>';
         . '<p align="center"><input type="submit" value="' 
         . _("Proceed") . ' &gt;&gt;"></p>'
         . '</form>';
+      /**
+       * Add some string vars so they can be i18n'd.
+       */
+      $msg .= "<script type='text/javascript'><!--\n"
+        . "var ui_choice = \"" . _("You must make a choice") ."\";\n"
+        . "var ui_candel = \"" . _("You can either delete your dictionary or type in the old password. Not both.") . "\";\n"
+        . "var ui_willdel = \"" . _("This will delete your personal dictionary file. Proceed?") . "\";\n"
+        . "//--></script>\n";
       /**
        * See if this happened in the pop-up window or when accessing
        * the SpellChecker options page. 
       /**
        * See if this happened in the pop-up window or when accessing
        * the SpellChecker options page. 
@@ -374,7 +382,7 @@ function sqspell_getWords(){
        */
       global $SCRIPT_NAME;
       if (strstr($SCRIPT_NAME, "sqspell_options")){
        */
       global $SCRIPT_NAME;
       if (strstr($SCRIPT_NAME, "sqspell_options")){
-       sqspell_makePage( _("Error Decrypting Dictionary"), 
+       sqspell_makePage(_("Error Decrypting Dictionary"), 
                          "decrypt_error.js", $msg);
       } else {
        sqspell_makeWindow(null, _("Error Decrypting Dictionary"), 
                          "decrypt_error.js", $msg);
       } else {
        sqspell_makeWindow(null, _("Error Decrypting Dictionary"),