From ae4ffb130f21110be454fc88cda2afec2e461150 Mon Sep 17 00:00:00 2001 From: Emily Lamancusa Date: Fri, 28 Feb 2025 15:22:14 -0500 Subject: [PATCH] Bug 38842: Add reusable modal wrapper This patch adds the block modal_wrapper to html_helpers.inc. NOTE: The caller is responsible for sanitizing all data inputs. Minimal usage: [% WRAPPER modal_wrapper modal_id= modal_header_contents= %] [ % END %] The above will produce an informational modal with an "OK" button to dismiss, and no actions taken. Optional parameters to add functionality to the modal: noblock=1 - if the modal should not block modal_action - if the modal should submit a form, the action url for the form To add a "confirm" button that will submit the modal form: modal_confirm_text - text to show on the button (must be specified) modal_confirm_name - (optional) specify a name attribute modal_confirm_val - (optional) specify a value attribute modal_confirm_accesskey - (optional) specify an accesskey attribute To add a "print" button that will open a print window to the specified url: modal_print_text - text to show on the button (must be specified) modal_print_url - url of the page to print (must be specified) modal_print_name - (optional) specify a name attribute modal_print_accesskey - (optional) specify an accesskey attribute To add a "cancel/deny/dismiss" button: modal_deny_text - text to show on the button (must be specified) modal_deny_action - "submit" if the deny button should submit the modal (to take some denial/cancellation action) - "dismiss" if the deny button should dismiss the modal without submitting the form - This parameter can be omitted if the button should neither submit nor dismiss the modal (for example, if the button click will be handled with JS) modal_deny_name - (optional) specify a name attribute modal_deny_val - (optional) specify a value attribute modal_deny_accesskey - (optional) specify an accesskey attribute If the above generic buttons do not suffice, the below parameters can be used in addition or instead of the above options to specify custom button code and/or other customized footer content: modal_custom_confirm modal_custom_utility_button modal_custom_deny modal_footer_append --- .../prog/en/includes/html_helpers.inc | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index fc0f4cae1e7..5423943dfb5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -628,3 +628,85 @@ [% END %] + +[% BLOCK modal_wrapper %] + +[% END %] -- 2.34.1