diff --git a/interface/lib/classes/custom_datasource.inc.php b/interface/lib/classes/custom_datasource.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..298e997416b1e2b99faf5c59a7b2fc8f02257e3f --- /dev/null +++ b/interface/lib/classes/custom_datasource.inc.php @@ -0,0 +1,46 @@ +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; + } + +} + +?> \ No newline at end of file diff --git a/interface/web/client/client_template_edit.php b/interface/web/client/client_template_edit.php index 7368063ec54f830aaea2af6fc2ccfda76bfdd0dd..bf2795937039acee274755c540b7da962e5ddb65 100644 --- a/interface/web/client/client_template_edit.php +++ b/interface/web/client/client_template_edit.php @@ -52,13 +52,29 @@ $app->load('tform_actions'); 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 */ diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php index 8be3de8a2e328d45f33532e9dcf39436d2da6b6e..1124c7e094173453d4981ab8d36a921554b4b3ae 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -301,12 +301,11 @@ $form["tabs"]['limits'] = array ( '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', diff --git a/interface/web/client/lib/lang/en_client.lng b/interface/web/client/lib/lang/en_client.lng index 8f7661628a2aa7b0f3efc989c31f1ccac76c05e9..8d08549806f9e5f10bfd0153110b7a60f89f88fd 100644 --- a/interface/web/client/lib/lang/en_client.lng +++ b/interface/web/client/lib/lang/en_client.lng @@ -82,4 +82,6 @@ $wb["default_dbserver_txt"] = 'Default Database Server'; $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'; ?> diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm index 5e4232b9aeab6e53b28f3b86117e90975688e434..ff8d6ae7976861489651560b6fc7cdbd2562fc9c 100644 --- a/interface/web/client/templates/client_edit_limits.htm +++ b/interface/web/client/templates/client_edit_limits.htm @@ -1,134 +1,130 @@ -