Javascript detection no longer requires SquirrelSpell.
[squirrelmail.git] / plugins / newmail / newmail_opt.php
1 <?php
2
3 /**
4 * newmails_opt.php
5 *
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Displays all options relating to new mail sounds
10 *
11 * $Id$
12 */
13
14 define('SM_PATH','../../');
15
16 /* SquirrelMail required files. */
17 require_once(SM_PATH . 'include/validate.php');
18 require_once(SM_PATH . 'functions/page_header.php');
19 require_once(SM_PATH . 'functions/display_messages.php');
20 require_once(SM_PATH . 'functions/imap.php');
21 require_once(SM_PATH . 'functions/array.php');
22 require_once(SM_PATH . 'include/load_prefs.php');
23
24 displayPageHeader($color, 'None');
25
26 $media_enable = getPref($data_dir,$username, 'newmail_enable', 'FALSE' );
27 $media_popup = getPref($data_dir, $username,'newmail_popup');
28 $media_allbox = getPref($data_dir,$username,'newmail_allbox');
29 $media_recent = getPref($data_dir,$username,'newmail_recent');
30 $media_changetitle = getPref($data_dir,$username,'newmail_changetitle');
31 $media = getPref($data_dir,$username,'newmail_media', '../plugins/newmail/sounds/Notify.wav');
32
33 // Set $allowsound to false if you don't want sound files available
34 $allowsound = "true";
35
36 echo html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) . "\n" .
37 html_tag( 'tr', "\n" .
38 html_tag( 'td', '<b>' . _("Options") . ' - ' . _("New Mail Notification") . '</b>', 'center', $color[0] )
39 ) . "\n" .
40 html_tag( 'tr' ) . "\n" .
41 html_tag( 'td', '', 'left' );
42 if ($allowsound == "true") {
43 echo html_tag( 'p',
44 _("Select <b>Enable Media Playing</b> to turn on playing a media file when unseen mail is in your folders. When enabled, you can specify the media file to play in the provided file box.")
45 ) . "\n";
46 }
47 echo html_tag( 'p',
48 _("The <b>Check all boxes, not just INBOX</b> option will check ALL of your folders for unseen mail, not just the inbox for notification.")
49 ) . "\n" .
50 html_tag( 'p',
51 _("Selecting the <b>Show popup</b> option will enable the showing of a popup window when unseen mail is in your folders (requires JavaScript).")
52 ) . "\n" .
53 html_tag( 'p',
54 _("Use the <b>Check RECENT</b> to only check for messages that are recent. Recent messages are those that have just recently showed up and have not been \"viewed\" or checked yet. This can prevent being continuously annoyed by sounds or popups for unseen mail.")
55 ) . "\n" .
56 html_tag( 'p',
57 _("Selecting the <b>Change title</b> option will change the title in some browsers to let you know when you have new mail (requires JavaScript, and only works in IE but you won't see errors with other browsers). This will always tell you if you have new mail, even if you have <b>Check RECENT</b> enabled.")
58 );
59 if ($allowsound == "true") {
60 echo html_tag( 'p',
61 _("Select from the list of <b>server files</b> the media file to play when new mail arrives. Selecting <b>local media</b> will play the file specified in the <b>local media file</b> box to play from the local computer. If no file is specified, the system will use a default from the server.")
62 ) . "\n";
63 }
64 echo '<form action="../../src/options.php" method=post>'.
65 html_tag( 'table', '', '', '', 'width="100%" cellpadding="0" cellspacing="2" border="0"' ) . "\n" .
66 html_tag( 'tr' ) . "\n" .
67 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n";
68 if ($allowsound == "true") {
69 echo html_tag( 'td', '', 'left' ) .
70 '<input type="checkbox" ';
71 if ($media_enable == 'on') {
72 echo 'checked ';
73 }
74 echo 'name="media_enable"><b> ' . _("Enable Media Playing") . '</b></td>'.
75 '</tr>' . "\n";
76 }
77 echo html_tag( 'tr' ) . "\n" .
78 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n" .
79 html_tag( 'td', '', 'left' ) .
80 '<input type="checkbox" ';
81 if ($media_allbox == 'on') {
82 echo 'checked ';
83 }
84 echo 'name="media_allbox"><b> ' . _("Check all boxes, not just INBOX") . '</b></td>'.
85 '</tr>'. "\n" .
86 html_tag( 'tr' ) . "\n" .
87 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n" .
88 html_tag( 'td', '', 'left' ) .
89 '<input type="checkbox" ';
90 if ($media_recent == 'on') {
91 echo 'checked ';
92 }
93 echo 'name="media_recent"><b> ' . _("Count only messages that are RECENT") . '</b></td>'.
94 '</tr>'. "\n" .
95 html_tag( 'tr' ) . "\n" .
96 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n" .
97 html_tag( 'td', '', 'left' ) .
98 '<input type="checkbox" ';
99 if ($media_changetitle == 'on') {
100 echo 'checked ';
101 }
102 echo 'name="media_changetitle"><b> ' . _("Change title on supported browsers.") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
103 '</tr>'. "\n" .
104 html_tag( 'tr' ) . "\n" .
105 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n" .
106 html_tag( 'td', '', 'left' ) .
107 '<input type="checkbox" ';
108 if($media_popup == 'on') {
109 echo 'checked ';
110 }
111 echo 'name="media_popup"><b> ' . _("Show popup window on new mail") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
112 '</tr>' . "\n";
113 if ($allowsound == "true") {
114 echo html_tag( 'tr' ) . "\n" .
115 html_tag( 'td', _("Select server file:"), 'right', '', 'nowrap' ) . "\n" .
116 html_tag( 'td', '', 'left' ) .
117 '<select name="media_sel">'. "\n" .
118 '<option value="(local media)">' . _("(local media)") . '</option>' . "\n";
119
120 // Iterate sound files for options
121
122 $d = dir(SM_PATH . 'plugins/newmail/sounds');
123 while($entry=$d->read()) {
124 $fname = $d->path . "/" . $entry;
125 if ($entry != '..' && $entry != '.') {
126 echo "<option ";
127 if ($fname == $media) {
128 echo "selected ";
129 }
130 echo "value=\"" . $fname . "\">" . $entry . "</option>\n";
131 }
132 }
133 $d->close();
134 echo '</select>'.
135 '<input type="submit" value=" ' . _("Try") . ' " name="test" onClick="'.
136 "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound',".
137 "'width=150,height=30,scrollbars=no');".
138 'return false;'.
139 '">'.
140 '</td>'.
141 '</tr>'.
142 html_tag( 'tr', "\n" .
143 html_tag( 'td', _("Local Media File:"), 'right', '', 'nowrap' ) .
144 html_tag( 'td', '<input type="file" size="40" name="media_file">', 'left' )
145 ) . "\n" .
146 html_tag( 'tr', "\n" .
147 html_tag( 'td', _("Current File:"), 'right', '', 'nowrap' ) .
148 html_tag( 'td', '<input type="hidden" value="' . $media . '" name="media_default">' . $media . '', 'left' )
149 ) . "\n";
150 }
151 echo html_tag( 'tr', "\n" .
152 html_tag( 'td', '&nbsp;' ) .
153 html_tag( 'td',
154 '<input type="hidden" name="optmode" value="submit">'.
155 '<input type="submit" value="' . _("Submit") . '" name="submit_newmail">',
156 'left' )
157 ) . "\n" .
158 '</table>'. "\n" .
159 '</form>'. "\n" .
160 '</td></tr></table>'. "\n" .
161 '</body></html>';
162
163 ?>