2013-02-22 23 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

相關問題