tbrehm
2007-03-11 7de96bb4b9dba19c8c151e26af36a143dda1c93e
added form and list for spamfilter users.
2 files modified
9 files added
495 ■■■■■ changed files
interface/web/mail/form/spamfilter_users.tform.php 125 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_mail_user.lng 2 ●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_spamfilter_users.lng 10 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_spamfilter_users_list.lng 16 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/module.conf.php 2 ●●● patch | view | raw | blame | history
interface/web/mail/list/spamfilter_users.list.php 108 ●●●●● patch | view | raw | blame | history
interface/web/mail/spamfilter_users_del.php 54 ●●●●● patch | view | raw | blame | history
interface/web/mail/spamfilter_users_edit.php 62 ●●●●● patch | view | raw | blame | history
interface/web/mail/spamfilter_users_list.php 27 ●●●●● patch | view | raw | blame | history
interface/web/mail/templates/spamfilter_users_edit.htm 50 ●●●●● patch | view | raw | blame | history
interface/web/mail/templates/spamfilter_users_list.htm 39 ●●●●● patch | view | raw | blame | history
interface/web/mail/form/spamfilter_users.tform.php
New file
@@ -0,0 +1,125 @@
<?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"]             = "Spamfilter users";
$form["description"]     = "";
$form["name"]             = "spamfilter_users";
$form["action"]            = "spamfilter_users_edit.php";
$form["db_table"]        = "spamfilter_users";
$form["db_table_idx"]    = "id";
$form["db_history"]        = "yes";
$form["tab_default"]    = "users";
$form["list_default"]    = "spamfilter_users_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"]['users'] = array (
    'title'     => "Users",
    'width'     => 100,
    'template'     => "templates/spamfilter_users_edit.htm",
    'fields'     => array (
    ##################################
    # Begin Datatable fields
    ##################################
        'server_id' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'SELECT',
            'default'    => '',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
                                        'keyfield'=> 'server_id',
                                        'valuefield'=> 'server_name'
                                     ),
            'value'        => ''
        ),
        'priority' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'SELECT',
            'default'    => 5,
            'value'        => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
        ),
        'policy_id' => array (
            'datatype'    => 'INTEGER',
            'formtype'    => 'SELECT',
            'default'    => '',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
                                        'keyfield'=> 'id',
                                        'valuefield'=> 'policy_name'
                                     ),
            'value'        => ''
        ),
        'email' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'TEXT',
            'default'    => '',
            'validators'    => array (     0 => array (    'type'    => 'NOTEMPTY',
                                                        'errmsg'=> 'email_error_notempty'),
                                    ),
            'value'        => '',
            'width'        => '30',
            'maxlength'    => '255'
        ),
        'fullname' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'TEXT',
            'default'    => '',
            'validators'    => array (     0 => array (    'type'    => 'NOTEMPTY',
                                                        'errmsg'=> 'fullname_error_notempty'),
                                    ),
            'value'        => '',
            'width'        => '30',
            'maxlength'    => '255'
        ),
        'local' => array (
            'datatype'    => 'VARCHAR',
            'formtype'    => 'SELECT',
            'default'    => 'Y',
            'value'        => array('N' => 'No','Y' => 'Yes')
        ),
    ##################################
    # ENDE Datatable fields
    ##################################
    )
);
?>
interface/web/mail/lib/lang/en_mail_user.lng
@@ -1,5 +1,5 @@
<?php
$wb["email_txt"] = 'email';
$wb["email_txt"] = 'Email';
$wb["cryptpwd_txt"] = 'Password';
$wb["active_txt"] = 'Active';
$wb["btn_save_txt"] = 'Save';
interface/web/mail/lib/lang/en_spamfilter_users.lng
New file
@@ -0,0 +1,10 @@
<?php
$wb["server_id_txt"] = 'Server';
$wb["priority_txt"] = 'Priority';
$wb["policy_id_txt"] = 'Policy';
$wb["email_txt"] = 'Email (Pattern)';
$wb["fullname_txt"] = 'Name';
$wb["local_txt"] = 'Local';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
?>
interface/web/mail/lib/lang/en_spamfilter_users_list.lng
New file
@@ -0,0 +1,16 @@
<?php
$wb["list_head_txt"] = 'Spamfilter Users';
$wb["local_txt"] = 'Local';
$wb["server_id_txt"] = 'Server';
$wb["priority_txt"] = 'Priority';
$wb["policy_id_txt"] = 'Policy';
$wb["fullname_txt"] = 'Name';
$wb["email_txt"] = 'Email';
$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 Spamfilter User';
?>
interface/web/mail/lib/module.conf.php
@@ -94,7 +94,7 @@
        array (
          'title' => 'User',
          'target' => 'content',
          'link' => 'mail/spamfilter_user_list.php',
          'link' => 'mail/spamfilter_users_list.php',
        ),
        3 => 
        array (
interface/web/mail/list/spamfilter_users.list.php
New file
@@ -0,0 +1,108 @@
<?php
/*
    Datatypes:
    - INTEGER
    - DOUBLE
    - CURRENCY
    - VARCHAR
    - TEXT
    - DATE
*/
// Name of the list
$liste["name"]                 = "spamfilter_users";
// Database table
$liste["table"]             = "spamfilter_users";
// Index index field of the database table
$liste["table_idx"]            = "id";
// Search Field Prefix
$liste["search_prefix"]     = "search_";
// Records per page
$liste["records_per_page"]     = 15;
// Script File of the list
$liste["file"]                = "spamfilter_users_list.php";
// Script file of the edit form
$liste["edit_file"]            = "spamfilter_users_edit.php";
// Script File of the delete script
$liste["delete_file"]        = "spamfilter_users_del.php";
// Paging Template
$liste["paging_tpl"]        = "templates/paging.tpl.htm";
// Enable auth
$liste["auth"]                = "yes";
/*****************************************************
* Suchfelder
*****************************************************/
$liste["item"][] = array(    'field'        => "local",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "SELECT",
                            'op'        => "=",
                            'prefix'    => "",
                            'suffix'    => "",
                            'width'        => "",
                            'value'        => array('Y' => "Yes",'N' => "No"));
$liste["item"][] = array(    'field'        => "server_id",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "SELECT",
                            'op'        => "like",
                            'prefix'    => "%",
                            'suffix'    => "%",
                            'datasource'    => array (     'type'    => 'SQL',
                                                        'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
                                                        'keyfield'=> 'server_id',
                                                        'valuefield'=> 'server_name'
                                                       ),
                            'width'        => "",
                            'value'        => "");
$liste["item"][] = array(    'field'        => "priority",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "SELECT",
                            'op'        => "=",
                            'prefix'    => "",
                            'suffix'    => "",
                            'width'        => "",
                            'value'        => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
$liste["item"][] = array(    'field'        => "policy_id",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "SELECT",
                            'op'        => "like",
                            'prefix'    => "%",
                            'suffix'    => "%",
                            'datasource'    => array (     'type'    => 'SQL',
                                                        'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
                                                        'keyfield'=> 'id',
                                                        'valuefield'=> 'policy_name'
                                                       ),
                            'width'        => "",
                            'value'        => "");
$liste["item"][] = array(    'field'        => "fullname",
                            'datatype'    => "VARCHAR",
                            'formtype'    => "TEXT",
                            'op'        => "like",
                            'prefix'    => "%",
                            'suffix'    => "%",
                            'width'        => "",
                            'value'        => "");
?>
interface/web/mail/spamfilter_users_del.php
New file
@@ -0,0 +1,54 @@
<?php
/*
Copyright (c) 2007, 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/spamfilter_users.list.php";
$tform_def_file = "form/spamfilter_users.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Checke Berechtigungen für Modul
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
    header("Location: ../index.php");
    exit;
}
$app->uses("tform_actions");
$app->tform_actions->onDelete();
?>
interface/web/mail/spamfilter_users_edit.php
New file
@@ -0,0 +1,62 @@
<?php
/*
Copyright (c) 2007, 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/spamfilter_users.tform.php";
/******************************************
* End Form configuration
******************************************/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Checking module permissions
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
    header("Location: ../index.php");
    exit;
}
// Loading classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
}
$app->tform_actions = new page_action;
$app->tform_actions->onLoad();
?>
interface/web/mail/spamfilter_users_list.php
New file
@@ -0,0 +1,27 @@
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/spamfilter_users.list.php";
/******************************************
* End Form configuration
******************************************/
// Checking module permissions
if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
    header("Location: ../index.php");
    exit;
}
$app->uses('listform_actions');
//$app->listform_actions->SQLExtWhere = "wb = 'W'";
$app->listform_actions->onLoad();
?>
interface/web/mail/templates/spamfilter_users_edit.htm
New file
@@ -0,0 +1,50 @@
<table width="500" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td class="frmText11">{tmpl_var name='server_id_txt'}:</td>
    <td class="frmText11">
        <select name="server_id" class="text">
            {tmpl_var name='server_id'}
        </select>
    </td>
  </tr>
  <tr>
    <td class="frmText11">{tmpl_var name='priority_txt'}:</td>
    <td class="frmText11">
        <select name="priority" class="text">
            {tmpl_var name='priority'}
        </select>
    </td>
  </tr>
  <tr>
    <td class="frmText11">{tmpl_var name='policy_id_txt'}:</td>
    <td class="frmText11">
        <select name="policy_id" class="text">
            {tmpl_var name='policy_id'}
        </select>
    </td>
  </tr>
  <tr>
    <td class="frmText11">{tmpl_var name='email_txt'}:</td>
    <td class="frmText11"><input name="email" type="text" class="text" value="{tmpl_var name='email'}" size="30" maxlength="255"></td>
  </tr>
  <tr>
    <td class="frmText11">{tmpl_var name='fullname_txt'}:</td>
    <td class="frmText11"><input name="fullname" type="text" class="text" value="{tmpl_var name='fullname'}" size="30" maxlength="255"></td>
  </tr>
  <tr>
    <td class="frmText11">{tmpl_var name='local_txt'}:</td>
    <td class="frmText11"><select name="local" class="text">
            {tmpl_var name='local'}
        </select></td>
  </tr>  <tr>
    <td class="frmText11">&nbsp;</td>
    <td class="frmText11">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input name="btn_save" type="submit" class="button" value="{tmpl_var name='btn_save_txt'}">
      <input name="btn_cancel" type="button" class="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="self.location.href='spamfilter_users_list.php';">
    </td>
  </tr>
</table>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
interface/web/mail/templates/spamfilter_users_list.htm
New file
@@ -0,0 +1,39 @@
<form name="myform" action="spamfilter_users_list.php" method="POST">
<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
<input type="button" value="{tmpl_var name="add_new_record_txt"}" onClick="location.href='spamfilter_users_edit.php'" /><br /><br />
<table width="100%" border="0" cellspacing="0" cellpadding="4">
  <tr>
    <td class="tblHead"><tmpl_var name="local_txt"></td>
    <td class="tblHead"><tmpl_var name="server_id_txt"></td>
    <td class="tblHead"><tmpl_var name="priority_txt"></td>
    <td class="tblHead"><tmpl_var name="policy_id_txt"></td>
    <td class="tblHead"><tmpl_var name="fullname_txt"></td>
    <td class="tblHead"><tmpl_var name="email_txt"></td>
    <td class="tblHead">&nbsp;</td>
  </tr>
  <tr>
    <td class="frmText11"><select name="search_local" onChange="document.myform.submit();">{tmpl_var name='search_local'}</select></td>
    <td class="frmText11"><select name="search_server_id" onChange="document.myform.submit();">{tmpl_var name='search_server_id'}</select></td>
    <td class="frmText11"><select name="search_priority" onChange="document.myform.submit();">{tmpl_var name='search_priority'}</select></td>
    <td class="frmText11"><select name="search_policy_id" onChange="document.myform.submit();">{tmpl_var name='search_policy_id'}</select></td>
    <td class="frmText11"><input type="text" name="search_fullname" value="{tmpl_var name='search_fullname'}" class="text" /></td>
    <td class="frmText11"><input type="text" name="search_email" value="{tmpl_var name='search_email'}" class="text" /></td>
    <td class="frmText11" align="right"><input name="Filter" type="submit" id="Filter" value="{tmpl_var name="filter_txt"}"></td>
  </tr>
  <tmpl_loop name="records">
  <tr bgcolor="{tmpl_var name="bgcolor"}">
    <td class="frmText11"><a href="spamfilter_users_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="local"}</a></td>
    <td class="frmText11"><a href="spamfilter_users_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="server_id"}</a></td>
    <td class="frmText11"><a href="spamfilter_users_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="priority"}</a></td>
    <td class="frmText11"><a href="spamfilter_users_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="policy_id"}</a></td>
    <td class="frmText11"><a href="spamfilter_users_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="fullname"}</a></td>
    <td class="frmText11"><a href="spamfilter_users_edit.php?id={tmpl_var name='id'}" class="frmText11">{tmpl_var name="email"}</a></td>
    <td class="frmText11" align="right">[<a href="javascript: del_record('spamfilter_users_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');" class="frmText11">{tmpl_var name='delete_txt'}</a>]</td>
  </tr>
  </tmpl_loop>
  <tr>
      <td colspan="7" height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
  </tr>
</table>
</form>