From 89d03b98f357d70a52fb2dd95b219620c0fdc6ec Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Fri, 4 Feb 2022 15:01:19 -0500 Subject: [PATCH 1/7] link to guides when creating, editing, selecting guestbooks #8244 --- src/main/java/propertyFiles/Bundle.properties | 3 ++- src/main/webapp/dataset-license-terms.xhtml | 16 ++++++++++++++-- src/main/webapp/guestbook.xhtml | 8 ++++++++ src/main/webapp/manage-guestbooks.xhtml | 3 ++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties index 06be584e154..0626affcb2b 100644 --- a/src/main/java/propertyFiles/Bundle.properties +++ b/src/main/java/propertyFiles/Bundle.properties @@ -1222,7 +1222,8 @@ dataset.manageGuestbooks.noGuestbooks.why.reason2=You can download the data coll dataset.manageGuestbooks.noGuestbooks.how.header=How To Use Guestbooks dataset.manageGuestbooks.noGuestbooks.how.tip1=A guestbook can be used for multiple datasets but only one guestbook can be used for a dataset. dataset.manageGuestbooks.noGuestbooks.how.tip2=Custom questions can have free form text answers or have a user select an answer from several options. -dataset.manageGuestbooks.noGuestbooks.getStarted=To get started, click on the Create Dataset Guestbook button above. To learn more about Guestbooks, visit the Dataset Guestbook section of the User Guide. +dataset.manageGuestbooks.noGuestbooks.getStarted=To get started, click on the Create Dataset Guestbook button above. +dataset.manageGuestbooks.noGuestbooks.learnMore=To learn more about Guestbooks, visit the Dataset Guestbook section of the User Guide. dataset.manageGuestbooks.tab.header.name=Guestbook Name dataset.manageGuestbooks.tab.header.date=Date Created dataset.manageGuestbooks.tab.header.usage=Usage diff --git a/src/main/webapp/dataset-license-terms.xhtml b/src/main/webapp/dataset-license-terms.xhtml index ec4f5b84ff0..09abc96d31f 100644 --- a/src/main/webapp/dataset-license-terms.xhtml +++ b/src/main/webapp/dataset-license-terms.xhtml @@ -464,7 +464,13 @@ and ((!dataverseSession.user.authenticated or !permissionsWrapper.canIssueUpdateDatasetCommand(DatasetPage.dataset)) or ((dataverseSession.user.authenticated and permissionsWrapper.canIssueUpdateDatasetCommand(DatasetPage.dataset) and !empty DatasetPage.dataset.dataverseContext.availableGuestbooks)))}"> -

#{bundle['file.dataFilesTab.terms.list.guestbook.noSelected.tip']}

+

+ #{bundle['file.dataFilesTab.terms.list.guestbook.noSelected.tip']} + + + + +

-

#{bundle['file.dataFilesTab.terms.list.guestbook.select.tip']}

+

+ #{bundle['file.dataFilesTab.terms.list.guestbook.select.tip']} + + + + +

diff --git a/src/main/webapp/guestbook.xhtml b/src/main/webapp/guestbook.xhtml index 9cbd368157a..76af9e02ab4 100644 --- a/src/main/webapp/guestbook.xhtml +++ b/src/main/webapp/guestbook.xhtml @@ -44,6 +44,14 @@ +

+ + + + + +
+
diff --git a/src/main/webapp/manage-guestbooks.xhtml b/src/main/webapp/manage-guestbooks.xhtml index 1e84d4c3353..9a039268adf 100644 --- a/src/main/webapp/manage-guestbooks.xhtml +++ b/src/main/webapp/manage-guestbooks.xhtml @@ -67,7 +67,8 @@

- + + From 43e4e74e8b2a19de4bfcf3cec37164bb534582f1 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Fri, 4 Feb 2022 15:30:18 -0500 Subject: [PATCH 2/7] link guestbook sections (User, API) in guides #8244 --- doc/sphinx-guides/source/api/native-api.rst | 4 ++++ doc/sphinx-guides/source/user/dataverse-management.rst | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst index 10e2014c8cd..f8c3a3ef1ff 100644 --- a/doc/sphinx-guides/source/api/native-api.rst +++ b/doc/sphinx-guides/source/api/native-api.rst @@ -584,9 +584,13 @@ The fully expanded example above (without environment variables) looks like this You should expect a 200 ("OK") response and JSON output. +.. _download-guestbook-api: + Retrieve Guestbook Responses for a Dataverse Collection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +For more about guestbooks, see :ref:`dataset-guestbooks` in the User Guide. + In order to retrieve the Guestbook Responses for a Dataverse collection, you must know either its "alias" (which the GUI calls an "identifier") or its database ID. If the Dataverse collection has more than one guestbook you may provide the id of a single guestbook as an optional parameter. If no guestbook id is provided the results returned will be the same as pressing the "Download All Responses" button on the Manage Dataset Guestbook page. If the guestbook id is provided then only those responses from that guestbook will be included. The FILENAME parameter is optional, and if it is not included, the responses will be displayed in the console. .. note:: See :ref:`curl-examples-and-environment-variables` if you are unfamiliar with the use of ``export`` below. diff --git a/doc/sphinx-guides/source/user/dataverse-management.rst b/doc/sphinx-guides/source/user/dataverse-management.rst index 5cc58a970ac..0aa34835bb4 100755 --- a/doc/sphinx-guides/source/user/dataverse-management.rst +++ b/doc/sphinx-guides/source/user/dataverse-management.rst @@ -190,7 +190,7 @@ What can you do with a guestbook? After creating a guestbook, you will notice th - If you want to use a guestbook you have created, you will first need to click the button in the Action column that says Enable. Once a guestbook has been enabled, you can go to the License + Terms for a dataset and select a guestbook for it. - There are also options to view, copy, edit, or delete a guestbook. -- Once someone has downloaded a file in a dataset where a guestbook has been assigned, an option to download collected data will appear. +- Once someone has downloaded a file in a dataset where a guestbook has been assigned, an option to download collected data will appear. Note that it is also possible to download guestbook responses via API. See :ref:`download-guestbook-api` for details. .. _featured-dataverses: From b8eca4041b2488ac591d5c1182b0b439a2c4405b Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Mon, 7 Feb 2022 15:15:30 -0500 Subject: [PATCH 3/7] add download button to guestbook listing #8244 --- .../iq/dataverse/ManageGuestbooksPage.java | 17 +++++++++++++++++ src/main/webapp/manage-guestbooks.xhtml | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/src/main/java/edu/harvard/iq/dataverse/ManageGuestbooksPage.java b/src/main/java/edu/harvard/iq/dataverse/ManageGuestbooksPage.java index a4602759ea8..7db0ecc0767 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ManageGuestbooksPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/ManageGuestbooksPage.java @@ -338,4 +338,21 @@ public String updateGuestbooksRoot(javax.faces.event.AjaxBehaviorEvent event) th } return ""; } + + public void streamResponsesByDataverseAndGuestbook(Long guestbookId) { + FacesContext ctx = FacesContext.getCurrentInstance(); + HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse(); + response.setContentType("text/comma-separated-values"); + String fileNameString = "attachment;filename=" + getFileName(); + response.setHeader("Content-Disposition", fileNameString); + try { + ServletOutputStream out = response.getOutputStream(); + guestbookResponseService.streamResponsesByDataverseIdAndGuestbookId(out, dataverseId, guestbookId); + out.flush(); + ctx.responseComplete(); + } catch (Exception e) { + logger.warning("Failed to stream collected guestbook responses for guestbook " + guestbookId + ", dataverse " + dataverseId); + } + } + } diff --git a/src/main/webapp/manage-guestbooks.xhtml b/src/main/webapp/manage-guestbooks.xhtml index 9a039268adf..95abf4c901c 100644 --- a/src/main/webapp/manage-guestbooks.xhtml +++ b/src/main/webapp/manage-guestbooks.xhtml @@ -130,6 +130,10 @@ title="#{bundle['dataset.manageGuestbooks.tab.action.btn.edit']}"> + Date: Mon, 7 Feb 2022 15:25:45 -0500 Subject: [PATCH 4/7] add release note #8244 --- doc/release-notes/8244-guestbook.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 doc/release-notes/8244-guestbook.md diff --git a/doc/release-notes/8244-guestbook.md b/doc/release-notes/8244-guestbook.md new file mode 100644 index 00000000000..ec5e3f69503 --- /dev/null +++ b/doc/release-notes/8244-guestbook.md @@ -0,0 +1,3 @@ +A download button has been added to the page that lists guestbooks. This saves a click but you can still download from the "View Responses" page, as before. + +Links to the guides about guestbooks have been added in additional places. From d27a45bf7b0a6f1625e8a458339e43a66fe7cb9b Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Tue, 8 Feb 2022 16:49:23 -0500 Subject: [PATCH 5/7] improve docs on guestbooks #8244 --- .../source/user/dataverse-management.rst | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/sphinx-guides/source/user/dataverse-management.rst b/doc/sphinx-guides/source/user/dataverse-management.rst index 0aa34835bb4..b1f24d6a3bc 100755 --- a/doc/sphinx-guides/source/user/dataverse-management.rst +++ b/doc/sphinx-guides/source/user/dataverse-management.rst @@ -176,21 +176,20 @@ How do you create a template? Dataset Guestbooks ----------------------------- -Guestbooks allow you to collect data about who is downloading the files from your datasets. You can decide to collect account information (username, given name & last name, affiliation, etc.) as well as create custom questions (e.g., What do you plan to use this data for?). You are also able to download the data collected from the enabled guestbooks as Excel files to store and use outside of the Dataverse installation. +Guestbooks allow you to collect data about who is downloading the files from your datasets. You can decide to collect account information (username, given name & last name, affiliation, etc.) as well as create custom questions (e.g., What do you plan to use this data for?). You are also able to download the data collected from the enabled guestbooks as CSV files to store and use outside of the Dataverse installation. How do you create a guestbook? -#. After creating a Dataverse collection, click on the Edit Dataverse button and select Dataset Guestbook -#. By default, guestbooks created in the Dataverse collection your Dataverse collection is in, will appear. If you do not want to use or see those guestbooks, uncheck the checkbox that says Include Guestbooks from Root Dataverse. -#. To create a new guestbook, click the Create Dataset Guestbook button on the right side of the page. -#. Name the guestbook, determine the account information that you would like to be required (all account information fields show when someone downloads a file), and then add Custom Questions (can be required or not required). -#. Hit the Create Dataset Guestbook button once you have finished. +#. After creating a Dataverse collection, click on the "Edit Dataverse" button and select "Dataset Guestbooks". +#. To create a new guestbook, click the "Create Dataset Guestbook" button on the right side of the page. +#. Name the guestbook, determine the account information that you would like to be required (all account information fields show when someone downloads a file), and then add custom questions (can be required or not required), if desired. +#. Click the "Create Dataset Guestbook" button once you have finished. -What can you do with a guestbook? After creating a guestbook, you will notice there are several options for a guestbook and appear in the list of guestbooks. +What can you do with a guestbook? After creating a guestbook, you will notice there are several options for a guestbook that appear in the list of guestbooks. -- If you want to use a guestbook you have created, you will first need to click the button in the Action column that says Enable. Once a guestbook has been enabled, you can go to the License + Terms for a dataset and select a guestbook for it. -- There are also options to view, copy, edit, or delete a guestbook. -- Once someone has downloaded a file in a dataset where a guestbook has been assigned, an option to download collected data will appear. Note that it is also possible to download guestbook responses via API. See :ref:`download-guestbook-api` for details. +- From the dataset page, you can select a guestbook by clicking "Terms" and then "Edit Terms Requirements", unless the guestbook is disabled. +- From the "Manage Dataset Guestbooks" page, there are options to view, copy, edit, disable, or delete a guestbook. There are also options to download or view responses. By default, guestbooks inherited from the parent Dataverse collection will appear. If you do not want to use or see those guestbooks, uncheck the checkbox that says "Include Guestbooks from [Parent]". +- Note that it is also possible to download guestbook responses via API. See :ref:`download-guestbook-api` for details. .. _featured-dataverses: From 0d34784a49d38c5254553f50b8f32ca121f91e59 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Tue, 8 Feb 2022 16:54:16 -0500 Subject: [PATCH 6/7] lowercase to "guestbooks" #8244 --- src/main/java/propertyFiles/Bundle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties index 0626affcb2b..74345bb5a50 100644 --- a/src/main/java/propertyFiles/Bundle.properties +++ b/src/main/java/propertyFiles/Bundle.properties @@ -1223,7 +1223,7 @@ dataset.manageGuestbooks.noGuestbooks.how.header=How To Use Guestbooks dataset.manageGuestbooks.noGuestbooks.how.tip1=A guestbook can be used for multiple datasets but only one guestbook can be used for a dataset. dataset.manageGuestbooks.noGuestbooks.how.tip2=Custom questions can have free form text answers or have a user select an answer from several options. dataset.manageGuestbooks.noGuestbooks.getStarted=To get started, click on the Create Dataset Guestbook button above. -dataset.manageGuestbooks.noGuestbooks.learnMore=To learn more about Guestbooks, visit the Dataset Guestbook section of the User Guide. +dataset.manageGuestbooks.noGuestbooks.learnMore=To learn more about guestbooks, visit the Dataset Guestbook section of the User Guide. dataset.manageGuestbooks.tab.header.name=Guestbook Name dataset.manageGuestbooks.tab.header.date=Date Created dataset.manageGuestbooks.tab.header.usage=Usage From 4facb3d50e90cbdffb797b68871c0ba1214466ed Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Wed, 9 Feb 2022 11:38:33 -0500 Subject: [PATCH 7/7] when no guestbook selected, only show panel to editors #8244 --- src/main/java/propertyFiles/Bundle.properties | 2 +- src/main/webapp/dataset-license-terms.xhtml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties index 74345bb5a50..8abca8ff3fd 100644 --- a/src/main/java/propertyFiles/Bundle.properties +++ b/src/main/java/propertyFiles/Bundle.properties @@ -1794,7 +1794,7 @@ file.dataFilesTab.terms.list.termsOfAccess.addInfo.studyCompletion=Study Complet file.dataFilesTab.terms.list.termsOfAccess.addInfo.studyCompletion.title=Relationship of the data collected to the amount of data coded and stored in the Dataset. Information as to why certain items of collected information were not included in the dataset or a specific data file should be provided. file.dataFilesTab.terms.list.guestbook=Guestbook file.dataFilesTab.terms.list.guestbook.title=User information (i.e., name, email, institution, and position) will be collected when files are downloaded. -file.dataFilesTab.terms.list.guestbook.noSelected.tip=No guestbook is assigned to this dataset, you will not be prompted to provide any information on file download. +file.dataFilesTab.terms.list.guestbook.noSelected.tip=No guestbook is assigned to this dataset so users will not be prompted to provide any information when downloading files. file.dataFilesTab.terms.list.guestbook.noSelected.admin.tip=There are no guestbooks available in {0} to assign to this dataset. file.dataFilesTab.terms.list.guestbook.inUse.tip=The following guestbook will prompt a user to provide additional information when downloading a file. file.dataFilesTab.terms.list.guestbook.viewBtn=Preview Guestbook diff --git a/src/main/webapp/dataset-license-terms.xhtml b/src/main/webapp/dataset-license-terms.xhtml index cf8049f97d0..0874f6939d9 100644 --- a/src/main/webapp/dataset-license-terms.xhtml +++ b/src/main/webapp/dataset-license-terms.xhtml @@ -446,7 +446,8 @@

-
+
#{bundle['file.dataFilesTab.terms.list.guestbook']}