{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2024 Teclib' and contributors. # @copyright 2003-2014 by the INDEPNET Development Team. # @licence https://www.gnu.org/licenses/gpl-3.0.html # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # --------------------------------------------------------------------- #} {% import 'components/form/fields_macros.html.twig' as fields %} {% import 'components/form/basic_inputs_macros.html.twig' as inputs %} {% set lang = lang|default(null) %} {% set comment_id = comment_id|default(false) %} {% set parent_comment_id = parent_comment_id|default(false) %} {% set rand = random() %} {% set edit = edit|default(false) %} {% set comment_style = (edit == false or parent_comment_id != false) %}
{% if comment_style %} {{ include('components/user/picture.html.twig', { 'users_id': session('glpiID'), 'with_link': false, }, with_context = false) }} {% endif %}
{{ inputs.hidden('_glpi_csrf_token', csrf_token()) }} {{ inputs.hidden('knowbaseitems_id', kbitem_id) }} {% if lang is not null %} {{ inputs.hidden('language', lang) }} {% endif %} {% if parent_comment_id %} {{ inputs.hidden('parent_comment_id', parent_comment_id) }} {% endif %} {% if comment_id %} {{ inputs.hidden('id', comment_id) }} {% endif %} {% set btn %}
{% if comment_id or parent_comment_id %}
{{ inputs.button('cancel', __('Cancel'), 'reset', 1, { class: 'btn btn-ghost-secondary' }) }}
{% endif %}
{{ inputs.submit(comment_id ? 'edit' : 'add', comment_id ? _x('button', 'Edit') : _x('button', 'Add'), 1) }}
{% endset %} {% if comment_id %}
{% endif %}
{{ fields.textareaField('comment', comment, null, { no_label: true, full_width: true, add_field_html: btn, add_field_class: 'd-flex flex-column', required: true, }) }}