tbrehm
2008-12-16 aa150015a52cfdf30949b6b19fdd43b6550ce067
Improved Client templates.
6 files modified
1 files added
370 ■■■■■ changed files
interface/lib/classes/custom_datasource.inc.php 46 ●●●●● patch | view | raw | blame | history
interface/web/client/client_template_edit.php 18 ●●●●● patch | view | raw | blame | history
interface/web/client/form/client.tform.php 9 ●●●●● patch | view | raw | blame | history
interface/web/client/lib/lang/en_client.lng 2 ●●●●● patch | view | raw | blame | history
interface/web/client/templates/client_edit_limits.htm 264 ●●●● patch | view | raw | blame | history
interface/web/client/tools.inc.php 4 ●●●● patch | view | raw | blame | history
interface/web/js/scrigo.js.php 27 ●●●●● patch | view | raw | blame | history
interface/lib/classes/custom_datasource.inc.php
New file
@@ -0,0 +1,46 @@
<?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.
*/
class custom_datasource {
    function master_templates($field, $record) {
        global $app, $conf;
        $records = $app->db->queryAllRecords("SELECT template_id,template_name FROM client_template WHERE template_type ='m'");
        $records_new[0] = $app->lng('Custom');
        foreach($records as $rec) {
            $key = $rec['template_id'];
            $records_new[$key] = $rec['template_name'];
        }
        return $records_new;
    }
}
?>
interface/web/client/client_template_edit.php
@@ -52,13 +52,29 @@
class page_action extends tform_actions {
    function onBeforeUpdate() {
        global $app;
        if(isset($this->dataRecord['template_type'])) {
            //* Check if the template_type has been changed
            $rec = $app->db->queryOneRecord("SELECT template_type from client_template WHERE template_id = ".$this->id);
            if($rec['template_type'] != $this->dataRecord['template_type']) {
                //* Add a error message and switch back to old server
                $app->tform->errorMessage .= $app->lng('The template type can not be changed.');
                $this->dataRecord['template_type'] = $rec['template_type'];
            }
            unset($rec);
        }
    }
    /*
     This function is called automatically right after
     the data was successful updated in the database.
    */
    function onAfterUpdate() {
        global $app;
        /*
         * the template has changed. apply the new data to all clients
         */
interface/web/client/form/client.tform.php
@@ -301,12 +301,11 @@
            'datatype'    => 'INTEGER',
            'formtype'    => 'SELECT',
            'default'    => '1',
            'datasource'    => array (     'type'    => 'SQL',
                                        'querystring' => "SELECT template_id,template_name FROM client_template WHERE template_type ='m'",
                                        'keyfield'=> 'template_id',
                                        'valuefield'=> 'template_name'
            'datasource'    => array (     'type'    => 'CUSTOM',
                                        'class'=> 'custom_datasource',
                                        'function'=> 'master_templates'
                                     ),
            'value'        => array('0' => 'custom')
            'value'        => ''
        ),
        'template_additional' => array (
            'datatype'    => 'VARCHAR',
interface/web/client/lib/lang/en_client.lng
@@ -82,4 +82,6 @@
$wb["limit_database_txt"] = 'Max. number of Databases';
$wb["limit_database_error_notint"] = 'The database limit must be a number.';
$wb["username_error_regex"] = 'The Username contains invalid chracaters.';
$wb["template_master_txt"] = 'Master';
$wb["template_additional_txt"] = 'Addon';
?>
interface/web/client/templates/client_edit_limits.htm
@@ -1,134 +1,130 @@
<h2><tmpl_var name="list_head_txt"></h2>
<div class="panel panel_client">
  <div class="pnl_formsarea">
    <fieldset id="wf_area_client"><legend>Client-Template</legend>
      <span class="wf_oneField">
        <label for="template_master" class="wf_preField">{tmpl_var name='template_master_txt'}</label>
        <select id="template_master" name="template_master">{tmpl_var name='template_master'}</select>
      </span>
    </fieldset>
    <fieldset id="wf_area_client"><legend>Additional-Templates</legend>
      <span class="wf_oneField">
        <select id="tpl_add_select" name="tpl_add_select">{tmpl_var name='tpl_add_select'}</select>
      </span>
      <span id="template_additional_list">{tmpl_var name='template_additional_list'}</span>
      <input type="hidden" id="template_additional" name="template_additional" value="{tmpl_var name='template_additional'}">
        <div class="wf_actions buttons">
          <button class="positive iconstxt icoAdd" type="button" value="Add additional template" onClick="addAdditionalTemplate();"><span>Add additional template</span></button>
          <button class="negative iconstxt icoDelete" type="button" value="Delete additional template" onClick="delAdditionalTemplate();"><span>Delete additional template</span></button>
        </div>
    </fieldset>
    <fieldset id="wf_area_client"><legend>Limits</legend>
      <span class="wf_oneField">
        <label for="default_mailserver" class="wf_preField">{tmpl_var name='default_mailserver_txt'}</label>
        <select id="default_mailserver" name="default_mailserver">{tmpl_var name='default_mailserver'}</select>
      </span>
      <span class="wf_oneField">
        <label for="limit_maildomain" class="wf_preField">{tmpl_var name='limit_maildomain_txt'}</label>
        <input type="text" id="limit_maildomain" name="limit_maildomain" value="{tmpl_var name='limit_maildomain'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailbox" class="wf_preField">{tmpl_var name='limit_mailbox_txt'}</label>
        <input type="text" id="limit_mailbox" name="limit_mailbox" value="{tmpl_var name='limit_mailbox'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailalias" class="wf_preField">{tmpl_var name='limit_mailalias_txt'}</label>
        <input type="text" id="limit_mailalias" name="limit_mailalias" value="{tmpl_var name='limit_mailalias'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailforward" class="wf_preField">{tmpl_var name='limit_mailforward_txt'}</label>
        <input type="text" id="limit_mailforward" name="limit_mailforward" value="{tmpl_var name='limit_mailforward'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailcatchall" class="wf_preField">{tmpl_var name='limit_mailcatchall_txt'}</label>
        <input type="text" id="limit_mailcatchall" name="limit_mailcatchall" value="{tmpl_var name='limit_mailcatchall'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailrouting" class="wf_preField">{tmpl_var name='limit_mailrouting_txt'}</label>
        <input type="text" id="limit_mailrouting" name="limit_mailrouting" value="{tmpl_var name='limit_mailrouting'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailfilter" class="wf_preField">{tmpl_var name='limit_mailfilter_txt'}</label>
        <input type="text" id="limit_mailfilter" name="limit_mailfilter" value="{tmpl_var name='limit_mailfilter'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_fetchmail" class="wf_preField">{tmpl_var name='limit_fetchmail_txt'}</label>
        <input type="text" id="limit_fetchmail" name="limit_fetchmail" value="{tmpl_var name='limit_fetchmail'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailquota" class="wf_preField">{tmpl_var name='limit_mailquota_txt'}</label>
        <input type="text" id="limit_mailquota" name="limit_mailquota" value="{tmpl_var name='limit_mailquota'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_spamfilter_wblist" class="wf_preField">{tmpl_var name='limit_spamfilter_wblist_txt'}</label>
        <input type="text" id="limit_spamfilter_wblist" name="limit_spamfilter_wblist" value="{tmpl_var name='limit_spamfilter_wblist'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_spamfilter_user" class="wf_preField">{tmpl_var name='limit_spamfilter_user_txt'}</label>
        <input type="text" id="limit_spamfilter_user" name="limit_spamfilter_user" value="{tmpl_var name='limit_spamfilter_user'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_spamfilter_policy" class="wf_preField">{tmpl_var name='limit_spamfilter_policy_txt'}</label>
        <input type="text" id="limit_spamfilter_policy" name="limit_spamfilter_policy" value="{tmpl_var name='limit_spamfilter_policy'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="default_webserver" class="wf_preField">{tmpl_var name='default_webserver_txt'}</label>
        <select id="default_webserver" name="default_webserver">{tmpl_var name='default_webserver'}</select>
      </span>
      <span class="wf_oneField">
        <label for="limit_web_domain" class="wf_preField">{tmpl_var name='limit_web_domain_txt'}</label>
        <input type="text" id="limit_web_domain" name="limit_web_domain" value="{tmpl_var name='limit_web_domain'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_web_aliasdomain" class="wf_preField">{tmpl_var name='limit_web_aliasdomain_txt'}</label>
        <input type="text" id="limit_web_aliasdomain" name="limit_web_aliasdomain" value="{tmpl_var name='limit_web_aliasdomain'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_web_subdomain" class="wf_preField">{tmpl_var name='limit_web_subdomain_txt'}</label>
        <input type="text" id="limit_web_subdomain" name="limit_web_subdomain" value="{tmpl_var name='limit_web_subdomain'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_ftp_user" class="wf_preField">{tmpl_var name='limit_ftp_user_txt'}</label>
        <input type="text" id="limit_ftp_user" name="limit_ftp_user" value="{tmpl_var name='limit_ftp_user'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_shell_user" class="wf_preField">{tmpl_var name='limit_shell_user_txt'}</label>
        <input type="text" id="limit_shell_user" name="limit_shell_user" value="{tmpl_var name='limit_shell_user'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="default_dnsserver" class="wf_preField">{tmpl_var name='default_dnsserver_txt'}</label>
        <select id="default_dnsserver" name="default_dnsserver">{tmpl_var name='default_dnsserver'}</select>
      </span>
      <span class="wf_oneField">
        <label for="limit_dns_zone" class="wf_preField">{tmpl_var name='limit_dns_zone_txt'}</label>
        <input type="text" id="limit_dns_zone" name="limit_dns_zone" value="{tmpl_var name='limit_dns_zone'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_dns_record" class="wf_preField">{tmpl_var name='limit_dns_record_txt'}</label>
        <input type="text" id="limit_dns_record" name="limit_dns_record" value="{tmpl_var name='limit_dns_record'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_client" class="wf_preField">{tmpl_var name='limit_client_txt'}</label>
        <input type="text" id="limit_client" name="limit_client" value="{tmpl_var name='limit_client'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="default_dbserver" class="wf_preField">{tmpl_var name='default_dbserver_txt'}</label>
        <select id="default_dbserver" name="default_dbserver">{tmpl_var name='default_dbserver'}</select>
      </span>
      <span class="wf_oneField">
        <label for="limit_database" class="wf_preField">{tmpl_var name='limit_database_txt'}</label>
        <input type="text" id="limit_database" name="limit_database" value="{tmpl_var name='limit_database'}" size="10" maxlength="10">
      </span>
    </fieldset>
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
    <div class="wf_actions buttons">
      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','client/client_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/client_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
    </div>
  </div>
</div>
<h2><tmpl_var name="list_head_txt"></h2>
<div class="panel panel_client">
  <div class="pnl_formsarea">
    <fieldset id="wf_area_client"><legend>Templates</legend>
      <div class="wf_actions buttons">
          <button class="positive iconstxt icoAdd" type="button" value="Add additional template" onClick="addAdditionalTemplate();"><span>Add additional template</span></button>
          <button class="negative iconstxt icoDelete" type="button" value="Delete additional template" onClick="delAdditionalTemplate();"><span>Delete additional template</span></button>
      </div>
      <span class="wf_oneField">
        <label for="template_master" class="wf_preField">{tmpl_var name='template_master_txt'}</label>
        <select id="template_master" name="template_master">{tmpl_var name='template_master'}</select>
        <label for="template_additional">{tmpl_var name='template_additional_txt'}</label>
        <select id="tpl_add_select" name="tpl_add_select">{tmpl_var name='tpl_add_select'}</select>
      </span>
      <input type="hidden" id="template_additional" name="template_additional" value="{tmpl_var name='template_additional'}">
    </fieldset>
    <fieldset id="wf_area_client"><legend>Limits</legend>
      <span class="wf_oneField">
        <label for="default_mailserver" class="wf_preField">{tmpl_var name='default_mailserver_txt'}</label>
        <select id="default_mailserver" name="default_mailserver">{tmpl_var name='default_mailserver'}</select>
      </span>
      <span class="wf_oneField">
        <label for="limit_maildomain" class="wf_preField">{tmpl_var name='limit_maildomain_txt'}</label>
        <input type="text" id="limit_maildomain" name="limit_maildomain" value="{tmpl_var name='limit_maildomain'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailbox" class="wf_preField">{tmpl_var name='limit_mailbox_txt'}</label>
        <input type="text" id="limit_mailbox" name="limit_mailbox" value="{tmpl_var name='limit_mailbox'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailalias" class="wf_preField">{tmpl_var name='limit_mailalias_txt'}</label>
        <input type="text" id="limit_mailalias" name="limit_mailalias" value="{tmpl_var name='limit_mailalias'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailforward" class="wf_preField">{tmpl_var name='limit_mailforward_txt'}</label>
        <input type="text" id="limit_mailforward" name="limit_mailforward" value="{tmpl_var name='limit_mailforward'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailcatchall" class="wf_preField">{tmpl_var name='limit_mailcatchall_txt'}</label>
        <input type="text" id="limit_mailcatchall" name="limit_mailcatchall" value="{tmpl_var name='limit_mailcatchall'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailrouting" class="wf_preField">{tmpl_var name='limit_mailrouting_txt'}</label>
        <input type="text" id="limit_mailrouting" name="limit_mailrouting" value="{tmpl_var name='limit_mailrouting'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailfilter" class="wf_preField">{tmpl_var name='limit_mailfilter_txt'}</label>
        <input type="text" id="limit_mailfilter" name="limit_mailfilter" value="{tmpl_var name='limit_mailfilter'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_fetchmail" class="wf_preField">{tmpl_var name='limit_fetchmail_txt'}</label>
        <input type="text" id="limit_fetchmail" name="limit_fetchmail" value="{tmpl_var name='limit_fetchmail'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_mailquota" class="wf_preField">{tmpl_var name='limit_mailquota_txt'}</label>
        <input type="text" id="limit_mailquota" name="limit_mailquota" value="{tmpl_var name='limit_mailquota'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_spamfilter_wblist" class="wf_preField">{tmpl_var name='limit_spamfilter_wblist_txt'}</label>
        <input type="text" id="limit_spamfilter_wblist" name="limit_spamfilter_wblist" value="{tmpl_var name='limit_spamfilter_wblist'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_spamfilter_user" class="wf_preField">{tmpl_var name='limit_spamfilter_user_txt'}</label>
        <input type="text" id="limit_spamfilter_user" name="limit_spamfilter_user" value="{tmpl_var name='limit_spamfilter_user'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_spamfilter_policy" class="wf_preField">{tmpl_var name='limit_spamfilter_policy_txt'}</label>
        <input type="text" id="limit_spamfilter_policy" name="limit_spamfilter_policy" value="{tmpl_var name='limit_spamfilter_policy'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="default_webserver" class="wf_preField">{tmpl_var name='default_webserver_txt'}</label>
        <select id="default_webserver" name="default_webserver">{tmpl_var name='default_webserver'}</select>
      </span>
      <span class="wf_oneField">
        <label for="limit_web_domain" class="wf_preField">{tmpl_var name='limit_web_domain_txt'}</label>
        <input type="text" id="limit_web_domain" name="limit_web_domain" value="{tmpl_var name='limit_web_domain'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_web_aliasdomain" class="wf_preField">{tmpl_var name='limit_web_aliasdomain_txt'}</label>
        <input type="text" id="limit_web_aliasdomain" name="limit_web_aliasdomain" value="{tmpl_var name='limit_web_aliasdomain'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_web_subdomain" class="wf_preField">{tmpl_var name='limit_web_subdomain_txt'}</label>
        <input type="text" id="limit_web_subdomain" name="limit_web_subdomain" value="{tmpl_var name='limit_web_subdomain'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_ftp_user" class="wf_preField">{tmpl_var name='limit_ftp_user_txt'}</label>
        <input type="text" id="limit_ftp_user" name="limit_ftp_user" value="{tmpl_var name='limit_ftp_user'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_shell_user" class="wf_preField">{tmpl_var name='limit_shell_user_txt'}</label>
        <input type="text" id="limit_shell_user" name="limit_shell_user" value="{tmpl_var name='limit_shell_user'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="default_dnsserver" class="wf_preField">{tmpl_var name='default_dnsserver_txt'}</label>
        <select id="default_dnsserver" name="default_dnsserver">{tmpl_var name='default_dnsserver'}</select>
      </span>
      <span class="wf_oneField">
        <label for="limit_dns_zone" class="wf_preField">{tmpl_var name='limit_dns_zone_txt'}</label>
        <input type="text" id="limit_dns_zone" name="limit_dns_zone" value="{tmpl_var name='limit_dns_zone'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_dns_record" class="wf_preField">{tmpl_var name='limit_dns_record_txt'}</label>
        <input type="text" id="limit_dns_record" name="limit_dns_record" value="{tmpl_var name='limit_dns_record'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="limit_client" class="wf_preField">{tmpl_var name='limit_client_txt'}</label>
        <input type="text" id="limit_client" name="limit_client" value="{tmpl_var name='limit_client'}" size="10" maxlength="10">
      </span>
      <span class="wf_oneField">
        <label for="default_dbserver" class="wf_preField">{tmpl_var name='default_dbserver_txt'}</label>
        <select id="default_dbserver" name="default_dbserver">{tmpl_var name='default_dbserver'}</select>
      </span>
      <span class="wf_oneField">
        <label for="limit_database" class="wf_preField">{tmpl_var name='limit_database_txt'}</label>
        <input type="text" id="limit_database" name="limit_database" value="{tmpl_var name='limit_database'}" size="10" maxlength="10">
      </span>
    </fieldset>
    <input type="hidden" name="id" value="{tmpl_var name='id'}">
    <div class="wf_actions buttons">
      <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','client/client_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/client_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
    </div>
  </div>
</div>
interface/web/client/tools.inc.php
@@ -28,7 +28,7 @@
*/
function applyClientTemplates($clientId){
    global $app;
    global $app,$page;
    /*
     * Get the master-template for the client
     */
@@ -44,7 +44,7 @@
        $sql = "SELECT * FROM client_template WHERE template_id = " . intval($masterTemplateId);
        $limits = $app->db->queryOneRecord($sql);
    } else {
        $limits = $this->dataRecord;
        $limits = $page->dataRecord;
    }
    /*
interface/web/js/scrigo.js.php
@@ -102,7 +102,8 @@
            }
        },
        failure: function(o) {
            alert('Ajax Request was not successful. 1');
            var parts = o.responseText.split(':');
            alert('Ajax Request was not successful. '+parts[1]);
        }
    }
    
@@ -411,17 +412,19 @@
function addAdditionalTemplate(){
  var tpl_add = document.getElementById('template_additional').value;
  var tpl_list = document.getElementById('template_additional_list').innerHTML;
  var addTemplate = document.getElementById('tpl_add_select').value.split('|',2);
  var addTplId = addTemplate[0];
  var addTplText = addTemplate[1];
  var newVal = tpl_add + '/' + addTplId + '/';
  newVal = newVal.replace('//', '/');
  var newList = tpl_list + '<br>' + addTplText;
  newList = newList.replace('<br><br>', '<br>');
  document.getElementById('template_additional').value = newVal;
  document.getElementById('template_additional_list').innerHTML = newList;
  alert('additional template ' + addTplText + ' added to customer');
  if(tpl_add != '') {
    var tpl_list = document.getElementById('template_additional_list').innerHTML;
    var addTemplate = document.getElementById('tpl_add_select').value.split('|',2);
    var addTplId = addTemplate[0];
    var addTplText = addTemplate[1];
    var newVal = tpl_add + '/' + addTplId + '/';
    newVal = newVal.replace('//', '/');
    var newList = tpl_list + '<br>' + addTplText;
    newList = newList.replace('<br><br>', '<br>');
    document.getElementById('template_additional').value = newVal;
    document.getElementById('template_additional_list').innerHTML = newList;
    alert('additional template ' + addTplText + ' added to customer');
  }
}
function delAdditionalTemplate(){