[ http://jira.magnolia.info/browse/MAGNOLIA-1275?page=comments#action_13064
]
Daniel Bleisteiner commented on MAGNOLIA-1275:
----------------------------------------------
I'd use the following solution:
1st search from the local content node upwards if set - not the request page!
2nd change the returned value within resolveNode in case of local set content
node!
Here is my local patch... please have a closer look. I found no reason why the
original return within resolveNode returns the local content node - it has
nothing to do with the currentPage parameter given. But I could oversee some
other sideeffects - maybe there is another reoson for returning that local
content node instead of the given currentPage parameter.
Index:
/home/daniel/Software/magnolia/magnolia-taglib-cms/src/main/java/info/magnolia/cms/taglibs/BaseContentTag.java
===================================================================
---
/home/daniel/Software/magnolia/magnolia-taglib-cms/src/main/java/info/magnolia/cms/taglibs/BaseContentTag.java
(revision 6740)
+++
/home/daniel/Software/magnolia/magnolia-taglib-cms/src/main/java/info/magnolia/cms/taglibs/BaseContentTag.java
(working copy)
@@ -88,7 +88,8 @@
protected Content getFirtMatchingNode() {
HttpServletRequest request = (HttpServletRequest)
pageContext.getRequest();
- Content currentPage = Resource.getCurrentActivePage(request);
+ Content currentPage = Resource.getLocalContentNode(request);
+ if (currentPage == null) currentPage =
Resource.getCurrentActivePage(request);
Content contentNode = resolveNode(currentPage);
if (contentNode == null) {
return null;
@@ -150,7 +151,7 @@
// inside collection iterator
if (contentNodeName == null && contentNodeCollectionName ==
null) {
// e.g. <cms:out nodeDataName="title"/>
- return currentParagraph;
+ return currentPage; //currentParagraph;
}
else if ((contentNodeName != null &&
StringUtils.isEmpty(contentNodeName))
|| (contentNodeCollectionName != null &&
StringUtils.isEmpty(contentNodeCollectionName))) {
> <cms:out inherit="true"> does not work with <cms:includeTemplate
> contentNode="..."> set
> ---------------------------------------------------------------------------------------
>
> Key: MAGNOLIA-1275
> URL: http://jira.magnolia.info/browse/MAGNOLIA-1275
> Project: Magnolia
> Issue Type: Bug
> Components: taglibs
> Reporter: Daniel Bleisteiner
> Assigned To: Fabrizio Giustina
>
> I'm using <cms:includeTemplate contentNode="..."> to include templates which
> use <cms:out inherit="true"> themself. That inherit="true" does not work in
> that case. Only local properties are printed - parent node's properties are
> not found. This issue is related to MAGNOLIA-1272 and should affect all cases
> where Resource.getLocalContentNode(request) != null!
> As far as I have analyzed this issue the problem lies in
> BaseContentTag#resolveNode(Content)! This method uses a local variable
> currentParagraph. If this variable != null (in case of a local conent node)
> and no contentNodeName or contentNodeCollectionName is set it simply returns
> the local content node referenced by currentParagraph. It never returns the
> node with the property we are looking for.
> if (contentNodeName == null && contentNodeCollectionName ==
> null) {
> // e.g. <cms:out nodeDataName="title"/>
> return currentParagraph;
> }
> To come back to my problem... the following code in
> BaseContentTag#getFirstMatchingNode() never returns the desired node because
> it won't be returned by resolveNode(Content):
> while (inherit && currentPage.getLevel() > 0 &&
> !nodeData.isExist()) {
> currentPage = currentPage.getParent();
> contentNode = resolveNode(currentPage);
> nodeData = contentNode.getNodeData(this.nodeDataName);
> }
> The contentNode stays the local content node all over the while loop and is
> returned in the end.
> That's all for the moment... I'll try to solve this for my local installation
> and report my changes later... but I don't have the total overview of
> possible sideeffects. We'll see that I can do...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.magnolia.info/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/magnolia/developer.html
----------------------------------------------------------------