diff --git a/phpBB/adm/style/acp_attachments.html b/phpBB/adm/style/acp_attachments.html index 78d937b967..6448c51c80 100644 --- a/phpBB/adm/style/acp_attachments.html +++ b/phpBB/adm/style/acp_attachments.html @@ -208,7 +208,11 @@
-
+
+ + {% from 'form_macros.twig' import select %} + {{ select(EXT_GROUP_SIZE_OPTIONS) }} +
diff --git a/phpBB/adm/style/form_macros.twig b/phpBB/adm/style/form_macros.twig index 124f066093..845d039ddd 100644 --- a/phpBB/adm/style/form_macros.twig +++ b/phpBB/adm/style/form_macros.twig @@ -8,6 +8,7 @@ {% if form_data.maxlength %}maxlength="{{ form_data.maxlength }}"{% endif %} {% if form_data.min %}min="{{ form_data.min }}"{% endif %} {% if form_data.max %}max="{{ form_data.max }}"{% endif %} + {% if form_data.step %}step="{{ form_data.step }}"{% endif %} {% if form_data.type == 'password' %}autocomplete="off"{% endif %} {% if form_data.checked %}checked="checked"{% endif %} {% if form_data.class %}class="{{ form_data.class }}"{% endif %} diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index c03cda951a..329900130e 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -794,7 +794,10 @@ class acp_attachments 'ASSIGNED_EXTENSIONS' => $assigned_extensions, 'S_CATEGORY_SELECT' => $this->category_select('special_category', $group_id, 'category'), - 'S_EXT_GROUP_SIZE_OPTIONS' => size_select_options($size_format), + 'EXT_GROUP_SIZE_OPTIONS' => [ + 'name' => 'size_select', + 'options' => size_select_options($size_format), + ], 'S_EXTENSION_OPTIONS' => $s_extension_options, 'S_FILENAME_LIST' => $filename_list, 'S_EDIT_GROUP' => true, @@ -1723,8 +1726,23 @@ class acp_attachments $size_var = $filesize['si_identifier']; $value = $filesize['value']; - // size and maxlength must not be specified for input of type number - return ' '; + return [ + [ + 'tag' => 'input', + 'id' => $key, + 'type' => 'number', + 'name' => 'config[' . $key . ']', + 'min' => 0, + 'max' => 999999999999999, + 'step' => 'any', + 'value' => $value, + ], + [ + 'tag' => 'select', + 'name' => $key, + 'options' => size_select_options($size_var), + ] + ]; } /** diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 621d1a284e..4eaedc4041 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -160,20 +160,23 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = */ function size_select_options($size_compare) { - global $user; + global $language; - $size_types_text = array($user->lang['BYTES'], $user->lang['KIB'], $user->lang['MIB']); + $size_types_text = array($language->lang('BYTES'), $language->lang('KIB'), $language->lang('MIB')); $size_types = array('b', 'kb', 'mb'); - $s_size_options = ''; + $size_options = []; for ($i = 0, $size = count($size_types_text); $i < $size; $i++) { - $selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : ''; - $s_size_options .= ''; + $size_options[] = [ + 'value' => $size_types[$i], + 'selected' => $size_compare == $size_types[$i], + 'label' => $size_types_text[$i], + ]; } - return $s_size_options; + return $size_options; } /** diff --git a/phpBB/styles/all/template/macros/form_macros.twig b/phpBB/styles/all/template/macros/form_macros.twig index 124f066093..845d039ddd 100644 --- a/phpBB/styles/all/template/macros/form_macros.twig +++ b/phpBB/styles/all/template/macros/form_macros.twig @@ -8,6 +8,7 @@ {% if form_data.maxlength %}maxlength="{{ form_data.maxlength }}"{% endif %} {% if form_data.min %}min="{{ form_data.min }}"{% endif %} {% if form_data.max %}max="{{ form_data.max }}"{% endif %} + {% if form_data.step %}step="{{ form_data.step }}"{% endif %} {% if form_data.type == 'password' %}autocomplete="off"{% endif %} {% if form_data.checked %}checked="checked"{% endif %} {% if form_data.class %}class="{{ form_data.class }}"{% endif %}