- SiteBanner um Methoden für das Auslesen der einzelnen erweitert, diese können einfach überschrieben werden
- SubSiteBanner erstellt. Dies ist eine Unterklasse, die die Methode getSiteName() von SiteBanner überschreibt. Die überschriebene Methode gibt den Namen der SubSite (aus dem Kontext) zurück und nicht wie SiteBanner den Namen aus der Konfiguration Um das Default-Layout so zu ändern, dass der SubSiteBanner verwendet wird, muss derzeit noch die Konfiguration angepasst werden. git-svn-id: https://svn.libreccm.org/ccm/trunk@2480 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
615996dbb4
commit
5708731ebc
|
|
@ -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",
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <jens@jp-digital.de>
|
||||
* @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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue