Skip to content

Commit 248bc32

Browse files
committed
- Added more details to client drop-down fields (in Sites and DNS module).
1 parent 528ac3b commit 248bc32

File tree

6 files changed

+808
-807
lines changed

6 files changed

+808
-807
lines changed

interface/lib/classes/custom_datasource.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function webdav_domains($field, $record) {
7575
if($web_config['server_type'] != 'nginx') $server_ids[] = $server['server_id'];
7676
}
7777
}
78+
if(count($server_ids) == 0) return array();
7879
$server_ids = implode(',', $server_ids);
7980
$records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND server_id IN (".$server_ids.") AND ".$app->tform->getAuthSQL('r')." ORDER BY domain");
8081

interface/web/dns/dns_import.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@
8484
$app->tpl->setVar("server_id",$server_id_option);
8585

8686
// load the list of clients
87-
$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
87+
$sql = "SELECT groupid, name, CONCAT(company_name,' :: ',contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
8888
$clients = $app->db->queryAllRecords($sql);
8989
$client_select = '';
9090
if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
9191
if(is_array($clients)) {
9292
foreach( $clients as $client) {
9393
$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';
94-
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
94+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]::$client[contactname]</option>\r\n";
9595
}
9696
}
9797

@@ -102,18 +102,18 @@
102102

103103
// Get the limits of the client
104104
$client_group_id = $_SESSION["s"]["user"]["default_group"];
105-
$client = $app->db->queryOneRecord("SELECT client.client_id, contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
105+
$client = $app->db->queryOneRecord("SELECT client.client_id, contact_name, CONCAT(company_name,' :: ',contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
106106

107107

108108
// load the list of clients
109-
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
109+
$sql = "SELECT groupid, name, CONCAT(company_name,' :: ',contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
110110
$clients = $app->db->queryAllRecords($sql);
111111
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
112-
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
112+
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['name'].'::'.$client['contactname'].'</option>';
113113
if(is_array($clients)) {
114114
foreach( $clients as $client) {
115115
$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';
116-
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
116+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]::$client[contactname]</option>\r\n";
117117
}
118118
}
119119

interface/web/dns/dns_slave_edit.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,34 +72,34 @@ function onShowEnd() {
7272
// If user is admin, we will allow him to select to whom this record belongs
7373
if($_SESSION["s"]["user"]["typ"] == 'admin') {
7474
// Getting Domains of the user
75-
$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER by name";
75+
$sql = "SELECT groupid, name, CONCAT(company_name,' :: ',contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
7676
$clients = $app->db->queryAllRecords($sql);
7777
$client_select = '';
7878
if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
7979
//$tmp_data_record = $app->tform->getDataRecord($this->id);
8080
if(is_array($clients)) {
8181
foreach( $clients as $client) {
8282
$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
83-
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
83+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]::$client[contactname]</option>\r\n";
8484
}
8585
}
8686
$app->tpl->setVar("client_group_id",$client_select);
8787
} else if($app->auth->has_clients($_SESSION['s']['user']['userid'])) {
8888

8989
// Get the limits of the client
9090
$client_group_id = $_SESSION["s"]["user"]["default_group"];
91-
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
91+
$client = $app->db->queryOneRecord("SELECT client.client_id, sys_group.name, client.contact_name, CONCAT(company_name,' :: ',contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
9292

9393
// Fill the client select field
94-
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
94+
$sql = "SELECT groupid, name, CONCAT(company_name,' :: ',contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
9595
$clients = $app->db->queryAllRecords($sql);
9696
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
97-
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
97+
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['name'].'::'.$client['contactname'].'</option>';
9898
//$tmp_data_record = $app->tform->getDataRecord($this->id);
9999
if(is_array($clients)) {
100100
foreach( $clients as $client) {
101101
$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
102-
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
102+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]::$client[contactname]</option>\r\n";
103103
}
104104
}
105105
$app->tpl->setVar("client_group_id",$client_select);

interface/web/dns/dns_soa_edit.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,34 +82,34 @@ function onShowEnd() {
8282
// If user is admin, we will allow him to select to whom this record belongs
8383
if($_SESSION["s"]["user"]["typ"] == 'admin') {
8484
// Getting Domains of the user
85-
$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER by name";
85+
$sql = "SELECT groupid, name, CONCAT(company_name,' :: ',contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
8686
$clients = $app->db->queryAllRecords($sql);
8787
$client_select = '';
8888
if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
8989
//$tmp_data_record = $app->tform->getDataRecord($this->id);
9090
if(is_array($clients)) {
9191
foreach( $clients as $client) {
9292
$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
93-
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
93+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]::$client[contactname]</option>\r\n";
9494
}
9595
}
9696
$app->tpl->setVar("client_group_id",$client_select);
9797
} else if($app->auth->has_clients($_SESSION['s']['user']['userid'])) {
9898

9999
// Get the limits of the client
100100
$client_group_id = $_SESSION["s"]["user"]["default_group"];
101-
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
101+
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(company_name,' :: ',contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
102102

103103
// Fill the client select field
104-
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
104+
$sql = "SELECT groupid, name, CONCAT(company_name,' :: ',contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
105105
$clients = $app->db->queryAllRecords($sql);
106106
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
107-
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
107+
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['name'].'::'.$client['contactname'].'</option>';
108108
//$tmp_data_record = $app->tform->getDataRecord($this->id);
109109
if(is_array($clients)) {
110110
foreach( $clients as $client) {
111111
$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
112-
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
112+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]::$client[contactname]</option>\r\n";
113113
}
114114
}
115115
$app->tpl->setVar("client_group_id",$client_select);

interface/web/dns/dns_wizard.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@
8181
$app->tpl->setVar("server_id",$server_id_option);
8282

8383
// load the list of clients
84-
$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
84+
$sql = "SELECT groupid, name, CONCAT(company_name,' :: ',contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
8585
$clients = $app->db->queryAllRecords($sql);
8686
$client_select = '';
8787
if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
8888
if(is_array($clients)) {
8989
foreach( $clients as $client) {
9090
$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';
91-
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
91+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]::$client[contactname]</option>\r\n";
9292
}
9393
}
9494

@@ -99,18 +99,18 @@
9999

100100
// Get the limits of the client
101101
$client_group_id = $_SESSION["s"]["user"]["default_group"];
102-
$client = $app->db->queryOneRecord("SELECT client.client_id, contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
102+
$client = $app->db->queryOneRecord("SELECT client.client_id, contact_name, CONCAT(company_name,' :: ',contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
103103

104104

105105
// load the list of clients
106-
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
106+
$sql = "SELECT groupid, name, CONCAT(company_name,' :: ',contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
107107
$clients = $app->db->queryAllRecords($sql);
108108
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
109-
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
109+
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['name'].'::'.$client['contactname'].'</option>';
110110
if(is_array($clients)) {
111111
foreach( $clients as $client) {
112112
$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';
113-
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
113+
$client_select .= "<option value='$client[groupid]' $selected>$client[name]::$client[contactname]</option>\r\n";
114114
}
115115
}
116116

0 commit comments

Comments
 (0)