2013-02-22 39 views
1

我在页面属性>基本中添加了一个新的选择类型字段“主题”。 现在,如果我在WCM中使用相同的模板添加新页面,那么我也可以获得“主题”选项,这非常明显。 有什么方法可以隐藏子页面中的字段?在CQ如何禁用子页面属性对话框中的任何字段?

P.S这是因为我使用相同的模板的子页面。

+0

所以你想要一个属性只能在父页面上编辑,而不能在任何子页面上编辑。你想要该属性继承到子页面? – antonyh 2013-02-22 15:43:15

回答

3

您不能使用相同的模板并使页面属性对话框不同。

你可以做的是超负荷的对话框

  • 创建一个新的模板和resourceType为相应的组件, 从当前的继承。
  • 复制对话框或选项卡,以使其与组件的最低父级不同。确保该对话框是该组件下的唯一节点。
  • 在对话框中进行所需的更改。

你将不得不包括在页面的JSP代码来获取父页面属性一样的东西:

// if the parent page is always a certain level below the root you can use 
// currentPage.getAbsoluteParent(3); to get the third page down from the top 
// of the current path tree. 
Page parentPage = currentPage.getParent(); 

ValueMap parentPageProperties; 

if (parentPage != null) { 
    parentPageProperties = parentPage.getProperties(); 
} 

// This tries to get the property 'theme' from the current page. If that fails 
// then it tries to get the property from the parent page. If that fails it 
// defaults to blank. 
theme = properties.get("theme", parentPageProperties.get("theme", "")); 
0

一个快速的解决方案也将创建第二组模板/页组成的。让我们假设你已经有了模板,使用页面组分B为资源类型:

  • 创建模板X与allowedParents allowedChildren和allowedPaths性能发挥,使两者是独占(实际的解决方案取决于您的内容架构)
  • 给X相同的标题,扩展B,并确定它是一个
  • 创建页面分量Y自己的对话框
  • 让使用的xtype = cqincludeŸ的对话框重新使用任何标签从B(SEE基金会页的参考对话)
+0

嗨,感谢您的宝贵回复。我以其他方式实现了它。 写一个平行于属性的侦听器,并使用findByType(“selection”)[i] .hide();隐藏该字段。 – OmP 2013-03-26 13:30:32

相关问题