Code source wiki de Camp_2022 : Marseille - Toulouse
Modifié par Quentin / Zèbre STURER le 2022/09/30 11:47
Afficher les derniers auteurs
author | version | line-number | content |
---|---|---|---|
1 | {{groovy}} | ||
2 | def attachments = doc | ||
3 | def fullNameEscaped = doc.fullName.replaceAll("/","__") | ||
4 | def targetDir = "webapps/ROOT/resources/pictureExports/" + fullNameEscaped | ||
5 | def hadNovelty = false | ||
6 | for(att in doc.attachmentList) { | ||
7 | def targetFile = new File(targetDir + "/src/" + att.filename) | ||
8 | if(!targetFile.isFile() || targetFile.lastModified()+100 < att.date.time) { | ||
9 | hadNovelty = true | ||
10 | println("* exporting " + att.filename) | ||
11 | def input = att.getContentInputStream() | ||
12 | org.apache.commons.io.FileUtils.copyToFile(input, targetFile) | ||
13 | } | ||
14 | } | ||
15 | if(hadNovelty) { | ||
16 | println("Would be running thumbsup.") | ||
17 | } else { | ||
18 | println("\n\n{{html}}<iframe src='/resources/pictureExports/"+fullNameEscaped+"/out/index.html?version=${doc.version}' frameborder='0' style='width:80vw; height:80vw'>I need frames</iframe>") | ||
19 | } | ||
20 | |||
21 | {{/groovy}} |