Skip to content

Commit

Permalink
Merge pull request #4277 from IQSS/4197-dv-header
Browse files Browse the repository at this point in the history
4197 dv header
  • Loading branch information
kcondon authored Nov 28, 2017
2 parents caf6371 + 8e6354a commit b20ab14
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 14 deletions.
12 changes: 12 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,13 @@ 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 might prefer to disable the theme of the root dataverse. You can do so by setting ``:DisableRootDataverseTheme`` to ``true`` like this:

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

Please note: Disabling the display of the root dataverse theme also disables your ability to edit it. Remember that dataverse owners can set their dataverses to "inherit theme" from the root. Those dataverses will continue to inherit the root dataverse theme (even though it no longer displays on the root). If you would like to edit the root dataverse theme in the future, you will have to re-enable it first.


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

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

See :ref:`Branding Your Installation` above.

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

See :ref:`Branding Your Installation` above.

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

Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx-guides/source/user/dataverse-management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Tip: The metadata fields you select as required will appear on the Create Datase
Theme
====================================================

The Theme feature provides you with a way to customize the look of your dataverse. You can decide either to use the customization from the dataverse above yours or upload your own image file. Supported image types are JPEG, TIFF, or PNG and should be no larger than 500 KB. The maximum display size for an image file in a dataverse's theme is 940 pixels wide by 120 pixels high. Additionally, you can select the colors for the header of your dataverse and the text that appears in your dataverse. You can also add a link to your personal website, the website for your organization or institution, your department, journal, etc.
The Theme feature provides you with a way to customize the look of your dataverse. You can decide either to use the theme from the dataverse containing your dataverse (even up to the root dataverse, AKA the homepage), or upload your own image file. Supported image types are JPEG, TIFF, or PNG and should be no larger than 500 KB. The maximum display size for an image file in a dataverse's theme is 940 pixels wide by 120 pixels high. Additionally, you can select the colors for the header of your dataverse and the text that appears in your dataverse. You can also add a link to your personal website, the website for your organization or institution, your department, journal, etc.

.. _dataverse-widgets:

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,9 @@ dataverse.results.cards.foundInMetadata=Found in Metadata Fields:
dataverse.results.cards.files.tabularData=Tabular Data
dataverse.results.solrIsDown=Please note: Due to an internal error, browsing and searching is not available.
dataverse.theme.title=Theme
dataverse.theme.inheritCustomization.title=Check this to use the existing theme.
dataverse.theme.inheritCustomization.label=Inherit Customization
dataverse.theme.inheritCustomization.checkbox=Inherit customization from {0}
dataverse.theme.inheritCustomization.title=For this dataverse, use the same theme as the root dataverse.
dataverse.theme.inheritCustomization.label=Inherit Theme
dataverse.theme.inheritCustomization.checkbox=Inherit theme from {0}
dataverse.theme.logo=Logo
dataverse.theme.logo.tip=Supported image types are JPG, TIF, or PNG and should be no larger than 500 KB. The maximum display size for an image file in a dataverse's theme is 940 pixels wide by 120 pixels high.
dataverse.theme.logo.format=Logo Format
Expand Down Expand Up @@ -794,6 +794,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 @@ -44,8 +44,8 @@
@ViewScoped
@Named
public class ThemeWidgetFragment implements java.io.Serializable {
static final String DEFAULT_LOGO_BACKGROUND_COLOR = "F5F5F5";
static final String DEFAULT_BACKGROUND_COLOR = "F5F5F5";
static final String DEFAULT_LOGO_BACKGROUND_COLOR = "FFFFFF";
static final String DEFAULT_BACKGROUND_COLOR = "FFFFFF";
static final String DEFAULT_LINK_COLOR = "428BCA";
static final String DEFAULT_TEXT_COLOR = "888888";
private static final Logger logger = Logger.getLogger(ThemeWidgetFragment.class.getCanonicalName());
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ public class Dataverses extends AbstractApiBean {
@Deprecated
private static final Logger LOGGER = Logger.getLogger(Dataverses.class.getName());
private static final Logger logger = Logger.getLogger(Dataverses.class.getCanonicalName());
// static final String DEFAULT_LOGO_BACKGROUND_COLOR = "F5F5F5";
// static final String DEFAULT_BACKGROUND_COLOR = "F5F5F5";
// static final String DEFAULT_LINK_COLOR = "428BCA";
// static final String DEFAULT_TEXT_COLOR = "888888";

@EJB
ExplicitGroupServiceBean explicitGroupSvc;
Expand Down
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
8 changes: 5 additions & 3 deletions src/main/webapp/dataverse_header.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@
</div>
</nav>
<!-- Header Panel -->
<!-- FIXME: Rather than hard-coding "FFFFFF", get it from the backend (ThemeWidgetFragment.DEFAULT_BACKGROUND_COLOR). -->
<div id="dataverseHeader" class="container bg-muted"
style="background:##{!empty dataverse.dataverseTheme.backgroundColor ? dataverse.dataverseTheme.backgroundColor : 'F5F5F5'};"
jsf:rendered="#{showDataverseHeader and !widgetWrapper.widgetView}">
style="background:##{!empty dataverse.dataverseTheme.backgroundColor ? dataverse.dataverseTheme.backgroundColor : 'FFFFFF'};"
jsf:rendered="#{showDataverseHeader and !widgetWrapper.widgetView and !dataverseHeaderFragment.isRootDataverseThemeDisabled(dataverse)}">
<o:importFunctions type="org.apache.commons.lang.StringEscapeUtils"/>
<div class="dataverseHeaderLogo" style="text-align:#{!empty dataverse.dataverseTheme.logoAlignment ? dataverse.dataverseTheme.logoAlignment : 'center'};background:##{!empty dataverse.dataverseTheme.logoBackgroundColor ? dataverse.dataverseTheme.logoBackgroundColor : 'F5F5F5'};"
<!-- FIXME: Rather than hard-coding "FFFFFF", get it from the backend (ThemeWidgetFragment.DEFAULT_LOGO_BACKGROUND_COLOR). -->
<div class="dataverseHeaderLogo" style="text-align:#{!empty dataverse.dataverseTheme.logoAlignment ? dataverse.dataverseTheme.logoAlignment : 'center'};background:##{!empty dataverse.dataverseTheme.logoBackgroundColor ? dataverse.dataverseTheme.logoBackgroundColor : 'FFFFFF'};"
jsf:rendered="#{!empty dataverse.dataverseTheme.logo and dataverse.dataverseTheme.logoFormat == 'RECTANGLE'}">
<img src="/logos/#{dataverse.logoOwnerId}/#{dataverse.dataverseTheme.logo}" alt="#{dataverse.name}"/>
</div>
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 b20ab14

Please sign in to comment.