Author: dolander Date: Sun Jan 16 18:34:21 2005 New Revision: 125385 URL: http://svn.apache.org/viewcvs?view=rev&rev=125385 Log: Fix two Jira Bugs 161 - adding a tagId to an anchor with formSubmit stops the form submit code from being generated. 162 - anchor with a tagId and linkName doesn't output the lookup JavaScript
Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j161/ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j161/Controller.jpf incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j161/index.jsp incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j162/ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j162/Controller.jpf incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j162/index.jsp incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J161.xml incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J162.xml Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java?view=diff&rev=125385&p1=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java&r1=125384&p2=incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java&r2=125385 ============================================================================== --- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java (original) +++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/AnchorBase.java Sun Jan 16 18:34:21 2005 @@ -300,7 +300,7 @@ String tagId = getTagId(); // if only the _linkName or _tagId is set then we are creating the name attribute only. - if (have == 0 && tagId != null) { + if (have == 0 && !_formSubmit && tagId != null) { return createNameAnchor(request, trb); } @@ -470,9 +470,15 @@ assert(_state.id != null) : "tagId must not be nulll"; WriteRenderAppender writer = new WriteRenderAppender(pageContext); + + // the tagId must be qualified and we need to output the lookup methods _state.id = getIdForTagId(_state.id); renderDefaultNameAndId(_state,_state.id,null); + + //set the name so legacy browsers can support this. _state.name = _state.id; + + // output the tag. trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req); trb.doStartTag(writer, _state); return !hasErrors(); @@ -483,12 +489,15 @@ * be a valid ID within the document. If the name begins with the "#" we will * not qualify the set link name. If the name doesn't begin with #, then we * will qualify it into the current scope container. - * @param req - * @param trb + * @param req The servlet request. + * @param trb The TagRenderer that will output the link * @return */ private boolean createPageAnchor(ServletRequest req, TagRenderingBase trb) { + // create the fragment identifier. If the _linkName starts with + // '#' then we treat it as if it was fully qualified. Otherwise we + // need to qualify it before we add the '#'. _linkName = _linkName.trim(); if (_linkName.charAt(0) != '#') { _state.href = "#" + getIdForTagId(_linkName); @@ -497,6 +506,13 @@ _state.href = _linkName; } + // if the tagId was set then rewrite it and output it. + if (_state.id != null) { + _state.id = getIdForTagId(_state.id); + renderDefaultNameAndId(_state,_state.id,null); + } + + // write out the tag. WriteRenderAppender writer = new WriteRenderAppender(pageContext); trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req); trb.doStartTag(writer, _state); Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j161/Controller.jpf Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j161/Controller.jpf?view=auto&rev=125385 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j161/Controller.jpf Sun Jan 16 18:34:21 2005 @@ -0,0 +1,83 @@ +package bugs.j161; + +import javax.servlet.http.HttpSession; +import org.apache.beehive.netui.pageflow.FormData; +import org.apache.beehive.netui.pageflow.PageFlowController; +import org.apache.beehive.netui.pageflow.Forward; +import org.apache.beehive.netui.pageflow.annotations.Jpf; +import org.apache.beehive.netui.tags.tree.TreeElement; + +/** + * This is the default controller for a blank web application. + */ [EMAIL PROTECTED] +public class Controller extends PageFlowController +{ + private String _action; + public String getAction() { + return _action; + } + + @Jpf.Action( + forwards={ + @Jpf.Forward(name="index", path="index.jsp") + } + ) + protected Forward begin() + { + _action = "begin"; + return new Forward("index"); + } + + @Jpf.Action( + forwards={ + @Jpf.Forward(name="index", path="index.jsp") + } + ) + protected Forward post(Bean form) + { + _action = "post"; + return new Forward("index"); + } + + /** + * Callback that is invoked when this controller instance is created. + */ + protected void onCreate() + { + } + + /** + * Callback that is invoked when this controller instance is destroyed. + */ + protected void onDestroy(HttpSession session) + { + } + + public static class Bean extends FormData + { + private String text1; + + private String text2; + + public String getText1() + { + return text1; + } + + public void setText1(String value) + { + text1 = value; + } + + public String getText2() + { + return text2; + } + + public void setText2(String value) + { + text2 = value; + } + } +} Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j161/index.jsp Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j161/index.jsp?view=auto&rev=125385 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j161/index.jsp Sun Jan 16 18:34:21 2005 @@ -0,0 +1,36 @@ +<%@ page language="java" contentType="text/html;charset=UTF-8"%> +<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%> + +<netui:html> + <head> + <netui:base/> + </head> + <netui:body> + <netui:span value="${pageFlow.action}" /> + <netui:scriptContainer scopeId="one" > + <netui:form action="post"> + Form Submit Anchor JS Output Test + <br/> + <netui:textBox dataSource="actionForm.text1" /> <br/> + <netui:textBox dataSource="actionForm.text2" /> <br/> + <netui:anchor tagId="a1" formSubmit="true">Submit</netui:anchor><br/> + <br/> + </netui:form> + <p id="javaOut"></p> + </netui:scriptContainer> + + </netui:body> + + <script language="JavaScript" type="text/JavaScript"> + + var p = document.getElementById("javaOut"); + var val = "<b>Document Access</b><br>"; + var anchorTag = document.getElementById(lookupIdByTagId("a1",p)); + val = val + "Anchor Scope Id: <b>" + getScopeId(anchorTag) + "</b><br/>"; + val = val + "TextBox Name: <b>" + getNetuiTagName("a1", anchorTag) + "</b><br/>"; + val = val + "TextBox ID: <b>" + lookupIdByTagId("a1",anchorTag) + "</b><br/>"; + + p.innerHTML = val; + </script> + +</netui:html> \ No newline at end of file Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j162/Controller.jpf Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j162/Controller.jpf?view=auto&rev=125385 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j162/Controller.jpf Sun Jan 16 18:34:21 2005 @@ -0,0 +1,39 @@ +package bugs.j162; + +import javax.servlet.http.HttpSession; +import org.apache.beehive.netui.pageflow.FormData; +import org.apache.beehive.netui.pageflow.PageFlowController; +import org.apache.beehive.netui.pageflow.Forward; +import org.apache.beehive.netui.pageflow.annotations.Jpf; +import org.apache.beehive.netui.tags.tree.TreeElement; + +/** + * This is the default controller for a blank web application. + */ [EMAIL PROTECTED] +public class Controller extends PageFlowController +{ + @Jpf.Action( + forwards={ + @Jpf.Forward(name="index", path="index.jsp") + } + ) + protected Forward begin() + { + return new Forward("index"); + } + + /** + * Callback that is invoked when this controller instance is created. + */ + protected void onCreate() + { + } + + /** + * Callback that is invoked when this controller instance is destroyed. + */ + protected void onDestroy(HttpSession session) + { + } +} Added: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j162/index.jsp Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j162/index.jsp?view=auto&rev=125385 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/bugs/j162/index.jsp Sun Jan 16 18:34:21 2005 @@ -0,0 +1,36 @@ +<%@ page language="java" contentType="text/html;charset=UTF-8"%> +<%@ taglib prefix="netui" uri="http://beehive.apache.org/netui/tags-html-1.0"%> +<netui:html> + <head> + <netui:base/> + </head> + <netui:body> + <p style="color:green">This test will verify that an anchor + with just a linkName and tagId attribute will output the + lookup JavaScript. + </p> + <netui:scriptContainer scopeId="one" > + <a id="one.top"></a> + <h4>Anchor Fragment Identifier Test</h4> + <netui:anchor tagId="linkBottom" linkName="bottom">Bottom</netui:anchor> + <div style="border: thin solid;height: 400px;"> + <p id="javaOut"></p> + </div> + <a id="one.bottom"></a> + <netui:anchor tagId="linkTop" linkName="top">Top</netui:anchor> + </netui:scriptContainer> + </netui:body> + <script language="JavaScript" type="text/JavaScript"> + + var p = document.getElementById("javaOut"); + var val = "<b>Document Access</b><br>"; + var anchorTag = document.getElementById(lookupIdByTagId("linkBottom",p)); + val = val + "LinkBottom Scope Id: <b>" + lookupScopeId(anchorTag,".") + "</b><br/>"; + val = val + "LinkBottom ID: <b>" + lookupIdByTagId("linkBottom",anchorTag) + "</b><br/>"; + anchorTag = document.getElementById(lookupIdByTagId("linkTop",p)); + val = val + "LinkTop Scope Id: <b>" + lookupScopeId(anchorTag,".") + "</b><br/>"; + val = val + "LinkTop ID: <b>" + lookupIdByTagId("linkTop",anchorTag) + "</b><br/>"; + + p.innerHTML = val; + </script> +</netui:html> \ No newline at end of file Modified: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?view=diff&rev=125385&p1=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r1=125384&p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml&r2=125385 ============================================================================== --- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (original) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Sun Jan 16 18:34:21 2005 @@ -3387,6 +3387,25 @@ </features> </test> <test> + <name>J161</name> + <description>Verify that setting tagId and formSubmit on an anchor coexist.</description> + <webapp>coreWeb</webapp> + <categories> + <category>bvt</category> + <category>jiriBugs</category> + </categories> + </test> + <test> + <name>J162</name> + <description>Verify linkName and tagId on an anchor coexist</description> + <webapp>coreWeb</webapp> + <categories> + <category>bvt</category> + <category>jiriBugs</category> + </categories> + </test> + + <test> <name>J163</name> <description>Verify that Anchors with only TagId produce lookup code.</description> <webapp>coreWeb</webapp> Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J161.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J161.xml?view=auto&rev=125385 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J161.xml Sun Jan 16 18:34:21 2005 @@ -0,0 +1,384 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session"> + <ses:sessionName>J161</ses:sessionName> + <ses:tester>Daryl</ses:tester> + <ses:startDate>16 Jan 2005, 06:53:18.828 PM MST</ses:startDate> + <ses:description>Verify Jira Bug 161</ses:description> + <ses:tests> + <ses:test> + <ses:testNumber>1</ses:testNumber> + <ses:request> + <ses:protocol>HTTP</ses:protocol> + <ses:protocolVersion>1.1</ses:protocolVersion> + <ses:host>localhost</ses:host> + <ses:port>8080</ses:port> + <ses:uri>/coreWeb/bugs/j161/Controller.jpf</ses:uri> + <ses:method>GET</ses:method> + <ses:parameters/> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>07CDCA30AF1C1A0D0D107C5AA6393873</ses:value> + </ses:cookie> + </ses:cookies> + <ses:headers> + <ses:header> + <ses:name>---------------</ses:name> + <ses:value>------------</ses:value> + </ses:header> + <ses:header> + <ses:name>accept</ses:name> + <ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-charset</ses:name> + <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-language</ses:name> + <ses:value>en-us,en;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>connection</ses:name> + <ses:value>keep-alive</ses:value> + </ses:header> + <ses:header> + <ses:name>cookie</ses:name> + <ses:value>JSESSIONID=07CDCA30AF1C1A0D0D107C5AA6393873</ses:value> + </ses:header> + <ses:header> + <ses:name>host</ses:name> + <ses:value>localhost:8080</ses:value> + </ses:header> + <ses:header> + <ses:name>keep-alive</ses:name> + <ses:value>300</ses:value> + </ses:header> + <ses:header> + <ses:name>user-agent</ses:name> + <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value> + </ses:header> + </ses:headers> + </ses:request> + <ses:response> + <ses:statusCode>200</ses:statusCode> + <ses:reason/> + <ses:responseBody><!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> + + <head> + <base href="http://localhost:8080/coreWeb/bugs/j161/index.jsp"> + </head> + <body> + <span>begin</span> + <div netui:scopeId="one" > + <form name="bean" id="Netui_Form_0" action="/coreWeb/bugs/j161/post.do" method="post"> + Form Submit Anchor JS Output Test + <br/> + <input type="text" name="{actionForm.text1}"> <br/> + <input type="text" name="{actionForm.text2}"> <br/> + <a id="one.a1" href="/coreWeb/bugs/j161/post.do" onclick='anchor_submit_form("Netui_Form_0","/coreWeb/bugs/j161/post.do");return false;'>Submit</a><br/> + <br/> + </form> + <p id="javaOut"></p> + </div> + +<script language="JavaScript" type="text/JavaScript"> +<!-- + +// **** This section contains code that will run when the page is loaded **** + + +// Build the netui_names table to map the tagId attributes +// to the real id written into the HTML +if (netui_names == null) + var netui_names = new Object(); +netui_names.one__a1="one.a1" + + +// **** This section contains functions typically run as events **** + + +// submit the form from an Anchor or ImageAnchor +// Search for the form by actionName, +// Replace the action with the passed in action +// Submit the form +function anchor_submit_form(netuiName, newAction) +{ + for (var i=0; i<document.forms.length; i++) { + if (document.forms[i].id == netuiName) { + document.forms[i].method = "POST"; + document.forms[i].action = newAction; + document.forms[i].submit(); + } + } +} + +// method which will return a real id for a tagId, +// the tag parameter will be used to find the scopeId for +// containers that may scope their ids +function getNetuiTagName(id, tag) +{ + var scopeId = getScopeId(tag); + if (scopeId == "") + return netui_names[id]; + else + return netui_names[scopeId + "__" + id]; +} + +// This method will walk the hierarchy from the pass element looking for a scopeId. +// The first scopeId found will be returned or the empty string if a scopeId is not found. +function getScopeId(tag) +{ + if (tag == null || tag.getAttribute == null) + return ""; + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + return attrVal; + return getScopeId(tag.parentNode); +} + +// lookup by tagId to "real id" +function lookupIdByTagId(id, tag) +{ + var scopeId = lookupScopeId(tag,"."); + return (scopeId == "") ? id : scopeId + id; +} + +//Non-Legacy lookup method creating a fully qualified scope id +function lookupScopeId(tag,sep) +{ + var val = ""; + while (tag != null && tag.getAttribute != null) { + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + val = attrVal + sep + val; + tag = tag.parentNode; + } + return val; +} +--> +</script> + + + + </body> + + <script language="JavaScript" type="text/JavaScript"> + + var p = document.getElementById("javaOut"); + var val = "<b>Document Access</b><br>"; + var anchorTag = document.getElementById(lookupIdByTagId("a1",p)); + val = val + "Anchor Scope Id: <b>" + getScopeId(anchorTag) + "</b><br/>"; + val = val + "TextBox Name: <b>" + getNetuiTagName("a1", anchorTag) + "</b><br/>"; + val = val + "TextBox ID: <b>" + lookupIdByTagId("a1",anchorTag) + "</b><br/>"; + + p.innerHTML = val; + </script> + + +</html></ses:responseBody> + </ses:response> + </ses:test> + <ses:test> + <ses:testNumber>2</ses:testNumber> + <ses:request> + <ses:protocol>HTTP</ses:protocol> + <ses:protocolVersion>1.1</ses:protocolVersion> + <ses:host>localhost</ses:host> + <ses:port>8080</ses:port> + <ses:uri>/coreWeb/bugs/j161/post.do</ses:uri> + <ses:method>POST</ses:method> + <ses:parameters> + <ses:parameter> + <ses:name>{actionForm.text1}</ses:name> + <ses:value/> + </ses:parameter> + <ses:parameter> + <ses:name>{actionForm.text2}</ses:name> + <ses:value/> + </ses:parameter> + </ses:parameters> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>07CDCA30AF1C1A0D0D107C5AA6393873</ses:value> + </ses:cookie> + </ses:cookies> + <ses:headers> + <ses:header> + <ses:name>-------</ses:name> + <ses:value>----:-----------:-------------------------------------</ses:value> + </ses:header> + <ses:header> + <ses:name>---------------</ses:name> + <ses:value>------------</ses:value> + </ses:header> + <ses:header> + <ses:name>accept</ses:name> + <ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-charset</ses:name> + <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-language</ses:name> + <ses:value>en-us,en;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>connection</ses:name> + <ses:value>keep-alive</ses:value> + </ses:header> + <ses:header> + <ses:name>content-length</ses:name> + <ses:value>47</ses:value> + </ses:header> + <ses:header> + <ses:name>content-type</ses:name> + <ses:value>application/x-www-form-urlencoded</ses:value> + </ses:header> + <ses:header> + <ses:name>cookie</ses:name> + <ses:value>JSESSIONID=07CDCA30AF1C1A0D0D107C5AA6393873</ses:value> + </ses:header> + <ses:header> + <ses:name>host</ses:name> + <ses:value>localhost:8080</ses:value> + </ses:header> + <ses:header> + <ses:name>keep-alive</ses:name> + <ses:value>300</ses:value> + </ses:header> + <ses:header> + <ses:name>user-agent</ses:name> + <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value> + </ses:header> + </ses:headers> + </ses:request> + <ses:response> + <ses:statusCode>200</ses:statusCode> + <ses:reason/> + <ses:responseBody><!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> + + <head> + <base href="http://localhost:8080/coreWeb/bugs/j161/index.jsp"> + </head> + <body> + <span>post</span> + <div netui:scopeId="one" > + <form name="bean" id="Netui_Form_0" action="/coreWeb/bugs/j161/post.do" method="post"> + Form Submit Anchor JS Output Test + <br/> + <input type="text" name="{actionForm.text1}"> <br/> + <input type="text" name="{actionForm.text2}"> <br/> + <a id="one.a1" href="/coreWeb/bugs/j161/post.do" onclick='anchor_submit_form("Netui_Form_0","/coreWeb/bugs/j161/post.do");return false;'>Submit</a><br/> + <br/> + </form> + <p id="javaOut"></p> + </div> + +<script language="JavaScript" type="text/JavaScript"> +<!-- + +// **** This section contains code that will run when the page is loaded **** + + +// Build the netui_names table to map the tagId attributes +// to the real id written into the HTML +if (netui_names == null) + var netui_names = new Object(); +netui_names.one__a1="one.a1" + + +// **** This section contains functions typically run as events **** + + +// submit the form from an Anchor or ImageAnchor +// Search for the form by actionName, +// Replace the action with the passed in action +// Submit the form +function anchor_submit_form(netuiName, newAction) +{ + for (var i=0; i<document.forms.length; i++) { + if (document.forms[i].id == netuiName) { + document.forms[i].method = "POST"; + document.forms[i].action = newAction; + document.forms[i].submit(); + } + } +} + +// method which will return a real id for a tagId, +// the tag parameter will be used to find the scopeId for +// containers that may scope their ids +function getNetuiTagName(id, tag) +{ + var scopeId = getScopeId(tag); + if (scopeId == "") + return netui_names[id]; + else + return netui_names[scopeId + "__" + id]; +} + +// This method will walk the hierarchy from the pass element looking for a scopeId. +// The first scopeId found will be returned or the empty string if a scopeId is not found. +function getScopeId(tag) +{ + if (tag == null || tag.getAttribute == null) + return ""; + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + return attrVal; + return getScopeId(tag.parentNode); +} + +// lookup by tagId to "real id" +function lookupIdByTagId(id, tag) +{ + var scopeId = lookupScopeId(tag,"."); + return (scopeId == "") ? id : scopeId + id; +} + +//Non-Legacy lookup method creating a fully qualified scope id +function lookupScopeId(tag,sep) +{ + var val = ""; + while (tag != null && tag.getAttribute != null) { + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + val = attrVal + sep + val; + tag = tag.parentNode; + } + return val; +} +--> +</script> + + + + </body> + + <script language="JavaScript" type="text/JavaScript"> + + var p = document.getElementById("javaOut"); + var val = "<b>Document Access</b><br>"; + var anchorTag = document.getElementById(lookupIdByTagId("a1",p)); + val = val + "Anchor Scope Id: <b>" + getScopeId(anchorTag) + "</b><br/>"; + val = val + "TextBox Name: <b>" + getNetuiTagName("a1", anchorTag) + "</b><br/>"; + val = val + "TextBox ID: <b>" + lookupIdByTagId("a1",anchorTag) + "</b><br/>"; + + p.innerHTML = val; + </script> + + +</html></ses:responseBody> + </ses:response> + </ses:test> + </ses:tests> + <ses:endDate>16 Jan 2005, 06:53:29.390 PM MST</ses:endDate> + <ses:testCount>2</ses:testCount> +</ses:recorderSession> \ No newline at end of file Added: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J162.xml Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J162.xml?view=auto&rev=125385 ============================================================================== --- (empty file) +++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/J162.xml Sun Jan 16 18:34:21 2005 @@ -0,0 +1,271 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ses:recorderSession xmlns:ses="http://beehive.apache.org/netui/tools/testrecorder/2004/session"> + <ses:sessionName>J162</ses:sessionName> + <ses:tester>Daryl</ses:tester> + <ses:startDate>16 Jan 2005, 06:53:48.734 PM MST</ses:startDate> + <ses:description>Verify Jira bug 162</ses:description> + <ses:tests> + <ses:test> + <ses:testNumber>1</ses:testNumber> + <ses:request> + <ses:protocol>HTTP</ses:protocol> + <ses:protocolVersion>1.1</ses:protocolVersion> + <ses:host>localhost</ses:host> + <ses:port>8080</ses:port> + <ses:uri>/coreWeb/bugs/j162/Controller.jpf</ses:uri> + <ses:method>GET</ses:method> + <ses:parameters/> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>07CDCA30AF1C1A0D0D107C5AA6393873</ses:value> + </ses:cookie> + </ses:cookies> + <ses:headers> + <ses:header> + <ses:name>---------------</ses:name> + <ses:value>------------</ses:value> + </ses:header> + <ses:header> + <ses:name>accept</ses:name> + <ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-charset</ses:name> + <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-language</ses:name> + <ses:value>en-us,en;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>connection</ses:name> + <ses:value>keep-alive</ses:value> + </ses:header> + <ses:header> + <ses:name>cookie</ses:name> + <ses:value>JSESSIONID=07CDCA30AF1C1A0D0D107C5AA6393873</ses:value> + </ses:header> + <ses:header> + <ses:name>host</ses:name> + <ses:value>localhost:8080</ses:value> + </ses:header> + <ses:header> + <ses:name>keep-alive</ses:name> + <ses:value>300</ses:value> + </ses:header> + <ses:header> + <ses:name>user-agent</ses:name> + <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value> + </ses:header> + </ses:headers> + </ses:request> + <ses:response> + <ses:statusCode>200</ses:statusCode> + <ses:reason/> + <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> + + <head> + <base href="http://localhost:8080/coreWeb/bugs/j162/index.jsp"> + </head> + <body> + <p style="color:green">This test will verify that an anchor + with just a linkName and tagId attribute will output the + lookup JavaScript. + </p> + <div netui:scopeId="one" > + <a id="one.top"></a> + <h4>Anchor Fragment Identifier Test</h4> + <a id="one.linkBottom" href="#one.bottom">Bottom</a> + <div style="border: thin solid;height: 400px;"> + <p id="javaOut"></p> + </div> + <a id="one.bottom"></a> + <a id="one.linkTop" href="#one.top">Top</a> + </div> + +<script language="JavaScript" type="text/JavaScript"> +<!-- + +// **** This section contains functions typically run as events **** + + +// lookup by tagId to "real id" +function lookupIdByTagId(id, tag) +{ + var scopeId = lookupScopeId(tag,"."); + return (scopeId == "") ? id : scopeId + id; +} + +//Non-Legacy lookup method creating a fully qualified scope id +function lookupScopeId(tag,sep) +{ + var val = ""; + while (tag != null && tag.getAttribute != null) { + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + val = attrVal + sep + val; + tag = tag.parentNode; + } + return val; +} +--> +</script> + + + </body> + <script language="JavaScript" type="text/JavaScript"> + + var p = document.getElementById("javaOut"); + var val = "<b>Document Access</b><br>"; + var anchorTag = document.getElementById(lookupIdByTagId("linkBottom",p)); + val = val + "LinkBottom Scope Id: <b>" + lookupScopeId(anchorTag,".") + "</b><br/>"; + val = val + "LinkBottom ID: <b>" + lookupIdByTagId("linkBottom",anchorTag) + "</b><br/>"; + anchorTag = document.getElementById(lookupIdByTagId("linkTop",p)); + val = val + "LinkTop Scope Id: <b>" + lookupScopeId(anchorTag,".") + "</b><br/>"; + val = val + "LinkTop ID: <b>" + lookupIdByTagId("linkTop",anchorTag) + "</b><br/>"; + + p.innerHTML = val; + </script> + +</html>]]></ses:responseBody> + </ses:response> + </ses:test> + <ses:test> + <ses:testNumber>2</ses:testNumber> + <ses:request> + <ses:protocol>HTTP</ses:protocol> + <ses:protocolVersion>1.1</ses:protocolVersion> + <ses:host>localhost</ses:host> + <ses:port>8080</ses:port> + <ses:uri>/coreWeb/bugs/j162/index.jsp</ses:uri> + <ses:method>GET</ses:method> + <ses:parameters/> + <ses:cookies> + <ses:cookie> + <ses:name>JSESSIONID</ses:name> + <ses:value>07CDCA30AF1C1A0D0D107C5AA6393873</ses:value> + </ses:cookie> + </ses:cookies> + <ses:headers> + <ses:header> + <ses:name>-------</ses:name> + <ses:value>----:-----------:-------------------------------------</ses:value> + </ses:header> + <ses:header> + <ses:name>---------------</ses:name> + <ses:value>------------</ses:value> + </ses:header> + <ses:header> + <ses:name>accept</ses:name> + <ses:value>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-charset</ses:name> + <ses:value>ISO-8859-1,utf-8;q=0.7,*;q=0.7</ses:value> + </ses:header> + <ses:header> + <ses:name>accept-language</ses:name> + <ses:value>en-us,en;q=0.5</ses:value> + </ses:header> + <ses:header> + <ses:name>connection</ses:name> + <ses:value>keep-alive</ses:value> + </ses:header> + <ses:header> + <ses:name>cookie</ses:name> + <ses:value>JSESSIONID=07CDCA30AF1C1A0D0D107C5AA6393873</ses:value> + </ses:header> + <ses:header> + <ses:name>host</ses:name> + <ses:value>localhost:8080</ses:value> + </ses:header> + <ses:header> + <ses:name>keep-alive</ses:name> + <ses:value>300</ses:value> + </ses:header> + <ses:header> + <ses:name>user-agent</ses:name> + <ses:value>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0</ses:value> + </ses:header> + </ses:headers> + </ses:request> + <ses:response> + <ses:statusCode>200</ses:statusCode> + <ses:reason/> + <ses:responseBody><![CDATA[<!DOCTYPE HTML PUBLIC "//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> + + <head> + <base href="http://localhost:8080/coreWeb/bugs/j162/index.jsp"> + </head> + <body> + <p style="color:green">This test will verify that an anchor + with just a linkName and tagId attribute will output the + lookup JavaScript. + </p> + <div netui:scopeId="one" > + <a id="one.top"></a> + <h4>Anchor Fragment Identifier Test</h4> + <a id="one.linkBottom" href="#one.bottom">Bottom</a> + <div style="border: thin solid;height: 400px;"> + <p id="javaOut"></p> + </div> + <a id="one.bottom"></a> + <a id="one.linkTop" href="#one.top">Top</a> + </div> + +<script language="JavaScript" type="text/JavaScript"> +<!-- + +// **** This section contains functions typically run as events **** + + +// lookup by tagId to "real id" +function lookupIdByTagId(id, tag) +{ + var scopeId = lookupScopeId(tag,"."); + return (scopeId == "") ? id : scopeId + id; +} + +//Non-Legacy lookup method creating a fully qualified scope id +function lookupScopeId(tag,sep) +{ + var val = ""; + while (tag != null && tag.getAttribute != null) { + var attrVal = tag.getAttribute("netui:scopeId"); + if (attrVal != null) + val = attrVal + sep + val; + tag = tag.parentNode; + } + return val; +} +--> +</script> + + + </body> + <script language="JavaScript" type="text/JavaScript"> + + var p = document.getElementById("javaOut"); + var val = "<b>Document Access</b><br>"; + var anchorTag = document.getElementById(lookupIdByTagId("linkBottom",p)); + val = val + "LinkBottom Scope Id: <b>" + lookupScopeId(anchorTag,".") + "</b><br/>"; + val = val + "LinkBottom ID: <b>" + lookupIdByTagId("linkBottom",anchorTag) + "</b><br/>"; + anchorTag = document.getElementById(lookupIdByTagId("linkTop",p)); + val = val + "LinkTop Scope Id: <b>" + lookupScopeId(anchorTag,".") + "</b><br/>"; + val = val + "LinkTop ID: <b>" + lookupIdByTagId("linkTop",anchorTag) + "</b><br/>"; + + p.innerHTML = val; + </script> + +</html>]]></ses:responseBody> + </ses:response> + </ses:test> + </ses:tests> + <ses:endDate>16 Jan 2005, 06:53:58.671 PM MST</ses:endDate> + <ses:testCount>2</ses:testCount> +</ses:recorderSession> \ No newline at end of file
