Syntax error fix
[squirrelmail.git] / plugins / newmail / newmail_opt.php
CommitLineData
4508b1b6 1<?php
4b4abf93 2
8d6a115b 3/**
ebe02dfc 4 * newmails_opt.php - options page
8d6a115b 5 *
8d6a115b 6 * Displays all options relating to new mail sounds
7 *
4b5049de 8 * @copyright &copy; 1999-2007 The SquirrelMail Project Team
4b4abf93 9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
ebe02dfc 10 * @version $Id$
ea5f4b8e 11 * @package plugins
12 * @subpackage newmail
8d6a115b 13 */
4508b1b6 14
202bcbcc 15/**
16 * Path for SquirrelMail required files.
17 * @ignore
18 */
19require('../../include/init.php');
d0dbdb14 20
dbc7cd0a 21/** Plugin functions (also loads plugin's config) */
22include_once(SM_PATH . 'plugins/newmail/functions.php');
3d75ef16 23
202bcbcc 24include_once(SM_PATH . 'functions/forms.php');
3d75ef16 25
202bcbcc 26displayPageHeader($color, 'None');
3d75ef16 27
637fbe4d 28echo 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";
35
f7c05ce6 36echo html_tag( 'p',_("The NewMail plugin will follow the Folder Preferences option &quot;Enable Unread Message Notification&quot;")) . "\n" .
637fbe4d 37 html_tag( 'p',
38 sprintf(_("Selecting the %s option will enable the showing of a popup window when unseen mail is in your folders (requires JavaScript)."), '&quot;'._("Show popup window on new mail").'&quot;')
39 ) . "\n" .
40 html_tag( 'p',
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."), '&quot;'._("Count only messages that are RECENT").'&quot;')
42 ) . "\n" .
43 html_tag( 'p',
e2495a9f 44 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."), '&quot;'._("Change title on supported browsers").'&quot;', '&quot;'._("Count only messages that are RECENT").'&quot;')
637fbe4d 45 ) . "\n";
70e628ef 46if ($newmail_allowsound) {
637fbe4d 47 echo html_tag( 'p',
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."), '&quot;'._("Enable Media Playing").'&quot;')
49 ) . "\n" .
50 html_tag( 'p',
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."), '&quot;'._("Select server file").'&quot;', '&quot;'._("(none)").'&quot;')
52 ) . "\n";
692ca6b7 53}
637fbe4d 54
55echo '</td></tr>' .
56 html_tag( 'tr' ) .
57 html_tag( 'td', '', 'center', $color[4] ) . "\n" . '<hr style="width: 25%; height: 1px;" />' . "\n";
58
dbc7cd0a 59echo '<form action="'.sqm_baseuri().'src/options.php" method="post" enctype="multipart/form-data">' . "\n" .
637fbe4d 60 html_tag( 'table', '', '', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) . "\n";
61
321069a7 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"));
68echo html_tag('tr',
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')
71 );
72
637fbe4d 73// Option: media_recent
74echo html_tag( 'tr' ) .
c435f076 75 html_tag( 'td', _("Count only messages that are RECENT").':', 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 76 html_tag( 'td', '', 'left' ) .
77 '<input type="checkbox" ';
c8f452aa 78if ($newmail_recent == 'on') {
637fbe4d 79 echo 'checked="checked" ';
80}
81echo 'name="media_recent" /></td></tr>' . "\n";
82
83// Option: media_changetitle
84echo html_tag( 'tr' ) .
c435f076 85 html_tag( 'td', _("Change title on supported browsers").':', 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 86 html_tag( 'td', '', 'left' ) .
87 '<input type="checkbox" ';
c8f452aa 88if ($newmail_changetitle == 'on') {
637fbe4d 89 echo 'checked="checked" ';
90}
c8f452aa 91echo 'name="media_changetitle" />&nbsp;<small>('._("requires JavaScript to work").')</small></td></tr>' . "\n";
637fbe4d 92
93// Option: media_popup
94echo html_tag( 'tr' ) .
c435f076 95 html_tag( 'td', _("Show popup window on new mail").':', 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 96 html_tag( 'td', '', 'left' ) .
97 '<input type="checkbox" ';
c8f452aa 98if($newmail_popup == 'on') {
637fbe4d 99 echo 'checked="checked" ';
100}
c8f452aa 101echo 'name="media_popup" />&nbsp;<small>('._("requires JavaScript to work").')</small></td></tr>' . "\n";
102
103echo html_tag( 'tr' )
104 . html_tag('td',_("Width of popup window:"),'right','', 'style="white-space: nowrap;"')
f8a1ed5a 105 . html_tag('td','<input type="text" name="popup_width" value="'
c8f452aa 106 . (int)$newmail_popup_width . '" size="3" maxlengh="3" />'
107 . '&nbsp;<small>(' . _("If set to 0, reverts to default value") . ')</small>','left')
108 . "</tr>\n";
109
110echo html_tag( 'tr' )
111 . html_tag('td',_("Height of popup window:"),'right','', 'style="white-space: nowrap;"')
f8a1ed5a 112 . html_tag('td','<input type="text" name="popup_height" value="'
c8f452aa 113 . (int)$newmail_popup_height . '" size="3" maxlengh="3" />'
114 . '&nbsp;<small>(' . _("If set to 0, reverts to default value") . ')</small>','left')
115 . "</tr>\n";
637fbe4d 116
70e628ef 117if ($newmail_allowsound) {
637fbe4d 118// Option: media_enable
119 echo html_tag( 'tr' ) .
c435f076 120 html_tag( 'td', _("Enable Media Playing").':', 'right', '', 'style="white-space: nowrap;"' ) .
4cf43843 121 html_tag( 'td', '', 'left' ) .
122 '<input type="checkbox" ';
0f3d157e 123 if ($newmail_media_enable == 'on') {
637fbe4d 124 echo 'checked="checked" ';
3d75ef16 125 }
637fbe4d 126 echo 'name="media_enable" /></td></tr>' . "\n";
3d75ef16 127
637fbe4d 128// Option: media_sel
129 echo html_tag( 'tr' ) .
c435f076 130 html_tag( 'td', _("Select server file").':', 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 131 html_tag( 'td', '', 'left' ) .
132 '<select name="media_sel">' . "\n" .
133 '<option value="(none)"';
c8f452aa 134 if ( $newmail_media == '(none)') {
637fbe4d 135 echo 'selected="selected" ';
136 }
137 echo '>' . _("(none)") . '</option>' . "\n";
3d75ef16 138 // Iterate sound files for options
cd7fc9e6 139 $d = dir(SM_PATH . 'plugins/newmail/sounds');
3d75ef16 140 while($entry=$d->read()) {
f9710f76 141 // $fname = get_location () . '/sounds/' . $entry;
92192507 142 if ($entry != '..' && $entry != '.' && $entry != 'CVS' && $entry != 'index.php') {
692ca6b7 143 echo '<option ';
f9710f76 144 if ($entry == $newmail_media) {
637fbe4d 145 echo 'selected="selected" ';
3d75ef16 146 }
f9710f76 147 echo 'value="' . htmlspecialchars($entry) . '">' .
a9e1e670 148 htmlspecialchars($entry) . "</option>\n";
3d75ef16 149 }
150 }
151 $d->close();
dbc7cd0a 152 // display media selection
153 foreach($newmail_mmedia as $newmail_mm_name => $newmail_mm_data) {
154 echo '<option ';
c8f452aa 155 if ($newmail_media=='mmedia_' . $newmail_mm_name) {
dbc7cd0a 156 echo 'selected="selected" ';
157 }
158 echo 'value="mmedia_' . $newmail_mm_name . '">'
159 .htmlspecialchars($newmail_mm_name) . "</option>\n";
160 }
f9710f76 161
162 if($newmail_uploadsounds) {
163 // display local file option
164 echo '<option ';
165 if ($newmail_media=='(userfile)') {
166 echo 'selected="selected" ';
167 }
168 echo 'value="(userfile)">'.
169 _("uploaded media file") . "</option>\n";
170 // end of local file option
dbc7cd0a 171 }
dbc7cd0a 172
173 // Set media file name
c8f452aa 174 if ($newmail_media == '(none)') {
dbc7cd0a 175 $media_output = _("none");
c8f452aa 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);
dbc7cd0a 180 } else {
f9710f76 181 $media_output = basename($newmail_media);
dbc7cd0a 182 }
183
4cf43843 184 echo '</select>'.
c435f076 185 '<input type="submit" value="' . _("Try") . '" name="test" onclick="' .
637fbe4d 186 "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound'," .
187 "'width=150,height=30,scrollbars=no');" .
188 'return false;' .
dbc7cd0a 189 '" /></td></tr>';
f9710f76 190 if ($newmail_uploadsounds) {
191 // upload form
192 echo html_tag('tr')
193 . html_tag('td',_("Upload Media File:"),'right','','style="white-space: nowrap;"')
194 . html_tag('td','<input type="file" size="40" name="media_file">')
195 . "</tr>\n";
196 // display currently uploaded file information
197 echo html_tag('tr')
198 . html_tag('td',_("Uploaded Media File:"),'right','','style="white-space: nowrap;"')
199 . html_tag('td',($newmail_userfile_name!='' ? htmlspecialchars($newmail_userfile_name) : _("unavailable")))
200 ."</tr>\n";
201
202 if ($newmail_userfile_name!='') {
203 echo '<tr>'
204 .'<td colspan="2" align="center">'
205 .sprintf(_("Media file %s will be removed, if you upload other media file."),basename($newmail_userfile_name))
206 .'</td></tr>';
207 }
dbc7cd0a 208 }
209 echo html_tag( 'tr', "\n" .
c435f076 210 html_tag( 'td', _("Current File:"), 'right', '', 'style="white-space: nowrap;"' ) .
637fbe4d 211 html_tag( 'td', '<input type="hidden" value="' .
c8f452aa 212 htmlspecialchars($newmail_media) . '" name="media_default" />' .
637fbe4d 213 htmlspecialchars($media_output) . '', 'left' )
214 ) . "\n";
215}
216echo html_tag( 'tr', "\n" .
217 html_tag( 'td', '&nbsp;' ) .
218 html_tag( 'td',
219 '<input type="hidden" name="optmode" value="submit" />' .
ebe02dfc 220 '<input type="hidden" name="optpage" value="newmail" />' .
637fbe4d 221 '<input type="submit" value="' . _("Submit") . '" name="submit_newmail" />',
222 'left' )
223 ) . "\n";
dcc1cc82 224?>
202bcbcc 225</table></form></td></tr></table></td></tr></table></body></html>
226