mirror of
https://github.com/unraid/webgui.git
synced 2025-12-31 22:50:25 -06:00
74 lines
2.8 KiB
Plaintext
74 lines
2.8 KiB
Plaintext
Menu="OtherSettings"
|
|
Type="xmenu"
|
|
Title="Identification"
|
|
Icon="icon-home"
|
|
Tag="home"
|
|
---
|
|
<?PHP
|
|
/* Copyright 2005-2023, Lime Technology
|
|
* Copyright 2012-2023, Bergware International.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*/
|
|
?>
|
|
<?
|
|
$disabled = $var['fsState']!='Stopped' ? 'disabled' : '';
|
|
$name_regex = '^[A-Za-z0-9]([A-Za-z0-9\-\.]{0,13}[A-Za-z0-9])?$';
|
|
$name_warn = preg_match('/'.$name_regex.'/', $var['NAME']) ? 'none' : 'block';
|
|
?>
|
|
<form markdown="1" name="NameSettings" method="POST" action="/update.htm" target="progressFrame">
|
|
<input type="hidden" name="server_https" value="<?=_var($_SERVER,'HTTPS')?>">
|
|
<input type="hidden" name="server_name" value="<?=_var($_SERVER,'HTTP_HOST')?>">
|
|
<input type="hidden" name="server_addr" value="<?=_var($_SERVER,'SERVER_ADDR')?>">
|
|
|
|
_(Server name)_:
|
|
: <input type="text" name="NAME" id="NAME" maxlength="15" pattern="<?=$name_regex?>" value="<?=htmlspecialchars(_var($var,'NAME'))?>" title="_(Only alphanumeric characters)_ ("A-Z", "a-z", and "0-9"), dashes ("-"), and dots ("."); _(and, the first and last characters must be alphanumeric)_" <?=$disabled?> required> <span id="name_warning" style="display:<?=$name_warn?>"><i class="fa fa-warning icon warning"></i> _(Not compatible with NetBIOS)_</span>
|
|
|
|
:id_server_name_help:
|
|
|
|
_(Description)_:
|
|
: <input type="text" name="COMMENT" id="COMMENT" value="<?=htmlspecialchars(_var($var,'COMMENT'))?>" <?=$disabled?>>
|
|
|
|
:id_description_help:
|
|
|
|
_(Model)_:
|
|
: <input type="text" name="SYS_MODEL" id="SYS_MODEL" value="<?=htmlspecialchars(_var($var,'SYS_MODEL'))?>" <?=$disabled?>>
|
|
|
|
:id_model_help:
|
|
|
|
|
|
: <span class="inline-block">
|
|
<input type="submit" name="changeNames" value="_(Apply)_" disabled>
|
|
<input type="button" value="_(Done)_" onclick="done()">
|
|
</span>
|
|
<?if ($disabled):?>*_(Array must be **Stopped** to change)_*<?endif;?>
|
|
</form>
|
|
|
|
<script>
|
|
$("#NAME").keypress(function(event) {
|
|
return event.key.match(/[A-Za-z0-9\-\.]/)!==null;
|
|
});
|
|
|
|
$("#NAME").on("input change", function() {
|
|
if ($(this).val().match(/<?=$name_regex;?>/) === null) {
|
|
$('#name_warning').fadeIn('fast');
|
|
} else {
|
|
$('#name_warning').fadeOut('fast');
|
|
}
|
|
});
|
|
|
|
/* Sanitize the COMMENT and SYS_MODEL fields on form submission */
|
|
document.forms['NameSettings'].addEventListener('submit', function(event) {
|
|
const commentField = document.getElementById('COMMENT');
|
|
commentField.value = commentField.value.replace(/["\\]/g, '');
|
|
|
|
const sysModelField = document.getElementById('SYS_MODEL');
|
|
sysModelField.value = sysModelField.value.replace(/["\\]/g, '');
|
|
});
|
|
</script>
|