Commit d1018a8d authored by tbrehm's avatar tbrehm
Browse files

Added the form and list for mail filtering rules in the interface.

parent a171d63b
......@@ -177,12 +177,37 @@ $form["tabs"]['autoresponder'] = array (
)
);
$form["tabs"]['filter_records'] = array (
'title' => "Mail Filter",
'width' => 100,
'template' => "templates/mail_user_mailfilter_edit.htm",
'fields' => array (
##################################
# Begin Datatable fields
##################################
##################################
# ENDE Datatable fields
##################################
),
'plugins' => array (
'filter_records' => array (
'class' => 'plugin_listview',
'options' => array(
'listdef' => 'list/mail_user_filter.list.php',
'sqlextwhere' => "mailuser_id = ".@intval(@$_REQUEST['id']),
'sql_order_by' => "ORDER BY rulename"
)
)
)
);
if($_SESSION["s"]["user"]["typ"] == 'admin') {
$form["tabs"]['mailfilter'] = array (
'title' => "Mailfilter",
'title' => "Custom Rules",
'width' => 100,
'template' => "templates/mail_user_mailfilter_edit.htm",
'template' => "templates/mail_user_custom_rules_edit.htm",
'fields' => array (
##################################
# Begin Datatable fields
......
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
*/
$form["title"] = "Email filter";
$form["description"] = "";
$form["name"] = "mail_user_filter";
$form["action"] = "mail_user_filter_edit.php";
$form["db_table"] = "mail_user_filter";
$form["db_table_idx"] = "filter_id";
$form["db_history"] = "yes";
$form["tab_default"] = "filter";
$form["list_default"] = "mail_user_filter_list.php";
$form["auth"] = 'yes'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$form["tabs"]['filter'] = array (
'title' => "Filter",
'width' => 100,
'template' => "templates/mail_user_filter_edit.htm",
'fields' => array (
##################################
# Begin Datatable fields
##################################
'mailuser_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
'default' => @intval($_REQUEST["mailuser_id"]),
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'rulename' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'rulename_error_empty'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'source' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
'value' => array('Subject' => 'Subject','From'=>'From','To'=>'To','Header'=>'Custom Header')
),
'op' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
'value' => array('contains'=>'Contains','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
),
'searchterm' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'searchterm_is_empty'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'action' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
'value' => array('move' => 'Move to','delete'=>'Delete')
),
'target' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'active' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n',1 => 'y')
),
##################################
# ENDE Datatable fields
##################################
)
);
?>
\ No newline at end of file
<?php
$wb["custom_mailfilter_txt"] = 'custom_mailfilter';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["email_txt"] = 'Email';
$wb["cryptpwd_txt"] = 'Password';
$wb["active_txt"] = 'Active';
$wb["email_error_isemail"] = 'Email address is invalid.';
$wb["email_error_unique"] = 'Duplicate Emailaddress.';
$wb["autoresponder_text_txt"] = 'Text';
$wb["autoresponder_txt"] = 'Autoresponder';
$wb["no_domain_perm"] = 'You have no permission for this domain.';
$wb["error_no_pwd"] = 'Password is empty.';
$wb["quota_error_isint"] = 'Mailbox size must be a number.';
$wb["quota_txt"] = 'quota';
$wb["server_id_txt"] = 'server_id';
$wb["password_txt"] = 'password';
$wb["maildir_txt"] = 'maildir';
$wb["postfix_txt"] = 'Enable Receiving';
$wb["access_txt"] = 'Enable Access';
$wb["policy_txt"] = 'Spamfilter';
$wb["no_policy"] = '- not enabled -';
$wb["limit_mailbox_txt"] = 'The max. number of mailboxes for your account is reached.';
$wb["limit_mailquota_txt"] = 'The max space for mailboxes is reached. The max. available space in MB is';
$wb["welcome_mail_subject"] = 'Welcome to your new email account.';
$wb["welcome_mail_message"] = 'Welcome to your new email account.\n\nYour webmaster.';
$wb['custom_mailfilter_txt'] = 'Custom mail filter recipe';
<?php
$wb["custom_mailfilter_txt"] = 'Custom mail filter recipe';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["email_txt"] = 'Email';
$wb["cryptpwd_txt"] = 'Password';
$wb["active_txt"] = 'Active';
$wb["email_error_isemail"] = 'Email address is invalid.';
$wb["email_error_unique"] = 'Duplicate Emailaddress.';
$wb["autoresponder_text_txt"] = 'Text';
$wb["autoresponder_txt"] = 'Autoresponder';
$wb["no_domain_perm"] = 'You have no permission for this domain.';
$wb["error_no_pwd"] = 'Password is empty.';
$wb["quota_error_isint"] = 'Mailbox size must be a number.';
$wb["quota_txt"] = 'quota';
$wb["server_id_txt"] = 'server_id';
$wb["password_txt"] = 'password';
$wb["maildir_txt"] = 'maildir';
$wb["postfix_txt"] = 'Enable Receiving';
$wb["access_txt"] = 'Enable Access';
$wb["policy_txt"] = 'Spamfilter';
$wb["no_policy"] = '- not enabled -';
$wb["limit_mailbox_txt"] = 'The max. number of mailboxes for your account is reached.';
$wb["limit_mailquota_txt"] = 'The max space for mailboxes is reached. The max. available space in MB is';
$wb["welcome_mail_subject"] = 'Welcome to your new email account.';
$wb["welcome_mail_message"] = 'Welcome to your new email account.\n\nYour webmaster.';
?>
\ No newline at end of file
<?php
$wb["rulename_txt"] = 'Name';
$wb["action_txt"] = 'Action';
$wb["target_txt"] = 'Folder';
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
$wb["rulename_error_empty"] = 'Name is empty.';
$wb["searchterm_is_empty"] = 'Search term is empty.';
?>
\ No newline at end of file
<?php
$wb["rulename_txt"] = 'Name';
$wb["page_txt"] = 'Page';
$wb["page_of_txt"] = 'of';
$wb["page_next_txt"] = 'Next';
$wb["page_back_txt"] = 'Back';
$wb["delete_txt"] = 'Delete';
$wb["filter_txt"] = 'Filter';
$wb["add_new_record_txt"] = 'Add new Filter';
?>
\ No newline at end of file
<?php
/*
Datatypes:
- INTEGER
- DOUBLE
- CURRENCY
- VARCHAR
- TEXT
- DATE
*/
// Name of the list
$liste["name"] = "mail_user_filter";
// Database table
$liste["table"] = "mail_user_filter";
// Index index field of the database table
$liste["table_idx"] = "filter_id";
// Search Field Prefix
$liste["search_prefix"] = "search_";
// Records per page
$liste["records_per_page"] = 15;
// Script File of the list
$liste["file"] = "mail_user_filter_list.php";
// Script file of the edit form
$liste["edit_file"] = "mail_user_filter_edit.php";
// Script File of the delete script
$liste["delete_file"] = "mail_user_filter_del.php";
// Paging Template
$liste["paging_tpl"] = "templates/paging.tpl.htm";
// Enable auth
$liste["auth"] = "yes";
/*****************************************************
* Suchfelder
*****************************************************/
$liste["item"][] = array( 'field' => "rulename",
'datatype' => "VARCHAR",
'formtype' => "TEXT",
'op' => "like",
'prefix' => "%",
'suffix' => "%",
'width' => "",
'value' => "");
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2008, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/mail_user_filter.list.php";
$tform_def_file = "form/mail_user_filter.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('mail');
$app->uses("tform_actions");
$app->tform_actions->onDelete();
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2008, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/******************************************
* Begin Form configuration
******************************************/
$tform_def_file = "form/mail_user_filter.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('mail');
// Loading classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
function onSubmit() {
global $app, $conf;
// Get the parent soa record of the domain
$mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".intval($_REQUEST["mailuser_id"])."' AND ".$app->tform->getAuthSQL('r'));
// Check if Domain belongs to user
if($mailuser["mailuser_id"] != $_POST["mailuser_id"]) $app->tform->errorMessage .= $app->tform->wordbook["no_mailuser_perm"];
// Set the server ID of the rr record to the same server ID as the parent record.
$this->dataRecord["mailuser_id"] = $mailuser["mailuser_id"];
parent::onSubmit();
}
}
$page = new page_action;
$page->onLoad();
?>
\ No newline at end of file
<table width="500" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="frmText11">{tmpl_var name='custom_mailfilter_txt'}:</td>
<td class="frmText11"><textarea name='custom_mailfilter' cols='30' rows='15'>{tmpl_var name='custom_mailfilter'}</textarea></td>
</tr> <tr>
<td class="frmText11">&nbsp;</td>
<td class="frmText11">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mail/mail_user_edit.php');"><div class="buttonEnding"></div>&nbsp;
<input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('mail/mail_user_list.php');"><div class="buttonEnding"></div>
</td>
</tr>
</table>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
<table width="600" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="frmText11">{tmpl_var name='rulename_txt'}:</td>
<td class="frmText11"><input name="rulename" type="text" class="text" value="{tmpl_var name='rulename'}" size="30" maxlength="255"></td>
</tr>
<tr>
<td class="frmText11">{tmpl_var name='source_txt'}:</td>
<td class="frmText11">
<select name="source" class="text">
{tmpl_var name='source'}
</select>
<select name="op" class="text">
{tmpl_var name='op'}
</select>
<input name="searchterm" type="text" class="text" value="{tmpl_var name='searchterm'}" size="30" maxlength="255">
</td>
</tr>
<tr>
<td class="frmText11">{tmpl_var name='action_txt'}:</td>
<td class="frmText11">
<select name="action" class="text">
{tmpl_var name='action'}
</select>
<input name="target" type="text" class="text" value="{tmpl_var name='target'}" size="30" maxlength="255">
</td>
</tr>
<tr>
<td class="frmText11">{tmpl_var name='active_txt'}:</td>
<td class="frmText11">{tmpl_var name='active'}</td>
</tr> <tr>
<td class="frmText11">&nbsp;</td>
<td class="frmText11">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mail/mail_user_filter_edit.php');"><div class="buttonEnding"></div>&nbsp;
<input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('mail/mail_user_list.php');"><div class="buttonEnding"></div>
</td>
</tr>
</table>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<input name="mailuser_id" type="hidden" value="{tmpl_var name='mailuser_id'}">
\ No newline at end of file
<input type="button" value="{tmpl_var name="add_new_record_txt"}" class="button" onClick="loadContent('mail/mail_user_filter_edit.php?mailuser_id={tmpl_var name='parent_id'}');" /><div class="buttonEnding"></div><br /><br />
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="listTable">
<tr>
<td class="tblHead"><tmpl_var name="rulename_txt"></td>
<td class="tblHead">&nbsp;</td>
</tr>
<tr>
<td class="frmText11"><input type="text" name="search_rulename" value="{tmpl_var name='search_rulename'}" class="text" /></td>
<td class="frmText11" align="right"><input name="Filter" type="button" id="Filter" value="{tmpl_var name="filter_txt"}" class="button" onClick="changeTab('filter_records','mail/mail_user_edit.php');"><div class="buttonEnding"></div></td>
</tr>
<tmpl_loop name="records">
<tr bgcolor="{tmpl_var name="bgcolor"}">
<td class="frmText11"><a href="#" onClick="loadContent('mail/mail_user_filter_edit.php?id={tmpl_var name='id'}');" class="frmText11">{tmpl_var name="rulename"}</a></td>
<td class="frmText11" align="right">[<a href="javascript: del_record('mail/mail_user_filter_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td>
</tr>
</tmpl_loop>
<tr>
<td colspan="2" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
</tr>
</table>
\ No newline at end of file
<table width="500" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="frmText11">{tmpl_var name='custom_mailfilter_txt'}:</td>
<td class="frmText11"><textarea name='custom_mailfilter' cols='30' rows='15'>{tmpl_var name='custom_mailfilter'}</textarea></td>
</tr> <tr>
<td class="frmText11" colspan="2">{tmpl_var name='filter_records'}</td>
</tr>
<tr>
<td class="frmText11">&nbsp;</td>
<td class="frmText11">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="btn_save" type="button" class="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','mail/mail_user_edit.php');"><div class="buttonEnding"></div>&nbsp;
<input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('mail/mail_user_list.php');"><div class="buttonEnding"></div>
</td>
</tr>
</table>
</table>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment