Skip to content

Commit 905663d

Browse files
author
wichu
committed
Changed the UI for the DNS SRV records to help the user (instead of giving him 1 field which have to have 3 texts, now there are 3 fields which will be concated for the database and splitted for the user).
data --> weight port target
1 parent 5549545 commit 905663d

26 files changed

+193
-110
lines changed

interface/web/dns/dns_srv_edit.php

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@
4949
$app->load('tform_actions');
5050

5151
class page_action extends tform_actions {
52-
52+
5353
function onShowNew() {
5454
global $app, $conf;
55-
55+
5656
// we will check only users, not admins
5757
if($_SESSION["s"]["user"]["typ"] == 'user') {
58-
58+
5959
// Get the limits of the client
6060
$client_group_id = $_SESSION["s"]["user"]["default_group"];
6161
$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
62-
62+
6363
// Check if the user may add another mailbox.
6464
if($client["limit_dns_record"] >= 0) {
6565
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,54 @@ function onShowNew() {
6868
}
6969
}
7070
}
71-
71+
7272
parent::onShowNew();
7373
}
74-
74+
75+
function onShowEnd() {
76+
global $app, $conf;
77+
78+
// Split the 3 parts of the SRV Record apart
79+
$split = explode(' ', $this->dataRecord['data']);
80+
81+
// Weight
82+
$this->dataRecord['weight'] = $split[0];
83+
84+
// Port
85+
$this->dataRecord['port'] = $split[1];
86+
87+
// Target
88+
$this->dataRecord['target'] = $split[2];
89+
90+
// Bind the new datarecord to the template
91+
$app->tpl->setVar($this->dataRecord);
92+
93+
parent::onShowEnd();
94+
}
95+
96+
function onBeforeInsert() {
97+
$this->dataRecord['data'] = $this->dataRecord['weight'] .' '. $this->dataRecord['port'] .' '. $this->dataRecord['target'];
98+
}
99+
100+
function onBeforeUpdate() {
101+
$this->dataRecord['data'] = $this->dataRecord['weight'] .' '. $this->dataRecord['port'] .' '. $this->dataRecord['target'];
102+
}
103+
75104
function onSubmit() {
76105
global $app, $conf;
77-
106+
78107
// Get the parent soa record of the domain
79108
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
80109

81110
// Check if Domain belongs to user
82111
if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
83-
112+
84113
// Check the client limits, if user is not the admin
85114
if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
86115
// Get the limits of the client
87116
$client_group_id = $_SESSION["s"]["user"]["default_group"];
88117
$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
89-
118+
90119
// Check if the user may add another mailbox.
91120
if($this->id == 0 && $client["limit_dns_record"] >= 0) {
92121
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +124,22 @@ function onSubmit() {
95124
}
96125
}
97126
} // end if user is not admin
98-
99-
127+
128+
100129
// Set the server ID of the rr record to the same server ID as the parent record.
101130
$this->dataRecord["server_id"] = $soa["server_id"];
102-
131+
103132
// Update the serial number and timestamp of the RR record
104133
$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
105134
$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
106135
$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
107-
136+
108137
parent::onSubmit();
109138
}
110-
139+
111140
function onAfterInsert() {
112141
global $app, $conf;
113-
142+
114143
//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
115144
$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
116145
$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,10 +149,10 @@ function onAfterInsert() {
120149
$serial = $app->validate_dns->increase_serial($soa["serial"]);
121150
$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
122151
}
123-
152+
124153
function onAfterUpdate() {
125154
global $app, $conf;
126-
155+
127156
//* Update the serial number of the SOA record
128157
$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
129158
$soa_id = intval($_POST["zone"]);

interface/web/dns/form/dns_srv.tform.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@
9999
'formtype' => 'TEXT',
100100
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
101101
'errmsg'=> 'data_error_empty'),
102-
1 => array ( 'type' => 'REGEX',
103-
'regex' => '/^[\w\.\-]{0,64}\s[\w\.\-]{0,64}\s[\w\.\-]{0,64}$/',
104-
'errmsg'=> 'srv_error_regex'),
102+
1 => array ( 'type' => 'REGEX',
103+
'regex' => '/^[\w\.\-]{0,64}\s[\w\.\-]{0,64}\s[\w\.\-]{0,64}$/',
104+
'errmsg'=> 'srv_error_regex'),
105105
),
106106
'default' => '',
107107
'value' => '',

interface/web/dns/lib/lang/ar_dns_srv.lng

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ $wb['server_id_txt'] = 'Server';
33
$wb['zone_txt'] = 'Zone';
44
$wb['name_txt'] = 'Hostname';
55
$wb['type_txt'] = 'type';
6-
$wb['data_txt'] = 'Server Record';
6+
$wb["target_txt"] = 'Target';
7+
$wb["weight_txt"] = 'Weight';
8+
$wb["port_txt"] = 'Port';
79
$wb['ttl_txt'] = 'TTL';
810
$wb['active_txt'] = 'Active';
911
$wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account is reached.';

interface/web/dns/lib/lang/bg_dns_srv.lng

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ $wb['server_id_txt'] = 'Server';
33
$wb['zone_txt'] = 'Zone';
44
$wb['name_txt'] = 'Hostname';
55
$wb['type_txt'] = 'type';
6-
$wb['data_txt'] = 'Server Record';
6+
$wb["target_txt"] = 'Target';
7+
$wb["weight_txt"] = 'Weight';
8+
$wb["port_txt"] = 'Port';
79
$wb['ttl_txt'] = 'TTL';
810
$wb['active_txt'] = 'Active';
911
$wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account is reached.';

interface/web/dns/lib/lang/br_dns_srv.lng

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ $wb['server_id_txt'] = 'Servidor';
33
$wb['zone_txt'] = 'Zona';
44
$wb['name_txt'] = 'Hostname';
55
$wb['type_txt'] = 'tipo';
6-
$wb['data_txt'] = 'Registro do Servidor';
6+
$wb["target_txt"] = 'Target';
7+
$wb["weight_txt"] = 'Weight';
8+
$wb["port_txt"] = 'Port';
79
$wb['ttl_txt'] = 'TTL';
810
$wb['active_txt'] = 'Ativo';
911
$wb['limit_dns_record_txt'] = 'O número máximo de zonas DNS para sua conta foi atingido.';
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<?php
22
$wb['server_id_txt'] = 'Server';
3-
$wb['zone_txt'] = 'Zóna';
3+
$wb['zone_txt'] = 'Zóna';
44
$wb['name_txt'] = 'Hostname';
55
$wb['type_txt'] = 'Typ';
6-
$wb['data_txt'] = 'Záznam serveru';
6+
$wb["target_txt"] = 'Target';
7+
$wb["weight_txt"] = 'Weight';
8+
$wb["port_txt"] = 'Port';
79
$wb['ttl_txt'] = 'TTL';
8-
$wb['active_txt'] = 'Aktivní';
9-
$wb['limit_dns_record_txt'] = 'Dosažen maximální počet DNS záznamů pro Váš účet.';
10-
$wb['no_zone_perm'] = 'Nemáte oprávnění přidat záznam do této zóny.';
11-
$wb['name_error_empty'] = 'Hostname je prázdný.';
12-
$wb['name_error_regex'] = 'Hostname má chybný formát.';
13-
$wb['data_error_empty'] = 'Záznam serveru je prázdný';
14-
$wb['data_error_regex'] = 'Záznam serveru má chybný formát';
15-
$wb['srv_error_regex'] = 'Neplatný formát záznau serveru. Záznam serveru musí obsahovat 3 textové řetězce oddělené mezerami.';
10+
$wb['active_txt'] = 'Aktivní';
11+
$wb['limit_dns_record_txt'] = 'Dosažen maximální po�et DNS záznamů pro Váš ú�et.';
12+
$wb['no_zone_perm'] = 'Nemáte oprávnění přidat záznam do této zóny.';
13+
$wb['name_error_empty'] = 'Hostname je prázdný.';
14+
$wb['name_error_regex'] = 'Hostname má chybný formát.';
15+
$wb['data_error_empty'] = 'Záznam serveru je prázdný';
16+
$wb['data_error_regex'] = 'Záznam serveru má chybný formát';
17+
$wb['srv_error_regex'] = 'Neplatný formát záznau serveru. Záznam serveru musí obsahovat 3 textové řetězce oddělené mezerami.';
1618
$wb['aux_txt'] = 'Priority';
1719
?>

interface/web/dns/lib/lang/de_dns_srv.lng

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ $wb['server_id_txt'] = 'Server';
33
$wb['zone_txt'] = 'Zone';
44
$wb['name_txt'] = 'Hostname';
55
$wb['type_txt'] = 'Typ';
6-
$wb['data_txt'] = 'Servereintrag';
6+
$wb["target_txt"] = 'Ziel';
7+
$wb["weight_txt"] = 'Gewicht';
8+
$wb["port_txt"] = 'Port';
79
$wb['ttl_txt'] = 'TTL';
810
$wb['active_txt'] = 'Aktiv';
911
$wb['limit_dns_record_txt'] = 'Die maximale Anzahl an DNS Einträgen für ihr Konto wurde erreicht.';
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<?php
22
$wb['server_id_txt'] = 'Server';
3-
$wb['zone_txt'] = 'Ζώνη';
3+
$wb['zone_txt'] = 'Ζώνη';
44
$wb['name_txt'] = 'Hostname';
5-
$wb['type_txt'] = 'τύπος';
6-
$wb['data_txt'] = 'Εγγραφή Server';
5+
$wb['type_txt'] = 'τ�πος';
6+
$wb["target_txt"] = 'Target';
7+
$wb["weight_txt"] = 'Weight';
8+
$wb["port_txt"] = 'Port';
79
$wb['ttl_txt'] = 'TTL';
8-
$wb['active_txt'] = 'Ενεργή';
9-
$wb['aux_txt'] = 'Προτεραιότητα';
10-
$wb['limit_dns_record_txt'] = 'Έχετε φτάσει το μέγιστο πλήθος των εγγραφών DNS για τον λογαριασμό σας.';
11-
$wb['no_zone_perm'] = 'Δεν έχετε δικαίωμα να προσθέσετε εγγραφές σε αυτή τη ζώνη.';
12-
$wb['name_error_empty'] = 'Το hostname δεν έχει οριστεί.';
13-
$wb['name_error_regex'] = 'Το hostname δεν έχει σωστή μορφοποίηση.';
14-
$wb['data_error_empty'] = 'Η εγγραφή Server είναι κενή';
15-
$wb['data_error_regex'] = 'Εγγραφή Server με μη έγκυρη μορφοποίηση';
16-
$wb['srv_error_regex'] = 'Εγγραφή Server με μη έγκυρη μορφοποίηση. Η εγγραφή Server πρέπει να περιέχει 3 λέξεις χωρισμένες με κενά.';
10+
$wb['active_txt'] = 'Ενε�γή';
11+
$wb['aux_txt'] = 'Π�οτε�αιότητα';
12+
$wb['limit_dns_record_txt'] = 'Έχετε φτάσει το μέγιστο πλήθος των εγγ�αφών DNS για τον λογα�ιασμό σας.';
13+
$wb['no_zone_perm'] = 'Δεν έχετε δικαίωμα να π�οσθέσετε εγγ�αφές σε αυτή τη ζώνη.';
14+
$wb['name_error_empty'] = 'Το hostname δεν έχει ο�ιστεί.';
15+
$wb['name_error_regex'] = 'Το hostname δεν έχει σωστή μο�φοποίηση.';
16+
$wb['data_error_empty'] = 'Η εγγ�αφή Server είναι κενή';
17+
$wb['data_error_regex'] = 'Εγγ�αφή Server με μη έγκυ�η μο�φοποίηση';
18+
$wb['srv_error_regex'] = 'Εγγ�αφή Server με μη έγκυ�η μο�φοποίηση. Η εγγ�αφή Server π�έπει να πε�ιέχει 3 λέξεις χω�ισμένες με κενά.';
1719
?>

interface/web/dns/lib/lang/en_dns_srv.lng

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ $wb["server_id_txt"] = 'Server';
33
$wb["zone_txt"] = 'Zone';
44
$wb["name_txt"] = 'Hostname';
55
$wb["type_txt"] = 'type';
6-
$wb["data_txt"] = 'Server Record';
6+
$wb["target_txt"] = 'Target';
7+
$wb["weight_txt"] = 'Weight';
8+
$wb["port_txt"] = 'Port';
79
$wb["ttl_txt"] = 'TTL';
810
$wb["active_txt"] = 'Active';
911
$wb["aux_txt"] = 'Priority';

interface/web/dns/lib/lang/es_dns_srv.lng

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ $wb['server_id_txt'] = 'Servidor';
33
$wb['zone_txt'] = 'Zona';
44
$wb['name_txt'] = 'Nombre de la máquina';
55
$wb['type_txt'] = 'tipo';
6-
$wb['data_txt'] = 'Registro del servidor';
6+
$wb["target_txt"] = 'Target';
7+
$wb["weight_txt"] = 'Weight';
8+
$wb["port_txt"] = 'Port';
79
$wb['ttl_txt'] = 'TTL';
810
$wb['active_txt'] = 'Activar';
911
$wb['limit_dns_record_txt'] = 'Se ha alcanzado el número máximo de registros DNS de esta cuenta.';

0 commit comments

Comments
 (0)