ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/etc junit-frames.xsl
Date Thu, 30 Aug 2001 12:23:04 GMT
conor       01/08/30 05:23:04

  Modified:    src/etc  Tag: ANT_14_BRANCH junit-frames.xsl
  Log:
  Added in Erik's style sheet changes
  
  Submitted by:	Erik Hatcher <erikhatcher@earthlink.net>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.4   +73 -45    jakarta-ant/src/etc/junit-frames.xsl
  
  Index: junit-frames.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/junit-frames.xsl,v
  retrieving revision 1.2.2.3
  retrieving revision 1.2.2.4
  diff -u -w -u -r1.2.2.3 -r1.2.2.4
  --- junit-frames.xsl	2001/08/22 21:13:26	1.2.2.3
  +++ junit-frames.xsl	2001/08/30 12:23:04	1.2.2.4
  @@ -136,25 +136,6 @@
   	background:#eeeee0;
   }
   
  -table.properties {
  -	border-collapse:collapse;
  -	border-left:solid 1 #cccccc; border-top:solid 1 #cccccc;
  -	padding:5px;
  -}
  -
  -table.properties th {
  -  text-align:left;
  -	border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc;
  -	background-color:#eeeeee;
  -}
  -
  -table.properties td {
  -	font:normal;
  -	text-align:left;
  -	border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc;
  -	background-color:#fffffff;
  -}
  -
   p {
   	line-height:1.5em;
   	margin-top:0.5em; margin-bottom:1.0em;
  @@ -183,6 +164,9 @@
   .Failure {
   	font-weight:bold; color:purple;
   }
  +.Properties {
  +  text-align:right;
  +}
   </xsl:template>
   
   
  @@ -199,9 +183,37 @@
   				<xsl:with-param name="package.name" select="$package.name"/>
   			</xsl:call-template>
         <script language="JavaScript">
  -        function toggle (field) {
  -          field.style.display = (field.style.display == "block") ? "none" : "block";
  +        var TestCases = new Array();
  +        var cur;
  +        <xsl:apply-templates select="properties"/>
  +       </script>
  +       <script language="JavaScript"><![CDATA[
  +        function displayProperties (name) {
  +          var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
  +          var doc = win.document.open();
  +          doc.write("<html><head><title>Properties of " + name + "</title>");
  +          doc.write("<style>")
  +          doc.write("body {font:normal 68% verdana,arial,helvetica;	color:#000000; }");
  +          doc.write("table tr td, table tr th { font-size: 68%; }");
  +          doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc;
border-top:solid 1 #cccccc; padding:5px; }");
  +          doc.write("table.properties th { text-align:left; border-right:solid 1 #cccccc;
border-bottom:solid 1 #cccccc; background-color:#eeeeee; }");
  +          doc.write("table.properties td { font:normal; text-align:left; border-right:solid
1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#fffffff; }");
  +          doc.write("h3 { margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
}");
  +          doc.write("</style>");
  +          doc.write("</head><body>");
  +          doc.write("<h3>Properties of " + name + "</h3>");
  +          doc.write("<div align=\"right\"><a href=\"javascript:window.close();\">Close</a></div>");
  +          doc.write("<table class='properties'>");
  +          doc.write("<tr><th>Name</th><th>Value</th></tr>");
  +          for (prop in TestCases[name]) {
  +            doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop]
+ "</td></tr>");
  +          }
  +          doc.write("</table>");
  +          doc.write("</body></html>");
  +          doc.close();
  +          win.focus();
           }
  +      ]]>  
         </script>			
   		</head>
   		<body>
  @@ -228,33 +240,27 @@
   				</xsl:if>
   				<xsl:apply-templates select="./testcase" mode="print.test"/>
   			</table>
  -			
   			</p>
  -			<xsl:apply-templates select="properties"/>
  +      <div class="Properties">
  +        <a>
  +          <xsl:attribute name="href">javascript:displayProperties('<xsl:value-of
select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute>
  +          Properties &gt;&gt;
  +        </a>
  +      </div>
   		</body>
   	</html>
   </xsl:template>
   
   <!--
  - Simple way to display properties, it is not very nice but it does
  - the job. Properties are sorted so that they can be found easily.
  +   Write properties into a JavaScript data structure.
    This is based on the original idea by Erik Hatcher (erik@hatcher.net)
    -->
   <xsl:template match="properties">
  -  <xsl:variable name="id" select="concat(translate(../@package,'.','_'),'_', ../@name)"/>
  -  <i><a href="javascript:toggle({$id});">Show/Hide System Properties &gt;&gt;</a></i>
  -  <div id="{$id}" style="display:none">
  -	  <table class="properties" border="0" cellpadding="5" cellspacing="2" width="95%">
  +    cur = TestCases['<xsl:value-of select="../@package"/>.<xsl:value-of select="../@name"/>']
= new Array();
   	    <xsl:for-each select="property">
         <xsl:sort select="@name"/>
  -		  <tr valign="top">
  -			  <th><xsl:value-of select="@name"/></th>
  -			  <td><xsl:value-of select="@value"/></td>
  -		  </tr>			  
  +        cur['<xsl:value-of select="@name"/>'] = '<xsl:call-template name="JS-escape"><xsl:with-param
name="string" select="@value"/></xsl:call-template>';
   	    </xsl:for-each>
  -	  </table>
  -  </div>
  -  <p/>
   </xsl:template>
   
   
  @@ -642,6 +648,28 @@
   	<!-- the latter is better but might be problematic for non-21" monitors... -->
   	<!--pre><xsl:value-of select="."/></pre-->
   </xsl:template>
  +
  +<xsl:template name="JS-escape">
  +	<xsl:param name="string"/>
  +	<xsl:choose><!-- something isn't right here, basically all single quotes need
to be replaced with backslash-single-quote
  +		<xsl:when test="contains($string,'&apos;')">
  +			<xsl:value-of select="substring-before($string,'&apos;')"/>
  +			\&apos;
  +			<xsl:call-template name="JS-escape">
  +				<xsl:with-param name="string" select="substring-after($string,'&apos;')"/>
  +			</xsl:call-template>
  +		</xsl:when> -->
  +		<xsl:when test="contains($string,'\')">
  +			<xsl:value-of select="substring-before($string,'\')"/>\\<xsl:call-template
name="JS-escape">
  +				<xsl:with-param name="string" select="substring-after($string,'\')"/>
  +			</xsl:call-template>
  +		</xsl:when>
  +		<xsl:otherwise>
  +			<xsl:value-of select="$string"/>
  +		</xsl:otherwise>
  +	</xsl:choose>
  +</xsl:template>
  +
   
   <!--
   	template that will convert a carriage return into a br tag
  
  
  

Mime
View raw message