Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25568

Offer an attachment picker for the jars of the script macros

    XMLWordPrintable

Details

    • Unknown

    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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Lucas C Charpentier Lucas
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: