Scaffolding 'Attachment Options' with other content than the current page

Bjarne Knudsen January 29, 2019

Hello

I am using the Scaffolding plugins 'Attachment Options' macro inside a List Data macro. When I leave the content parameter (of the 'Attachment Options') empty it works fine and as expected: I can select Edit Contents on my page, select an attachment from the current page, and after edit it shows a link on the page, which is a working link to the selected file.

1. When I instead of leaving the content paramter (of the 'Attchment Options') empty, set it to the name of one of my pages, that exists in the same space, the selection still works as expected: I can select an attachment from that page. When I am back on the page after the "Edit Contents", I see a link named after the attachment I selected - so this is as expected - but the link is not linking to the attachment file, but instead linking to the current page. Can anybody confirm this error? Or confirm that it is working for them.

2. I actually do not want to hardcode some page to select the attachment from. I would like to be able to select from all attachments from the current space. Is it possible to do this, and what should I then write in the Content parameter field?

1 answer

0 votes
Sayed Bares [ServiceRocket]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 8, 2019

Hi Bjarne,

To answer your questions:

 

1. Can anybody confirm this error? Or confirm that it is working for them.

 

I've checked this and it is working for me. The issue might be specific to your Confluence instance.

You can raise a ticket to ServiceRocket Support through the following link:

 

2. I actually do not want to hardcode some page to select the attachment from. I would like to be able to select from all attachments from the current space. Is it possible to do this, and what should I then write in the Content parameter field?

 

With only Scaffolding you cant do that but together with Reporting Add-on you can certainly achieve the mentioned use case by importing the following storage format:

 

<p><br /></p>
<p><br /></p>
<p><br /></p>
<ac:structured-macro ac:name="list-data" ac:schema-version="1" ac:macro-id="88c65c41-5d4c-4727-9db2-c07aa531200d">
<ac:parameter ac:name="name">test</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
<p><br /></p>
<ac:structured-macro ac:name="report-block" ac:schema-version="1" ac:macro-id="7fa1c262-a4e7-45c4-bd0a-5d812f593bcd">
<ac:parameter ac:name="injected">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
<ac:structured-macro ac:name="content-reporter" ac:schema-version="1" ac:macro-id="61106bc5-db84-44e7-babc-275e2e88bc5a">
<ac:parameter ac:name="types">attachment</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
<ac:structured-macro ac:name="report-body" ac:schema-version="1" ac:macro-id="d18bb03c-9e58-4c69-9c66-f2ef6e95bc2e">
<ac:rich-text-body>
<p><br /></p>
<ac:structured-macro ac:name="list-option" ac:schema-version="1" ac:macro-id="e401a1e4-340c-4487-abd2-52803e10c45f">
<ac:parameter ac:name="value">%content:title%</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
<p><br /></p>
<p><br /></p>

 

To import the above storage format first install Reporting Add-on and then follow this documentation:

How to import storage format

Screenshot:

reporting + scaffolding.PNG

Let me know if you have any questions.

Regards,

Sayed

Bjarne Knudsen February 12, 2019

Hi Sayed

Thank you very much for your answer.

We already have the Reporting add-on, so it was easy for me to test your solution. It works for me in the way, that I can select among all attachments in the space. But as I understand it, I am actually not selecting among attachments, but only the attachment titles. So the selected item will be a string, and I cannot have a link to the attachment.

The linking functionality is why I was interested in the 'Attachment Options' macro in the first place. When selecting an Attachment option it seems like I have the attachment object and gets a link to the attchment. But I do not have enough information about what is possible with the Content field in that macro.

Is there any way I can use the Attachment Options for that in your solution, or is there something I did not get about your solution?

Regards,

Bjarne

Sayed Bares [ServiceRocket]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2019

Hi Bjarne,


You're most welcome.

And to answer your question:

 

Is there any way I can use the Attachment Options for that in your solution, or is there something I did not get about your solution?

 

Attachment options won't work with the use case you are trying to achieve and the sole reason is its un-injectable behavior. However, the following storage format will solve the Link problem:

 

<p><br /></p>
<ac:structured-macro ac:name="list-data" ac:schema-version="1" ac:macro-id="6347bd28-f617-4a64-80e2-a42a12a0ccba">
<ac:parameter ac:name="name">test</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
<ac:structured-macro ac:name="report-block" ac:schema-version="1" ac:macro-id="7fa1c262-a4e7-45c4-bd0a-5d812f593bcd">
<ac:parameter ac:name="injected">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
<ac:structured-macro ac:name="content-reporter" ac:schema-version="1" ac:macro-id="61106bc5-db84-44e7-babc-275e2e88bc5a">
<ac:parameter ac:name="types">attachment</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
<ac:structured-macro ac:name="report-body" ac:schema-version="1" ac:macro-id="d18bb03c-9e58-4c69-9c66-f2ef6e95bc2e">
<ac:rich-text-body>
<p><br /></p>
<ac:structured-macro ac:name="list-option" ac:schema-version="1" ac:macro-id="1b510cdb-eb0d-4255-93b5-bbd8d6bc4c4d">
<ac:parameter ac:name="value">%content:title%</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
<ac:structured-macro ac:name="report-block" ac:schema-version="1" ac:macro-id="7c4e5635-f9bb-4e1d-8ceb-959015bc0a7d">
<ac:parameter ac:name="injected">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
<ac:structured-macro ac:name="local-reporter" ac:schema-version="1" ac:macro-id="4b8152a9-a962-4e07-99b1-157c947c84f4">
<ac:parameter ac:name="">@self</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
<ac:structured-macro ac:name="report-header" ac:schema-version="1" ac:macro-id="58110463-dd54-4096-ae9d-1cfc458c3697">
<ac:rich-text-body>
<p><br /></p>
<ac:structured-macro ac:name="report-variable" ac:schema-version="1" ac:macro-id="42421192-a7ff-4424-b8f9-582b1d40d397">
<ac:parameter ac:name="name">X</ac:parameter>
<ac:parameter ac:name="value">%data:test&gt;first%</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
<ac:structured-macro ac:name="report-body" ac:schema-version="1" ac:macro-id="8d58ca5e-937e-4740-9e2a-3fe9acaf609f">
<ac:rich-text-body>
<p><br /></p>
<ac:structured-macro ac:name="report-table" ac:schema-version="1" ac:macro-id="aeb5931a-d07c-48e4-907f-fd68b529d61d">
<ac:parameter ac:name="injected">true</ac:parameter>
<ac:rich-text-body>
<p><br /></p>
<ac:structured-macro ac:name="content-reporter" ac:schema-version="1" ac:macro-id="543e1441-30f0-4914-9d7b-8195e5bbacec">
<ac:parameter ac:name="types">attachment</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<ac:structured-macro ac:name="text-filter" ac:schema-version="1" ac:macro-id="521cc44e-968c-4461-8b28-7c9743d0bcbd">
<ac:parameter ac:name="minLength">1</ac:parameter>
<ac:parameter ac:name="">content:title&gt;match %variable:X%&gt;value</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
<ac:structured-macro ac:name="report-column" ac:schema-version="1" ac:macro-id="c8b9f60d-4d0c-4834-a61b-bcfb150d637e">
<ac:parameter ac:name="injected">true</ac:parameter>
<ac:parameter ac:name="title">Attachment Link </ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:name="report-info" ac:schema-version="1" ac:macro-id="2b1717e1-4aa4-468d-bf13-2b2b95a950f4">
<ac:parameter ac:name="link">true</ac:parameter>
<ac:parameter ac:name="">content:title</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
</ac:rich-text-body>
</ac:structured-macro>
<p><br /></p>
<p><br /></p>
<p><br /></p>
<p class="auto-cursor-target"><br /></p>

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events