Till Brehm
2014-01-20 fedbcaf0c8ac62c0ee50f1f4ee8b68138c8c3c40
- Added Welcome email function for clients and resellers.
- Added email message templates.
10 files added
6 files modified
685 ■■■■■ changed files
install/sql/incremental/upd_0063.sql 13 ●●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql 24 ●●●●● patch | view | raw | blame | history
interface/web/client/client_edit.php 42 ●●●●● patch | view | raw | blame | history
interface/web/client/client_message.php 2 ●●● patch | view | raw | blame | history
interface/web/client/form/message_template.tform.php 108 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_client_message_template.lng 11 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_client_message_template_list.lng 5 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/module.conf.php 4 ●●●● patch | view | raw | blame | history
interface/web/client/list/message_template.list.php 77 ●●●●● patch | view | raw | blame | history
interface/web/client/message_template_del.php 58 ●●●●● patch | view | raw | blame | history
interface/web/client/message_template_edit.php 99 ●●●●● patch | view | raw | blame | history
interface/web/client/message_template_list.php 53 ●●●●● patch | view | raw | blame | history
interface/web/client/reseller_edit.php 41 ●●●●● patch | view | raw | blame | history
interface/web/client/templates/client_message_template_list.htm 57 ●●●●● patch | view | raw | blame | history
interface/web/client/templates/message_template.htm 39 ●●●●● patch | view | raw | blame | history
interface/web/client/templates/message_template_list.htm 52 ●●●●● patch | view | raw | blame | history
install/sql/incremental/upd_0063.sql
@@ -1,2 +1,15 @@
ALTER TABLE `client` ADD `limit_domainmodule` INT NOT NULL DEFAULT '0';
ALTER TABLE `client_template` ADD `limit_domainmodule` INT NOT NULL DEFAULT '0';
CREATE TABLE `client_message_template` (
  `client_message_template_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `sys_userid` int(11) NOT NULL DEFAULT '0',
  `sys_groupid` int(11) NOT NULL DEFAULT '0',
  `sys_perm_user` varchar(5) DEFAULT NULL,
  `sys_perm_group` varchar(5) DEFAULT NULL,
  `sys_perm_other` varchar(5) DEFAULT NULL,
  `template_type` varchar(255) DEFAULT NULL,
  `template_name` varchar(255) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `message` text,
  PRIMARY KEY (`client_message_template_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
install/sql/ispconfig3.sql
@@ -341,6 +341,30 @@
-- --------------------------------------------------------
--
-- Table structure for table `invoice_message_template`
--
CREATE TABLE `client_message_template` (
  `client_message_template_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `sys_userid` int(11) NOT NULL DEFAULT '0',
  `sys_groupid` int(11) NOT NULL DEFAULT '0',
  `sys_perm_user` varchar(5) DEFAULT NULL,
  `sys_perm_group` varchar(5) DEFAULT NULL,
  `sys_perm_other` varchar(5) DEFAULT NULL,
  `template_type` varchar(255) DEFAULT NULL,
  `template_name` varchar(255) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `message` text,
  PRIMARY KEY (`client_message_template_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `invoice_message_template`
--
-- --------------------------------------------------------
--
-- Table structure for table `country`
--
interface/web/client/client_edit.php
@@ -334,6 +334,48 @@
                }
            }
        }
        //* Send welcome email
        $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
        $sql = "SELECT * FROM client_message_template WHERE template_type = 'welcome' AND sys_groupid = ".$client_group_id;
        $email_template = $app->db->queryOneRecord($sql);
        $client = $app->tform->getDataRecord($this->id);
        if(is_array($email_template) && $client['email'] != '') {
            //* Parse client details into message
            $message = $email_template['message'];
            $subject = $email_template['subject'];
            foreach($client as $key => $val) {
                switch ($key) {
                case 'password':
                    $message = str_replace('{password}', $this->dataRecord['password'], $message);
                    $subject = str_replace('{password}', $this->dataRecord['password'], $subject);
                    break;
                case 'gender':
                    $message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message);
                    $subject = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $subject);
                    break;
                default:
                    $message = str_replace('{'.$key.'}', $val, $message);
                    $subject = str_replace('{'.$key.'}', $val, $subject);
                }
            }
            //* Get sender address
            if($app->auth->is_admin()) {
                $app->uses('getconf');
                $system_config = $app->getconf->get_global_config();
                $from = $system_config['admin_mail'];
            } else {
                $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
                $reseller = $app->db->queryOneRecord("SELECT client.email FROM sys_group,client WHERE client.client_id = sys_group.client_id and sys_group.groupid = ".$client_group_id);
                $from = $reseller["email"];
            }
            //* Send the email
            $app->functions->mail($client['email'], $subject, $message, $from);
        }
        parent::onAfterInsert();
    }
interface/web/client/client_message.php
@@ -146,7 +146,7 @@
//message variables
$message_variables = '';
$sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'password', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional') AND Field NOT LIKE 'limit_%'";
$sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'password', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional', 'force_suexec', 'default_slave_dnsserver', 'usertheme', 'locked', 'canceled', 'can_use_api', 'tmp_data', 'customer_no_template', 'customer_no_start', 'customer_no_counter', 'added_date', 'added_by') AND Field NOT LIKE 'limit_%'";
$field_names = $app->db->queryAllRecords($sql);
if(!empty($field_names) && is_array($field_names)){
    foreach($field_names as $field_name){
interface/web/client/form/message_template.tform.php
New file
@@ -0,0 +1,108 @@
<?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 template";
$form["description"]  = "";
$form["name"]    = "client_message_template";
$form["action"]   = "message_template_edit.php";
$form["db_table"]  = "client_message_template";
$form["db_table_idx"] = "client_message_template_id";
$form["db_history"]  = "no";
$form["tab_default"] = "template";
$form["list_default"] = "message_template_list.php";
$form["auth"]   = 'yes';
$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"]['template'] = array (
    'title'  => "Settings",
    'width'  => 100,
    'template'  => "templates/message_template.htm",
    'fields'  => array (
        //#################################
        // Begin Datatable fields
        //#################################
        'template_type' => array (
            'datatype' => 'VARCHAR',
            'formtype' => 'SELECT',
            'default' => '',
            'value'  => array('welcome' => 'Default welcome email', 'other' => 'Other')
        ),
        'template_name' => array (
            'datatype' => 'VARCHAR',
            'formtype' => 'TEXT',
            'default' => '',
            'value'  => '',
            'separator' => '',
            'width'  => '30',
            'maxlength' => '255',
            'rows'  => '',
            'cols'  => ''
        ),
        'subject' => array (
            'datatype' => 'VARCHAR',
            'formtype' => 'TEXT',
            'default' => '',
            'value'  => '',
            'separator' => '',
            'width'  => '30',
            'maxlength' => '255',
            'rows'  => '',
            'cols'  => ''
        ),
        'message' => array (
            'datatype' => 'TEXT',
            'formtype' => 'TEXTAREA',
            'default' => '',
            'value'  => '',
            'separator' => '',
            'width'  => '30',
            'maxlength' => '255',
            'rows'  => '',
            'cols'  => ''
        ),
        //#################################
        // END Datatable fields
        //#################################
    )
);
?>
interface/web/client/lib/lang/en_client_message_template.lng
New file
@@ -0,0 +1,11 @@
<?php
$wb["template_type_txt"] = 'Email type';
$wb["template_name_txt"] = 'Template name';
$wb["subject_txt"] = 'Subject';
$wb["message_txt"] = 'Message';
$wb['Email template'] = 'Email template';
$wb['Settings'] = 'Setting';
$wb['variables_txt'] = 'Variables';
$wb['variables_description_txt'] = '(The username and password variables are only available in welcome emails.)';
$wb['duplicate_welcome_error'] = 'There can be only one default welcome email template. Please edit the existing template instead of adding a new one.';
?>
interface/web/client/lib/lang/en_client_message_template_list.lng
New file
@@ -0,0 +1,5 @@
<?php
$wb["list_head_txt"] = 'Email templates';
$wb["template_type_txt"] = 'Message for';
$wb["template_name_txt"] = 'Template name';
?>
interface/web/client/lib/module.conf.php
@@ -65,6 +65,10 @@
    'link' => 'client/client_template_list.php',
    'html_id'   => 'client_template_list');
$items[] = array(   'title'  => "Email-Templates",
    'target'  => 'content',
    'link' => 'client/message_template_list.php',
    'html_id'   => 'message_template_list');
$module["nav"][] = array(   'title' => 'Templates',
    'open'  => 1,
interface/web/client/list/message_template.list.php
New file
@@ -0,0 +1,77 @@
<?php
/*
Copyright (c) 2010, Till Brehm, projektfarm Gmbh
All rights reserved.
*/
/*
    Datatypes:
    - INTEGER
    - DOUBLE
    - CURRENCY
    - VARCHAR
    - TEXT
    - DATE
*/
// Name of the list
$liste["name"]     = "client_message_template";
// Database table
$liste["table"]    = "client_message_template";
// Index index field of the database table
$liste["table_idx"]   = "client_message_template_id";
// Search Field Prefix
$liste["search_prefix"]  = "search_";
// Records per page
$liste["records_per_page"]  = 15;
// Script File of the list
$liste["file"]    = "message_template_list.php";
// Script file of the edit form
$liste["edit_file"]   = "message_template_edit.php";
// Script File of the delete script
$liste["delete_file"]  = "message_template_del.php";
// Paging Template
$liste["paging_tpl"]  = "templates/paging.tpl.htm";
// Enable authe
$liste["auth"]    = "yes";
/*****************************************************
* Suchfelder
*****************************************************/
$liste["item"][] = array( 'field'  => "template_type",
    'datatype' => "VARCHAR",
    'formtype' => "SELECT",
    'op'  => "=",
    'prefix' => "",
    'suffix' => "",
    'width'  => "",
    'value'  => array('welcome' => 'Default welcome email', 'other' => 'Other'));
$liste["item"][] = array( 'field'  => "template_name",
    'datatype' => "VARCHAR",
    'formtype' => "TEXT",
    'op'  => "like",
    'prefix' => "%",
    'suffix' => "%",
    'width'  => "",
    'value'  => "");
?>
interface/web/client/message_template_del.php
New file
@@ -0,0 +1,58 @@
<?php
/*
Copyright (c) 2014 Till Brehm, ISPConfig UG
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/message_template.list.php";
$tform_def_file = "form/message_template.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('client');
$app->uses('tpl,tform');
$app->load('tform_actions');
class page_action extends tform_actions {
}
$page = new page_action;
$page->onDelete()
?>
interface/web/client/message_template_edit.php
New file
@@ -0,0 +1,99 @@
<?php
/*
Copyright (c) 2014 Till Brehm, ISPConfig UG
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/message_template.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('client');
// Loading classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
class page_action extends tform_actions {
    function onSubmit() {
        global $app, $conf;
        // Check for duplicates
        if($this->dataRecord['template_type'] == 'welcome') {
            $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
            $sql = "SELECT count(client_message_template_id) as number FROM client_message_template WHERE template_type = 'welcome' AND sys_groupid = ".$client_group_id;
            if($this->id > 0) {
                $sql .= " AND client_message_template_id != ".$this->id;
            }
            $tmp = $app->db->queryOneRecord($sql);
            if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng('duplicate_welcome_error');
        }
        parent::onSubmit();
    }
    function onShowEnd() {
        global $app, $conf;
        //message variables
        $message_variables = '';
        $sql = "SHOW COLUMNS FROM client WHERE Field NOT IN ('client_id', 'sys_userid', 'sys_groupid', 'sys_perm_user', 'sys_perm_group', 'sys_perm_other', 'parent_client_id', 'id_rsa', 'ssh_rsa', 'created_at', 'default_mailserver', 'default_webserver', 'web_php_options', 'ssh_chroot', 'default_dnsserver', 'default_dbserver', 'template_master', 'template_additional', 'force_suexec', 'default_slave_dnsserver', 'usertheme', 'locked', 'canceled', 'can_use_api', 'tmp_data', 'customer_no_template', 'customer_no_start', 'customer_no_counter', 'added_date', 'added_by') AND Field NOT LIKE 'limit_%'";
        $field_names = $app->db->queryAllRecords($sql);
        if(!empty($field_names) && is_array($field_names)){
            foreach($field_names as $field_name){
                if($field_name['Field'] != ''){
                    if($field_name['Field'] == 'gender'){
                        $message_variables .= '<a href="javascript:void(0);" class="addPlaceholder">{salutation}</a> ';
                    } else {
                        $message_variables .= '<a href="javascript:void(0);" class="addPlaceholder">{'.$field_name['Field'].'}</a> ';
                    }
                }
            }
        }
        $app->tpl->setVar('message_variables', trim($message_variables));
        parent::onShowEnd();
    }
}
$page = new page_action;
$page->onLoad();
?>
interface/web/client/message_template_list.php
New file
@@ -0,0 +1,53 @@
<?php
/*
Copyright (c) 2014 Till Brehm, ISPConfig UG
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.
*/
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/message_template.list.php";
/******************************************
* End Form configuration
******************************************/
//* Check permissions for module
$app->auth->check_module_permissions('client');
$app->uses('listform_actions');
//$app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id';
//$app->listform_actions->SQLExtWhere = "limit_client = 0";
$app->listform_actions->onLoad();
?>
interface/web/client/reseller_edit.php
@@ -266,6 +266,47 @@
                
            }
        }
        //* Send welcome email
        $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
        $sql = "SELECT * FROM client_message_template WHERE template_type = 'welcome' AND sys_groupid = ".$client_group_id;
        $email_template = $app->db->queryOneRecord($sql);
        $client = $app->tform->getDataRecord($this->id);
        if(is_array($email_template) && $client['email'] != '') {
            //* Parse client details into message
            $message = $email_template['message'];
            $subject = $email_template['subject'];
            foreach($client as $key => $val) {
                switch ($key) {
                case 'password':
                    $message = str_replace('{password}', $this->dataRecord['password'], $message);
                    $subject = str_replace('{password}', $this->dataRecord['password'], $subject);
                    break;
                case 'gender':
                    $message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message);
                    $subject = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $subject);
                    break;
                default:
                    $message = str_replace('{'.$key.'}', $val, $message);
                    $subject = str_replace('{'.$key.'}', $val, $subject);
                }
            }
            //* Get sender address
            if($app->auth->is_admin()) {
                $app->uses('getconf');
                $system_config = $app->getconf->get_global_config();
                $from = $system_config['admin_mail'];
            } else {
                $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
                $reseller = $app->db->queryOneRecord("SELECT client.email FROM sys_group,client WHERE client.client_id = sys_group.client_id and sys_group.groupid = ".$client_group_id);
                $from = $reseller["email"];
            }
            //* Send the email
            $app->functions->mail($client['email'], $subject, $message, $from);
        }
        parent::onAfterInsert();
    }
interface/web/client/templates/client_message_template_list.htm
New file
@@ -0,0 +1,57 @@
<h2><tmpl_var name="list_head_txt"></h2>
<div class="panel panel_list_client_message_template">
  <div class="pnl_toolsarea">
    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
      <div class="buttons">
        <button class="iconstxt icoAdd" type="button" onclick="loadContent('client/message_template_edit.php');">
          <span>{tmpl_var name="add_new_record_txt"}</span>
        </button>
      </div>
    </fieldset>
  </div>
  <div class="pnl_listarea">
    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
      <table class="list">
        <thead>
          <tr>
            <th class="tbl_col_template_type" scope="col"><tmpl_var name="template_type_txt"></th>
            <th class="tbl_col_template_name" scope="col"><tmpl_var name="template_name_txt"></th>
            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
          </tr>
          <tr>
            <td class="tbl_col_template_type"><select name="search_template_type" onChange="submitForm('pageForm','client/message_template_list.php');">{tmpl_var name='search_template_type'}</select></td>
            <td class="tbl_col_template_name"><input type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td>
            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="submitForm('pageForm','client/message_template_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
          </tr>
        </thead>
        <tbody>
          <tmpl_loop name="records">
          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
            <td class="tbl_col_template_type"><a href="#" onclick="loadContent('client/message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_type"}</a></td>
            <td class="tbl_col_template_name"><a href="#" onclick="loadContent('client/message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_name"}</a></td>
            <td class="tbl_col_buttons">
              <div class="buttons icons16">
                <a class="button icons16 icoDelete" href="javascript: del_record('client/message_template_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
              </div>
            </td>
          </tr>
          </tmpl_loop>
          <tmpl_unless name="records">
              <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
                  <td colspan="2">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
              </tr>
          </tmpl_unless>
        </tbody>
        <tfoot>
          <tr>
            <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td>
          </tr>
        </tfoot>
      </table>
    </fieldset>
  </div>
</div>
interface/web/client/templates/message_template.htm
New file
@@ -0,0 +1,39 @@
<h2><tmpl_var name="list_head_txt"></h2>
<p><tmpl_var name="list_desc_txt"></p>
<div class="panel panel_invoice_message_template">
  <div class="pnl_formsarea">
    <fieldset class="inlineLabels"><legend>Settings</legend>
      <div class="ctrlHolder">
          <label for="template_type">{tmpl_var name='template_type_txt'}</label>
        <select name="template_type" id="template_type" class="selectInput">
                    {tmpl_var name='template_type'}
                </select>
      </div>
      <div class="ctrlHolder">
          <label for="template_name">{tmpl_var name='template_name_txt'}</label>
        <input name="template_name" id="template_name" value="{tmpl_var name='template_name'}" size="30" maxlength="255" type="text" class="textInput" />
            </div>
      <div class="ctrlHolder">
          <label for="subject">{tmpl_var name='subject_txt'}</label>
        <input name="subject" id="subject" value="{tmpl_var name='subject'}" style="width:500px" size="30" maxlength="255" type="text" class="textInput" />
        <br clear="all">{tmpl_var name='variables_txt'}: {tmpl_var name="message_variables"} <br />{tmpl_var name='variables_description_txt'}
            </div>
      <div class="ctrlHolder">
          <label for="message">{tmpl_var name='message_txt'}</label>
        <textarea name="message" id="message" rows='' cols='' style="width:500px">{tmpl_var name='message'}</textarea>
        <br clear="all">{tmpl_var name='variables_txt'}: {tmpl_var name="message_variables"} <br />{tmpl_var name='variables_description_txt'}
      </div>
      <div class="buttonHolder buttons">
      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','client/message_template_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
      <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('client/message_template_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
    </div>
    </fieldset>
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
  </div>
</div>
interface/web/client/templates/message_template_list.htm
New file
@@ -0,0 +1,52 @@
<h2><tmpl_var name="list_head_txt"></h2>
<div class="panel panel_list_invoice_message_template">
  <div class="pnl_toolsarea">
    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
      <div class="buttons">
        <button class="iconstxt icoAdd" type="button" onClick="loadContent('billing/invoice_message_template_edit.php');">
          <span>{tmpl_var name="add_new_record_txt"}</span>
        </button>
      </div>
    </fieldset>
  </div>
  <div class="pnl_listarea">
    <fieldset><legend><tmpl_var name="list_head_txt"></legend>
      <table class="list">
        <thead>
          <tr>
            <th class="tbl_col_template_type" scope="col"><tmpl_var name="template_type_txt"></th>
            <th class="tbl_col_template_name" scope="col"><tmpl_var name="template_name_txt"></th>
            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
          </tr>
          <tr>
            <td class="tbl_col_template_type"><select name="search_template_type" onChange="submitForm('pageForm','billing/invoice_message_template_list.php');">{tmpl_var name='search_template_type'}</select></td>
            <td class="tbl_col_template_name"><input type="text" name="search_template_name" value="{tmpl_var name='search_template_name'}" /></td>
            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onClick="submitForm('pageForm','billing/invoice_message_template_list.php');"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
          </tr>
        </thead>
        <tbody>
          <tmpl_loop name="records">
          <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
            <td class="tbl_col_template_type"><a href="#" onClick="loadContent('billing/invoice_message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_type"}</a></td>
            <td class="tbl_col_template_name"><a href="#" onClick="loadContent('billing/invoice_message_template_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="template_name"}</a></td>
            <td class="tbl_col_buttons">
              <div class="buttons icons16">
                <a class="button icons16 icoDelete" href="javascript: del_record('billing/invoice_message_template_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
              </div>
            </td>
          </tr>
          </tmpl_loop>
        </tbody>
        <tfoot>
          <tr>
            <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td>
          </tr>
        </tfoot>
      </table>
    </fieldset>
  </div>
</div>