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