navigation used to maintain it's own defaultContentSection parameter,

independently from the actual content-section configuration.
Now uses the content-section parameter to automatically reflect
configuration changes.


git-svn-id: https://svn.libreccm.org/ccm/trunk@470 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2010-07-11 10:26:56 +00:00
parent ee4107d2fb
commit ab9d979aa3
5 changed files with 42 additions and 17 deletions

View File

@ -22,6 +22,7 @@ import com.arsdigita.categorization.Category;
import com.arsdigita.categorization.CategoryCollection; import com.arsdigita.categorization.CategoryCollection;
import com.arsdigita.db.DbHelper; import com.arsdigita.db.DbHelper;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.TemplateContext; import com.arsdigita.cms.TemplateContext;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
@ -111,8 +112,12 @@ public class Initializer extends CompoundInitializer {
*/ */
public void init(DomainInitEvent e) { public void init(DomainInitEvent e) {
super.init(e); super.init(e);
// Don't use a private configuration parameter for default content-section!
// Use the content-sections configuration directly!
// System.setProperty( NavigationConstants.DEFAULT_CONTENT_SECTION_URL,
// Navigation.getConfig().getDefaultContentSectionURL() );
System.setProperty( NavigationConstants.DEFAULT_CONTENT_SECTION_URL, System.setProperty( NavigationConstants.DEFAULT_CONTENT_SECTION_URL,
Navigation.getConfig().getDefaultContentSectionURL() ); ContentSection.getConfig().getDefaultContentSection() );
e.getFactory().registerInstantiator e.getFactory().registerInstantiator
(Template.BASE_DATA_OBJECT_TYPE, (Template.BASE_DATA_OBJECT_TYPE,

View File

@ -57,6 +57,7 @@ import org.apache.log4j.Logger;
*/ */
public class Loader extends PackageLoader { public class Loader extends PackageLoader {
/** Creates a s_logging category with name = full name of class */
private static final Logger s_log = Logger.getLogger(Loader.class); private static final Logger s_log = Logger.getLogger(Loader.class);
private StringParameter m_templatesFile = new StringParameter( private StringParameter m_templatesFile = new StringParameter(
@ -64,14 +65,22 @@ public class Loader extends PackageLoader {
Parameter.REQUIRED, Parameter.REQUIRED,
"WEB-INF/navigation/templates.txt"); "WEB-INF/navigation/templates.txt");
/**
* Constructor
*/
public Loader() { public Loader() {
register( m_templatesFile ); register( m_templatesFile );
} }
/**
*
* @param ctx
*/
public void run(final ScriptContext ctx) { public void run(final ScriptContext ctx) {
new KernelExcursion() { new KernelExcursion() {
public void excurse() { public void excurse() {
setEffectiveParty(Kernel.getSystemParty()); setEffectiveParty(Kernel.getSystemParty());
setupNavigation(); setupNavigation();
Loader.loadObjectListPortlet(); Loader.loadObjectListPortlet();
Loader.loadItemListPortlet(); Loader.loadItemListPortlet();

View File

@ -65,8 +65,10 @@ public final class NavigationConfig extends AbstractConfig {
/** If no template for category, should it get template from parent, or /** If no template for category, should it get template from parent, or
* fall back on default? Default: true */ * fall back on default? Default: true */
private final Parameter m_inheritTemplates; private final Parameter m_inheritTemplates;
/** The URL of the default content section. Default: /content/ */ // Removed, use content-section config directly instead!
private final Parameter m_defaultContentSectionURL; // ContentSection.getConfig().getDefaultContentSection()
// /** The URL of the default content section. Default: /content/ */
// private final Parameter m_defaultContentSectionURL;
private final Parameter m_relatedItemsContext; private final Parameter m_relatedItemsContext;
private final Parameter m_defaultModelClass; private final Parameter m_defaultModelClass;
private final Parameter m_defaultCatRootPath; private final Parameter m_defaultCatRootPath;
@ -114,9 +116,11 @@ public final class NavigationConfig extends AbstractConfig {
m_inheritTemplates = new BooleanParameter m_inheritTemplates = new BooleanParameter
("com.arsdigita.london.navigation.inherit_templates", ("com.arsdigita.london.navigation.inherit_templates",
Parameter.REQUIRED, new Boolean(true)); Parameter.REQUIRED, new Boolean(true));
m_defaultContentSectionURL = new StringParameter // Removed, use content-section config directly instead!
("com.arsdigita.london.navigation.default_content_section_url", // ContentSection.getConfig().getDefaultContentSection()
Parameter.REQUIRED, "/content/"); // m_defaultContentSectionURL = new StringParameter
// ("com.arsdigita.london.navigation.default_content_section_url",
// Parameter.REQUIRED, "/content/");
m_relatedItemsContext = new StringParameter m_relatedItemsContext = new StringParameter
("com.arsdigita.london.navigation.related_items_context", ("com.arsdigita.london.navigation.related_items_context",
Parameter.REQUIRED, "subject"); Parameter.REQUIRED, "subject");
@ -165,7 +169,9 @@ public final class NavigationConfig extends AbstractConfig {
register(m_generateItemURL); register(m_generateItemURL);
register(m_defaultTemplate); register(m_defaultTemplate);
register(m_inheritTemplates); register(m_inheritTemplates);
register(m_defaultContentSectionURL); // Removed, use content-section config directly instead!
// ContentSection.getConfig().getDefaultContentSection()
// register(m_defaultContentSectionURL);
register(m_relatedItemsContext); register(m_relatedItemsContext);
register(m_defaultModelClass); register(m_defaultModelClass);
register(m_defaultCatRootPath); register(m_defaultCatRootPath);
@ -212,9 +218,11 @@ public final class NavigationConfig extends AbstractConfig {
return ((Boolean) get(m_inheritTemplates)).booleanValue(); return ((Boolean) get(m_inheritTemplates)).booleanValue();
} }
public final String getDefaultContentSectionURL() { // Removed, use content-section config directly instead!
return (String)get(m_defaultContentSectionURL); // ContentSection.getConfig().getDefaultContentSection()
} // public final String getDefaultContentSectionURL() {
// return (String)get(m_defaultContentSectionURL);
// }
public final String getRelatedItemsContext() { public final String getRelatedItemsContext() {
return (String)get(m_relatedItemsContext); return (String)get(m_relatedItemsContext);

View File

@ -19,8 +19,6 @@
package com.arsdigita.london.navigation.portlet; package com.arsdigita.london.navigation.portlet;
import org.apache.log4j.Logger;
import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.portal.AbstractPortletRenderer; import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
@ -36,6 +34,8 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.portal.Portlet; import com.arsdigita.portal.Portlet;
import com.arsdigita.portal.PortletType; import com.arsdigita.portal.PortletType;
import org.apache.log4j.Logger;
/** /**
* Displays the navigation tree as the navigation application does and provides * Displays the navigation tree as the navigation application does and provides
* a way to step into the navigation application presentation system. * a way to step into the navigation application presentation system.
@ -63,7 +63,9 @@ public class NavigationTreePortlet extends Portlet
*/ */
public static void loadPortletType() public static void loadPortletType()
{ {
PortletType type = PortletType.createPortletType("Navigation Tree", PortletType.WIDE_PROFILE, PortletType type = PortletType
.createPortletType("Navigation Tree",
PortletType.WIDE_PROFILE,
NavigationTreePortlet.BASE_DATA_OBJECT_TYPE); NavigationTreePortlet.BASE_DATA_OBJECT_TYPE);
type.setDescription("Displays a tree of navigation categories"); type.setDescription("Displays a tree of navigation categories");
s_log.info("Loading portlet type " + type); s_log.info("Loading portlet type " + type);
@ -74,7 +76,8 @@ public class NavigationTreePortlet extends Portlet
*/ */
public static void registerInstantiator() public static void registerInstantiator()
{ {
DomainObjectFactory.registerInstantiator(BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator() DomainObjectFactory.registerInstantiator(BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator()
{ {
public DomainObject doNewInstance(DataObject dataObject) public DomainObject doNewInstance(DataObject dataObject)
{ {

View File

@ -19,7 +19,7 @@ import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.ContentBundle; import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSectionConfig; import com.arsdigita.cms.CMSConfig;
import com.arsdigita.cms.ExtraXMLGenerator; import com.arsdigita.cms.ExtraXMLGenerator;
import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.london.navigation.Navigation; import com.arsdigita.london.navigation.Navigation;
@ -43,7 +43,7 @@ public class GreetingItemExtraXML extends AbstractComponent {
public void register(Page p) { public void register(Page p) {
super.register(p); super.register(p);
for (Iterator i=ContentSectionConfig.getExtraXMLGeneratorsIterator(); i.hasNext(); ) { for (Iterator i=CMSConfig.getExtraXMLGeneratorsIterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next(); Map.Entry e = (Map.Entry) i.next();
String type = (String) e.getKey(); String type = (String) e.getKey();
List genClasses = (List) e.getValue(); List genClasses = (List) e.getValue();