interface/lib/classes/custom_datasource.inc.php | ●●●●● patch | view | raw | blame | history | |
interface/web/client/client_template_edit.php | ●●●●● patch | view | raw | blame | history | |
interface/web/client/form/client.tform.php | ●●●●● patch | view | raw | blame | history | |
interface/web/client/lib/lang/en_client.lng | ●●●●● patch | view | raw | blame | history | |
interface/web/client/templates/client_edit_limits.htm | ●●●●● patch | view | raw | blame | history | |
interface/web/client/tools.inc.php | ●●●●● patch | view | raw | blame | history | |
interface/web/js/scrigo.js.php | ●●●●● 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,6 +52,22 @@ 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. 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
@@ -3,22 +3,18 @@ <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'}"> <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"> 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,6 +412,7 @@ function addAdditionalTemplate(){ var tpl_add = document.getElementById('template_additional').value; 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]; @@ -423,6 +425,7 @@ document.getElementById('template_additional_list').innerHTML = newList; alert('additional template ' + addTplText + ' added to customer'); } } function delAdditionalTemplate(){ var tpl_add = document.getElementById('template_additional').value;