Download all attachments of an article as zip

We often have more than a few attachments in an article. Is ist possible to add a zip download function, so you can download all attachments with one click?

6 Likes

Wrote a workaround in JS. Quick and dirty, but works for me.

at with position is the <script …> to add?

<!> – svgstore fallback →

<%= javascript_tag nonce: true do -%>
/*
detect if browser is
- Chrome 14-20
- Android Browser 4.1+
- iOS 6-7
- Safari 6
- Edge 12
- IE 9-11
*/
window.svgPolyfill = /\bEdge/12\b|\bTrident/[567]\b|\bVersion/7.0 Safari\b/.test(navigator.userAgent) || (navigator.userAgent.match(/AppleWebKit/(\d+)/) || )[1] < 537;

(function (doc) {
if(!svgPolyfill)
return

var scripts = doc.getElementsByTagName('script')
var script = scripts[scripts.length - 1]
var xhr = new XMLHttpRequest()
xhr.onload = function () {
  var div = doc.createElement('div')
  div.innerHTML = this.responseText
  div.style.cssText = 'position: absolute; clip: rect(0, 0, 0, 0); z-index: -1;'
  script.parentNode.insertBefore(div, script)
}
xhr.open('get', 'assets/images/icons.svg', true)
xhr.send()

})(document)
<% end -%>

Loading...

Since the last security patch (3.3.x) there are some changes in the way to include own js-scripts.
Now you have to replace the line:
<%= javascript_tag nonce: true do -%>
with
<%= javascript_include_tag “/timed_trigger.js”, “/jszip.js”, “/FileSaver.min.js”, nonce: true do %>

But that’s only half the way.
The script works with function calls inline. These are forbidden with the new policy. Heres a reprogramming with event listener necessary. Can’t findt time to do that at the moment.
Sorry for the news.

Is there any chance to apply this to zammad? Such built-in feature is sorely lacking.

1 Like

This topic was automatically closed after 416 days. New replies are no longer allowed.

Hi, there are already a couple of times others have asked for this feature here and here, I was looking for this in the interface and couldn’t find it. If someone sends a ticket with a bunch of files attached which need to be saved as is to be applied somewhere else. It is very useful to be able to download the whole thing at once, instead of tediously clicking and saving each file separately. Not to mention the chance of errors and forgetting one of them.

It would be really nice if this feature got some love from someone…

Cheers

/Simon

1 Like

Duplicate of Download all attachments of an article as zip, so merging it.