8c62edd0e62de7f77e33592f5ae79358862d6f05
4 * newmails_opt.php - options page
6 * Displays all options relating to new mail sounds
8 * @copyright © 1999-2006 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
16 define('SM_PATH','../../');
18 /* SquirrelMail required files. */
19 include_once(SM_PATH
. 'include/validate.php');
21 include_once(SM_PATH
. 'functions/forms.php');
22 /** Plugin functions (also loads plugin's config) */
23 include_once(SM_PATH
. 'plugins/newmail/functions.php');
25 displayPageHeader($color, 'None');
27 // plugin uses squirrelmail loading_pref hook.
28 // vars are already loaded in include/validate.php
30 echo html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) . "\n" .
31 html_tag( 'tr' ) . "\n" .
32 html_tag( 'td', '', 'center' ) .
33 '<b>' . _("Options") . ' - ' . _("New Mail Notification") . "</b><br />\n" .
34 html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n" .
35 html_tag( 'tr' ) . "\n" .
36 html_tag( 'td', '', 'left', $color[4] ) . "<br />\n";
38 echo html_tag( 'p',_("The NewMail plugin will follow the Folder Preferences option "Enable Unread Message Notification"")) . "\n" .
40 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").'"')
43 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").'"')
46 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."), '"'._("Change title on supported browsers").'"', '"'._("Count only messages that are RECENT").'"')
48 if ($newmail_allowsound) {
50 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").'"')
53 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)").'"')
59 html_tag( 'td', '', 'center', $color[4] ) . "\n" . '<hr style="width: 25%; height: 1px;" />' . "\n";
61 echo '<form action="'.sqm_baseuri().'src/options.php" method="post" enctype="multipart/form-data">' . "\n" .
62 html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n";
64 /* newmail_unseen_notify */
65 $newmail_unseen_opts = array( 0 => _("Follow folder preferences"),
66 SMPREF_UNSEEN_INBOX
=> _("INBOX"),
67 SMPREF_UNSEEN_ALL
=> _("All folders"),
68 SMPREF_UNSEEN_SPECIAL
=> _("Special folders"),
69 SMPREF_UNSEEN_NORMAL
=> _("Regular folders"));
71 html_tag('td',_("Check for new messages in:"),'right', '', 'style="white-space: nowrap;"').
72 html_tag('td',addSelect('newmail_unseen_notify',$newmail_unseen_opts,$newmail_unseen_notify,true),'left')
75 // Option: media_recent
76 echo html_tag( 'tr' ) .
77 html_tag( 'td', _("Count only messages that are RECENT").':', 'right', '', 'style="white-space: nowrap;"' ) .
78 html_tag( 'td', '', 'left' ) .
79 '<input type="checkbox" ';
80 if ($newmail_recent == 'on') {
81 echo 'checked="checked" ';
83 echo 'name="media_recent" /></td></tr>' . "\n";
85 // Option: media_changetitle
86 echo html_tag( 'tr' ) .
87 html_tag( 'td', _("Change title on supported browsers").':', 'right', '', 'style="white-space: nowrap;"' ) .
88 html_tag( 'td', '', 'left' ) .
89 '<input type="checkbox" ';
90 if ($newmail_changetitle == 'on') {
91 echo 'checked="checked" ';
93 echo 'name="media_changetitle" /> <small>('._("requires JavaScript to work").')</small></td></tr>' . "\n";
95 // Option: media_popup
96 echo html_tag( 'tr' ) .
97 html_tag( 'td', _("Show popup window on new mail").':', 'right', '', 'style="white-space: nowrap;"' ) .
98 html_tag( 'td', '', 'left' ) .
99 '<input type="checkbox" ';
100 if($newmail_popup == 'on') {
101 echo 'checked="checked" ';
103 echo 'name="media_popup" /> <small>('._("requires JavaScript to work").')</small></td></tr>' . "\n";
105 echo html_tag( 'tr' )
106 . html_tag('td',_("Width of popup window:"),'right','', 'style="white-space: nowrap;"')
107 . html_tag('td','<input type="text" name="popup_width" value="'
108 . (int)$newmail_popup_width . '" size="3" maxlengh="3" />'
109 . ' <small>(' . _("If set to 0, reverts to default value") . ')</small>','left')
112 echo html_tag( 'tr' )
113 . html_tag('td',_("Height of popup window:"),'right','', 'style="white-space: nowrap;"')
114 . html_tag('td','<input type="text" name="popup_height" value="'
115 . (int)$newmail_popup_height . '" size="3" maxlengh="3" />'
116 . ' <small>(' . _("If set to 0, reverts to default value") . ')</small>','left')
119 if ($newmail_allowsound) {
120 // Option: media_enable
121 echo html_tag( 'tr' ) .
122 html_tag( 'td', _("Enable Media Playing").':', 'right', '', 'style="white-space: nowrap;"' ) .
123 html_tag( 'td', '', 'left' ) .
124 '<input type="checkbox" ';
125 if ($newmail_media_enable == 'on') {
126 echo 'checked="checked" ';
128 echo 'name="media_enable" /></td></tr>' . "\n";
131 echo html_tag( 'tr' ) .
132 html_tag( 'td', _("Select server file").':', 'right', '', 'style="white-space: nowrap;"' ) .
133 html_tag( 'td', '', 'left' ) .
134 '<select name="media_sel">' . "\n" .
135 '<option value="(none)"';
136 if ( $newmail_media == '(none)') {
137 echo 'selected="selected" ';
139 echo '>' . _("(none)") . '</option>' . "\n";
140 // Iterate sound files for options
141 $d = dir(SM_PATH
. 'plugins/newmail/sounds');
142 while($entry=$d->read()) {
143 // $fname = get_location () . '/sounds/' . $entry;
144 if ($entry != '..' && $entry != '.' && $entry != 'CVS' && $entry != 'index.php') {
146 if ($entry == $newmail_media) {
147 echo 'selected="selected" ';
149 echo 'value="' . htmlspecialchars($entry) . '">' .
150 htmlspecialchars($entry) . "</option>\n";
154 // display media selection
155 foreach($newmail_mmedia as $newmail_mm_name => $newmail_mm_data) {
157 if ($newmail_media=='mmedia_' . $newmail_mm_name) {
158 echo 'selected="selected" ';
160 echo 'value="mmedia_' . $newmail_mm_name . '">'
161 .htmlspecialchars($newmail_mm_name) . "</option>\n";
164 if($newmail_uploadsounds) {
165 // display local file option
167 if ($newmail_media=='(userfile)') {
168 echo 'selected="selected" ';
170 echo 'value="(userfile)">'.
171 _("uploaded media file") . "</option>\n";
172 // end of local file option
175 // Set media file name
176 if ($newmail_media == '(none)') {
177 $media_output = _("none");
178 } elseif ($newmail_media == '(userfile)') {
179 $media_output = basename($newmail_userfile_name);
180 } elseif (preg_match("/^mmedia_+/",$newmail_media)) {
181 $media_output = preg_replace("/^mmedia_/",'',$newmail_media);
183 $media_output = basename($newmail_media);
187 '<input type="submit" value="' . _("Try") . '" name="test" onclick="' .
188 "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound'," .
189 "'width=150,height=30,scrollbars=no');" .
192 if ($newmail_uploadsounds) {
195 . html_tag('td',_("Upload Media File:"),'right','','style="white-space: nowrap;"')
196 . html_tag('td','<input type="file" size="40" name="media_file">')
198 // display currently uploaded file information
200 . html_tag('td',_("Uploaded Media File:"),'right','','style="white-space: nowrap;"')
201 . html_tag('td',($newmail_userfile_name!='' ?
htmlspecialchars($newmail_userfile_name) : _("unavailable")))
204 if ($newmail_userfile_name!='') {
206 .'<td colspan="2" align="center">'
207 .sprintf(_("Media file %s will be removed, if you upload other media file."),basename($newmail_userfile_name))
211 echo html_tag( 'tr', "\n" .
212 html_tag( 'td', _("Current File:"), 'right', '', 'style="white-space: nowrap;"' ) .
213 html_tag( 'td', '<input type="hidden" value="' .
214 htmlspecialchars($newmail_media) . '" name="media_default" />' .
215 htmlspecialchars($media_output) . '', 'left' )
218 echo html_tag( 'tr', "\n" .
219 html_tag( 'td', ' ' ) .
221 '<input type="hidden" name="optmode" value="submit" />' .
222 '<input type="hidden" name="optpage" value="newmail" />' .
223 '<input type="submit" value="' . _("Submit") . '" name="submit_newmail" />',
227 </table
></form
></td
></tr
></table
></td
></tr
></table
></body
></html
>