1) Corrected errors with relative paths that prevented sounds from
[squirrelmail.git] / plugins / newmail / newmail_opt.php
CommitLineData
4508b1b6 1<?php
2d4c15d6 2
8d6a115b 3/**
4 * newmails_opt.php
5 *
76911253 6 * Copyright (c) 1999-2003 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$
12 */
4508b1b6 13
8d6a115b 14define('SM_PATH','../../');
d0dbdb14 15
8d6a115b 16/* SquirrelMail required files. */
17require_once(SM_PATH . 'include/validate.php');
18require_once(SM_PATH . 'functions/page_header.php');
19require_once(SM_PATH . 'functions/display_messages.php');
20require_once(SM_PATH . 'functions/imap.php');
8d6a115b 21require_once(SM_PATH . 'include/load_prefs.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
692ca6b7 35echo html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) . "\n" .
36 html_tag( 'tr', "\n" .
4cf43843 37 html_tag( 'td', '<b>' . _("Options") . ' - ' . _("New Mail Notification") . '</b>', 'center', $color[0] )
692ca6b7 38 ) . "\n" .
4cf43843 39 html_tag( 'tr' ) . "\n" .
40 html_tag( 'td', '', 'left' );
692ca6b7 41if ($allowsound == "true") {
42 echo html_tag( 'p',
4cf43843 43 _("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.")
692ca6b7 44 ) . "\n";
45}
46 echo html_tag( 'p',
47 _("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.")
48 ) . "\n" .
49 html_tag( 'p',
4cf43843 50 _("Selecting the <b>Show popup</b> option will enable the showing of a popup window when unseen mail is in your folders (requires JavaScript).")
51 ) . "\n" .
52 html_tag( 'p',
53 _("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.")
54 ) . "\n" .
55 html_tag( 'p',
56 _("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.")
57 );
412303e0 58 if ($allowsound == "true") {
4cf43843 59 echo html_tag( 'p',
692ca6b7 60 _("Select from the list of <b>server files</b> the media file to play when new mail arrives. If no file is specified, \"(none)\", no sound will be used.")
4cf43843 61 ) . "\n";
3d75ef16 62 }
692ca6b7 63 echo '<form action="'.sqm_baseuri().'src/options.php" method=post>'.
4cf43843 64 html_tag( 'table', '', '', '', 'width="100%" cellpadding="0" cellspacing="2" border="0"' ) . "\n" .
65 html_tag( 'tr' ) . "\n" .
8e724112 66 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n";
412303e0 67 if ($allowsound == "true") {
692ca6b7 68 echo html_tag( 'td', '', 'left' ) .
69 '<input type="checkbox" ';
412303e0 70 if ($media_enable == 'on') {
71 echo 'checked ';
72 }
4cf43843 73 echo 'name="media_enable"><b> ' . _("Enable Media Playing") . '</b></td>'.
74 '</tr>' . "\n";
412303e0 75 }
4cf43843 76 echo html_tag( 'tr' ) . "\n" .
8e724112 77 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n" .
4cf43843 78 html_tag( 'td', '', 'left' ) .
79 '<input type="checkbox" ';
3d75ef16 80 if ($media_allbox == 'on') {
81 echo 'checked ';
82 }
4cf43843 83 echo 'name="media_allbox"><b> ' . _("Check all boxes, not just INBOX") . '</b></td>'.
84 '</tr>'. "\n" .
85 html_tag( 'tr' ) . "\n" .
8e724112 86 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n" .
4cf43843 87 html_tag( 'td', '', 'left' ) .
88 '<input type="checkbox" ';
3d75ef16 89 if ($media_recent == 'on') {
90 echo 'checked ';
91 }
4cf43843 92 echo 'name="media_recent"><b> ' . _("Count only messages that are RECENT") . '</b></td>'.
93 '</tr>'. "\n" .
94 html_tag( 'tr' ) . "\n" .
8e724112 95 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n" .
4cf43843 96 html_tag( 'td', '', 'left' ) .
97 '<input type="checkbox" ';
3d75ef16 98 if ($media_changetitle == 'on') {
99 echo 'checked ';
100 }
4cf43843 101 echo 'name="media_changetitle"><b> ' . _("Change title on supported browsers.") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
102 '</tr>'. "\n" .
103 html_tag( 'tr' ) . "\n" .
8e724112 104 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n" .
4cf43843 105 html_tag( 'td', '', 'left' ) .
106 '<input type="checkbox" ';
3d75ef16 107 if($media_popup == 'on') {
108 echo 'checked ';
109 }
4cf43843 110 echo 'name="media_popup"><b> ' . _("Show popup window on new mail") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
111 '</tr>' . "\n";
412303e0 112 if ($allowsound == "true") {
4cf43843 113 echo html_tag( 'tr' ) . "\n" .
114 html_tag( 'td', _("Select server file:"), 'right', '', 'nowrap' ) . "\n" .
115 html_tag( 'td', '', 'left' ) .
692ca6b7 116 '<select name="media_sel">'. "\n".
117 '<option value="(none)"';
118 if ( $media == '(none)') {
119 echo 'selected ';
120 }
121 echo '>' . _("(none)") . '</option>' . "\n";
3d75ef16 122
123 // Iterate sound files for options
cd7fc9e6 124 $d = dir(SM_PATH . 'plugins/newmail/sounds');
3d75ef16 125 while($entry=$d->read()) {
692ca6b7 126 $fname = get_location () . '/sounds/' . $entry;
127 if ($entry != '..' && $entry != '.' && $entry != 'CVS') {
128 echo '<option ';
3d75ef16 129 if ($fname == $media) {
692ca6b7 130 echo 'selected ';
3d75ef16 131 }
692ca6b7 132 echo 'value="' . $fname . '">' . $entry . "</option>\n";
3d75ef16 133 }
134 }
135 $d->close();
4cf43843 136 echo '</select>'.
3d75ef16 137 '<input type="submit" value=" ' . _("Try") . ' " name="test" onClick="'.
138 "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound',".
692ca6b7 139 "'width=150,height=30,scrollbars=no');".
3d75ef16 140 'return false;'.
141 '">'.
142 '</td>'.
143 '</tr>'.
4cf43843 144 html_tag( 'tr', "\n" .
4cf43843 145 html_tag( 'td', _("Current File:"), 'right', '', 'nowrap' ) .
146 html_tag( 'td', '<input type="hidden" value="' . $media . '" name="media_default">' . $media . '', 'left' )
147 ) . "\n";
412303e0 148 }
4cf43843 149 echo html_tag( 'tr', "\n" .
150 html_tag( 'td', '&nbsp;' ) .
151 html_tag( 'td',
152 '<input type="hidden" name="optmode" value="submit">'.
153 '<input type="submit" value="' . _("Submit") . '" name="submit_newmail">',
154 'left' )
155 ) . "\n" .
156 '</table>'. "\n" .
157 '</form>'. "\n" .
158 '</td></tr></table>'. "\n" .
3d75ef16 159'</body></html>';
160
15e6162e 161?>