Author: michiel Date: 2010-03-25 18:33:34 +0100 (Thu, 25 Mar 2010) New Revision: 41619
Modified: speeltuin/mihxil/portal/trunk/src/main/resources/META-INF/tags/mm/portal/page.tagx speeltuin/mihxil/portal/trunk/src/main/resources/META-INF/tags/mm/portal/pages.tagx Log: path attributes Modified: speeltuin/mihxil/portal/trunk/src/main/resources/META-INF/tags/mm/portal/page.tagx =================================================================== --- speeltuin/mihxil/portal/trunk/src/main/resources/META-INF/tags/mm/portal/page.tagx 2010-03-25 16:38:53 UTC (rev 41618) +++ speeltuin/mihxil/portal/trunk/src/main/resources/META-INF/tags/mm/portal/page.tagx 2010-03-25 17:33:34 UTC (rev 41619) @@ -7,17 +7,35 @@ version="2.0" > <jsp:directive.tag - description="Calculates the currently to be used page, it looks at related 'pages' object which are related to the 'current' node" /> + description="Calculates the currently to be used page, it looks at related 'pages' object which are related to the 'current' node. If the 'path' attribute is used, we filter also on that field" /> <jsp:directive.attribute name="date" description="the date for which the current page object must be calculated. Defaults to 'now'. For possible syntaxes see: http://www.mmbase.org/api/org/mmbase/util/DynamicDate.html" /> + <jsp:directive.attribute + name="path" + /> + <jsp:directive.attribute + name="pathfromrequest" + type="java.lang.Boolean" + /> <jsp:directive.attribute name="id" required="true" type="java.lang.String" rtexprvalue="false" /> <jsp:directive.variable name-from-attribute="id" alias="page" variable-class="org.mmbase.bridge.Node" scope="AT_END" /> + <c:if test="${! empty pathfromrequest and pathfromrequest}"> + <c:choose> + <c:when test="${! empty requestScope['javax.servlet.forward.servlet_path']}"> + <!-- godsamme, java suckt --> + <c:set var="path" value="${requestScope['javax.servlet.forward.servlet_path']}" /> + </c:when> + <c:otherwise> + <c:set var="path" value="${pageContext.request.servletPath}" /> + </c:otherwise> + </c:choose> + </c:if> <!-- This would work in MMBase >= 1.9 <mm-portal:pages date="${date}"> <jsp:attribute name="constraints"> @@ -49,10 +67,15 @@ <mm:constraint field="online" operator="lt" value="${now}" /> <mm:constraint field="offline" operator="gt" value="${now}" /> <mm:constraint field="show" value="true" /> + <c:if test="${! empty path}"> + <mm:constraint field="path" value="${path}" /> + </c:if> <mm:sortorder field="online" direction="down" /> <!-- show the one which went online most recently --> <mm:maxnumber value="1" /> <mm:listnodes> - <mm:node id="page" /> + <mm:node id="page"> + <jsp:doBody /> + </mm:node> </mm:listnodes> </mm:listnodescontainer> Modified: speeltuin/mihxil/portal/trunk/src/main/resources/META-INF/tags/mm/portal/pages.tagx =================================================================== --- speeltuin/mihxil/portal/trunk/src/main/resources/META-INF/tags/mm/portal/pages.tagx 2010-03-25 16:38:53 UTC (rev 41618) +++ speeltuin/mihxil/portal/trunk/src/main/resources/META-INF/tags/mm/portal/pages.tagx 2010-03-25 17:33:34 UTC (rev 41619) @@ -17,6 +17,15 @@ type="java.lang.Boolean" description="Whether or not to only list online pages. Defaults to true." /> + + <jsp:directive.attribute + name="path" + /> + <jsp:directive.attribute + name="pathfromrequest" + type="java.lang.Boolean" + /> + <jsp:directive.attribute fragment="true" name="constraints" /> @@ -36,12 +45,29 @@ <mm:relatednodescontainer type="pages" id="container" /> </c:otherwise> </c:choose> + + <c:if test="${! empty pathfromrequest and pathfromrequest}"> + <c:choose> + <c:when test="${! empty requestScope['javax.servlet.forward.servlet_path']}"> + <!-- godsamme, java suckt --> + <c:set var="path" value="${requestScope['javax.servlet.forward.servlet_path']}" /> + </c:when> + <c:otherwise> + <c:set var="path" value="${pageContext.request.servletPath}" /> + </c:otherwise> + </c:choose> + </c:if> + + <mm:listnodescontainer referid="container"> <c:if test="${empty online or online}"> <mm:constraint field="online" operator="lt" value="${now}" /> <mm:constraint field="offline" operator="gt" value="${now}" /> <mm:constraint field="show" value="true" /> </c:if> + <c:if test="${! empty path}"> + <mm:constraint field="path" value="${path}" /> + </c:if> <mm:sortorder field="online" direction="down" /> <!-- show the one which went online most recently --> <jsp:invoke fragment="constraints" /> <mm:listnodes> _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs