Skip to content

Commit

Permalink
implement :DisableRootDataverseTheme db setting IQSS#4197
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Nov 15, 2017
1 parent 7cd2fea commit 28f705c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 2 deletions.
9 changes: 9 additions & 0 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ Once you have the location of your custom header HTML file, run this curl comman

``curl -X PUT -d '/var/www/dataverse/branding/custom-header.html' http://localhost:8080/api/admin/settings/:HeaderCustomizationFile``

If you have enabled a custom header or navbar logo, you may want to disable the theme of the/logo/banner of the "root" dataverse by setting ``:DisableRootDataverseTheme`` to ``true`` like this:

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

Custom Footer
+++++++++++++

Expand Down Expand Up @@ -679,6 +683,11 @@ See :ref:`Branding Your Installation` above.

See :ref:`Branding Your Installation` above.

:DisableRootDataverseTheme
++++++++++++++++++++++++

See :ref:`Branding Your Installation` above.

:FooterCustomizationFile
++++++++++++++++++++++++

Expand Down
1 change: 1 addition & 0 deletions src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ dataverse.theme.website.title=URL for your personal website, institution, or any
dataverse.theme.website.tip=The website will be linked behind the tagline. To have a website listed, you must also provide a tagline.
dataverse.theme.website.watermark=Your personal site, http://...
dataverse.theme.website.invalidMsg=Invalid URL.
dataverse.theme.disabled=The theme for the root dataverse has been administratively disabled with the :DisableRootDataverseTheme database setting.
dataverse.widgets.title=Widgets
dataverse.widgets.notPublished.why.header=Why Use Widgets?
dataverse.widgets.notPublished.why.reason1=Increases the web visibility of your data by allowing you to embed your dataverse and datasets into your personal or project website.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,18 @@ public boolean isSignupAllowed() {
return signupAllowed;
}

public boolean isRootDataverseThemeDisabled(Dataverse dataverse) {
if (dataverse == null) {
return false;
}
if (dataverse.getOwner() == null) {
// We're operating on the root dataverse.
return settingsWrapper.isRootDataverseThemeDisabled();
} else {
return false;
}
}

public String getSignupUrl(String loginRedirect) {
String nonNullDefaultIfKeyNotFound = "";
String signUpUrl = settingsWrapper.getValueForKey(SettingsServiceBean.Key.SignUpUrl, nonNullDefaultIfKeyNotFound);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,9 @@ public String getSupportTeamName() {
return BrandingUtil.getSupportTeamName(systemAddress, dataverseService.findRootDataverse().getName());
}

public boolean isRootDataverseThemeDisabled() {
return isTrueForKey(Key.DisableRootDataverseTheme, false);
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ Whether Harvesting (OAI) service is enabled
// Option to override multiple guides with a single url
NavbarGuidesUrl,

/**
* The theme for the root dataverse can get in the way when you try make
* use of HeaderCustomizationFile and LogoCustomizationFile so this is a
* way to disable it.
*/
DisableRootDataverseTheme,
// Limit on how many guestbook entries to display on the guestbook-responses page:
GuestbookResponsesPageDisplayLimit,

Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/dataverse_header.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
<!-- FIXME: Rather than hard-coding "FFFFFF", get it from the backend. -->
<div id="dataverseHeader" class="container bg-muted"
style="background:##{!empty dataverse.dataverseTheme.backgroundColor ? dataverse.dataverseTheme.backgroundColor : 'FFFFFF'};"
jsf:rendered="#{showDataverseHeader and !widgetWrapper.widgetView}">
jsf:rendered="#{showDataverseHeader and !widgetWrapper.widgetView and !dataverseHeaderFragment.isRootDataverseThemeDisabled(dataverse)}">
<o:importFunctions type="org.apache.commons.lang.StringEscapeUtils"/>
<!-- FIXME: Rather than hard-coding "FFFFFF", get it from the backend. -->
<div class="dataverseHeaderLogo" style="text-align:#{!empty dataverse.dataverseTheme.logoAlignment ? dataverse.dataverseTheme.logoAlignment : 'center'};background:##{!empty dataverse.dataverseTheme.logoBackgroundColor ? dataverse.dataverseTheme.logoBackgroundColor : 'FFFFFF'};"
Expand Down
8 changes: 7 additions & 1 deletion src/main/webapp/themeAndWidgetsFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:o="http://omnifaces.org/ui">
<!-- Theme and Widgets Edit Tabs -->
<p:tabView rendered="#{themeWidgetFragment.editDv!=null}" id="themeWidgetsTabView" widgetVar="content">
<p:tab id="themeTab" title="#{bundle['dataverse.theme.title']}">
<p:tab id="themeTab" title="#{bundle['dataverse.theme.title']}" rendered="#{not settingsWrapper.rootDataverseThemeDisabled or themeWidgetFragment.editDv.owner != null}">
<p:fragment autoUpdate="true">
<!-- Dataverse Theme Panel -->
<div class="row form-horizontal">
Expand Down Expand Up @@ -184,6 +184,12 @@
<p:commandButton class="btn btn-default" action="#{themeWidgetFragment.cancel()}" immediate="true" id="themeCancel" value="#{bundle.cancel}"/>
</div>
</p:tab>
<p:tab id="themeTabDisabled" title="#{bundle['dataverse.theme.title']}" rendered="#{themeWidgetFragment.editDv.owner == null and settingsWrapper.rootDataverseThemeDisabled}">
<div>#{bundle['dataverse.theme.disabled']}</div>
<div class="button-block">
<p:commandButton class="btn btn-default" action="#{themeWidgetFragment.cancel()}" immediate="true" id="themeTabDisabledDone" value="#{bundle.done}"/>
</div>
</p:tab>
<p:tab id="widgetsTab" title="#{bundle['dataverse.widgets.title']}">
<div id="no-widgets-message" class="panel panel-default" jsf:rendered="#{!themeWidgetFragment.editDv.released}">
<div class="panel-body">
Expand Down

0 comments on commit 28f705c

Please sign in to comment.