Skip to content
Snippets Groups Projects
Commit 2eb5d1be authored by Falko Timme's avatar Falko Timme
Browse files

- Cleaned up JavaScript code.

- Fix: IPv6 address must not be '*'.
parent 9576ebb6
No related branches found
No related tags found
2 merge requests!46Master,!21Master
......@@ -69,7 +69,7 @@
{tmpl_var name='check_apache_config'}
</div>
</div>
<div class="ctrlHolder apache">
<div class="ctrlHolder">
<p class="label">{tmpl_var name='enable_sni_txt'}</p>
<div class="multiField">
{tmpl_var name='enable_sni'}
......@@ -173,13 +173,13 @@
<script language="JavaScript" type="text/javascript">
var serverType = jQuery('#server_type').val();
jQuery('#server_type').replaceWith('<label for="server_Type">'+serverType+'</label><input type="hidden" name="server_type" value="'+serverType+'">');
adjustForm(serverType);
adjustForm();
jQuery('#server_type').change(function(){
serverType = $(this).val();
adjustForm(serverType);
adjustForm();
});
function adjustForm(serverType){
function adjustForm(){
if(serverType == "nginx"){
jQuery('.nginx').show();
jQuery('.apache').hide();
......
......@@ -43,7 +43,11 @@ if($_SESSION["s"]["user"]["typ"] == 'admin') {
$sql = "SELECT ip_address FROM server_ip WHERE ip_type = '$ip_type' AND server_id = $server_id";
$ips = $app->db->queryAllRecords($sql);
// $ip_select = "<option value=''></option>";
$ip_select = "*";
if($ip_type == 'IPv4'){
$ip_select = "*";
} else {
$ip_select = "";
}
if(is_array($ips)) {
foreach( $ips as $ip) {
//$selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
......
......@@ -56,16 +56,16 @@
<script language="JavaScript" type="text/javascript">
var webId = jQuery('input[name="id"]').val();
var serverId;
getServerId(webId);
adjustForm(serverId);
getServerId();
adjustForm();
function getServerId(webId){
function getServerId(){
jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : webId, type : "getserverid"}, function(data) {
serverId = data.serverid;
});
}
function adjustForm(serverId){
function adjustForm(){
jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) {
if(data.servertype == "nginx"){
jQuery('.nginx').show();
......
......@@ -15,14 +15,14 @@
<input type="hidden" name="server_id" value="{tmpl_var name='server_id_value'}" />
<tmpl_else>
<label for="server_id">{tmpl_var name='server_id_txt'}</label>
<select name="server_id" id="server_id" class="selectInput" onChange="reloadWebIP()">
<select name="server_id" id="server_id" class="selectInput">
{tmpl_var name='server_id'}
</select>
</tmpl_if>
</div>
<div class="ctrlHolder">
<label for="client_group_id">{tmpl_var name='client_group_id_txt'}</label>
<select name="client_group_id" id="client_group_id" class="selectInput" onChange="reloadWebIP()">
<select name="client_group_id" id="client_group_id" class="selectInput">
{tmpl_var name='client_group_id'}
</select>
</div>
......@@ -30,7 +30,7 @@
<tmpl_if name="is_reseller">
<div class="ctrlHolder">
<label for="client_group_id">{tmpl_var name='client_group_id_txt'}</label>
<select name="client_group_id" id="client_group_id" class="selectInput" onChange="reloadWebIP()">
<select name="client_group_id" id="client_group_id" class="selectInput">
{tmpl_var name='client_group_id'}
</select>
</div>
......@@ -133,6 +133,7 @@
</div>
<script language="JavaScript" type="text/javascript">
var serverId;
var clientGroupId = jQuery('#client_group_id').val();
var serverIdDisabled = jQuery('#server_id_disabled').val();
if(serverIdDisabled > 0){
serverId = serverIdDisabled;
......@@ -140,12 +141,18 @@
serverId = jQuery('#server_id').val();
jQuery('#server_id').change(function(){
serverId = $(this).val();
adjustForm(serverId);
adjustForm();
reloadWebIP();
});
}
adjustForm(serverId);
adjustForm();
function adjustForm(serverId){
jQuery('#client_group_id').change(function(){
clientGroupId = $(this).val();
reloadWebIP();
});
function adjustForm(){
jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) {
if(data.servertype == "nginx"){
var selected = jQuery('#php').val();
......@@ -166,8 +173,8 @@
}
function reloadWebIP() {
loadOptionInto('ip_address','sites/ajax_get_ip.php?ip_type=IPv4&server_id='+document.getElementById('server_id').value)&client_group_id='+document.getElementById('client_group_id').value);
loadOptionInto('ipv6_address','sites/ajax_get_ip.php?ip_type=IPv6&server_id='+document.getElementById('server_id').value)&client_group_id='+document.getElementById('client_group_id').value);
loadOptionInto('ip_address','sites/ajax_get_ip.php?ip_type=IPv4&server_id='+serverId+'&client_group_id='+clientGroupId);
loadOptionInto('ipv6_address','sites/ajax_get_ip.php?ip_type=IPv6&server_id='+serverId+'&client_group_id='+clientGroupId);
}
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment