From b94726392eb39dcad9c83d4732f717db90fe6f34 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Thu, 05 Mar 2009 11:16:54 -0500 Subject: [PATCH] disable some fields in edit mode. --- interface/web/sites/database_edit.php | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php index afe7013..377f321 100644 --- a/interface/web/sites/database_edit.php +++ b/interface/web/sites/database_edit.php @@ -173,6 +173,13 @@ $app->tpl->setVar("database_name_prefix", $dbname_prefix); $app->tpl->setVar("database_user_prefix", $dbuser_prefix); } + + if($this->id > 0) { + //* we are editing a existing record + $app->tpl->setVar("edit_disabled", 'disabled="disabled"'); + } else { + $app->tpl->setVar("edit_disabled", ''); + } parent::onShowEnd(); } @@ -237,6 +244,10 @@ if($old_record["database_charset"] != $this->dataRecord["database_charset"]) { $app->tform->errorMessage .= $app->tform->wordbook["database_charset_change_txt"].'<br />'; } + + //* Database username and database name shall not be empty + if($this->dataRecord['database_name'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_name_error_empty"].'<br />'; + if($this->dataRecord['database_user'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_user_error_empty"].'<br />'; //* Check if the server has been changed // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway @@ -261,6 +272,10 @@ function onBeforeInsert() { global $app, $conf, $interfaceConf; + + //* Database username and database name shall not be empty + if($this->dataRecord['database_name'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_name_error_empty"].'<br />'; + if($this->dataRecord['database_user'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_user_error_empty"].'<br />'; //* Get the database name and database user prefix $app->uses('getconf'); -- Gitblit v1.9.1