diff --git a/ccm-core/src/com/arsdigita/ui/SiteBanner.java b/ccm-core/src/com/arsdigita/ui/SiteBanner.java index d098b0ce7..15fbef28f 100755 --- a/ccm-core/src/com/arsdigita/ui/SiteBanner.java +++ b/ccm-core/src/com/arsdigita/ui/SiteBanner.java @@ -30,17 +30,28 @@ import com.arsdigita.xml.Element; */ public class SiteBanner extends SimpleComponent { + @Override public void generateXML(PageState state, Element parent) { - Element content = parent.newChildElement("ui:siteBanner", - UIConstants.UI_XML_NS); + final Element content = parent.newChildElement("ui:siteBanner", + UIConstants.UI_XML_NS); exportAttributes(content); - content.addAttribute("hostname", - Web.getConfig().getServer().toString()); - content.addAttribute("sitename", - Web.getConfig().getSiteName()); - content.addAttribute("admin", - Kernel.getSecurityConfig().getAdminContactEmail()); + content.addAttribute("hostname", getHostname()); + content.addAttribute("sitename", getSiteName()); + content.addAttribute("admin", getAdminContactEmail()); } + + protected String getHostname() { + return Web.getConfig().getServer().toString(); + } + + protected String getSiteName() { + return Web.getConfig().getSiteName(); + } + + protected String getAdminContactEmail() { + return Kernel.getSecurityConfig().getAdminContactEmail(); + } + } diff --git a/ccm-subsite/src/com/arsdigita/subsite/Initializer.java b/ccm-subsite/src/com/arsdigita/subsite/Initializer.java index 80a719c15..478dd1576 100755 --- a/ccm-subsite/src/com/arsdigita/subsite/Initializer.java +++ b/ccm-subsite/src/com/arsdigita/subsite/Initializer.java @@ -34,6 +34,7 @@ import com.arsdigita.runtime.PDLInitializer; import com.arsdigita.runtime.RuntimeConfig; import com.arsdigita.subsite.dispatcher.SubsiteItemURLFinder; import com.arsdigita.templating.PatternStylesheetResolver; +import com.arsdigita.ui.UIConfig; import com.arsdigita.ui.admin.ApplicationManagers; import com.arsdigita.xml.XML; @@ -80,7 +81,6 @@ public class Initializer extends CompoundInitializer { //Register the ApplicationManager implementation for the Subsite application ApplicationManagers.register(new SubsiteAppManager()); - } } diff --git a/ccm-subsite/src/com/arsdigita/subsite/ui/SubSiteBanner.java b/ccm-subsite/src/com/arsdigita/subsite/ui/SubSiteBanner.java new file mode 100644 index 000000000..a87c428cb --- /dev/null +++ b/ccm-subsite/src/com/arsdigita/subsite/ui/SubSiteBanner.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2013 Jens Pelzetter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.subsite.ui; + +import com.arsdigita.subsite.Subsite; +import com.arsdigita.subsite.SubsiteContext; +import com.arsdigita.ui.SiteBanner; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SubSiteBanner extends SiteBanner { + + @Override + protected String getSiteName() { + final SubsiteContext context = Subsite.getContext(); + + if ((context == null) || (context.getSite() == null)) { + return super.getSiteName(); + } else { + return Subsite.getContext().getSite().getHostname(); + } + } + +}