From a8380e75f951c6915dba43505e94df50af6ea3cb Mon Sep 17 00:00:00 2001 From: graf25 Date: Thu, 31 Jan 2002 03:45:53 +0000 Subject: [PATCH] Some small bugfixes. Still testing. 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 | 35 +++++++++++++-------- plugins/squirrelspell/js/decrypt_error.js | 21 ++++++++----- plugins/squirrelspell/js/init.js | 26 ++++++++++----- plugins/squirrelspell/modules/enc_setup.mod | 17 ++++++++-- plugins/squirrelspell/sqspell_functions.php | 10 +++++- 5 files changed, 78 insertions(+), 31 deletions(-) diff --git a/plugins/squirrelspell/js/crypto_settings.js b/plugins/squirrelspell/js/crypto_settings.js index 9de86ea8..604a7cf2 100644 --- a/plugins/squirrelspell/js/crypto_settings.js +++ b/plugins/squirrelspell/js/crypto_settings.js @@ -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 ($Author$) + * @version $Date$ + */ +/** + * This function is the only thing. It is called on form submit and + * asks the user some questions. + */ 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); } diff --git a/plugins/squirrelspell/js/decrypt_error.js b/plugins/squirrelspell/js/decrypt_error.js index 56ec95e3..a8f188d8 100644 --- a/plugins/squirrelspell/js/decrypt_error.js +++ b/plugins/squirrelspell/js/decrypt_error.js @@ -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 ($Author$) + * @version $Date$ + */ 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; } - + 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 confirm("This will delete your personal dictionary file. Proceed?"); + return confirm(ui_willdel); return true; } diff --git a/plugins/squirrelspell/js/init.js b/plugins/squirrelspell/js/init.js index ca2a368f..a7448c31 100644 --- a/plugins/squirrelspell/js/init.js +++ b/plugins/squirrelspell/js/init.js @@ -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 ($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){ - // 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(); diff --git a/plugins/squirrelspell/modules/enc_setup.mod b/plugins/squirrelspell/modules/enc_setup.mod index 53113038..bee87241 100644 --- a/plugins/squirrelspell/modules/enc_setup.mod +++ b/plugins/squirrelspell/modules/enc_setup.mod @@ -18,6 +18,19 @@ global $SQSPELL_CRYPTO; +/** + * Set up some i18n'able wrappers for javascript. + */ +$msg = ""; + $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. ;( */ - $msg = + $msg .= _("

Your personal dictionary is currently encrypted. 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.

ATTENTION: 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.

") . '
' . '' @@ -48,7 +61,7 @@ if ($SQSPELL_CRYPTO){ * Unfortunately, the following text needs to be all on one line, * unless someone fixes xgettext. ;( */ - $msg = + $msg .= _("

Your personal dictionary is currently not encrypted. 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).

ATTENTION: If you decide to encrypt your personal dictionary, you must remember that it gets "hashed" 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.

") . '' . '' diff --git a/plugins/squirrelspell/sqspell_functions.php b/plugins/squirrelspell/sqspell_functions.php index 00b031bd..189a0e20 100644 --- a/plugins/squirrelspell/sqspell_functions.php +++ b/plugins/squirrelspell/sqspell_functions.php @@ -367,6 +367,14 @@ function sqspell_getWords(){ . '

' . '
'; + /** + * Add some string vars so they can be i18n'd. + */ + $msg .= "\n"; /** * 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")){ - sqspell_makePage( _("Error Decrypting Dictionary"), + sqspell_makePage(_("Error Decrypting Dictionary"), "decrypt_error.js", $msg); } else { sqspell_makeWindow(null, _("Error Decrypting Dictionary"), -- 2.25.1