Skip to content

Commit 23f185c

Browse files
committed
Add DatasetPrePublishPopupCustomText
1 parent eb9ab04 commit 23f185c

7 files changed

Lines changed: 71 additions & 0 deletions

File tree

doc/sphinx-guides/source/api/native-api.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6605,6 +6605,28 @@ The fully expanded example above (without environment variables) looks like this
66056605
66066606
curl "https://demo.dataverse.org/api/info/settings/:DatasetPublishPopupCustomText"
66076607
6608+
.. _show-custom-popup-for-pre-publishing-datasets:
6609+
6610+
Show Custom Popup Text for Pre-Publishing Datasets (Submit for Review)
6611+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6612+
6613+
For now, only the value for the :ref:`:DatasetPrePublishPopupCustomText` setting from the Configuration section of the Installation Guide is exposed:
6614+
6615+
.. note:: See :ref:`show-disclaimer-for-prepublishing-datasets` if you want the user to acknowledge before submitting for review.
6616+
.. note:: See :ref:`curl-examples-and-environment-variables` if you are unfamiliar with the use of export below.
6617+
6618+
.. code-block:: bash
6619+
6620+
export SERVER_URL=https://demo.dataverse.org
6621+
6622+
curl "$SERVER_URL/api/info/settings/:DatasetPrePublishPopupCustomText"
6623+
6624+
The fully expanded example above (without environment variables) looks like this:
6625+
6626+
.. code-block:: bash
6627+
6628+
curl "https://demo.dataverse.org/api/info/settings/:DatasetPrePublishPopupCustomText"
6629+
66086630
.. _show-disclaimer-for-publishing-datasets:
66096631
66106632
Show Disclaimer for Publishing Datasets

doc/sphinx-guides/source/installation/config.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4842,6 +4842,23 @@ Set whether a user will see the custom text when publishing all versions of a da
48424842

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

4845+
.. _:DatasetPrePublishPopupCustomText:
4846+
4847+
:DatasetPrePublishPopupCustomText
4848+
+++++++++++++++++++++++++++++++++
4849+
4850+
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`.
4851+
4852+
``curl -X PUT -d "Deposit License Requirements" http://localhost:8080/api/admin/settings/:DatasetPrePublishPopupCustomText``
4853+
4854+
If you have a long text string, you can upload it as a file as in the example below.
4855+
4856+
``curl -X PUT --upload-file /tmp/long.txt http://localhost:8080/api/admin/settings/:DatasetPrePublishPopupCustomText``
4857+
4858+
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.
4859+
4860+
See also :ref:`show-custom-popup-for-pre-publishing-datasets` in the API Guide.
4861+
48454862
:SearchHighlightFragmentSize
48464863
++++++++++++++++++++++++++++
48474864

src/main/java/edu/harvard/iq/dataverse/DatasetPage.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4870,6 +4870,18 @@ public Boolean isDatasetPublishPopupCustomTextOnAllVersions(){
48704870
return settingsWrapper.isTrueForKey(SettingsServiceBean.Key.DatasetPublishPopupCustomTextOnAllVersions, false);
48714871
}
48724872

4873+
public boolean isDisplayPrePublishPopupCustomText() {
4874+
return !getDatasetPrePublishCustomText().isEmpty();
4875+
}
4876+
4877+
public String getDatasetPrePublishCustomText(){
4878+
String datasetPrePublishCustomText = settingsWrapper.getValueForKey(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText);
4879+
if (datasetPrePublishCustomText != null && !datasetPrePublishCustomText.isEmpty()) {
4880+
return datasetPrePublishCustomText;
4881+
}
4882+
return "";
4883+
}
4884+
48734885
public String getVariableMetadataURL(Long fileid) {
48744886
String myHostURL = getDataverseSiteUrl();
48754887
String metaURL = myHostURL + "/api/meta/datafile/" + fileid;

src/main/java/edu/harvard/iq/dataverse/api/Info.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ public Response getDatasetPublishPopupCustomText() {
4646
return getSettingResponseByKey(SettingsServiceBean.Key.DatasetPublishPopupCustomText);
4747
}
4848

49+
@GET
50+
@Path("settings/:DatasetPrePublishPopupCustomText")
51+
public Response DatasetPrePublishPopupCustomText() {
52+
return getSettingResponseByKey(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText);
53+
}
54+
4955
@GET
5056
@Path("settings/:PublishDatasetDisclaimerText")
5157
public Response getPublishDatasetDisclaimerText() {

src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ <p>Size limit (in bytes) for tabular file ingest. Accepts either a single numeri
325325
Whether to display the publish text for every published version
326326
*/
327327
DatasetPublishPopupCustomTextOnAllVersions,
328+
/**
329+
The message added to a popup upon dataset submit for review
330+
*/
331+
DatasetPrePublishPopupCustomText,
328332
/*
329333
Publish Disclaimer text. If this setting exists user must acknowledge before a Dataset can be published
330334
*/

src/main/webapp/dataset.xhtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,6 +1947,9 @@
19471947
<p jsf:rendered="#{!valid}" class="text-warning">
19481948
<span class="glyphicon glyphicon-warning-sign"/><b style="color:red;"> #{bundle['dataset.message.incomplete.warning']}</b>
19491949
</p>
1950+
<div class="well terms-agreement-block" jsf:rendered="#{DatasetPage.displayPrePublishPopupCustomText}">
1951+
<h:outputText value="#{DatasetPage.datasetPrePublishCustomText}" escape="false"/>
1952+
</div>
19501953
<c:if test="#{showSubmitForReviewLink}">
19511954
<ui:include src="datasetLicenseInfoFragment.xhtml"/>
19521955
</c:if>

src/test/java/edu/harvard/iq/dataverse/api/InfoIT.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static void setUpClass() {
2626
UtilIT.deleteSetting(SettingsServiceBean.Key.ApplicationTermsOfUse);
2727
UtilIT.deleteSetting(SettingsServiceBean.Key.ApplicationTermsOfUse, "fr");
2828
UtilIT.deleteSetting(SettingsServiceBean.Key.PublishDatasetDisclaimerText);
29+
UtilIT.deleteSetting(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText);
2930
UtilIT.deleteSetting(SettingsServiceBean.Key.PrePublishDatasetDisclaimerText);
3031
}
3132

@@ -34,6 +35,7 @@ public static void afterClass() {
3435
UtilIT.deleteSetting(SettingsServiceBean.Key.MaxEmbargoDurationInMonths);
3536
UtilIT.deleteSetting(SettingsServiceBean.Key.DatasetPublishPopupCustomText);
3637
UtilIT.deleteSetting(SettingsServiceBean.Key.PublishDatasetDisclaimerText);
38+
UtilIT.deleteSetting(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText);
3739
UtilIT.deleteSetting(SettingsServiceBean.Key.PrePublishDatasetDisclaimerText);
3840
}
3941

@@ -52,6 +54,11 @@ public void testGetPrePublishDatasetDisclaimerText() {
5254
testSettingEndpoint(SettingsServiceBean.Key.PrePublishDatasetDisclaimerText, "Hello world! PrePublishDatasetDisclaimerText");
5355
}
5456

57+
@Test
58+
public void testGetDatasetPrePublishPopupCustomText() {
59+
testSettingEndpoint(SettingsServiceBean.Key.DatasetPrePublishPopupCustomText, "Hello world! DatasetPrePublishPopupCustomText");
60+
}
61+
5562
@Test
5663
public void testGetMaxEmbargoDurationInMonths() {
5764
testSettingEndpoint(SettingsServiceBean.Key.MaxEmbargoDurationInMonths, "12");

0 commit comments

Comments
 (0)