Some cleanup.
[squirrelmail.git] / plugins / newmail / newmail_opt.php
CommitLineData
4508b1b6 1<?php
2d4c15d6 2
4508b1b6 3 /**
4 ** newmails_opt.php
2d4c15d6 5 ** Copyright (c) 1999-2001 The Squirrelmail Development Team
3d75ef16 6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
4508b1b6 7 **
8 ** Displays all options relating to new mail sounds
9 **
2d4c15d6 10 ** $Id$
3d75ef16 11 **
4508b1b6 12 **/
13
3d75ef16 14 chdir("..");
15 require_once('../src/validate.php');
16 require_once('../functions/page_header.php');
17 require_once('../functions/display_messages.php');
18 require_once('../functions/imap.php');
19 require_once('../functions/array.php');
20 require_once('../src/load_prefs.php');
21
22 displayPageHeader($color, 'None');
23
24 $media_enable = getPref($data_dir,$username, 'newmail_enable');
25 if ($media_enable == '') {
26 $media_enable = 'FALSE';
27 }
28
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
34 $media = getPref($data_dir,$username,'newmail_media');
35 if ($media == '') {
36 $media = '../plugins/newmail/sounds/Notify.wav';
37 }
38
39 echo '<br>' .
40 "<table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor=\"$color[0]\">\n".
41 '<center><b>' . _("Options") . ' - ' . _("New Mail Notification") . '</b></center>'.
42 '</td></tr><tr><td>'.
43 '<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 '</p><p>'.
46_("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.").
47 '</p><p>'.
48_("Selecting the <b>Show popup</b> option will enable the showing of a popup window when unseen mail is in your folders (requires JavaScript).") .
49 '</p><p>'.
50_("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.").
51 '</p><p>'.
52_("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.").
53 '</p><p>'.
54_("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.") .
55 '</p>'.
56 '<form action="../../src/options.php" method=post>'.
57 '<table width=100% cellpadding=0 cellspacing=2 border=0>'.
58 '<tr>'.
59 '<td align=right nowrap>&nbsp</td>'.
60 '<td><input type=checkbox ';
61 if ($media_enable == 'on') {
62 echo 'checked ';
63 }
64 echo 'name=media_enable><b> ' . _("Enable Media Playing") . '</b></td>'.
65 '</tr>'.
66 '<tr>'.
67 '<td align=right nowrap>&nbsp</td>'.
68 '<td><input type=checkbox ';
69 if ($media_allbox == 'on') {
70 echo 'checked ';
71 }
72 echo 'name=media_allbox><b> ' . _("Check all boxes, not just INBOX") . '</b></td>'.
73 '</tr>'.
74 '<tr>'.
75 '<td align=right nowrap>&nbsp</td>'.
76 '<td><input type=checkbox ';
77 if ($media_recent == 'on') {
78 echo 'checked ';
79 }
80 echo 'name=media_recent><b> ' . _("Count only messages that are RECENT") . '</b></td>'.
81 '</tr>'.
82 '<tr>'.
83 '<td align=right nowrap>&nbsp</td>' .
84 '<td><input type=checkbox ';
85 if ($media_changetitle == 'on') {
86 echo 'checked ';
87 }
e697b6cc 88 echo 'name=media_changetitle><b> ' . _("Change title on supported browsers.") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
3d75ef16 89 '</tr>'.
90 '<tr>'.
91 '<td align=right nowrap>&nbsp</td>'.
92 '<td><input type=checkbox ';
93 if($media_popup == 'on') {
94 echo 'checked ';
95 }
96 echo 'name=media_popup><b> ' . _("Show popup window on new mail") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
97 '</tr>'.
98 '<tr>'.
99 '<td align=right nowrap>' . _("Select server file:") . '</td>'.
100 '<td><SELECT NAME=media_sel>'.
101 '<OPTION VALUE="(local media)">' . _("(local media)");
102
103 // Iterate sound files for options
104
105 $d = dir('../plugins/newmail/sounds');
106 while($entry=$d->read()) {
107 $fname = $d->path . "/" . $entry;
108 if ($entry != ".." && $entry != ".") {
109 echo "<OPTION ";
110 if ($fname == $media) {
111 echo "SELECTED ";
112 }
113 echo "VALUE=\"" . $fname . "\">" . $entry . "\n";
114 }
115 }
116 $d->close();
117 echo '</SELECT>'.
118 '<input type="submit" value=" ' . _("Try") . ' " name="test" onClick="'.
119 "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound',".
120 "'width=150,height=30,scrollbars=no');".
121 'return false;'.
122 '">'.
123 '</td>'.
124 '</tr>'.
125 '<tr>'.
126 '<td align=right nowrap>' . _("Local Media File:") .
127 '</td><td>'.
128 '<input type=file size=40 name=media_file>'.
129 '</td>'.
130 '</tr>'.
131 '<tr>'.
132 '<td align=right nowrap>' . _("Current File:") .
133 '</td><td>'.
134 "<input type=hidden value=\"$media;\" name=media_default>$media;</td>".
135 '</tr>'.
136 '<tr>'.
137 '<td>&nbsp;</td>'.
138 '<td>'.
139 '<input type="submit" value="' . _("Submit") . '" name="submit_newmail">'.
140 '</td>'.
141 '</tr>'.
142 '</table>'.
143 '</form>'.
144 '</td></tr></table>'.
145'</body></html>';
146
147?>