diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php index cca5c2dc224dceddaf9498fb57fe8205c3e05bb6..735ec0bfaf166906d324ea294723ac4c8d61582f 100644 --- a/interface/web/client/domain_edit.php +++ b/interface/web/client/domain_edit.php @@ -147,9 +147,10 @@ class page_action extends tform_actions { } else { /* - * We edit a existing one, but there is nothing to edit + * We edit a existing one, but domain name can't be changed */ - $this->dataRecord = $app->tform->getDataRecord($this->id); + $oldData = $app->tform->getDataRecord($this->id); + $this->dataRecord["domain"] = $oldData["domain"]; } } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) { if ($this->id == 0) { @@ -199,6 +200,17 @@ class page_action extends tform_actions { } } + function onAfterUpdate() { + global $app, $conf; + + // make sure that the record belongs to the client group and not the admin group when admin inserts it + // also make sure that the user can not delete domain created by a admin + if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); + $app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); + } + } + } $page = new page_action; diff --git a/interface/web/client/templates/domain_edit.htm b/interface/web/client/templates/domain_edit.htm index aaafa6e9e4395c09f4afabb821c531209334bb43..551dbbed0d95b891c2efc8b56e9e05a09a1ca002 100644 --- a/interface/web/client/templates/domain_edit.htm +++ b/interface/web/client/templates/domain_edit.htm @@ -7,22 +7,16 @@ <div class="ctrlHolder"> <label for="domain">{tmpl_var name='domain_txt'}</label> <tmpl_if name="edit_disabled"> - <input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" disabled="disabled" /> + <input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" readonly="readonly" /> <tmpl_else> <input name="domain" id="domain" value="{tmpl_var name='domain'}" size="30" maxlength="255" type="text" class="textInput" /> </tmpl_if> </div> <div class="ctrlHolder"> <label for="client_group_id">{tmpl_var name='client_txt'}</label> - <tmpl_if name="edit_disabled"> - <select name="client_group_id" id="client_group_id" class="selectInput" disabled="disabled"> - {tmpl_var name='client_group_id'} - </select> - <tmpl_else> <select name="client_group_id" id="client_group_id" class="selectInput"> {tmpl_var name='client_group_id'} </select> - </tmpl_if> </div> </fieldset>