Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2728 from phenotips/PT-3814-filename-markup
Browse files Browse the repository at this point in the history
PT-3814: Attachment filenames are parsed for XWiki markup
  • Loading branch information
sdumitriu committed Aug 15, 2018
2 parents 9355152 + f58c538 commit 5d5612f
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,17 @@ $xwiki.jsx.use('PhenoTips.Widgets')##
#macro (__getExtension $filename)$!{filename.substring($mathtool.add($filename.lastIndexOf('.'), 1)).toLowerCase()}#end

#macro (__displaySelectableAttachment $attachment $targetDocument $selection)
{{html wiki=true clean=false}}<div class="attachment-item #if($options.isImage) image #else #__getExtension(${attachment.filename})#{end}#if($selection.contains(${attachment.filename})) selected#{end}">
{{html wiki=false clean=false}}##
<div class="attachment-item #if($options.isImage) image #else #__getExtension(${attachment.filename})#{end}#if($selection.contains(${attachment.filename})) selected#{end}">
<label for='${fieldName}_${escapetool.xml($attachment.filename)}' title='${escapetool.xml($attachment.filename)}'>
{{html wiki=false clean=false}}<input id='${fieldName}_${escapetool.xml($attachment.filename)}' type='${options.inputType}' name='${fieldName}' value='${escapetool.xml($attachment.filename)}'#if($selection.contains(${attachment.filename})) checked='checked'#{end}/>{{/html}}${escapetool.xml($attachment.filename)} <span class="size">(#dynamicsize($attachment.filesize))</span></label>##
<input id='${fieldName}_${escapetool.xml($attachment.filename)}' type='${options.inputType}' name='${fieldName}' value='${escapetool.xml($attachment.filename)}'#if($selection.contains(${attachment.filename})) checked='checked'#{end}/>${escapetool.xml($attachment.filename)} <span class="size">(#dynamicsize($attachment.filesize))</span></label>##
#if ($options.manage)
<a class='action delete fa fa-times-circle fa-lg fa-fw' href="$targetDocument.getAttachmentURL(${attachment.filename}, 'delattachment', "form_token=$!{services.csrf.getToken()}&xredirect=$!{escapetool.url($doc.getURL($xcontext.action, $request.queryString))}")" title="$services.localization.render('phenotips.imageDisplayer.delete')"></a>##
#end
#if($options.isImage)(% class="attachment-preview" %)((([[image:${services.rendering.escape($targetDoc.fullName, $doc.syntax)}@${services.rendering.escape($attachment.filename, $doc.syntax)}||title="${services.rendering.escape($attachment.filename, $doc.syntax)}"]])))#else##
#* *# <a class='view #if($options.manage)hidden#end' target="_blank" href="$targetDocument.getAttachmentURL(${attachment.filename})" title="$services.localization.render('phenotips.imageDisplayer.openImage', [$!{attachment.filename}])">$services.localization.render('phenotips.imageDisplayer.open')</a>#end##
</div>{{/html}}##
#if($options.isImage)<div class="attachment-preview"><img src="$targetDocument.getAttachmentURL(${attachment.filename})" title="${escapetool.xml($attachment.filename)}" alt="${escapetool.xml($attachment.filename)}"></div>#else##
<a class='view #if($options.manage)hidden#end' target="_blank" href="$targetDocument.getAttachmentURL(${attachment.filename})" title="$services.localization.render('phenotips.imageDisplayer.openImage', [$!{attachment.filename}])">$services.localization.render('phenotips.imageDisplayer.open')</a>#end##
</div>##
{{/html}}##
#end

#macro (__displaySelectableAttachmentList $targetDocument $selection)
Expand Down

0 comments on commit 5d5612f

Please sign in to comment.