From 0bf4cd8e7f0e4649f98add268c799abb5708c6ea Mon Sep 17 00:00:00 2001 From: Christos KK Loverdos Date: Thu, 13 Jun 2013 18:34:09 +0300 Subject: [PATCH] Show (c) message only if SHOW_COPYRIGHT is true Refs #3785 --- src/gr/grnet/pithos/web/client/Pithos.java | 11 +++++++++++ src/gr/grnet/pithos/web/client/StatusPanel.java | 21 +++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/gr/grnet/pithos/web/client/Pithos.java b/src/gr/grnet/pithos/web/client/Pithos.java index a304a9b..99fe458 100644 --- a/src/gr/grnet/pithos/web/client/Pithos.java +++ b/src/gr/grnet/pithos/web/client/Pithos.java @@ -114,6 +114,13 @@ public class Pithos implements EntryPoint, ResizeHandler { return getFromOtherPropertiesOrDefault(key, null); } + private static final boolean SHOW_COPYRIGHT; + static { + final String valueStr = getFromOtherPropertiesOrDefault("SHOW_COPYRIGHT", "true").trim().toLowerCase(); + SHOW_COPYRIGHT = "true".equals(valueStr); + LOG("SHOW_COPYRIGHT = '", valueStr, "' ==> ", SHOW_COPYRIGHT); + } + public static final String OTHERPROPS_STORAGE_API_URL = getFromOtherPropertiesOrNull("STORAGE_API_URL"); public static final String OTHERPROPS_USER_CATALOGS_API_URL = getFromOtherPropertiesOrNull("USER_CATALOGS_API_URL"); static { @@ -1110,6 +1117,10 @@ public class Pithos implements EntryPoint, ResizeHandler { return STORAGE_VIEW_URL; } + public static boolean isShowCopyrightMessage() { + return SHOW_COPYRIGHT; + } + public static String getUserCatalogsURL() { return USER_CATALOGS_API_URL; } diff --git a/src/gr/grnet/pithos/web/client/StatusPanel.java b/src/gr/grnet/pithos/web/client/StatusPanel.java index 41739ef..f06f5c7 100644 --- a/src/gr/grnet/pithos/web/client/StatusPanel.java +++ b/src/gr/grnet/pithos/web/client/StatusPanel.java @@ -34,7 +34,8 @@ */ package gr.grnet.pithos.web.client; -import com.google.gwt.i18n.client.Dictionary; +import com.google.gwt.safehtml.shared.SafeHtmlUtils; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.client.ui.*; /** @@ -46,10 +47,7 @@ public class StatusPanel extends Composite { * The constructor of the status panel. */ public StatusPanel() { - Dictionary otherProperties = Dictionary.getDictionary("otherProperties"); - final String COMPANY_URL = otherProperties.get("COMPANY_URL"); - final String COPYRIGHT_MESSAGE = otherProperties.get("COPYRIGHT_MESSAGE"); - final String SYNNEFO_VERSION = otherProperties.get("SYNNEFO_VERSION"); + final String SYNNEFO_VERSION = Pithos.getFromOtherPropertiesOrDefault("SYNNEFO_VERSION", ""); HorizontalPanel outer = new HorizontalPanel(); outer.setWidth("100%"); @@ -59,7 +57,18 @@ public class StatusPanel extends Composite { inner.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel firstLine = new HorizontalPanel(); firstLine.setSpacing(8); - firstLine.add(new HTML("" + COPYRIGHT_MESSAGE + "")); + if(Pithos.isShowCopyrightMessage()) { + final String COMPANY_URL = Pithos.getFromOtherPropertiesOrDefault("COMPANY_URL", "#"); + final String safeCompanyURL = UriUtils.encode(COMPANY_URL); + final String COPYRIGHT_MESSAGE = Pithos.getFromOtherPropertiesOrDefault("COPYRIGHT_MESSAGE", ""); + final String safeCopyrightMessage = SafeHtmlUtils.htmlEscape(COPYRIGHT_MESSAGE); + firstLine.add(new HTML("" + safeCopyrightMessage + "")); + + Pithos.LOG("Showing copyright message"); + } + else { + Pithos.LOG("Not showing copyright message"); + } inner.add(firstLine); HorizontalPanel secondLine = new HorizontalPanel(); -- 1.7.10.4