%PDF- %PDF-
Direktori : /var/www/projetos/suporte.iigd.com.br/plugins/glpiinventory/templates/forms/ |
Current File : //var/www/projetos/suporte.iigd.com.br/plugins/glpiinventory/templates/forms/iprange.html.twig |
{# # --------------------------------------------------------------------- # GLPI Inventory Plugin # Copyright (C) 2021 Teclib' and contributors. # # http://glpi-project.org # # based on FusionInventory for GLPI # Copyright (C) 2010-2021 by the FusionInventory Development Team. # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI Inventory Plugin. # # GLPI Inventory Plugin is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # GLPI Inventory Plugin is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with GLPI Inventory Plugin. If not, see <https://www.gnu.org/licenses/>. # --------------------------------------------------------------------- #} {% extends "generic_show_form.html.twig" %} {% import 'components/form/fields_macros.html.twig' as fields %} {% set params = params ?? [] %} {% block more_fields %} {{ fields.nullField() }} {{ _self.ipField( 'ip_start', item.fields['ip_start'], __('Start of IP range', 'glpiinventory'), ) }} {{ fields.nullField() }} {{ _self.ipField( 'ip_end', item.fields['ip_end'], __('End of IP range', 'glpiinventory'), ) }} <script type='text/javascript'> function endip(index) { if ($('#ip_end' + index).val() == '') { if (index == 3) { $('#ip_end' + index).val('254'); } else { $('#ip_end' + index).val($('#ip_start' + index).val()); } } } $(function() { $("input[name^='ip_end']").focus(function() { endip($(this).data('index')); }); }); </script> {% if is_multi_entities_mode() %} {{ fields.nullField() }} {{ fields.dropdownField( 'Entity', 'entities_id', item.fields['entities_id'], 'Entity'|itemtype_name, ) }} {% endif %} {% endblock %} {% macro ipField(name, value, label = '', options = {}) %} {% set field %} {% if value|length == 0 %} {% set value = '...' %} {% endif %} {% set ipexploded = value|split('.') %} {% for ipnum in ipexploded %} {% if ipnum > 255 %} {% set ipexploded = ipexploded|merge({(loop.index0): ''}) %} {% endif %} {% endfor %} <div class="row flex-nowrap"> <div class="col-auto"> <input type="text" class="form-control" value="{{ ipexploded[0] }}" name="{{ name }}0" id="{{ name }}0" data-index="0" size="2" maxlength="3"> </div> <div class="col-auto"> <input type="text" class="form-control" value="{{ ipexploded[1] }}" name="{{ name }}1" id="{{ name }}1" data-index="1" size="2" maxlength="3"> </div> <div class="col-auto"> <input type="text" class="form-control" value="{{ ipexploded[2] }}" name="{{ name }}2" id="{{ name }}2" data-index="2" size="2" maxlength="3" > </div> <div class="col-auto"> <input type="text" class="form-control" value="{{ ipexploded[3] }}" name="{{ name }}3" id="{{ name }}3" data-index="3" size="2" maxlength="3"> </div> </div> {% endset %} {{ fields.field(name, field, label, options) }} {% endmacro %}