4 * newmails_opt.php - options page
6 * Displays all options relating to new mail sounds
8 * @copyright © 1999-2007 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
16 * Path for SquirrelMail required files.
19 require('../../include/init.php');
21 /** Plugin functions (also loads plugin's config) */
22 include_once(SM_PATH
. 'plugins/newmail/functions.php');
24 include_once(SM_PATH
. 'functions/forms.php');
26 displayPageHeader($color);
28 echo html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) . "\n" .
29 html_tag( 'tr' ) . "\n" .
30 html_tag( 'td', '', 'center' ) .
31 '<b>' . _("Options") . ' - ' . _("New Mail Notification") . "</b><br />\n" .
32 html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n" .
33 html_tag( 'tr' ) . "\n" .
34 html_tag( 'td', '', 'left', $color[4] ) . "<br />\n";
36 echo html_tag( 'p',_("The NewMail plugin will follow the Folder Preferences option "Enable Unread Message Notification"")) . "\n" .
38 sprintf(_("Selecting the %s option will enable the showing of a popup window when unseen mail is in your folders (requires JavaScript)."), '"'._("Show popup window on new mail").'"')
41 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."), '"'._("Count only messages that are RECENT").'"')
44 sprintf(_("Selecting the %s option will change the title in some browsers to let you know when you have new mail (requires JavaScript). This will always tell you if you have new mail, even if you have %s enabled."), '"'._("Change title on supported browsers").'"', '"'._("Count only messages that are RECENT").'"')
46 if ($newmail_allowsound) {
48 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."), '"'._("Enable Media Playing").'"')
51 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."), '"'._("Select server file").'"', '"'._("(none)").'"')
57 html_tag( 'td', '', 'center', $color[4] ) . "\n" . '<hr style="width: 25%; height: 1px;" />' . "\n";
59 echo '<form action="'.sqm_baseuri().'src/options.php" method="post" enctype="multipart/form-data">' . "\n" .
60 html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n";
62 /* newmail_unseen_notify */
63 $newmail_unseen_opts = array( 0 => _("Follow folder preferences"),
64 SMPREF_UNSEEN_INBOX
=> _("INBOX"),
65 SMPREF_UNSEEN_ALL
=> _("All folders"),
66 SMPREF_UNSEEN_SPECIAL
=> _("Special folders"),
67 SMPREF_UNSEEN_NORMAL
=> _("Regular folders"));
69 html_tag('td',_("Check for new messages in:"),'right', '', 'style="white-space: nowrap;"').
70 html_tag('td',addSelect('newmail_unseen_notify',$newmail_unseen_opts,$newmail_unseen_notify,true),'left')
73 // Option: media_recent
74 echo html_tag( 'tr' ) .
75 html_tag( 'td', _("Count only messages that are RECENT").':', 'right', '', 'style="white-space: nowrap;"' ) .
76 html_tag( 'td', '', 'left' ) .
77 '<input type="checkbox" ';
78 if ($newmail_recent == 'on') {
79 echo 'checked="checked" ';
81 echo 'name="media_recent" /></td></tr>' . "\n";
83 // Option: media_changetitle
84 echo html_tag( 'tr' ) .
85 html_tag( 'td', _("Change title on supported browsers").':', 'right', '', 'style="white-space: nowrap;"' ) .
86 html_tag( 'td', '', 'left' ) .
87 '<input type="checkbox" ';
88 if ($newmail_changetitle == 'on') {
89 echo 'checked="checked" ';
91 echo 'name="media_changetitle" /> <small>('._("requires JavaScript to work").')</small></td></tr>' . "\n";
93 // Option: media_popup
94 echo html_tag( 'tr' ) .
95 html_tag( 'td', _("Show popup window on new mail").':', 'right', '', 'style="white-space: nowrap;"' ) .
96 html_tag( 'td', '', 'left' ) .
97 '<input type="checkbox" ';
98 if($newmail_popup == 'on') {
99 echo 'checked="checked" ';
101 echo 'name="media_popup" /> <small>('._("requires JavaScript to work").')</small></td></tr>' . "\n";
103 echo html_tag( 'tr' )
104 . html_tag('td',_("Width of popup window:"),'right','', 'style="white-space: nowrap;"')
105 . html_tag('td','<input type="text" name="popup_width" value="'
106 . (int)$newmail_popup_width . '" size="3" maxlengh="3" />'
107 . ' <small>(' . _("If set to 0, reverts to default value") . ')</small>','left')
110 echo html_tag( 'tr' )
111 . html_tag('td',_("Height of popup window:"),'right','', 'style="white-space: nowrap;"')
112 . html_tag('td','<input type="text" name="popup_height" value="'
113 . (int)$newmail_popup_height . '" size="3" maxlengh="3" />'
114 . ' <small>(' . _("If set to 0, reverts to default value") . ')</small>','left')
117 if ($newmail_allowsound) {
118 // Option: media_enable
119 echo html_tag( 'tr' ) .
120 html_tag( 'td', _("Enable Media Playing").':', 'right', '', 'style="white-space: nowrap;"' ) .
121 html_tag( 'td', '', 'left' ) .
122 '<input type="checkbox" ';
123 if ($newmail_media_enable == 'on') {
124 echo 'checked="checked" ';
126 echo 'name="media_enable" /></td></tr>' . "\n";
129 echo html_tag( 'tr' ) .
130 html_tag( 'td', _("Select server file").':', 'right', '', 'style="white-space: nowrap;"' ) .
131 html_tag( 'td', '', 'left' ) .
132 '<select name="media_sel">' . "\n" .
133 '<option value="(none)"';
134 if ( $newmail_media == '(none)') {
135 echo 'selected="selected" ';
137 echo '>' . _("(none)") . '</option>' . "\n";
138 // Iterate sound files for options
139 $d = dir(SM_PATH
. 'plugins/newmail/sounds');
140 while($entry=$d->read()) {
141 // $fname = get_location () . '/sounds/' . $entry;
142 if ($entry != '..' && $entry != '.' && $entry != 'CVS' && $entry != 'index.php') {
144 if ($entry == $newmail_media) {
145 echo 'selected="selected" ';
147 echo 'value="' . htmlspecialchars($entry) . '">' .
148 htmlspecialchars($entry) . "</option>\n";
152 // display media selection
153 foreach($newmail_mmedia as $newmail_mm_name => $newmail_mm_data) {
155 if ($newmail_media=='mmedia_' . $newmail_mm_name) {
156 echo 'selected="selected" ';
158 echo 'value="mmedia_' . $newmail_mm_name . '">'
159 .htmlspecialchars($newmail_mm_name) . "</option>\n";
162 if($newmail_uploadsounds) {
163 // display local file option
165 if ($newmail_media=='(userfile)') {
166 echo 'selected="selected" ';
168 echo 'value="(userfile)">'.
169 _("uploaded media file") . "</option>\n";
170 // end of local file option
173 // Set media file name
174 if ($newmail_media == '(none)') {
175 $media_output = _("none");
176 } elseif ($newmail_media == '(userfile)') {
177 $media_output = basename($newmail_userfile_name);
178 } elseif (preg_match("/^mmedia_+/",$newmail_media)) {
179 $media_output = preg_replace("/^mmedia_/",'',$newmail_media);
181 $media_output = basename($newmail_media);
185 '<input type="submit" value="' . _("Try") . '" name="test" onclick="' .
186 "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound'," .
187 "'width=150,height=30,scrollbars=no');" .
190 if ($newmail_uploadsounds) {
193 . html_tag('td',_("Upload Media File:"),'right','','style="white-space: nowrap;"')
194 . html_tag('td','<input type="file" size="40" name="media_file" />')
196 // display currently uploaded file information
198 . html_tag('td',_("Uploaded Media File:"),'right','','style="white-space: nowrap;"')
199 . html_tag('td',($newmail_userfile_name!='' ?
htmlspecialchars($newmail_userfile_name) : _("unavailable")))
202 if ($newmail_userfile_name!='') {
204 .'<td colspan="2" align="center">'
205 .sprintf(_("Media file %s will be removed, if you upload other media file."),basename($newmail_userfile_name))
209 echo html_tag( 'tr', "\n" .
210 html_tag( 'td', _("Current File:"), 'right', '', 'style="white-space: nowrap;"' ) .
211 html_tag( 'td', '<input type="hidden" value="' .
212 htmlspecialchars($newmail_media) . '" name="media_default" />' .
213 htmlspecialchars($media_output) . '', 'left' )
216 echo html_tag( 'tr', "\n" .
217 html_tag( 'td', ' ' ) .
219 '<input type="hidden" name="optmode" value="submit" />' .
220 '<input type="hidden" name="optpage" value="newmail" />' .
221 '<input type="submit" value="' . _("Submit") . '" name="submit_newmail" />',
225 </table
></form
></td
></tr
></table
></td
></tr
></table
></body
></html
>