This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-2d1ec87a-105e-4ccc-9ea2-cbd1fa3a45b0 XWIKI-25568 Open

Offer an attachment picker for the jars of the script macros

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-f1a18fcc-43b7-40f4-921e-eacd08481fe9 Charpentier Lucas created this issue on 23/Oct/26 14:38
 
Summary: Offer an attachment picker for the jars of the script macros
Issue Type: cid:jira-generated-image-avatar-2d1ec87a-105e-4ccc-9ea2-cbd1fa3a45b0 Improvement
Affects Versions: 17.10.14, 18.8.0
Assignee: Unassigned
Components: Rendering - Script Macro, Web - Templates & Resources
Created: 23/Oct/26 14:38
Priority: cid:jira-generated-image-static-major-3421879e-1e76-40c2-ab8c-c9f833009cd3 Major
Reporter: Charpentier Lucas
Description:

The script macros take the libraries to add to their class loader in the jars parameter: attachment references or URLs, in one free text field of the Edit Macro dialog. The user has to type the reference of each attachment, with no way to browse or upload one, and a reference to a missing attachment is only reported at rendering, with a message about the input stream or the script engine, or not at all.

The parameter is declared once, in ScriptMacroParameters.java, for the script, groovy, python and velocity macros.

The main problems:

  • The attachment picker, #attachmentPicker of macros.vm, already takes several values and uploads several files at once, but no HTML displayer offers it for a list of attachments: there is an edit template for AttachmentReference only.
  • The parameter is a single string, which also accepts URLs, so giving it a list type changes the API of ScriptMacroParameters and has to keep the URLs working.

Proposal

  • Add an HTML displayer edit template for List<AttachmentReference> that calls #attachmentPicker with several values, like the list templates proposed in PR #5999 for XWIKI-23834.
  • Give jars a display type that uses it, while still accepting a URL next to the picked attachments, and keeping the getter and setter of the string value for backward compatibility.
  • Do it together with XWIKI-25509, which declares the separator of the same parameter.

KOs covered

Macro Criterion Parameter Problem
groovy C4 input-assistance jars A free text field for attachment references or URLs, with no picker; a missing attachment gives the unclear message "inputStream".
python C4 input-assistance jars A free text field for attachment references or URLs, with no picker; a missing attachment is reported as a missing script engine.
script C4 input-assistance jars A free text field for attachment references or URLs, with no picker; a missing attachment is reported as a missing script engine.
velocity C4 input-assistance jars A free text field for attachment references or URLs, with no picker; a missing attachment is accepted silently.

Impact found on macro fluidity

These 4 KOs come from the WYSIWYG usability audit of the macros, under the criterion C4 input-assistance of its usability criteria, where they are minor, since the field takes free text. The page of each macro, linked in the table, has the full notes.