Skip to content

Commit d097c76

Browse files
author
choongii
committed
Implemented checkboxes in Interface Config to enable showing/hiding the tabs Mail Filters, Autoresponders and Custom Rules for mailboxes.
See also http://www.howtoforge.com/forums/showthread.php?t=59539
1 parent 43b345c commit d097c76

File tree

5 files changed

+159
-112
lines changed

5 files changed

+159
-112
lines changed

interface/web/admin/form/system_config.tform.php

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,30 @@
174174
##################################
175175
# Begin Datatable fields
176176
##################################
177-
'enable_custom_login' => array(
178-
'datatype' => 'VARCHAR',
179-
'formtype' => 'CHECKBOX',
180-
'default' => 'n',
181-
'value' => array(0 => 'n', 1 => 'y')
182-
),
177+
'enable_custom_login' => array(
178+
'datatype' => 'VARCHAR',
179+
'formtype' => 'CHECKBOX',
180+
'default' => 'n',
181+
'value' => array(0 => 'n', 1 => 'y')
182+
),
183+
'mailbox_show_autoresponder_tab' => array (
184+
'datatype' => 'VARCHAR',
185+
'formtype' => 'CHECKBOX',
186+
'default' => 'y',
187+
'value' => array(0 => 'n',1 => 'y')
188+
),
189+
'mailbox_show_mail_filter_tab' => array (
190+
'datatype' => 'VARCHAR',
191+
'formtype' => 'CHECKBOX',
192+
'default' => 'y',
193+
'value' => array(0 => 'n',1 => 'y')
194+
),
195+
'mailbox_show_custom_rules_tab' => array (
196+
'datatype' => 'VARCHAR',
197+
'formtype' => 'CHECKBOX',
198+
'default' => 'y',
199+
'value' => array(0 => 'n',1 => 'y')
200+
),
183201
'mailboxlist_webmail_link' => array (
184202
'datatype' => 'VARCHAR',
185203
'formtype' => 'CHECKBOX',

interface/web/admin/lib/lang/en_system_config.lng

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ $wb["webdavuser_prefix_error_regex"] = 'Char not allowed in webdav user prefix.'
2323
$wb["dblist_phpmyadmin_link_txt"] = 'Link to phpmyadmin in DB list';
2424
$wb['enable_custom_login_txt'] = 'Allow custom login name';
2525
$wb["mailboxlist_webmail_link_txt"] = 'Link to webmail in Mailbox list';
26+
$wb['mailbox_show_autoresponder_tab_txt'] = 'Show Autoresponder tab in Mailbox detail';
27+
$wb['mailbox_show_mail_filter_tab_txt'] = 'Show Mail Filter tab in Mailbox detail';
28+
$wb['mailbox_show_custom_rules_tab_txt'] = 'Show Custom Rules tab in Mailbox detail';
2629
$wb["webmail_url_txt"] = 'Webmail URL';
2730
$wb["mailmailinglist_link_txt"] = 'Link to mailing list in Mailing list list';
2831
$wb["mailmailinglist_url_txt"] = 'Mailing list URL';

interface/web/admin/lib/lang/nl_system_config.lng

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ $wb['shelluser_prefix_error_regex'] = 'Char niet toegestaan in shell gebruiker v
1616
$wb['webdavuser_prefix_error_regex'] = 'Char niet toegestaan in webdav gebruiker voorvoegsel.';
1717
$wb['dblist_phpmyadmin_link_txt'] = 'Link naar phpmyadmin in DB lijst';
1818
$wb['mailboxlist_webmail_link_txt'] = 'Link naar webmail in Mailbox lijst';
19+
$wb['mailbox_show_autoresponder_tab_txt'] = 'Toon Autoresponder tabblad in Mailbox detail';
20+
$wb['mailbox_show_mail_filter_tab_txt'] = 'Toon Mail Filter tabblad in Mailbox detail';
21+
$wb['mailbox_show_custom_rules_tab_txt'] 'Toon Custom Rules tabblad in Mailbox detail';
1922
$wb['webmail_url_txt'] = 'Webmail URL';
2023
$wb['phpmyadmin_url_txt'] = 'PHPMyAdmin URL';
2124
$wb['use_domain_module_txt'] = 'Gebruik de domein-module om nieuwe domeinen toe te voegen';

interface/web/admin/templates/system_config_mail_edit.htm

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ <h2><tmpl_var name="list_head_txt"></h2>
1111
{tmpl_var name='enable_custom_login'}
1212
</div>
1313
</div>
14+
<div class="ctrlHolder">
15+
<p class="label">{tmpl_var name='mailbox_show_autoresponder_tab_txt'}</p>
16+
<div class="multiField">
17+
{tmpl_var name='mailbox_show_autoresponder_tab'}
18+
</div>
19+
</div>
20+
<div class="ctrlHolder">
21+
<p class="label">{tmpl_var name='mailbox_show_mail_filter_tab_txt'}</p>
22+
<div class="multiField">
23+
{tmpl_var name='mailbox_show_mail_filter_tab'}
24+
</div>
25+
</div>
26+
<div class="ctrlHolder">
27+
<p class="label">{tmpl_var name='mailbox_show_custom_rules_tab_txt'}</p>
28+
<div class="multiField">
29+
{tmpl_var name='mailbox_show_custom_rules_tab'}
30+
</div>
31+
</div>
1432
<div class="ctrlHolder">
1533
<p class="label">{tmpl_var name='mailboxlist_webmail_link_txt'}</p>
1634
<div class="multiField">
@@ -77,4 +95,4 @@ <h2><tmpl_var name="list_head_txt"></h2>
7795
</div>
7896
</div>
7997

80-
</div>
98+
</div>

interface/web/mail/form/mail_user.tform.php

Lines changed: 110 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
3939
*/
4040
global $app;
41+
$app->uses('getconf');
42+
$global_config = $app->getconf->get_global_config();
4143

4244
$form["title"] = "Mailbox";
4345
$form["description"] = "";
@@ -230,115 +232,118 @@
230232
)
231233
);
232234

233-
$form["tabs"]['autoresponder'] = array (
234-
'title' => "Autoresponder",
235-
'width' => 100,
236-
'template' => "templates/mail_user_autoresponder_edit.htm",
237-
'fields' => array (
238-
##################################
239-
# Begin Datatable fields
240-
##################################
241-
'autoresponder_subject' => array (
242-
'datatype' => 'VARCHAR',
243-
'formtype' => 'TEXT',
244-
'default' => 'Out of office reply',
245-
'value' => '',
246-
'width' => '30',
247-
'maxlength' => '255'
248-
),
249-
'autoresponder_text' => array (
250-
'datatype' => 'TEXT',
251-
'formtype' => 'TEXTAREA',
252-
'default' => '',
253-
'value' => '',
254-
'cols' => '30',
255-
'rows' => '15'
256-
),
257-
'autoresponder' => array (
258-
'datatype' => 'VARCHAR',
259-
'formtype' => 'CHECKBOX',
260-
'default' => 'n',
261-
'value' => array(1 => 'y',0 => 'n')
262-
),
263-
'autoresponder_start_date' => array (
264-
'datatype' => 'DATETIME',
265-
'formtype' => 'DATETIME',
266-
'validators'=> array ( 0 => array ( 'type' => 'CUSTOM',
267-
'class' => 'validate_autoresponder',
268-
'function' => 'start_date',
269-
'errmsg'=> 'autoresponder_start_date_is_required'),
270-
)
271-
),
272-
'autoresponder_end_date' => array (
273-
'datatype' => 'DATETIME',
274-
'formtype' => 'DATETIME',
275-
'validators'=> array ( 0 => array ( 'type' => 'CUSTOM',
276-
'class' => 'validate_autoresponder',
277-
'function' => 'end_date',
278-
'errmsg'=> 'autoresponder_end_date_isgreater'),
279-
),
280-
),
281-
##################################
282-
# END Datatable fields
283-
##################################
284-
)
285-
);
235+
if ($global_config['mail']['mailbox_show_autoresponder_tab'] === 'y') {
236+
$form["tabs"]['autoresponder'] = array (
237+
'title' => "Autoresponder",
238+
'width' => 100,
239+
'template' => "templates/mail_user_autoresponder_edit.htm",
240+
'fields' => array (
241+
##################################
242+
# Begin Datatable fields
243+
##################################
244+
'autoresponder_subject' => array (
245+
'datatype' => 'VARCHAR',
246+
'formtype' => 'TEXT',
247+
'default' => 'Out of office reply',
248+
'value' => '',
249+
'width' => '30',
250+
'maxlength' => '255'
251+
),
252+
'autoresponder_text' => array (
253+
'datatype' => 'TEXT',
254+
'formtype' => 'TEXTAREA',
255+
'default' => '',
256+
'value' => '',
257+
'cols' => '30',
258+
'rows' => '15'
259+
),
260+
'autoresponder' => array (
261+
'datatype' => 'VARCHAR',
262+
'formtype' => 'CHECKBOX',
263+
'default' => 'n',
264+
'value' => array(1 => 'y',0 => 'n')
265+
),
266+
'autoresponder_start_date' => array (
267+
'datatype' => 'DATETIME',
268+
'formtype' => 'DATETIME',
269+
'validators'=> array ( 0 => array ( 'type' => 'CUSTOM',
270+
'class' => 'validate_autoresponder',
271+
'function' => 'start_date',
272+
'errmsg'=> 'autoresponder_start_date_is_required'),
273+
)
274+
),
275+
'autoresponder_end_date' => array (
276+
'datatype' => 'DATETIME',
277+
'formtype' => 'DATETIME',
278+
'validators'=> array ( 0 => array ( 'type' => 'CUSTOM',
279+
'class' => 'validate_autoresponder',
280+
'function' => 'end_date',
281+
'errmsg'=> 'autoresponder_end_date_isgreater'),
282+
),
283+
),
284+
##################################
285+
# END Datatable fields
286+
##################################
287+
)
288+
);
289+
}
286290

287-
$form["tabs"]['filter_records'] = array (
288-
'title' => "Mail Filter",
289-
'width' => 100,
290-
'template' => "templates/mail_user_mailfilter_edit.htm",
291-
'fields' => array (
292-
##################################
293-
# Begin Datatable fields
294-
##################################
295-
'move_junk' => array (
296-
'datatype' => 'VARCHAR',
297-
'formtype' => 'CHECKBOX',
298-
'default' => 'n',
299-
'value' => array(0 => 'n',1 => 'y')
291+
292+
if ($global_config['mail']['mailbox_show_mail_filter_tab'] === 'y') {
293+
$form["tabs"]['filter_records'] = array (
294+
'title' => "Mail Filter",
295+
'width' => 100,
296+
'template' => "templates/mail_user_mailfilter_edit.htm",
297+
'fields' => array (
298+
##################################
299+
# Begin Datatable fields
300+
##################################
301+
'move_junk' => array (
302+
'datatype' => 'VARCHAR',
303+
'formtype' => 'CHECKBOX',
304+
'default' => 'n',
305+
'value' => array(0 => 'n',1 => 'y')
306+
),
307+
##################################
308+
# END Datatable fields
309+
##################################
300310
),
301-
##################################
302-
# END Datatable fields
303-
##################################
304-
),
305-
'plugins' => array (
306-
'filter_records' => array (
307-
'class' => 'plugin_listview',
308-
'options' => array(
309-
'listdef' => 'list/mail_user_filter.list.php',
310-
'sqlextwhere' => "mailuser_id = ".@$app->functions->intval(@$_REQUEST['id']),
311-
'sql_order_by' => "ORDER BY rulename"
311+
'plugins' => array (
312+
'filter_records' => array (
313+
'class' => 'plugin_listview',
314+
'options' => array(
315+
'listdef' => 'list/mail_user_filter.list.php',
316+
'sqlextwhere' => "mailuser_id = ".@$app->functions->intval(@$_REQUEST['id']),
317+
'sql_order_by' => "ORDER BY rulename"
318+
)
312319
)
313-
)
314-
)
315-
);
320+
)
321+
);
322+
}
316323

317-
if($_SESSION["s"]["user"]["typ"] == 'admin') {
318-
319-
$form["tabs"]['mailfilter'] = array (
320-
'title' => "Custom Rules",
321-
'width' => 100,
322-
'template' => "templates/mail_user_custom_rules_edit.htm",
323-
'fields' => array (
324-
##################################
325-
# Begin Datatable fields
326-
##################################
327-
'custom_mailfilter' => array (
328-
'datatype' => 'TEXT',
329-
'formtype' => 'TEXTAREA',
330-
'default' => '',
331-
'value' => '',
332-
'cols' => '30',
333-
'rows' => '15'
334-
),
335-
##################################
336-
# END Datatable fields
337-
##################################
338-
)
339-
);
340324

325+
if ($_SESSION["s"]["user"]["typ"] == 'admin' && $global_config['mail']['mailbox_show_custom_rules_tab'] === 'y') {
326+
$form["tabs"]['mailfilter'] = array (
327+
'title' => "Custom Rules",
328+
'width' => 100,
329+
'template' => "templates/mail_user_custom_rules_edit.htm",
330+
'fields' => array (
331+
##################################
332+
# Begin Datatable fields
333+
##################################
334+
'custom_mailfilter' => array (
335+
'datatype' => 'TEXT',
336+
'formtype' => 'TEXTAREA',
337+
'default' => '',
338+
'value' => '',
339+
'cols' => '30',
340+
'rows' => '15'
341+
),
342+
##################################
343+
# END Datatable fields
344+
##################################
345+
)
346+
);
341347
}
342348

343-
344-
?>
349+
?>

0 commit comments

Comments
 (0)