diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index 83dd633d22..07f1eb7e5e 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -1223,7 +1223,7 @@ "name": "max_avatar_height", "type": "double", "label": "Maximum Avatar Height (meters)", - "help": "Limits the scale of avatars in your domain. Cannot be greater than 1755.", + "help": "Limits the height of avatars in your domain. Cannot be greater than 1755.", "placeholder": 5.2, "default": 5.2 }, diff --git a/domain-server/resources/web/settings/js/settings.js b/domain-server/resources/web/settings/js/settings.js index e67ea43158..3888277c00 100644 --- a/domain-server/resources/web/settings/js/settings.js +++ b/domain-server/resources/web/settings/js/settings.js @@ -58,7 +58,11 @@ $(document).ready(function(){ } Settings.handlePostSettings = function(formJSON) { - + + if (!verifyAvatarHeights()) { + return false; + } + // check if we've set the basic http password if (formJSON["security"]) { @@ -207,7 +211,7 @@ $(document).ready(function(){ swal({ title: '', type: 'error', - text: "There was a problem retreiving domain information from High Fidelity API.", + text: "There was a problem retrieving domain information from High Fidelity API.", confirmButtonText: 'Try again', showCancelButton: true, closeOnConfirm: false @@ -288,7 +292,7 @@ $(document).ready(function(){ swal({ title: 'Create new domain ID', type: 'input', - text: 'Enter a label this machine.

This will help you identify which domain ID belongs to which machine.

', + text: 'Enter a label for this machine.

This will help you identify which domain ID belongs to which machine.

', showCancelButton: true, confirmButtonText: "Create", closeOnConfirm: false, @@ -669,7 +673,7 @@ $(document).ready(function(){ var spinner = createDomainSpinner(); $('#' + Settings.PLACES_TABLE_ID).after($(spinner)); - var errorEl = createDomainLoadingError("There was an error retreiving your places."); + var errorEl = createDomainLoadingError("There was an error retrieving your places."); $("#" + Settings.PLACES_TABLE_ID).after(errorEl); // do we have a domain ID? @@ -1091,4 +1095,43 @@ $(document).ready(function(){ $('#settings_backup .panel-body').html(html); } + + function verifyAvatarHeights() { + var errorString = ''; + var minAllowedHeight = 0.009; + var maxAllowedHeight = 1755; + var alertCss = { backgroundColor: '#ffa0a0' }; + var minHeightElement = $('input[name="avatars.min_avatar_height"]'); + var maxHeightElement = $('input[name="avatars.max_avatar_height"]'); + + var minHeight = Number(minHeightElement.val()); + var maxHeight = Number(maxHeightElement.val()); + + if (maxHeight < minHeight) { + errorString = 'Maximum avatar height must not be less than minimum avatar height
'; + minHeightElement.css(alertCss); + maxHeightElement.css(alertCss); + }; + if (minHeight < minAllowedHeight) { + errorString += 'Minimum avatar height must not be less than ' + minAllowedHeight + '
'; + minHeightElement.css(alertCss); + } + if (maxHeight > maxAllowedHeight) { + errorString += 'Maximum avatar height must not be greater than ' + maxAllowedHeight + '
'; + maxHeightElement.css(alertCss); + } + + if (errorString.length > 0) { + swal({ + type: 'error', + title: '', + text: errorString, + html: true + }); + return false; + } else { + return true; + } + + } });