-
Notifications
You must be signed in to change notification settings - Fork 541
Expand file tree
/
Copy pathfile-info-fragment.xhtml
More file actions
137 lines (132 loc) · 10.1 KB
/
file-info-fragment.xhtml
File metadata and controls
137 lines (132 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:pt="http://java.sun.com/jsf/passthrough"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:o="http://omnifaces.org/ui"
xmlns:iqbs="http://xmlns.jcp.org/jsf/composite/iqbs">
<ui:remove>
<!--
This fragment is included on...
- dataset pg, filesFragment, empty editMode render logic
- dataset pg AND file pg, (s3) package-download-popup-fragment
- editdatafiles (replace files) pg
Parameters:
fileMetadata - object from containing page backing bean
editDatafilesPage - true if included on editdatafiles pg
-->
</ui:remove>
<ui:param name="dataFile" value="#{fileMetadata.dataFile}" />
<ui:param name="hasFileId" value="#{!(empty fileMetadata.id)}" />
<ui:param name="hasDescription" value="#{!(empty fileMetadata.description)}" />
<ui:param name="hasDirectoryLabel" value="#{!empty fileMetadata.directoryLabel}" />
<ui:param name="isTabularData" value="#{dataFile.tabularData}" />
<ui:param name="isReleased" value="#{dataFile.released}" />
<ui:param name="hasEmbargo" value="#{!(empty dataFile.embargo)}" />
<ui:param name="hasRetention" value="#{!(empty dataFile.retention)}" />
<ui:param name="canDownloadFile" value="#{fileDownloadHelper.canDownloadFile(fileMetadata)}" />
<ui:param name="hasThumbnail" value="#{thumbnailServiceWrapper.isThumbnailAvailable(dataFile)}" />
<ui:param name="showThumbnail" value="#{canDownloadFile and hasThumbnail}" />
<ui:param name="hasCategories" value="#{!(empty fileMetadata.categories)}" />
<ui:param name="hasTags" value="#{!(empty dataFile.tags)}" />
<ui:param name="hasGlobalId" value="#{!empty dataFile.globalId}" />
<ui:param name="fileIdParam" value="#{hasGlobalId ? 'persistentId=' : 'fileId='}" />
<ui:param name="fileIdValue" value="#{hasGlobalId ? dataFile.globalId.asString() : dataFile.id}" />
<ui:param name="checksumValue" value="#{dataFile.checksumValue}" />
<ui:param name="unfValue" value="#{dataFile.unf}" />
<p:outputPanel id="fileInfoInclude-filesTable" styleClass="media" rendered="#{fileMetadata != null}">
<div class="media-left col-file-thumb" style="padding-top:4px;">
<div class="media-object thumbnail-block text-center">
<span class="icon-#{dataFileServiceBean.getFileThumbnailClass(dataFile)} file-thumbnail-icon text-muted" jsf:rendered="#{!canDownloadFile or !hasThumbnail}"/>
<span class="file-thumbnail-preview-img" jsf:rendered="#{showThumbnail}"
data-toggle="popover" data-placement="auto top" data-trigger="hover" data-html="true" data-content="<img src="/api/access/datafile/#{dataFile.id}?imageThumb=400" alt="#{bundle['file.preview']} #{fileMetadata.label}" />"
data-template='<div class="popover thumb-preview" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'>
<p:graphicImage value="/api/access/datafile/#{dataFile.id}?imageThumb=true" alt="#{fileMetadata.label}"/>
</span>
<!-- Restricted File Icon -->
<div class="file-icon-restricted-block" title="#{bundle['file.metaData.fileAccess']}#{bundle['restricted']}" data-toggle="tooltip" jsf:rendered="#{fileMetadata.restricted and !canDownloadFile}">
<span class="glyphicon glyphicon-lock text-danger"/>
</div>
<div class="file-icon-restricted-block" title="#{bundle['file.metaData.fileAccess']}#{bundle['restrictedaccess']}" data-toggle="tooltip" jsf:rendered="#{fileMetadata.restricted and canDownloadFile}">
<span class="icon-unlock text-success"/>
</div>
</div>
</div>
<div class="media-body col-file-metadata">
<div class="fileNameOriginal">
<ui:fragment rendered="#{!editDatafilesPage}">
<!-- conditional render in file page links, if file has global id, use that; if not, we use database id -->
<a href="#{widgetWrapper.wrapURL('/file.xhtml?'.concat(fileIdParam).concat(fileIdValue).concat('&version=').concat(fileMetadata.datasetVersion.friendlyVersionNumber))}">
#{fileMetadata.labelForOriginal}
</a>
</ui:fragment>
<ui:fragment rendered="#{editDatafilesPage}">
<span>#{fileMetadata.labelForOriginal}</span>
</ui:fragment>
</div>
<!-- HIERARCHY + TYPE + SIZE + DATE + CHECKSUM -->
<div class="text-muted small">
<!-- id:#{fileMetadata.dataFile.id} -->
<h:outputText id="fileHierarchy" styleClass="show" value="#{fileMetadata.directoryLabel}/" rendered="#{hasDirectoryLabel}"/>
<h:outputText id="fileType" value="#{dataFile.friendlyType}"/>
<h:outputText id="fileSize" value=" - #{dataFile.friendlyOriginalFileSize}"/>
<div class="dateCreatePublish-block">
<h:outputText id="fileCreatePublishDate" value="#{isReleased ? ((dataFile.embargo!=null) ? bundle['metadatareleased'] : bundle['published']) : bundle['deposited']} #{fileMetadata.getFileDateToDisplay()}" rendered="#{hasFileId}"/>
<h:outputText id="embargoDate" class="embargoright" value="#{isReleased ? ((dataFileServiceBean.isActivelyEmbargoed(fileMetadata)) ? bundle['embargoed.until'] : bundle['embargoed.wasthrough']):bundle['embargoed.willbeuntil']} #{dataFile.embargo.formattedDateAvailable}" rendered="#{hasEmbargo}"/>
<h:outputText id="retentionDate" class="retentionright" value="#{isReleased ? ((dataFileServiceBean.isRetentionExpired(fileMetadata)) ? bundle['retention.after'] : bundle['retention.isfrom']):bundle['retention.willbeafter']} #{dataFile.retention.formattedDateUnavailable}, #{bundle['retention.enddateinfo']}" rendered="#{hasRetention}"/>
</div>
<div class="downloads-block" jsf:rendered="#{!editDatafilesPage and !(settingsWrapper.rsyncOnly) and isReleased}">
<h:outputFormat styleClass="visible-xs-block visible-sm-block visible-md-inline visible-lg-inline" id="fileDownloadCount" value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getDownloadCountByDataFileId(dataFile.id)}"/>
</h:outputFormat>
</div>
<!-- CHECKSUM -->
<div class="checksum-block" jsf:rendered="#{!(empty dataFile.checksumValue)}">
<span class="#{!editDatafilesPage ? 'checksum-truncate checksum-tooltip' : ''}" style="margin-right:3px;"
data-toggle="tooltip" data-placement="top" data-html="true"
data-clipboard-action="copy"
data-clipboard-text="#{checksumValue}"
title="#{bundle['file.metaData.checksum.copy']}<br/>#{checksumValue}">#{dataFile.checksumType}: #{checksumValue}</span>
<span class="glyphicon glyphicon-copy btn-copy checksum-tooltip"
data-toggle="tooltip" data-placement="top" data-html="true"
data-clipboard-action="copy"
data-clipboard-text="#{checksumValue}"
title="#{bundle['file.metaData.checksum.copy']}<br/>#{checksumValue}"></span>
</div>
<!-- TABULAR VARIABLES, OBSERVATIONS + UNF -->
<div class="unf-block" jsf:rendered="#{isTabularData}">
<h:outputText value="#{bundle['file.type.tabularData']}: "/>
<h:outputText id="fileNumVars" value="#{dataFile.dataTable.varQuantity} #{bundle['file.metaData.dataFile.dataTab.variables']}, "/>
<h:outputText id="fileNumObs" value="#{dataFile.dataTable.caseQuantity} #{bundle['file.metaData.dataFile.dataTab.observations']} "/>
<span jsf:id="fileUNF" class="#{!editDatafilesPage ? 'checksum-truncate checksum-tooltip' : ''}" style="margin-right:3px;"
jsf:rendered="#{!(empty unfValue)}"
data-toggle="tooltip" data-placement="top" data-html="true"
data-clipboard-action="copy"
data-clipboard-text="#{unfValue}"
title="#{bundle['file.metaData.checksum.copy']}<br/>#{unfValue}">#{unfValue}</span>
<span class="glyphicon glyphicon-copy btn-copy checksum-tooltip" jsf:rendered="#{!(empty unfValue)}"
data-toggle="tooltip" data-placement="top" data-html="true"
data-clipboard-action="copy"
data-clipboard-text="#{unfValue}"
title="#{bundle['file.metaData.checksum.copy']}<br/>#{unfValue}"></span>
</div>
</div>
<div class="fileDescription small" jsf:rendered="#{hasDescription}">
<h:outputText id="fileDescNonEmpty" value="#{fileMetadata.description}"/>
</div>
<div class="file-tags-block" jsf:rendered="#{hasCategories or hasTags}">
<ui:repeat value="#{fileMetadata.categories}" var="cat">
<h:outputText value="#{cat.name}" styleClass="label label-default"/>
</ui:repeat>
<ui:repeat value="#{dataFile.tags}" var="tag">
<h:outputText value="#{tag.typeLabel}" styleClass="label label-info"/>
</ui:repeat>
</div>
</div>
</p:outputPanel>
</ui:composition>