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.db.DbHelper;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.TemplateContext;
import com.arsdigita.domain.DomainObject;
@ -111,8 +112,12 @@ public class Initializer extends CompoundInitializer {
*/
public void init(DomainInitEvent 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,
Navigation.getConfig().getDefaultContentSectionURL() );
ContentSection.getConfig().getDefaultContentSection() );
e.getFactory().registerInstantiator
(Template.BASE_DATA_OBJECT_TYPE,

View File

@ -57,6 +57,7 @@ import org.apache.log4j.Logger;
*/
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 StringParameter m_templatesFile = new StringParameter(
@ -64,14 +65,22 @@ public class Loader extends PackageLoader {
Parameter.REQUIRED,
"WEB-INF/navigation/templates.txt");
/**
* Constructor
*/
public Loader() {
register( m_templatesFile );
}
/**
*
* @param ctx
*/
public void run(final ScriptContext ctx) {
new KernelExcursion() {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
setupNavigation();
Loader.loadObjectListPortlet();
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
* fall back on default? Default: true */
private final Parameter m_inheritTemplates;
/** The URL of the default content section. Default: /content/ */
private final Parameter m_defaultContentSectionURL;
// Removed, use content-section config directly instead!
// 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_defaultModelClass;
private final Parameter m_defaultCatRootPath;
@ -114,9 +116,11 @@ public final class NavigationConfig extends AbstractConfig {
m_inheritTemplates = new BooleanParameter
("com.arsdigita.london.navigation.inherit_templates",
Parameter.REQUIRED, new Boolean(true));
m_defaultContentSectionURL = new StringParameter
("com.arsdigita.london.navigation.default_content_section_url",
Parameter.REQUIRED, "/content/");
// Removed, use content-section config directly instead!
// ContentSection.getConfig().getDefaultContentSection()
// m_defaultContentSectionURL = new StringParameter
// ("com.arsdigita.london.navigation.default_content_section_url",
// Parameter.REQUIRED, "/content/");
m_relatedItemsContext = new StringParameter
("com.arsdigita.london.navigation.related_items_context",
Parameter.REQUIRED, "subject");
@ -165,7 +169,9 @@ public final class NavigationConfig extends AbstractConfig {
register(m_generateItemURL);
register(m_defaultTemplate);
register(m_inheritTemplates);
register(m_defaultContentSectionURL);
// Removed, use content-section config directly instead!
// ContentSection.getConfig().getDefaultContentSection()
// register(m_defaultContentSectionURL);
register(m_relatedItemsContext);
register(m_defaultModelClass);
register(m_defaultCatRootPath);
@ -212,9 +218,11 @@ public final class NavigationConfig extends AbstractConfig {
return ((Boolean) get(m_inheritTemplates)).booleanValue();
}
public final String getDefaultContentSectionURL() {
return (String)get(m_defaultContentSectionURL);
}
// Removed, use content-section config directly instead!
// ContentSection.getConfig().getDefaultContentSection()
// public final String getDefaultContentSectionURL() {
// return (String)get(m_defaultContentSectionURL);
// }
public final String getRelatedItemsContext() {
return (String)get(m_relatedItemsContext);

View File

@ -19,8 +19,6 @@
package com.arsdigita.london.navigation.portlet;
import org.apache.log4j.Logger;
import com.arsdigita.bebop.RequestLocal;
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.domain.DomainObject;
@ -36,6 +34,8 @@ import com.arsdigita.persistence.DataObject;
import com.arsdigita.portal.Portlet;
import com.arsdigita.portal.PortletType;
import org.apache.log4j.Logger;
/**
* Displays the navigation tree as the navigation application does and provides
* a way to step into the navigation application presentation system.
@ -63,7 +63,9 @@ public class NavigationTreePortlet extends Portlet
*/
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);
type.setDescription("Displays a tree of navigation categories");
s_log.info("Loading portlet type " + type);
@ -74,7 +76,8 @@ public class NavigationTreePortlet extends Portlet
*/
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)
{

View File

@ -19,7 +19,7 @@ import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSectionConfig;
import com.arsdigita.cms.CMSConfig;
import com.arsdigita.cms.ExtraXMLGenerator;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.london.navigation.Navigation;
@ -43,7 +43,7 @@ public class GreetingItemExtraXML extends AbstractComponent {
public void register(Page 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();
String type = (String) e.getKey();
List genClasses = (List) e.getValue();