dumping translate plugin changes into cvs.
[squirrelmail.git] / plugins / translate / options.php
CommitLineData
849bdf42 1<?php
8d6a115b 2/**
3 * options.php
4 *
82d304a0 5 * Copyright (c) 1999-2004 The SquirrelMail Project Team
8d6a115b 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 *
87392775 10 * @version $Id$
ea5f4b8e 11 * @package plugins
12 * @subpackage translate
8d6a115b 13 */
aa7fb30c 14
ea5f4b8e 15/**
16 * Path for SquirrelMail required files.
17 * @ignore
18 */
92219031 19define('SM_PATH','../../');
8d6a115b 20
21/* SquirrelMail required files. */
20bc790c 22include_once(SM_PATH . 'include/validate.php');
23include_once(SM_PATH . 'functions/display_messages.php');
24include_once(SM_PATH . 'functions/imap.php');
25include_once(SM_PATH . 'plugins/translate/functions.php');
8d6a115b 26
87392775 27displayPageHeader($color, 'None');
28
20bc790c 29// Save preferences
30if (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);
87392775 33 } else {
20bc790c 34 setPref($data_dir, $username, 'translate_server', $translate_default_engine);
e38ebf4d 35 }
36
20bc790c 37 if (sqgetGlobalVar('translate_translate_location',$translate_translate_location,SQ_POST)) {
38 setPref($data_dir, $username, 'translate_location', $translate_translate_location);
87392775 39 } else {
40 setPref($data_dir, $username, 'translate_location', 'center');
e38ebf4d 41 }
87392775 42
20bc790c 43 if (sqgetGlobalVar('translate_translate_show_read',$tmp,SQ_POST)) {
87392775 44 setPref($data_dir, $username, 'translate_show_read', '1');
45 } else {
46 setPref($data_dir, $username, 'translate_show_read', '');
e38ebf4d 47 }
849bdf42 48
20bc790c 49 if (sqgetGlobalVar('translate_translate_show_send',$tmp,SQ_POST)) {
87392775 50 setPref($data_dir, $username, 'translate_show_send', '1');
51 } else {
52 setPref($data_dir, $username, 'translate_show_send', '');
53 }
38a7b6a0 54
20bc790c 55 if (sqgetGlobalVar('translate_translate_same_window',$tmp,SQ_POST)) {
87392775 56 setPref($data_dir, $username, 'translate_same_window', '1');
57 } else {
58 setPref($data_dir, $username, 'translate_same_window', '');
59 }
60}
38a7b6a0 61
20bc790c 62// Move these calls to separate function
63$translate_server = getPref($data_dir, $username, 'translate_server',$translate_default_engine);
64
87392775 65$translate_location = getPref($data_dir, $username, 'translate_location');
66if ($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');
849bdf42 72
73?>
6fd95361 74 <table width="95%" align="center" border="0" cellpadding="1" cellspacing="0"><tr><td bgcolor="<?php echo $color[0]; ?>">
38a7b6a0 75 <center><b><?php echo _("Options") . ' - '. _("Translator"); ?></b></center>
849bdf42 76 </td></tr></table>
77
20bc790c 78 <?php if (sqgetGlobalVar('submit_translate',$tmp,SQ_POST)) {
04f6008a 79 print "<center><h4>"._("Saved Translation Options")."</h4></center>\n";
80 }?>
81
38a7b6a0 82 <p><?php echo _("Your server options are as follows:"); ?></p>
849bdf42 83
38a7b6a0 84 <ul>
85<?php
20bc790c 86 translate_showtrad();
38a7b6a0 87?>
849bdf42 88 </ul>
38a7b6a0 89 <p>
90<?php
e38ebf4d 91 echo _("You also decide if you want the translation box displayed, and where it will be located.") .
6fd95361 92 '<form action="'.$PHP_SELF.'" method="post">'.
93 '<table border="0" cellpadding="0" cellspacing="2">'.
87392775 94 '<tr><td align="right" nowrap>' .
e38ebf4d 95 _("Select your translator:") .
96 '</td>'.
97 '<td><select name="translate_translate_server">';
20bc790c 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";
e38ebf4d 116
ea526024 117if (!$disable_compose_translate) {
118 echo '<tr>'.html_tag('td',_("When composing:"),'right','','nowrap').
6fd95361 119 '<td><input type="checkbox" name="translate_translate_show_send"';
849bdf42 120 if ($translate_show_send)
6fd95361 121 echo ' checked="checked"';
87392775 122 echo ' /> - ' . _("Not yet functional, currently does nothing") .
ea526024 123 "</td></tr>\n";
124}
6fd95361 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>