Call me anal
[squirrelmail.git] / plugins / squirrelspell / modules / edit_dic.mod
CommitLineData
849bdf42 1<?php
4b4abf93 2
d112ed5a 3/**
4 * edit_dic.mod
d112ed5a 5 *
4b4abf93 6 * Squirrelspell module
d112ed5a 7 *
8 * This module lets the user edit his/her personal dictionary.
9 *
4b4abf93 10 * @author Konstantin Riabitsev <icon at duke.edu>
47ccfad4 11 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
4b4abf93 12 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
44d661aa 13 * @version $Id$
14 * @package plugins
15 * @subpackage squirrelspell
d112ed5a 16 */
2b5a7157 17
d112ed5a 18global $color;
7996c920 19
20$pre_msg = '<p>'
21 . _("Please check any words you wish to delete from your dictionary.")
22 . "</p>\n";
23$pre_msg .= "<table border=\"0\" width=\"95%\" align=\"center\">\n";
24
d112ed5a 25/**
7996c920 26 * Get how many dictionaries this user has defined.
d112ed5a 27 */
7996c920 28$langs=sqspell_getSettings();
29
30foreach ($langs as $lang) {
d112ed5a 31 /**
7996c920 32 * Get all words from this language dictionary.
d112ed5a 33 */
7996c920 34 $lang_words = sqspell_getLang($lang);
35 if (! empty($lang_words)){
d112ed5a 36 /**
7996c920 37 * There are words in this dictionary. If this is the first
38 * language we're processing, prepend the output with the
39 * "header" message.
d112ed5a 40 */
7996c920 41 if (!isset($msg) || !$msg) {
42 $msg = $pre_msg;
43 }
44 $msg .= "<tr bgcolor=\"$color[0]\" align=\"center\"><th>"
45 . sprintf( _("%s dictionary"), $lang ) . '</th></tr>'
46 . '<tr><td align="center">'
47 . '<form method="post">'
48 . '<input type="hidden" name="MOD" value="forget_me" />'
49 . '<input type="hidden" name="sqspell_use_app" value="'
50 . $lang . '" />'
51 . '<table border="0" width="95%" align="center">'
52 . '<tr>'
53 . "<td valign=\"top\">\n";
54 /**
55 * Do some fancy stuff to separate the words into three
56 * columns.
57 */
58 for ($j=0; $j<sizeof($lang_words); $j++){
59 if ($j==intval(sizeof($lang_words)/3)
60 || $j==intval(sizeof($lang_words)/3*2)){
61 $msg .= "</td><td valign=\"top\">\n";
d112ed5a 62 }
7996c920 63 $msg .= "<input type=\"checkbox\" name=\"words_ary[]\" "
d4e2e61a 64 . 'value="'.htmlspecialchars($lang_words[$j]). '" id="words_ary_'
65 . $j . '" /> <label for="words_ary_' . $j .'">'
66 . htmlspecialchars($lang_words[$j]) . "</label><br />\n";
2b5a7157 67 }
7996c920 68 $msg .= '</td></tr></table></td></tr>'
69 . "<tr bgcolor=\"$color[0]\" align=\"center\"><td>"
70 . '<input type="submit" value="' . _("Delete checked words")
71 . '" /></form>'
72 . '</td></tr><tr><td><hr />'
73 . "</td></tr>\n";
d112ed5a 74 }
d112ed5a 75}
7996c920 76/**
77 * Check if all dictionaries were empty.
78 */
79if (! isset($msg)) {
80 $msg = '<p>' . _("No words in your personal dictionary.") . '</p>';
81} else {
82 $msg .= '</table>';
83}
84sqspell_makePage(_("Edit your Personal Dictionary"), null, $msg);
d112ed5a 85
86/**
87 * For Emacs weenies:
88 * Local variables:
89 * mode: php
90 * End:
2b6b400e 91 * vim: syntax=php
d112ed5a 92 */