Author: apetrelli
Date: Fri Sep 26 11:27:45 2008
New Revision: 699447

URL: http://svn.apache.org/viewvc?rev=699447&view=rev
Log:
TILES-305
Applied a modified version of the patch provided by Oleg Gorobets.
Added Selenium test.

Added:
    tiles/framework/trunk/tiles-test/src/main/webapp/layout_ignore.jsp   (with 
props)
    
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_ignore.jsp
   (with props)
    
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionIgnoreTest.html
   (with props)
Modified:
    
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
    tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
    tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp
    tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html

Modified: 
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java?rev=699447&r1=699446&r2=699447&view=diff
==============================================================================
--- 
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
 (original)
+++ 
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
 Fri Sep 26 11:27:45 2008
@@ -114,7 +114,8 @@
         HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
 
         // Checks if the attribute can be rendered with the current user.
-        if (role != null && !req.isUserInRole(role)) {
+        if ((role != null && !req.isUserInRole(role))
+                || (attribute == null && ignore)) {
             return;
         }
         render(attribute);

Modified: 
tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml?rev=699447&r1=699446&r2=699447&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml 
(original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml Fri 
Sep 26 11:27:45 2008
@@ -47,6 +47,11 @@
       <put-attribute name="body"   value="/body.jsp"/>
   </definition>
 
+  <definition name="test.definition.ignore" template="/layout_ignore.jsp">
+      <put-attribute name="title"  value="This is the title."/>
+      <put-attribute name="body"   value="/body.jsp"/>
+  </definition>
+
   <definition name="test.definition.freemarker" template="/layout.ftl">
       <put-attribute name="title"  value="This is the title."/>
       <put-attribute name="header" value="/header.jsp"/>

Modified: tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp?rev=699447&r1=699446&r2=699447&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp (original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp Fri Sep 26 
11:27:45 2008
@@ -34,6 +34,7 @@
 
     <h3>Standard Render/Attribute Tests</h3>
     <a href="testinsertdefinition.jsp">Test Insert Configured 
Definition</a><br/>
+    <a href="testinsertdefinition_ignore.jsp">Test Insert Configured 
Definition with Ignore</a><br/>
     <a href="testinsertdefinition_flush.jsp">Test Insert Configured Definition 
with Flush</a><br/>
     <a href="testinsertdefinition_preparer.jsp">Test Insert Configured 
Definition with Preparer</a><br/>
     <a href="testinsertdefinition_preparer_configured.jsp">Test Insert 
Configured Definition with Preparer configured in the definition itself</a><br/>

Added: tiles/framework/trunk/tiles-test/src/main/webapp/layout_ignore.jsp
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/layout_ignore.jsp?rev=699447&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/layout_ignore.jsp (added)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/layout_ignore.jsp Fri Sep 
26 11:27:45 2008
@@ -0,0 +1,37 @@
+<%@ page session="false" %>
+<%--
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+--%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles"; prefix="tiles" %>
+
+<table  border="2"  width="300"  bordercolor="Gray">
+  <tr>
+    <td  bgcolor="Blue"><strong><tiles:getAsString name="title"/></strong></td>
+  </tr>
+  <tr>
+    <td><tiles:insertAttribute name="header" ignore="true"/></td>
+  </tr>
+  <tr>
+    <td><tiles:insertAttribute name="body"/></td>
+  </tr>
+</table>           
\ No newline at end of file

Propchange: tiles/framework/trunk/tiles-test/src/main/webapp/layout_ignore.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/framework/trunk/tiles-test/src/main/webapp/layout_ignore.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: 
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_ignore.jsp
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_ignore.jsp?rev=699447&view=auto
==============================================================================
--- 
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_ignore.jsp
 (added)
+++ 
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_ignore.jsp
 Fri Sep 26 11:27:45 2008
@@ -0,0 +1,27 @@
+<%@ page session="false" %>
+<%--
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+--%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles"; prefix="tiles" %>
+
+<tiles:insertDefinition name="test.definition.ignore" />

Propchange: 
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_ignore.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_ignore.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: 
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionIgnoreTest.html
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionIgnoreTest.html?rev=699447&view=auto
==============================================================================
--- 
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionIgnoreTest.html
 (added)
+++ 
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionIgnoreTest.html
 Fri Sep 26 11:27:45 2008
@@ -0,0 +1,61 @@
+<!--
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-->
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Configured Definition Ignore Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Configured Definition Ignore Test</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/tiles-test/index.jsp</td>
+       <td></td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>link=Test Insert Configured Definition with Ignore</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertTextPresent</td>
+       <td>This is the title.</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertTextNotPresent</td>
+       <td>This is the header</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertTextPresent</td>
+       <td>This is a body</td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>

Propchange: 
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionIgnoreTest.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionIgnoreTest.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html?rev=699447&r1=699446&r2=699447&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html (original)
+++ tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html Fri Sep 
26 11:27:45 2008
@@ -34,6 +34,9 @@
         <td><a href="ConfiguredDefinitionTest.html">Configured Definition 
Test</a></td>
     </tr>
     <tr>
+        <td><a href="ConfiguredDefinitionIgnoreTest.html">Configured 
Definition with Ignore Test</a></td>
+    </tr>
+    <tr>
         <td><a href="ConfiguredDefinitionFlushTest.html">Configured Definition 
with Flush Test</a></td>
     </tr>
     <tr>


Reply via email to