rooms admin: Set a maximum character length
closes #525 (Room names with more than 35 characters dispatch a team of untrained monkeys)
This commit is contained in:
parent
c676e73cf6
commit
204ff4c0e7
|
@ -158,7 +158,7 @@ function admin_rooms()
|
|||
form([
|
||||
div('row', [
|
||||
div('col-md-6', [
|
||||
form_text('name', __('Name'), $name),
|
||||
form_text('name', __('Name'), $name, false, 35),
|
||||
form_checkbox('from_frab', __('Frab import'), $from_frab),
|
||||
form_text('map_url', __('Map URL'), $map_url),
|
||||
form_info('', __('The map url is used to display an iframe on the room page.')),
|
||||
|
|
|
@ -229,15 +229,18 @@ function form_submit($name, $label, $class = '', $wrapForm = true, $buttonType =
|
|||
* @param string $label
|
||||
* @param string $value
|
||||
* @param bool $disabled
|
||||
* @param int $maxlength
|
||||
* @return string
|
||||
*/
|
||||
function form_text($name, $label, $value, $disabled = false)
|
||||
function form_text($name, $label, $value, $disabled = false, $maxlength = null)
|
||||
{
|
||||
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||
$maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : '';
|
||||
|
||||
return form_element(
|
||||
$label,
|
||||
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name
|
||||
. '" value="' . htmlspecialchars($value) . '" ' . $disabled . '/>',
|
||||
. '" value="' . htmlspecialchars($value) . '"' . $maxlength . $disabled . '/>',
|
||||
'form_' . $name
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue