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