Skip to content

Commit

Permalink
Add checkbox to accept the CC License - refs IQSS#10736
Browse files Browse the repository at this point in the history
  • Loading branch information
fintanorbert committed Nov 6, 2024
1 parent 582fc45 commit a138734
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
19 changes: 19 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ public class DatasetPage implements java.io.Serializable {

private static final Logger logger = Logger.getLogger(DatasetPage.class.getCanonicalName());

public boolean isArpTermsAccepted() {
return arpTermsAccepted;
}

public void setArpTermsAccepted(boolean arpTermsAccepted) {
this.arpTermsAccepted = arpTermsAccepted;
}

public enum EditMode {

CREATE, INFO, FILE, METADATA, LICENSE
Expand Down Expand Up @@ -284,6 +292,8 @@ public enum DisplayMode {
ArpServiceBean arpService;

private String aromaAddress = "";

private boolean arpTermsAccepted = false;

private Dataset dataset = new Dataset();

Expand Down Expand Up @@ -475,6 +485,15 @@ public Boolean isHasValidTermsOfAccess() {
}
}

public boolean arpIsHasCCLicense() {
var license = dataset.getLatestVersion().getTermsOfUseAndAccess().getLicense();
if (license != null) {
return license.getName().toLowerCase().startsWith("cc");
} else {
return false;
}
}

private Boolean hasRestrictedFiles = null;

public boolean isHasRestrictedFiles(){
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2996,4 +2996,5 @@ arp.rocrate.related.changes.description=The new version contains RO-Crate relate
arp.rocrate.is.missing=Missing \"{0}\". Please ensure that your RO-Crate.zip contains all necessary files and try again.
arp.rocrate.is.missing.summary=Upload Error
arp.file.dataFilesTab.terms.list.license=Agree to ARP General Terms of Use
arp.file.dataFilesTab.terms.list.license.view.description= I have read, understood and accept the <a href="https://researchdata.hu/altalanos-felhasznalasi-feltetelek" title="ARP General Terms of Use" target="_blank">General Terms of Use</a> of the ARP Data Repository and I take responsibility for compliance with the terms and conditions contained therein.
arp.file.dataFilesTab.terms.list.license.view.description= I have read, understood and accept the <a href="https://researchdata.hu/altalanos-felhasznalasi-feltetelek" title="ARP General Terms of Use" target="_blank">General Terms of Use</a> of the ARP Data Repository and I take responsibility for compliance with the terms and conditions contained therein.
arp.dataset.publish.cc.license.accept=I have read, understood and accept the terms of the&nbsp;<a href="https://creativecommons.org/share-your-work/cclicenses/" title="Creative Commons Licenses" target="_blank">Creative Commons Licenses</a>.
17 changes: 14 additions & 3 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -1828,14 +1828,25 @@
<ui:include src="datasetLicenseInfoFragment.xhtml" />
</c:if>
<ui:fragment rendered="#{publishDataset}">
<div class="form-group" style="display: flex; align-items: start;" jsf:rendered="#{DatasetPage.arpIsHasCCLicense()}">
<h:selectBooleanCheckbox style="margin-right: 10px; margin-left: 15px;" id="arpTermsCheckbox" value="#{DatasetPage.arpTermsAccepted}">
<f:ajax render="continueButton" />
</h:selectBooleanCheckbox>
<h:outputText value="#{bundle['arp.dataset.publish.cc.license.accept']}" escape="false" />
</div>
<div class="form-group">
<p class="col-sm-12 help-block">#{bundle['dataset.publish.terms.help.tip']}</p>
</div>
</ui:fragment>
<div class="button-block">
<p:commandButton rendered="#{valid}" styleClass="btn btn-default" value="#{bundle.continue}"
onclick="PF('publishDataset').hide();
PF('blockDatasetForm').hide();" action="#{DatasetPage.releaseDataset}" />
<p:commandButton
id="continueButton"
rendered="#{valid}"
styleClass="btn btn-default"
value="#{bundle.continue}"
onclick="PF('publishDataset').hide(); PF('blockDatasetForm').hide();"
action="#{DatasetPage.releaseDataset}"
disabled="#{!DatasetPage.arpTermsAccepted and DatasetPage.arpIsHasCCLicense()}" />
<button class="btn btn-link" onclick="PF('publishDataset').hide();
PF('blockDatasetForm').hide();" type="button">
#{bundle.cancel}
Expand Down

0 comments on commit a138734

Please sign in to comment.