forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdatasetFieldForEditFragment.xhtml
More file actions
105 lines (100 loc) · 7.45 KB
/
datasetFieldForEditFragment.xhtml
File metadata and controls
105 lines (100 loc) · 7.45 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
<ui:composition
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:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
xmlns:pt="http://java.sun.com/jsf/passthrough"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<ui:remove>
<!-- input text start UPDATE: UI:REMOVE applied due to duplicate ID errors, left code as reference in case test scripts complain -->
<span id="pre-input-#{dsf.datasetFieldType.name}" class="pre-input-tag"/></ui:remove>
<ui:fragment rendered="#{cvoc==null}">
<p:inputText value="#{dsfv.valueForEdit}" id="inputText" pt:aria-required="#{dsf.required}"
styleClass="form-control #{dsfv.datasetField.datasetFieldType.name == 'title' and DatasetPage.editMode == 'CREATE' ? 'datasetfield-title' : ''}"
rendered="#{!dsfv.datasetField.datasetFieldType.controlledVocabulary
and (dsfv.datasetField.datasetFieldType.fieldType == 'TEXT'
or dsfv.datasetField.datasetFieldType.fieldType == 'STRING'
or dsfv.datasetField.datasetFieldType.fieldType == 'INT'
or dsfv.datasetField.datasetFieldType.fieldType == 'FLOAT'
or dsfv.datasetField.datasetFieldType.fieldType == 'URL'
or dsfv.datasetField.datasetFieldType.fieldType == 'DATE'
or dsfv.datasetField.datasetFieldType.fieldType == 'EMAIL')}"
onkeypress="return event.keyCode !== 13;" >
<c:if test="#{dsfvIndex!=0}">
<f:passThroughAttribute name="aria-label" value="#{bundle['dataset.additionalEntry']}" />
</c:if>
</p:inputText>
<p:watermark for="inputText" value="#{dsfv.datasetField.datasetFieldType.localeWatermark}"></p:watermark>
</ui:fragment>
<ui:fragment rendered="#{cvoc!=null and cvoc.getString('term-uri-field').equals(dsfv.datasetField.datasetFieldType.name)}">
<p:inputText value="#{dsfv.valueForEdit}" id="cvocInputText" pt:aria-required="#{dsf.required}"
styleClass="form-control #{dsfv.datasetField.datasetFieldType.name == 'title' and DatasetPage.editMode == 'CREATE' ? 'datasetfield-title' : ''}"
rendered="#{!dsfv.datasetField.datasetFieldType.controlledVocabulary
and (dsfv.datasetField.datasetFieldType.fieldType == 'TEXT'
or dsfv.datasetField.datasetFieldType.fieldType == 'STRING'
or dsfv.datasetField.datasetFieldType.fieldType == 'INT'
or dsfv.datasetField.datasetFieldType.fieldType == 'FLOAT'
or dsfv.datasetField.datasetFieldType.fieldType == 'URL'
or dsfv.datasetField.datasetFieldType.fieldType == 'DATE'
or dsfv.datasetField.datasetFieldType.fieldType == 'EMAIL')}">
<c:if test="#{dsfvIndex!=0}">
<f:passThroughAttribute name="aria-label" value="#{bundle['dataset.additionalEntry']}" />
</c:if>
<f:passThroughAttribute name="lang" value="#{DatasetPage.getFieldLanguage(cvoc.getString('languages'))}"/>
<f:passThroughAttribute name="data-cvoc-service-url" value="#{cvoc.getString('cvoc-url','')}"/>
<f:passThroughAttribute name="data-cvoc-headers" value="#{cvoc.containsKey('headers') ? cvoc.get('headers').toString() : '{}'}"/>
<f:passThroughAttribute name="data-cvoc-protocol" value="#{cvoc.getString('protocol','')}"/>
<f:passThroughAttribute name="data-cvoc-filter" value="#{cvoc.getString('term-parent-uri','')}"/>
<f:passThroughAttribute name="data-cvoc-vocabs" value="#{cvoc.get('vocabs').toString()}"/>
<f:passThroughAttribute name="data-cvoc-allowfreetext" value="#{cvoc.getBoolean('allow-free-text', false)}"/>
<f:passThroughAttribute name="data-cvoc-parent" value="#{cvoc.getString('field-name','')}"/>
<f:passThroughAttribute name="data-cvoc-managedfields" value="#{cvoc.get('managed-fields').toString()}"/>
</p:inputText>
</ui:fragment>
<ui:fragment rendered="#{cvoc!=null and !cvoc.getString('term-uri-field').equals(dsfv.datasetField.datasetFieldType.name)}">
<p:inputText value="#{dsfv.valueForEdit}" id="cvocInputText2" pt:aria-required="#{dsf.required}"
styleClass="form-control #{dsfv.datasetField.datasetFieldType.name == 'title' and DatasetPage.editMode == 'CREATE' ? 'datasetfield-title' : ''}"
rendered="#{!dsfv.datasetField.datasetFieldType.controlledVocabulary
and (dsfv.datasetField.datasetFieldType.fieldType == 'TEXT'
or dsfv.datasetField.datasetFieldType.fieldType == 'STRING'
or dsfv.datasetField.datasetFieldType.fieldType == 'INT'
or dsfv.datasetField.datasetFieldType.fieldType == 'FLOAT'
or dsfv.datasetField.datasetFieldType.fieldType == 'URL'
or dsfv.datasetField.datasetFieldType.fieldType == 'DATE'
or dsfv.datasetField.datasetFieldType.fieldType == 'EMAIL')}">
<c:if test="#{dsfvIndex!=0}">
<f:passThroughAttribute name="aria-label" value="#{bundle['dataset.additionalEntry']}" />
</c:if>
<f:passThroughAttribute name="data-cvoc-managed-field" value="#{dsfv.datasetField.datasetFieldType.name}"/>
</p:inputText>
</ui:fragment>
<p:inputTextarea value="#{dsfv.valueForEdit}" id="description" pt:aria-required="#{dsf.required}"
rows="5" cols="60" styleClass="form-control"
rendered="#{dsfv.datasetField.datasetFieldType.fieldType == 'TEXTBOX'}">
<c:if test="#{dsfvIndex!=0}">
<f:passThroughAttribute name="aria-label" value="#{bundle['dataset.additionalEntry']}" />
</c:if>
</p:inputTextarea>
<p:watermark for="description" value="#{dsfv.datasetField.datasetFieldType.localeWatermark}"></p:watermark>
<div class="ui-message ui-message-error ui-widget ui-corner-all" aria-live="polite" jsf:rendered="#{dsfvIndex eq 0 and !empty dsfv.datasetField.validationMessage}">
<span class="ui-message-error-detail">#{dsfv.datasetField.validationMessage}</span>
</div>
<div class="ui-message ui-message-error ui-widget ui-corner-all" aria-live="polite" jsf:rendered="#{!empty dsfv.validationMessage}">
<span class="ui-message-error-detail">#{dsfv.validationMessage}</span>
</div>
<!-- This button / script is for replication data for the title field and is client side only -->
<ui:fragment rendered="#{dsfv.datasetField.datasetFieldType.name == 'title' and DatasetPage.editMode == 'CREATE' }">
<input type="button" id="replicationDataButton"
class="btn btn-default" value="#{bundle['dataset.AddReplication']}"
onclick="replicationFor();return false;"/>
<script>
//<![CDATA[
function replicationFor() {
$(".datasetfield-title")[0].value = "#{bundle['dataset.replicationDataFor']} " + $(".datasetfield-title")[0].value;
$('#replicationDataButton').prop('disabled', true);
}
//]]>
</script>
</ui:fragment>
</ui:composition>