Attachment-UI macro - version summary missing

Hi, I’m tyring to use the attachment-ui macro because it allows version summaries (for the attachment) to be entered when uploading. For some reason, it works on my test wiki but not on my live wiki. I’m using xwiki-tomcat8-common/stable 9.9 on Ubuntu 16.04 on both boxes.

For the macro embedded code, I’m using examples from the attachment-ui page on xwiki.org, and have set versionSummary="true". I’m using the wiki as an admin user.

Any ideas on solving this would be welcome, TIA!

If you’re referring to http://extensions.xwiki.org/xwiki/bin/view/Extension/Attachment+Selector+Macro then see the comments on https://jira.xwiki.org/browse/XWIKI-14160 .

Thanks for the reply, Marius. That is the extension I mean.

The problem is I cannot add the comment when the file selector comes up: https://i.imgur.com/Ufg9VXJ.png I didn’t change any templates on the xwiki installation where it does work, not sure if the changes in that jira reflect on this issue. I did try adding the div suggested on that page, it hasn’t changed anything.

Looking at the velocity code for the macro, it seems to hinge on

#if ($xwiki.hasEditComment() && $options.versionSummary)

I’ve updated xwiki.cfg to set comment editing, but that doesn’t seem to make a difference. I’m probably misunderstanding something, please let me know …

Thanks again :slight_smile:

You need to find where the Attachment Selector Macro ( http://extensions.xwiki.org/xwiki/bin/view/Extension/Attachment+Selector+Macro ) is called and set the versionSummary parameter, e.g.:

{{attachmentSelector ... versionSummary="true" /}}

Hi, thanks again for responding. I’m using this (from the examples) to call the attachment selector:

{{attachmentSelector classname="Sandbox.Demo" property="avatar" savemode="direct" versionSummary="true" displayImage="true" width="120" link="true" filter="png,jpg,gif" defaultValue="XWiki.XWikiUserSheet@noavatar.png"/}}

I have full edit/view/comment rights on the page in question.

On my test box, the attachment selector comes up with a version summary field, but on the live one it doesn’t.

If I go back to edit the page and insert the macro using the form, the option to set “Version Summary” is also missing:

I’m not sure why this is different, and would appreciate some advice. I’ve looked at the xwiki.cfg options shown in the jira you linked, but that’s not the issue afaict.

I noticed in the source code for the attachment ui that it’s looking for $xwiki.hasEditComment to be set to true (line 224) so I put that in a velocity macro in the page, and I can confirm, it is set to true. Not sure where to look after that, I’m still going through the source code.

BTW, I didn’t realise when you first replied that you are the developer. Thanks for taking the time to get back to me, and for writing the macro :slight_smile:

As indicated on http://extensions.xwiki.org/xwiki/bin/view/Extension/Attachment+Selector+Macro#HParameters the version summary parameter is available since XWiki 9.5RC1. Do you have the same XWiki version on the test instance and on the live instance? It looks like you have an older version of XWiki on the live instance.

Yes, they’re both running on Ubuntu 16.04.3 LTS with this xwiki software installed via apt:

/# apt list --installed|grep xwiki

xwiki-common/stable,now 9.9 all [installed,automatic]
xwiki-mysql-common/stable,now 9.9 all [installed,automatic]
xwiki-tomcat8-common/stable,now 9.9 all [installed,automatic]
xwiki-tomcat8-mysql/stable,now 9.9 all [installed]

The only other thing I looked at was that the live system is proxied through Apache, but when I tried bypassing that I had the same problem.

I put this

{{attachmentSelector classname="Sandbox.Demo" property="avatar" savemode="direct" versionSummary="true" displayImage="true" width="120" link="true" filter="png,jpg,gif" defaultValue="XWiki.XWikiUserSheet@noavatar.png"/}}

in a new page on a XWiki 9.9 instance and I get the version summary field. Did you had a previous version of XWiki installed? Is 9.9 a clean install or an upgrade. Maybe the Attachment Selector Macro was not upgraded.

I’m not getting the version summary using that code. It was a new install and content was migrated by exporting from an older xwiki into the new production xwiki. Could this have introduced an issue? The attachment-ui in the new wiki is v9.9.

Check /xwiki/bin/view/XWiki/AttachmentSelector#History . If you have other versions besides 1.1 and “Version coming from extension Attachment Application 9.9” then it probably means that you have overwritten the 9.9 version of the Attachment Selector with an older version. You should have imported / migrated only your own pages (that were created by you) and not the standard pages (like the Attachment Selector pages). If the summary of version 1.1 is “Install extension [org.xwiki.platform:xwiki-platform-attachment-ui/9.9]” then you can try to rollback to it.

That looks like a real possibility. I have this:

So at some point I’ll take a backup and try a rollback. Thanks for the help, it looks very promising.

Yes, it worked. Many thanks for staying with me through this journey, this was a show-stopping issue for me.