Browse Source
Make everything more user-friendly and streamlined. Port and and # of connections are now placed under 'Show more'. Clicking SSL will change the port to 563. Username and option for SSL removed from the wizard, they can be enabled in the Config.pull/365/head
committed by
shypike
11 changed files with 459 additions and 530 deletions
@ -1,2 +1,2 @@ |
|||
</body> |
|||
</body> |
|||
</html> |
@ -1,110 +1,78 @@ |
|||
function checkRequired() |
|||
{ |
|||
if ($("#host").val() && $("#connections").val()) |
|||
{ |
|||
$("#next-button").removeAttr("disabled"); |
|||
function checkRequired() { |
|||
if ($("#host").val() && $("#connections").val()) { |
|||
$("#next-button").removeClass('disabled') |
|||
return true; |
|||
} else { |
|||
$("#next-button").attr("disabled","disabled"); |
|||
$("#next-button").addClass('disabled') |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
$(document).ready(function() { |
|||
checkRequired() |
|||
$("#serverTest").click(function(){ |
|||
// Add tooltips
|
|||
$('[data-toggle="tooltip"]').tooltip() |
|||
|
|||
// On form-submit
|
|||
$("#serverTest").click(function() { |
|||
$('#serverResponse').html(txtChecking); |
|||
$.getJSON( |
|||
"../tapi?mode=config&name=test_server&output=json", |
|||
$("form").serialize(), |
|||
function(result) { |
|||
if (result.value.result){ |
|||
cls = "success" |
|||
if (result.value.result) { |
|||
r = '<span class="success"><span class="glyphicon glyphicon-ok"></span> ' + result.value.message + '</span>'; |
|||
} else { |
|||
cls = "failed" |
|||
r = '<span class="failed"><span class="glyphicon glyphicon-minus-sign"></span> ' + result.value.message + '</span>'; |
|||
} |
|||
r = '<span class="' + cls + '">' + result.value.message + '</span>'; |
|||
|
|||
$('#serverResponse').html(r); |
|||
} |
|||
); |
|||
return false; |
|||
}); |
|||
$(".validate-text").blur(function(){ |
|||
if (this.value || this.checked){ |
|||
$(this).removeClass("incorrect"); |
|||
$(this).addClass("correct"); |
|||
} else { |
|||
$(this).removeClass("correct"); |
|||
} |
|||
}); |
|||
$(".validate-text-required").blur(function(){ |
|||
if (this.value || this.checked){ |
|||
$(this).removeClass("incorrect"); |
|||
$(this).addClass("correct"); |
|||
} else { |
|||
$(this).removeClass("correct"); |
|||
$(this).addClass("incorrect"); |
|||
} |
|||
}); |
|||
$(".validate-numeric").blur(function(){ |
|||
if (this.value && isFinite(this.value)){ |
|||
$(this).removeClass("incorrect"); |
|||
$(this).addClass("correct"); |
|||
} else { |
|||
$(this).removeClass("correct"); |
|||
} |
|||
}); |
|||
$(".validate-numeric-required").blur(function(){ |
|||
if (this.value && isFinite(this.value)){ |
|||
|
|||
$("#port, #connections").bind('keyup blur', function() { |
|||
if (this.value > 0) { |
|||
$(this).removeClass("incorrect"); |
|||
$(this).addClass("correct"); |
|||
} else { |
|||
$(this).removeClass("correct"); |
|||
$(this).addClass("incorrect"); |
|||
} |
|||
checkRequired() |
|||
}); |
|||
|
|||
$("#connections").bind('keyup blur',function(){ |
|||
if (this.value && isFinite(this.value)){ |
|||
$("#host, #username, #password").bind('keyup blur', function() { |
|||
if (this.value) { |
|||
$(this).removeClass("incorrect"); |
|||
$(this).addClass("correct"); |
|||
$("#connections-tip").removeClass("hidden"); |
|||
$("#connections-error").addClass("hidden"); |
|||
checkRequired(); |
|||
} else { |
|||
$(this).removeClass("correct"); |
|||
$(this).addClass("incorrect"); |
|||
$("#connections-tip").addClass("hidden"); |
|||
$("#connections-error").removeClass("hidden"); |
|||
checkRequired(); |
|||
} |
|||
checkRequired(); |
|||
}); |
|||
|
|||
$("#port").bind('keyup blur',function(){ |
|||
if (!this.value || isFinite(this.value)){ |
|||
$(this).removeClass("incorrect"); |
|||
$(this).addClass("correct"); |
|||
$("#port-tip").removeClass("hidden"); |
|||
$("#port-error").addClass("hidden"); |
|||
$('#ssl').click(function() { |
|||
if(this.checked) { |
|||
// Enabled SSL change port when not already a custom port
|
|||
if($('#port').val() == '119') { |
|||
$('#port').val('563') |
|||
} |
|||
} else { |
|||
$(this).removeClass("correct"); |
|||
$(this).addClass("incorrect"); |
|||
$("#port-tip").addClass("hidden"); |
|||
$("#port-error").removeClass("hidden"); |
|||
// Remove SSL port
|
|||
if($('#port').val() == '563') { |
|||
$('#port').val('119') |
|||
} |
|||
}); |
|||
} |
|||
}) |
|||
|
|||
$("#host").bind('keyup blur',function(){ |
|||
if (this.value){ |
|||
$(this).removeClass("incorrect"); |
|||
$(this).addClass("correct"); |
|||
$("#host-tip").removeClass("hidden"); |
|||
$("#host-error").addClass("hidden"); |
|||
checkRequired(); |
|||
} else { |
|||
$(this).removeClass("correct"); |
|||
$(this).addClass("incorrect"); |
|||
$("#host-tip").addClass("hidden"); |
|||
$("#host-error").removeClass("hidden"); |
|||
checkRequired(); |
|||
checkRequired() |
|||
|
|||
$('form').submit(function(event) { |
|||
// Double check
|
|||
if(!checkRequired()) { |
|||
event.preventDefault(); |
|||
} |
|||
}); |
|||
}) |
|||
}); |
@ -1,62 +1,38 @@ |
|||
function toggleWebPass() |
|||
{ |
|||
var web |
|||
web = $('#enable_webpass').attr('checked') |
|||
if ($('#enable_webpass').attr('checked') == 1) |
|||
{ |
|||
$('#web_user').attr("disabled",""); |
|||
$('#web_pass').attr("disabled",""); |
|||
|
|||
} else { |
|||
$('#web_user').attr("disabled","disabled"); |
|||
$('#web_pass').attr("value",""); |
|||
$('#web_pass').attr("disabled","disabled"); |
|||
$('#web_user').attr("value",""); |
|||
} |
|||
}; |
|||
|
|||
|
|||
function checkRequired() |
|||
{ |
|||
if ($("#bandwidth").val()) |
|||
{ |
|||
$("#next-button").removeAttr("disabled"); |
|||
function checkRequired() { |
|||
if ($("#bandwidth").val()) { |
|||
$("#next-button").removeClass('disabled') |
|||
return true; |
|||
} else { |
|||
$("#next-button").attr("disabled","disabled"); |
|||
$("#next-button").addClass('disabled') |
|||
return false; |
|||
} |
|||
}; |
|||
|
|||
} |
|||
|
|||
$(document).ready(function() { |
|||
checkRequired(); |
|||
toggleWebPass(); |
|||
// Add tooltips
|
|||
$('[data-toggle="tooltip"]').tooltip() |
|||
|
|||
$(".validate-text-required").blur(function(){ |
|||
if (this.value || this.checked){ |
|||
// Check
|
|||
$("#bandwidth").bind('keyup blur', function() { |
|||
if (this.value) { |
|||
$(this).removeClass("incorrect"); |
|||
$(this).addClass("correct"); |
|||
} else { |
|||
$(this).removeClass("correct"); |
|||
$(this).addClass("incorrect"); |
|||
} |
|||
}); |
|||
$("#bandwidth").bind('keyup blur',function(){ |
|||
if (this.value){ |
|||
$(this).removeClass("incorrect"); |
|||
$(this).addClass("correct"); |
|||
$("#bandwidth-tip").removeClass("hidden"); |
|||
$("#bandwidth-error").addClass("hidden"); |
|||
checkRequired(); |
|||
} else { |
|||
$(this).removeClass("correct"); |
|||
$(this).addClass("incorrect"); |
|||
$("#bandwidth-tip").addClass("hidden"); |
|||
$("#bandwidth-error").removeClass("hidden"); |
|||
checkRequired(); |
|||
} |
|||
checkRequired() |
|||
}); |
|||
|
|||
$('#enable_webpass').bind('change click focus', function() { |
|||
toggleWebPass(); |
|||
}); |
|||
checkRequired() |
|||
|
|||
$('form').submit(function(event) { |
|||
// Double check
|
|||
if(!checkRequired()) { |
|||
event.preventDefault(); |
|||
} |
|||
}) |
|||
}); |
|||
|
|||
|
Loading…
Reference in new issue