Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF Viewer Macro not modified to support attachment picker #14

silviamacovei opened this issue May 14, 2020 · 1 comment

PDF Viewer Macro not modified to support attachment picker #14

silviamacovei opened this issue May 14, 2020 · 1 comment


Copy link

Comment from @ldubost : It seems "org.xwiki.model.reference.AttachmentReference" needs to be added to the field definition.

Copy link

mflorea commented Sep 25, 2020

The file parameter accepts an URL as value, besides an attachment name. So if we're going to use the attachment picker we need to make sure we can still set an URL (e.g. by allowing "free" values).

Then, setting the parameter type to org.xwiki.model.reference.AttachmentReference with the object editor is a first step. It would allow the user to easily select an attachment, but it wouldn't limit the suggestions to PDF attachments, which is what we want. For this we need to follow what has been done for the Office Viewer macro:

  • create a PDFResourceReference Java type similar to OfficeResourceReference. For this we need a new (Java) module in the macro-pdfviewer.
  • set the type of the file PDF macro parameter to PDFResourceReference
  • in the newly created Java module, add a template to control how the PDFResourceReference parameters are displayed, following what we did for OfficeResourceReference.
  • modify the POM of the wiki module to depend on the Java module, using an optional dependency for now.

We need to be careful that support for binding a picker to a macro parameter type is available since 10.11 I think. So we probably need to edit the PDF Viewer macro on a recent version of XWiki, set the parameter type, export as XAR, add to source tree, apply xar:format, drop unneeded stuff, build for 9.11 and check if we can import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

4 participants