From 242080d6a39aa4c5e386f519a0164ec41e412507 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Fri, 23 Sep 2016 13:57:58 -0400 Subject: [PATCH 1/3] add ability to change footer copyright #3379 --- .../harvard/iq/dataverse/settings/SettingsServiceBean.java | 1 + .../java/edu/harvard/iq/dataverse/util/SystemConfig.java | 5 +++++ src/main/webapp/dataverse_footer.xhtml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java index c4aedb81a71..9235ab19dab 100644 --- a/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/settings/SettingsServiceBean.java @@ -33,6 +33,7 @@ public class SettingsServiceBean { * So there. */ public enum Key { + FooterCopyright, MinutesUntilConfirmEmailTokenExpires, /** * Override Solr highlighting "fragsize" diff --git a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java index 5246be6acd2..8de6535e1b1 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java @@ -528,4 +528,9 @@ public boolean isTimerServer() { } return false; } + + public String getFooterCopyright() { + String footerCopyright = settingsService.getValueForKey(SettingsServiceBean.Key.FooterCopyright, BundleUtil.getStringFromBundle("footer.copyright")); + return footerCopyright; + } } diff --git a/src/main/webapp/dataverse_footer.xhtml b/src/main/webapp/dataverse_footer.xhtml index 97141f69b69..9ab7d10329d 100644 --- a/src/main/webapp/dataverse_footer.xhtml +++ b/src/main/webapp/dataverse_footer.xhtml @@ -17,7 +17,7 @@  |  #{bundle['footer.dataverseProjectOn']}  |  #{bundle['footer.codeAvailable']}

-  |  #{bundle['footer.privacyPolicy']} +  |  #{bundle['footer.privacyPolicy']}

From 51017bd61ea4eb7f763f8a6638d62bf0bff4a08e Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Tue, 27 Sep 2016 13:53:19 -0400 Subject: [PATCH 2/3] make copyright year dynamic #2905, document `:FooterCopyright` #3379 --- doc/sphinx-guides/source/installation/config.rst | 7 +++++++ src/main/java/Bundle.properties | 2 +- .../java/edu/harvard/iq/dataverse/util/SystemConfig.java | 7 +++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/sphinx-guides/source/installation/config.rst b/doc/sphinx-guides/source/installation/config.rst index 347a86e92db..e5327f67057 100644 --- a/doc/sphinx-guides/source/installation/config.rst +++ b/doc/sphinx-guides/source/installation/config.rst @@ -265,6 +265,13 @@ This is the email address that "system" emails are sent from such as password re ``curl -X PUT -d "Support " http://localhost:8080/api/admin/settings/:SystemEmail`` +:FooterCopyright +++++++++++++++++ + +By default the footer says "Copyright © [YYYY], The President & Fellows of Harvard College" but the text after the year can be customized. + +``curl -X PUT -d "The President & Fellows of Harvard College" http://localhost:8080/api/admin/settings/:FooterCopyright`` + :DoiProvider ++++++++++++ .. _:DoiProvider: diff --git a/src/main/java/Bundle.properties b/src/main/java/Bundle.properties index 2ca4fd5de66..8876ebc752c 100755 --- a/src/main/java/Bundle.properties +++ b/src/main/java/Bundle.properties @@ -92,7 +92,7 @@ footer.dataverseOnGitHub=Dataverse On GitHub footer.dataverseProjectOn=Dataverse Project on footer.Twitter=Twitter footer.dataScienceIQSS=Developed at the Institute for Quantitative Social Science -footer.copyright=Copyright © 2016, The President & Fellows of Harvard College +footer.copyright=Copyright © {0}, footer.widget.datastored=Data is stored at {0}. footer.widget.login=Log in to footer.privacyPolicy=Privacy Policy diff --git a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java index 8de6535e1b1..38abcbc5671 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java @@ -7,6 +7,8 @@ import java.io.InputStream; import java.net.InetAddress; import java.net.UnknownHostException; +import java.time.Year; +import java.util.Arrays; import java.util.MissingResourceException; import java.util.Properties; import java.util.ResourceBundle; @@ -530,7 +532,8 @@ public boolean isTimerServer() { } public String getFooterCopyright() { - String footerCopyright = settingsService.getValueForKey(SettingsServiceBean.Key.FooterCopyright, BundleUtil.getStringFromBundle("footer.copyright")); - return footerCopyright; + String copyrightYear = BundleUtil.getStringFromBundle("footer.copyright", Arrays.asList(Year.now().getValue() + "")); + String extraText = settingsService.getValueForKey(SettingsServiceBean.Key.FooterCopyright, "The President & Fellows of Harvard College"); + return copyrightYear + extraText; } } From d78a83463a2a311918a152ddcbd5a5b8a936c3af Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Thu, 29 Sep 2016 09:59:36 -0400 Subject: [PATCH 3/3] =?UTF-8?q?change=20default=20to=20be=20"Copyright=20?= =?UTF-8?q?=C2=A9=20[YYYY]"=20#3379?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also use `settingsWrapper.get` for better performance. --- doc/sphinx-guides/source/installation/config.rst | 4 ++-- scripts/api/setup-optional-harvard.sh | 1 + src/main/java/Bundle.properties | 2 +- .../java/edu/harvard/iq/dataverse/util/SystemConfig.java | 6 ++---- src/main/webapp/dataverse_footer.xhtml | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/doc/sphinx-guides/source/installation/config.rst b/doc/sphinx-guides/source/installation/config.rst index e5327f67057..c0fce1b844a 100644 --- a/doc/sphinx-guides/source/installation/config.rst +++ b/doc/sphinx-guides/source/installation/config.rst @@ -268,9 +268,9 @@ This is the email address that "system" emails are sent from such as password re :FooterCopyright ++++++++++++++++ -By default the footer says "Copyright © [YYYY], The President & Fellows of Harvard College" but the text after the year can be customized. +By default the footer says "Copyright © [YYYY]" but you can add text after the year, as in the example below. -``curl -X PUT -d "The President & Fellows of Harvard College" http://localhost:8080/api/admin/settings/:FooterCopyright`` +``curl -X PUT -d ", The President & Fellows of Harvard College" http://localhost:8080/api/admin/settings/:FooterCopyright`` :DoiProvider ++++++++++++ diff --git a/scripts/api/setup-optional-harvard.sh b/scripts/api/setup-optional-harvard.sh index 52caa31c1e0..3433e823014 100755 --- a/scripts/api/setup-optional-harvard.sh +++ b/scripts/api/setup-optional-harvard.sh @@ -22,6 +22,7 @@ curl -s -X PUT -d true "$SERVER/admin/settings/:GeoconnectCreateEditMaps" curl -s -X PUT -d true "$SERVER/admin/settings/:GeoconnectViewMaps" echo "- Setting system email" curl -X PUT -d "Dataverse Support " http://localhost:8080/api/admin/settings/:SystemEmail +curl -X PUT -d ", The President & Fellows of Harvard College" http://localhost:8080/api/admin/settings/:FooterCopyright echo "- Setting up the Harvard Shibboleth institutional group" curl -s -X POST -H 'Content-type:application/json' --upload-file data/shibGroupHarvard.json "$SERVER/admin/groups/shib?key=$adminKey" echo diff --git a/src/main/java/Bundle.properties b/src/main/java/Bundle.properties index 8876ebc752c..ca19a51533e 100755 --- a/src/main/java/Bundle.properties +++ b/src/main/java/Bundle.properties @@ -92,7 +92,7 @@ footer.dataverseOnGitHub=Dataverse On GitHub footer.dataverseProjectOn=Dataverse Project on footer.Twitter=Twitter footer.dataScienceIQSS=Developed at the Institute for Quantitative Social Science -footer.copyright=Copyright © {0}, +footer.copyright=Copyright © {0} footer.widget.datastored=Data is stored at {0}. footer.widget.login=Log in to footer.privacyPolicy=Privacy Policy diff --git a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java index 38abcbc5671..1912642ea9b 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java @@ -531,9 +531,7 @@ public boolean isTimerServer() { return false; } - public String getFooterCopyright() { - String copyrightYear = BundleUtil.getStringFromBundle("footer.copyright", Arrays.asList(Year.now().getValue() + "")); - String extraText = settingsService.getValueForKey(SettingsServiceBean.Key.FooterCopyright, "The President & Fellows of Harvard College"); - return copyrightYear + extraText; + public String getFooterCopyrightAndYear() { + return BundleUtil.getStringFromBundle("footer.copyright", Arrays.asList(Year.now().getValue() + "")); } } diff --git a/src/main/webapp/dataverse_footer.xhtml b/src/main/webapp/dataverse_footer.xhtml index 9ab7d10329d..285c4408f19 100644 --- a/src/main/webapp/dataverse_footer.xhtml +++ b/src/main/webapp/dataverse_footer.xhtml @@ -17,7 +17,7 @@  |  #{bundle['footer.dataverseProjectOn']}  |  #{bundle['footer.codeAvailable']}

-  |  #{bundle['footer.privacyPolicy']} +  |  #{bundle['footer.privacyPolicy']}