| 1 | <?php |
| 2 | /** |
| 3 | * options.php |
| 4 | * |
| 5 | * Copyright (c) 1999-2004 The SquirrelMail Project Team |
| 6 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 7 | * |
| 8 | * Pick your translator to translate the body of incoming mail messages |
| 9 | * |
| 10 | * @version $Id$ |
| 11 | * @package plugins |
| 12 | * @subpackage translate |
| 13 | */ |
| 14 | |
| 15 | /** |
| 16 | * Path for SquirrelMail required files. |
| 17 | * @ignore |
| 18 | */ |
| 19 | define('SM_PATH','../../'); |
| 20 | |
| 21 | /* SquirrelMail required files. */ |
| 22 | include_once(SM_PATH . 'include/validate.php'); |
| 23 | include_once(SM_PATH . 'functions/display_messages.php'); |
| 24 | include_once(SM_PATH . 'functions/imap.php'); |
| 25 | include_once(SM_PATH . 'plugins/translate/functions.php'); |
| 26 | |
| 27 | displayPageHeader($color, 'None'); |
| 28 | |
| 29 | // Save preferences |
| 30 | if (sqgetGlobalVar('submit_translate',$tmp,SQ_POST)) { |
| 31 | if (sqgetGlobalVar('translate_translate_server',$translate_translate_server,SQ_POST)) { |
| 32 | setPref($data_dir, $username, 'translate_server', $translate_translate_server); |
| 33 | } else { |
| 34 | setPref($data_dir, $username, 'translate_server', $translate_default_engine); |
| 35 | } |
| 36 | |
| 37 | if (sqgetGlobalVar('translate_translate_location',$translate_translate_location,SQ_POST)) { |
| 38 | setPref($data_dir, $username, 'translate_location', $translate_translate_location); |
| 39 | } else { |
| 40 | setPref($data_dir, $username, 'translate_location', 'center'); |
| 41 | } |
| 42 | |
| 43 | if (sqgetGlobalVar('translate_translate_show_read',$tmp,SQ_POST)) { |
| 44 | setPref($data_dir, $username, 'translate_show_read', '1'); |
| 45 | } else { |
| 46 | setPref($data_dir, $username, 'translate_show_read', ''); |
| 47 | } |
| 48 | |
| 49 | if (sqgetGlobalVar('translate_translate_show_send',$tmp,SQ_POST)) { |
| 50 | setPref($data_dir, $username, 'translate_show_send', '1'); |
| 51 | } else { |
| 52 | setPref($data_dir, $username, 'translate_show_send', ''); |
| 53 | } |
| 54 | |
| 55 | if (sqgetGlobalVar('translate_translate_same_window',$tmp,SQ_POST)) { |
| 56 | setPref($data_dir, $username, 'translate_same_window', '1'); |
| 57 | } else { |
| 58 | setPref($data_dir, $username, 'translate_same_window', ''); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // Move these calls to separate function |
| 63 | $translate_server = getPref($data_dir, $username, 'translate_server',$translate_default_engine); |
| 64 | |
| 65 | $translate_location = getPref($data_dir, $username, 'translate_location'); |
| 66 | if ($translate_location == '') { |
| 67 | $translate_location = 'center'; |
| 68 | } |
| 69 | $translate_show_read = getPref($data_dir, $username, 'translate_show_read'); |
| 70 | $translate_show_send = getPref($data_dir, $username, 'translate_show_send'); |
| 71 | $translate_same_window = getPref($data_dir, $username, 'translate_same_window'); |
| 72 | |
| 73 | ?> |
| 74 | <table width="95%" align="center" border="0" cellpadding="1" cellspacing="0"><tr><td bgcolor="<?php echo $color[0]; ?>"> |
| 75 | <center><b><?php echo _("Options") . ' - '. _("Translator"); ?></b></center> |
| 76 | </td></tr></table> |
| 77 | |
| 78 | <?php if (sqgetGlobalVar('submit_translate',$tmp,SQ_POST)) { |
| 79 | print "<center><h4>"._("Saved Translation Options")."</h4></center>\n"; |
| 80 | }?> |
| 81 | |
| 82 | <p><?php echo _("Your server options are as follows:"); ?></p> |
| 83 | |
| 84 | <ul> |
| 85 | <?php |
| 86 | translate_showtrad(); |
| 87 | ?> |
| 88 | </ul> |
| 89 | <p> |
| 90 | <?php |
| 91 | echo _("You also decide if you want the translation box displayed, and where it will be located.") . |
| 92 | '<form action="'.$PHP_SELF.'" method="post">'. |
| 93 | '<table border="0" cellpadding="0" cellspacing="2">'. |
| 94 | '<tr><td align="right" nowrap>' . |
| 95 | _("Select your translator:") . |
| 96 | '</td>'. |
| 97 | '<td><select name="translate_translate_server">'; |
| 98 | translate_showoption(); |
| 99 | echo '</select>' . |
| 100 | '</td></tr>' . |
| 101 | '<tr>'.html_tag('td',_("When reading:"),'right','','nowrap'). |
| 102 | '<td><input type="checkbox" name="translate_translate_show_read"'; |
| 103 | if ($translate_show_read) |
| 104 | echo ' checked="checked"'; |
| 105 | echo ' /> - ' . _("Show translation box") . |
| 106 | ' <select name="translate_translate_location">'; |
| 107 | translate_showoption_internal('location', 'left', _("to the left")); |
| 108 | translate_showoption_internal('location', 'center', _("in the center")); |
| 109 | translate_showoption_internal('location', 'right', _("to the right")); |
| 110 | echo '</select><br />'. |
| 111 | '<input type="checkbox" name="translate_translate_same_window"'; |
| 112 | if ($translate_same_window) |
| 113 | echo ' checked="checked"'; |
| 114 | echo ' /> - ' . _("Translate inside the SquirrelMail frames"). |
| 115 | "</td></tr>\n"; |
| 116 | |
| 117 | if (!$disable_compose_translate) { |
| 118 | echo '<tr>'.html_tag('td',_("When composing:"),'right','','nowrap'). |
| 119 | '<td><input type="checkbox" name="translate_translate_show_send"'; |
| 120 | if ($translate_show_send) |
| 121 | echo ' checked="checked"'; |
| 122 | echo ' /> - ' . _("Not yet functional, currently does nothing") . |
| 123 | "</td></tr>\n"; |
| 124 | } |
| 125 | ?> |
| 126 | <tr><td></td><td> |
| 127 | <input type="submit" value="<?php echo _("Submit"); ?>" name="submit_translate" /> |
| 128 | </td></tr> |
| 129 | </table> |
| 130 | </form> |
| 131 | </body></html> |