Fixed typo.
[squirrelmail.git] / plugins / newmail / newmail_opt.php
CommitLineData
4508b1b6 1<?php
8d6a115b 2/**
ebe02dfc 3 * newmails_opt.php - options page
8d6a115b 4 *
6c84ba1e 5 * Copyright (c) 1999-2005 The SquirrelMail Project Team
8d6a115b 6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * Displays all options relating to new mail sounds
9 *
ebe02dfc 10 * @version $Id$
ea5f4b8e 11 * @package plugins
12 * @subpackage newmail
8d6a115b 13 */
4508b1b6 14
ea5f4b8e 15/** @ignore */
8d6a115b 16define('SM_PATH','../../');
d0dbdb14 17
8d6a115b 18/* SquirrelMail required files. */
19require_once(SM_PATH . 'include/validate.php');
ebe02dfc 20/* sqm_baseuri function */
8d6a115b 21require_once(SM_PATH . 'functions/display_messages.php');
3d75ef16 22
692ca6b7 23displayPageHeader($color, 'None');
3d75ef16 24
692ca6b7 25$media_enable = getPref($data_dir,$username, 'newmail_enable', 'FALSE' );
26$media_popup = getPref($data_dir, $username,'newmail_popup');
27$media_allbox = getPref($data_dir,$username,'newmail_allbox');
28$media_recent = getPref($data_dir,$username,'newmail_recent');
29$media_changetitle = getPref($data_dir,$username,'newmail_changetitle');
30$media = getPref($data_dir,$username,'newmail_media', '(none)');
3d75ef16 31
692ca6b7 32// Set $allowsound to false if you don't want sound files available
33$allowsound = "true";
412303e0 34
637fbe4d 35echo html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) . "\n" .
36 html_tag( 'tr' ) . "\n" .
37 html_tag( 'td', '', 'center' ) .
38 '<b>' . _("Options") . ' - ' . _("New Mail Notification") . "</b><br />\n" .
39 html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n" .
40 html_tag( 'tr' ) . "\n" .
41 html_tag( 'td', '', 'left', $color[4] ) . "<br />\n";
42
43echo html_tag( 'p',
44 sprintf(_("The %s option will check ALL of your folders for unseen mail, not just the inbox for notification."), '&quot;'._("Check all boxes, not just INBOX").'&quot;')
45 ) . "\n" .
46 html_tag( 'p',
47 sprintf(_("Selecting the %s option will enable the showing of a popup window when unseen mail is in your folders (requires JavaScript)."), '&quot;'._("Show popup window on new mail").'&quot;')
48 ) . "\n" .
49 html_tag( 'p',
50 sprintf(_("Use the %s option 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."), '&quot;'._("Count only messages that are RECENT").'&quot;')
51 ) . "\n" .
52 html_tag( 'p',
e2495a9f 53 sprintf(_("Selecting the %s 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 %s enabled."), '&quot;'._("Change title on supported browsers").'&quot;', '&quot;'._("Count only messages that are RECENT").'&quot;')
637fbe4d 54 ) . "\n";
692ca6b7 55if ($allowsound == "true") {
637fbe4d 56 echo html_tag( 'p',
57 sprintf(_("Select %s 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."), '&quot;'._("Enable Media Playing").'&quot;')
58 ) . "\n" .
59 html_tag( 'p',
60 sprintf(_("Select from the list of %s the media file to play when new mail arrives. If no file is specified, %s, no sound will be used."), '&quot;'._("Select server file").'&quot;', '&quot;'._("(none)").'&quot;')
61 ) . "\n";
692ca6b7 62}
637fbe4d 63
64echo '</td></tr>' .
65 html_tag( 'tr' ) .
66 html_tag( 'td', '', 'center', $color[4] ) . "\n" . '<hr style="width: 25%; height: 1px;" />' . "\n";
67
68echo '<form action="'.sqm_baseuri().'src/options.php" method="post">' . "\n" .
69 html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n";
70
71// Option: media_allbox
72echo html_tag( 'tr' ) .
c435f076 73 html_tag( 'td', _("Check all boxes, not just INBOX").':', 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 74 html_tag( 'td', '', 'left' ) .
75 '<input type="checkbox" ';
76if ($media_allbox == 'on') {
77 echo 'checked="checked" ';
78}
79echo 'name="media_allbox" /></td></tr>' . "\n";
80
81// Option: media_recent
82echo html_tag( 'tr' ) .
c435f076 83 html_tag( 'td', _("Count only messages that are RECENT").':', 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 84 html_tag( 'td', '', 'left' ) .
85 '<input type="checkbox" ';
86if ($media_recent == 'on') {
87 echo 'checked="checked" ';
88}
89echo 'name="media_recent" /></td></tr>' . "\n";
90
91// Option: media_changetitle
92echo html_tag( 'tr' ) .
c435f076 93 html_tag( 'td', _("Change title on supported browsers").':', 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 94 html_tag( 'td', '', 'left' ) .
95 '<input type="checkbox" ';
96if ($media_changetitle == 'on') {
97 echo 'checked="checked" ';
98}
99echo 'name="media_changetitle" />&nbsp;('._("requires JavaScript to work").')</td></tr>' . "\n";
100
101// Option: media_popup
102echo html_tag( 'tr' ) .
c435f076 103 html_tag( 'td', _("Show popup window on new mail").':', 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 104 html_tag( 'td', '', 'left' ) .
105 '<input type="checkbox" ';
106if($media_popup == 'on') {
107 echo 'checked="checked" ';
108}
109echo 'name="media_popup" />&nbsp;('._("requires JavaScript to work").')</td></tr>' . "\n";
110
111if ($allowsound == "true") {
112// Option: media_enable
113 echo html_tag( 'tr' ) .
c435f076 114 html_tag( 'td', _("Enable Media Playing").':', 'right', '', 'style="white-space: nowrap;"' ) .
4cf43843 115 html_tag( 'td', '', 'left' ) .
116 '<input type="checkbox" ';
637fbe4d 117 if ($media_enable == 'on') {
118 echo 'checked="checked" ';
3d75ef16 119 }
637fbe4d 120 echo 'name="media_enable" /></td></tr>' . "\n";
3d75ef16 121
637fbe4d 122// Option: media_sel
123 echo html_tag( 'tr' ) .
c435f076 124 html_tag( 'td', _("Select server file").':', 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 125 html_tag( 'td', '', 'left' ) .
126 '<select name="media_sel">' . "\n" .
127 '<option value="(none)"';
128 if ( $media == '(none)') {
129 echo 'selected="selected" ';
130 }
131 echo '>' . _("(none)") . '</option>' . "\n";
3d75ef16 132 // Iterate sound files for options
cd7fc9e6 133 $d = dir(SM_PATH . 'plugins/newmail/sounds');
3d75ef16 134 while($entry=$d->read()) {
692ca6b7 135 $fname = get_location () . '/sounds/' . $entry;
136 if ($entry != '..' && $entry != '.' && $entry != 'CVS') {
137 echo '<option ';
3d75ef16 138 if ($fname == $media) {
637fbe4d 139 echo 'selected="selected" ';
3d75ef16 140 }
a9e1e670 141 echo 'value="' . htmlspecialchars($fname) . '">' .
142 htmlspecialchars($entry) . "</option>\n";
3d75ef16 143 }
144 }
145 $d->close();
637fbe4d 146 $media_output = ($media == '(none)') ? _("(none)") : substr($media, strrpos($media, '/')+1);
4cf43843 147 echo '</select>'.
c435f076 148 '<input type="submit" value="' . _("Try") . '" name="test" onclick="' .
637fbe4d 149 "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound'," .
150 "'width=150,height=30,scrollbars=no');" .
151 'return false;' .
ebe02dfc 152 '" /></td></tr>' .
637fbe4d 153 html_tag( 'tr', "\n" .
c435f076 154 html_tag( 'td', _("Current File:"), 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 155 html_tag( 'td', '<input type="hidden" value="' .
5f75494f 156 htmlspecialchars($media) . '" name="media_default" />' .
637fbe4d 157 htmlspecialchars($media_output) . '', 'left' )
158 ) . "\n";
159}
160echo html_tag( 'tr', "\n" .
161 html_tag( 'td', '&nbsp;' ) .
162 html_tag( 'td',
163 '<input type="hidden" name="optmode" value="submit" />' .
ebe02dfc 164 '<input type="hidden" name="optpage" value="newmail" />' .
637fbe4d 165 '<input type="submit" value="' . _("Submit") . '" name="submit_newmail" />',
166 'left' )
167 ) . "\n";
dcc1cc82 168?>
91e0dccc 169</table></form></td></tr></table></td></tr></table></body></html>