Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/release-notes/12325-submit-for-review-message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Feature

Added Submit for Review dialog disclaimer messages (similar to Publish disclaimer messages). Can be set using setting :PrePublishDatasetDisclaimerText
Also added :DatasetPrePublishPopupCustomText to allow for custom text to be displayed in the dialog similar to the Publish dialog
43 changes: 43 additions & 0 deletions doc/sphinx-guides/source/api/native-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6605,6 +6605,28 @@ The fully expanded example above (without environment variables) looks like this

curl "https://demo.dataverse.org/api/info/settings/:DatasetPublishPopupCustomText"

.. _show-custom-popup-for-pre-publishing-datasets:

Show Custom Popup Text for Pre-Publishing Datasets (Submit for Review)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For now, only the value for the :ref:`:DatasetPrePublishPopupCustomText` setting from the Configuration section of the Installation Guide is exposed:

.. note:: See :ref:`show-disclaimer-for-prepublishing-datasets` if you want the user to acknowledge before submitting for review.
.. note:: See :ref:`curl-examples-and-environment-variables` if you are unfamiliar with the use of export below.

.. code-block:: bash

export SERVER_URL=https://demo.dataverse.org

curl "$SERVER_URL/api/info/settings/:DatasetPrePublishPopupCustomText"

The fully expanded example above (without environment variables) looks like this:

.. code-block:: bash

curl "https://demo.dataverse.org/api/info/settings/:DatasetPrePublishPopupCustomText"

.. _show-disclaimer-for-publishing-datasets:

Show Disclaimer for Publishing Datasets
Expand All @@ -6627,6 +6649,27 @@ The fully expanded example above (without environment variables) looks like this

curl "https://demo.dataverse.org/api/info/settings/:PublishDatasetDisclaimerText"

.. _show-disclaimer-for-prepublishing-datasets:

Show Disclaimer for PrePublishing Datasets (Submit for Review)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The setting :ref:`:PrePublishDatasetDisclaimerText`, when set, will prevent a draft dataset from being submitted for review through the UI without the user acknowledging the disclaimer.

.. note:: See :ref:`curl-examples-and-environment-variables` if you are unfamiliar with the use of export below.

.. code-block:: bash

export SERVER_URL=https://demo.dataverse.org

curl "$SERVER_URL/api/info/settings/:PrePublishDatasetDisclaimerText"

The fully expanded example above (without environment variables) looks like this:

.. code-block:: bash

curl "https://demo.dataverse.org/api/info/settings/:PrePublishDatasetDisclaimerText"

.. _api-get-app-tou:

Get Application Terms of Use (General Terms of Use)
Expand Down
28 changes: 28 additions & 0 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4842,6 +4842,23 @@ Set whether a user will see the custom text when publishing all versions of a da

``curl -X PUT -d true http://localhost:8080/api/admin/settings/:DatasetPublishPopupCustomTextOnAllVersions``

.. _:DatasetPrePublishPopupCustomText:

:DatasetPrePublishPopupCustomText
+++++++++++++++++++++++++++++++++

Set custom text a user will view when submitting a dataset for review. Note that this text is exposed via the "Info" endpoint of the :doc:`/api/native-api`.

``curl -X PUT -d "Deposit License Requirements" http://localhost:8080/api/admin/settings/:DatasetPrePublishPopupCustomText``

If you have a long text string, you can upload it as a file as in the example below.

``curl -X PUT --upload-file /tmp/long.txt http://localhost:8080/api/admin/settings/:DatasetPrePublishPopupCustomText``

There is a related setting called :ref:`:PrePublishDatasetDisclaimerText` that also makes text appear on the popup when submitting for review, but it requires a checkbox to be clicked.

See also :ref:`show-custom-popup-for-pre-publishing-datasets` in the API Guide.

:SearchHighlightFragmentSize
++++++++++++++++++++++++++++

Expand Down Expand Up @@ -5369,6 +5386,17 @@ There is a similar setting called :ref:`:DatasetPublishPopupCustomText` that als

See also :ref:`show-disclaimer-for-publishing-datasets` in the API Guide.

.. _:PrePublishDatasetDisclaimerText:

:PrePublishDatasetDisclaimerText
++++++++++++++++++++++++++++++++

The text displayed to the user that must be acknowledged prior to submitting a Dataset for review. When not set the acknowledgment is not required nor displayed.

``curl -sS -X PUT -d 'I agree to the following:<br/>1. My submission has been fully anonymized (required for all human subject'\''s datasets).<br/>2. My submission does not violate any known copyright laws.<br/>3. I understand that I am liable for any and all violations of the Harvard Repository <a href=https://support.dataverse.harvard.edu/harvard-dataverse-general-terms-use>Terms of Use.</a>' http://localhost:8080/api/admin/settings/:PrePublishDatasetDisclaimerText``

See also :ref:`show-disclaimer-for-prepublishing-datasets` in the API Guide.

.. _:BagItHandlerEnabled:

:BagItHandlerEnabled
Expand Down
23 changes: 22 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -4870,6 +4870,18 @@ public Boolean isDatasetPublishPopupCustomTextOnAllVersions(){
return settingsWrapper.isTrueForKey(SettingsServiceBean.Key.DatasetPublishPopupCustomTextOnAllVersions, false);
}

public boolean isDisplayPrePublishPopupCustomText() {
return !getDatasetPrePublishCustomText().isEmpty();
}

public String getDatasetPrePublishCustomText(){
String datasetPrePublishCustomText = settingsWrapper.getValueForKey(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText);
if (datasetPrePublishCustomText != null && !datasetPrePublishCustomText.isEmpty()) {
return datasetPrePublishCustomText;
}
return "";
}

public String getVariableMetadataURL(Long fileid) {
String myHostURL = getDataverseSiteUrl();
String metaURL = myHostURL + "/api/meta/datafile/" + fileid;
Expand Down Expand Up @@ -6373,6 +6385,7 @@ public void setFileMetadataForAction(FileMetadata fileMetadataForAction) {
private String termsOfAccess;
private boolean fileAccessRequest;
private boolean publishDisclaimerAcknowledged;
private boolean prePublishDisclaimerAcknowledged;

public String getTermsOfAccess() {
return termsOfAccess;
Expand All @@ -6398,6 +6411,14 @@ public void setPublishDisclaimerAcknowledged(boolean publishDisclaimerAcknowledg
this.publishDisclaimerAcknowledged = publishDisclaimerAcknowledged;
}

public boolean isPrePublishDisclaimerAcknowledged() {
return prePublishDisclaimerAcknowledged || !settingsWrapper.isHasPrePublishDatasetDisclaimerText();
}

public void setPrePublishDisclaimerAcknowledged(boolean prePublishDisclaimerAcknowledged) {
this.prePublishDisclaimerAcknowledged = prePublishDisclaimerAcknowledged;
}

// wrapper method to see if the file has been deleted (or replaced) in the current version
public boolean isFileDeleted (DataFile dataFile) {
if (dataFile.getDeleted() == null) {
Expand Down Expand Up @@ -7005,4 +7026,4 @@ public void setRequestedCSL(String requestedCSL) {
public void validateEmbargoReason(FacesContext context, UIComponent component, Object value) {
FileUtil.validateEmbargoReason(context, component, value, removeEmbargo);
}
}
}
15 changes: 14 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ public class SettingsWrapper implements java.io.Serializable {
private String metricsUrl = null;

private String publishDatasetDisclaimerText = null;


private String prePublishDatasetDisclaimerText = null;

private Boolean dataFilePIDSequentialDependent = null;

private Boolean customLicenseAllowed = null;
Expand Down Expand Up @@ -885,4 +887,15 @@ public String getPublishDatasetDisclaimerText() {
public Boolean isHasPublishDatasetDisclaimerText() {
return !StringUtil.isEmpty(getPublishDatasetDisclaimerText());
}

public String getPrePublishDatasetDisclaimerText() {
if (prePublishDatasetDisclaimerText == null) {
prePublishDatasetDisclaimerText = getValueForKey(Key.PrePublishDatasetDisclaimerText);
}
return prePublishDatasetDisclaimerText;
}

public Boolean isHasPrePublishDatasetDisclaimerText() {
return !StringUtil.isEmpty(getPrePublishDatasetDisclaimerText());
}
}
12 changes: 12 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/api/Info.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,24 @@ public Response getDatasetPublishPopupCustomText() {
return getSettingResponseByKey(SettingsServiceBean.Key.DatasetPublishPopupCustomText);
}

@GET
@Path("settings/:DatasetPrePublishPopupCustomText")
public Response DatasetPrePublishPopupCustomText() {
return getSettingResponseByKey(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText);
}

@GET
@Path("settings/:PublishDatasetDisclaimerText")
public Response getPublishDatasetDisclaimerText() {
return getSettingResponseByKey(SettingsServiceBean.Key.PublishDatasetDisclaimerText);
}

@GET
@Path("settings/:PrePublishDatasetDisclaimerText")
public Response getPrePublishDatasetDisclaimerText() {
return getSettingResponseByKey(SettingsServiceBean.Key.PrePublishDatasetDisclaimerText);
}

@GET
@Path("settings/:MaxEmbargoDurationInMonths")
public Response getMaxEmbargoDurationInMonths() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,19 @@ <p>Size limit (in bytes) for tabular file ingest. Accepts either a single numeri
Whether to display the publish text for every published version
*/
DatasetPublishPopupCustomTextOnAllVersions,
/**
The message added to a popup upon dataset submit for review
*/
DatasetPrePublishPopupCustomText,
/*
Publish Disclaimer text. If this setting exists user must acknowledge before a Dataset can be published
*/
PublishDatasetDisclaimerText,
/*
Submit for review Disclaimer text. If this setting exists user must acknowledge before a Dataset can be submitted for review
*/
PrePublishDatasetDisclaimerText,
/*
Whether Harvesting (OAI) service is enabled
*/
OAIServerEnabled,
Expand Down
16 changes: 15 additions & 1 deletion src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -1947,11 +1947,25 @@
<p jsf:rendered="#{!valid}" class="text-warning">
<span class="glyphicon glyphicon-warning-sign"/><b style="color:red;"> #{bundle['dataset.message.incomplete.warning']}</b>
</p>
<div class="well terms-agreement-block" jsf:rendered="#{DatasetPage.displayPrePublishPopupCustomText}">
<h:outputText value="#{DatasetPage.datasetPrePublishCustomText}" escape="false"/>
</div>
<c:if test="#{showSubmitForReviewLink}">
<ui:include src="datasetLicenseInfoFragment.xhtml"/>
</c:if>
<ui:fragment rendered="#{valid and settingsWrapper.isHasPrePublishDatasetDisclaimerText()}">
<div class="form-group">
<p:selectBooleanCheckbox class="text-danger" id="submitForReviewDisclaimer"
itemLabel="#{MarkupChecker:sanitizeAdvancedHTML(settingsWrapper.getPrePublishDatasetDisclaimerText())}"
escape="false"
value="#{DatasetPage.prePublishDisclaimerAcknowledged}">
<p:ajax event="change" update="submitReviewDatasetButton"/>
</p:selectBooleanCheckbox>
</div>
</ui:fragment>
<div class="button-block">
<p:commandButton rendered="#{DatasetPage.validOrCanReviewIncomplete}" styleClass="btn btn-default" value="#{bundle.submit}"
<p:commandButton id="submitReviewDatasetButton" rendered="#{DatasetPage.validOrCanReviewIncomplete}" styleClass="btn btn-default" value="#{bundle.submit}"
disabled="#{!DatasetPage.prePublishDisclaimerAcknowledged}"
onclick="PF('inreview').hide();
PF('blockDatasetForm').hide();" action="#{DatasetPage.submitDataset}" immediate="true"/>
<button class="btn btn-link" onclick="PF('inreview').hide();PF('blockDatasetForm').hide();" type="button">
Expand Down
19 changes: 17 additions & 2 deletions src/test/java/edu/harvard/iq/dataverse/api/InfoIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,37 @@ public static void setUpClass() {
UtilIT.deleteSetting(SettingsServiceBean.Key.ApplicationTermsOfUse);
UtilIT.deleteSetting(SettingsServiceBean.Key.ApplicationTermsOfUse, "fr");
UtilIT.deleteSetting(SettingsServiceBean.Key.PublishDatasetDisclaimerText);
UtilIT.deleteSetting(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText);
UtilIT.deleteSetting(SettingsServiceBean.Key.PrePublishDatasetDisclaimerText);
}

@AfterAll
public static void afterClass() {
UtilIT.deleteSetting(SettingsServiceBean.Key.MaxEmbargoDurationInMonths);
UtilIT.deleteSetting(SettingsServiceBean.Key.DatasetPublishPopupCustomText);
UtilIT.deleteSetting(SettingsServiceBean.Key.PublishDatasetDisclaimerText);
UtilIT.deleteSetting(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText);
UtilIT.deleteSetting(SettingsServiceBean.Key.PrePublishDatasetDisclaimerText);
}

@Test
public void testGetDatasetPublishPopupCustomText() {
testSettingEndpoint(SettingsServiceBean.Key.DatasetPublishPopupCustomText, "Hello world!");
testSettingEndpoint(SettingsServiceBean.Key.DatasetPublishPopupCustomText, "Hello world! DatasetPublishPopupCustomText");
}

@Test
public void testGetDatasetPublishDisclaimerText() {
testSettingEndpoint(SettingsServiceBean.Key.PublishDatasetDisclaimerText, "Hello world!");
testSettingEndpoint(SettingsServiceBean.Key.PublishDatasetDisclaimerText, "Hello world! PublishDatasetDisclaimerText");
}

@Test
public void testGetPrePublishDatasetDisclaimerText() {
testSettingEndpoint(SettingsServiceBean.Key.PrePublishDatasetDisclaimerText, "Hello world! PrePublishDatasetDisclaimerText");
}

@Test
public void testGetDatasetPrePublishPopupCustomText() {
testSettingEndpoint(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText, "Hello world! DatasetPrePublishPopupCustomText");
}

@Test
Expand Down
Loading