site documentation 1.2.11

This commit is contained in:
Jeremy Long
2015-05-12 08:00:49 -04:00
parent 1359cc70b6
commit 1040418d65
1576 changed files with 332294 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
dl {
float: left;
width: 100%;
}
dt {
border-top: 1px solid #808080;
float: left;
font-weight: bold;
margin: 0;
padding: 1em;
width: 20%;
}
dd {
border-top: 1px solid #808080;
float: left;
font-style: italic;
margin: 0;
padding: 1em;
width: 60%;
}

View File

@@ -0,0 +1,131 @@
@import url("help.css");
@import url("source-viewer.css");
@import url("tooltip.css");
.hidden {
display: none;
}
a.dfn {
border-bottom: 1px dotted #00aa00;
cursor: help;
}
a.dfn:active, a.dfn:link, a.dfn:visited {
color: #000000;
text-decoration: none;
}
a.dfn:hover {
color: #0000ff;
text-decoration: none;
}
body {
font-family: verdana, arial, helvetica;
}
h1, h2, h3, h4, h5, h6 {
margin-bottom: 0.5em;
}
h5 {
margin-top: 0.5em;
}
div.footer {
font-size: 68%;
margin-top: 1.5em;
}
div.percentgraph
{
background-color: #f02020;
border: #808080 1px solid;
height: 1.3em;
margin: 0px;
padding: 0px;
width: 100px;
}
div.percentgraph div.greenbar
{
background-color: #00f000;
height: 1.3em;
margin: 0px;
padding: 0px;
}
div.percentgraph div.na
{
background-color: #eaeaea;
height: 1.3em;
margin: 0px;
padding: 0px;
}
div.percentgraph span.text
{
display: block;
position: absolute;
text-align: center;
width: 100px;
}
div.separator {
height: 10px;
}
table tr td, table tr th {
font-size: 68%;
}
td.value table tr td {
font-size: 11px;
}
table.percentgraph {
border: 0px;
font-size: 130%;
margin: 0px;
margin-left: auto;
margin-right: 0px;
padding: 0px;
}
table.percentgraph tr.percentgraph {
border: 0px;
margin: 0px;
padding: 0px;
}
table.percentgraph td.percentgraph {
border: 0px;
margin: 0px;
padding: 0px;
padding-left: 4px;
}
table.report {
border-collapse: collapse;
width: 100%;
}
table.report td {
border: #d0d0d0 1px solid;
}
table.report td.heading {
background: #dcecff;
font-weight: bold;
text-align: center;
}
table.report td.heading:hover {
background: #c0ffc0;
cursor: pointer;
}
table.report td.value {
text-align: right;
}

View File

@@ -0,0 +1,50 @@
.sort-table {
font: Icon;
border: 1px Solid ThreeDShadow;
background: Window;
color: WindowText;
}
.sort-table thead {
background: ButtonFace;
}
.sort-table td {
padding: 2px 5px;
}
.sort-table thead td {
border: 1px solid;
border-color: ButtonHighlight ButtonShadow
ButtonShadow ButtonHighlight;
cursor: default;
}
.sort-table thead td:active {
border-color: ButtonShadow ButtonHighlight
ButtonHighlight ButtonShadow;
padding: 3px 4px 1px 6px;
}
.sort-table thead td[_sortType=None]:active {
border-color: ButtonHighlight ButtonShadow
ButtonShadow ButtonHighlight;
padding: 2px 5px;
}
.sort-arrow {
width: 11px;
height: 11px;
background-position: center center;
background-repeat: no-repeat;
margin: 0 2px;
}
.sort-arrow.descending {
background-image: url("../images/downsimple.png");
}
.sort-arrow.ascending {
background-image: url("../images/upsimple.png");
}

View File

@@ -0,0 +1,73 @@
pre.src {
background: #ffffff;
margin-top: 0px;
margin-bottom: 0px;
}
table.src {
border: #dcdcdc 1px solid;
font-size: 16px;
}
td.numLine {
background: #f0f0f0;
border-right: #dcdcdc 1px solid;
padding-right: 3px;
text-align: right;
}
td.numLineCover {
background: #80ff80;
border-right: #dcdcdc 1px solid;
padding-right: 3px;
text-align: right;
}
td.nbHits {
background: #f0f0f0;
border-right: #dcdcdc 1px solid;
padding-right: 3px;
text-align: right;
}
td.nbHitsCovered {
background: #80ff80;
border-right: #dcdcdc 1px solid;
padding-right: 3px;
text-align: right;
}
td.nbHitsUncovered {
background: #ff9090;
border-right: #dcdcdc 1px solid;
font-weight: bold;
padding-right: 3px;
text-align: right;
}
td.src {
width: 100%;
}
span.comment {
color: #b22222;
font-style: italic;
}
span.keyword {
color: #2020bf;
font-weight: bold;
}
span.srcUncovered {
background: #ff9090;
}
span.string {
color: #2a00ff;
}
span.text_italic {
font-size: 12px;
font-style: italic;
}

View File

@@ -0,0 +1,49 @@
a.hastooltip {
border-bottom: 1px dotted #00aa00;
color: #000000;
cursor: help;
font-style: normal;
position: relative; /* This is the key */
text-decoration: none;
z-index: 24; /* What does this do? */
}
a.hastooltip:active {
color: #000000;
text-decoration: none;
}
a.hastooltip:link {
color: #000000;
text-decoration: none;
}
a.hastooltip:hover {
background-color: #a0b8ff;
color: #000000;
text-decoration: none;
z-index: 25;
}
a.hastooltip:visited {
color: #000000;
text-decoration: none;
}
a.hastooltip span {
display: none;
}
a.hastooltip:hover span {
background-color: #eeeeee;
border: 1px solid #000000;
color: #000000;
display: block;
padding: 5px;
left: -15.2em;
position: absolute;
text-align: center;
text-decoration: none;
top: 2em;
width: 20em;
}

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Coverage Report</title>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css" />
</head>
<body>
<h5>Packages</h5>
<table width="100%">
<tr>
<td nowrap="nowrap"><a href="frame-summary.html" onclick='parent.sourceFileList.location.href="frame-sourcefiles.html"' target="summary">All</a></td>
</tr>
<tr>
<td nowrap="nowrap"><a href="frame-summary-org.owasp.dependencycheck.taskdefs.html" onclick='parent.sourceFileList.location.href="frame-sourcefiles-org.owasp.dependencycheck.taskdefs.html"' target="summary">org.owasp.dependencycheck.taskdefs</a></td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Coverage Report Classes</title>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css"/>
</head>
<body>
<h5>
org.owasp.dependencycheck.taskdefs
</h5>
<div class="separator">&nbsp;</div>
<h5>Classes</h5>
<table width="100%">
<tbody>
<tr>
<td nowrap="nowrap"><a target="summary" href="org.owasp.dependencycheck.taskdefs.DependencyCheckTask.html">DependencyCheckTask</a> <i>(49%)</i></td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Coverage Report Classes</title>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css"/>
</head>
<body>
<h5>
All Packages
</h5>
<div class="separator">&nbsp;</div>
<h5>Classes</h5>
<table width="100%">
<tbody>
<tr>
<td nowrap="nowrap"><a target="summary" href="org.owasp.dependencycheck.taskdefs.DependencyCheckTask.html">DependencyCheckTask</a> <i>(49%)</i></td>
</tr>
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Coverage Report</title>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css"/>
<link title="Style" type="text/css" rel="stylesheet" href="css/sortabletable.css"/>
<script type="text/javascript" src="js/popup.js"></script>
<script type="text/javascript" src="js/sortabletable.js"></script>
<script type="text/javascript" src="js/customsorttypes.js"></script>
</head>
<body>
<h5>Coverage Report - org.owasp.dependencycheck.taskdefs</h5>
<div class="separator">&nbsp;</div>
<table class="report" id="packageResults">
<thead><tr> <td class="heading">Package</td> <td class="heading"># Classes</td> <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Line Coverage</a></td> <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Branch Coverage</a></td> <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Complexity</a></td></tr></thead>
<tbody>
<tr><td><a href="frame-summary-org.owasp.dependencycheck.taskdefs.html" onclick='parent.sourceFileList.location.href="frame-sourcefiles-org.owasp.dependencycheck.taskdefs.html"'>org.owasp.dependencycheck.taskdefs</a></td><td class="value">2</td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">49%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:49px"><span class="text">151/307</span></div></div></td></tr></table></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">39%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:39px"><span class="text">55/138</span></div></div></td></tr></table></td><td class="value"><span class="hidden">2.0;</span>2</td></tr>
</tbody>
</table>
<script type="text/javascript">
var packageTable = new SortableTable(document.getElementById("packageResults"),
["String", "Number", "Percentage", "Percentage", "FormattedNumber"]);
packageTable.sort(0);
</script>
<div class="separator">&nbsp;</div>
<table class="report" id="classResults">
<thead><tr> <td class="heading">Classes in this Package</td> <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Line Coverage</a></td> <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Branch Coverage</a></td> <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Complexity</a></td></tr></thead>
<tbody>
<tr><td><a href="org.owasp.dependencycheck.taskdefs.DependencyCheckTask.html">DependencyCheckTask</a></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">48%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:48px"><span class="text">144/300</span></div></div></td></tr></table></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">38%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:38px"><span class="text">53/136</span></div></div></td></tr></table></td><td class="value"><span class="hidden">2.0;</span>2</td></tr>
<tr><td><a href="org.owasp.dependencycheck.taskdefs.DependencyCheckTask.html">DependencyCheckTask$ReportFormats</a></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">100%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:100px"><span class="text">7/7</span></div></div></td></tr></table></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">100%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:100px"><span class="text">2/2</span></div></div></td></tr></table></td><td class="value"><span class="hidden">2.0;</span>2</td></tr>
</tbody>
</table>
<script type="text/javascript">
var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
</script>
<div class="footer">Report generated by <a href="http://cobertura.sourceforge.net/" target="_top">Cobertura</a> 2.0.3 on 5/11/15 8:42 PM.</div>
</body>
</html>

View File

@@ -0,0 +1,30 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Coverage Report</title>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css"/>
<link title="Style" type="text/css" rel="stylesheet" href="css/sortabletable.css"/>
<script type="text/javascript" src="js/popup.js"></script>
<script type="text/javascript" src="js/sortabletable.js"></script>
<script type="text/javascript" src="js/customsorttypes.js"></script>
</head>
<body>
<h5>Coverage Report - All Packages</h5>
<div class="separator">&nbsp;</div>
<table class="report" id="packageResults">
<thead><tr> <td class="heading">Package</td> <td class="heading"># Classes</td> <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Line Coverage</a></td> <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Branch Coverage</a></td> <td class="heading"><a class="dfn" href="help.html" onclick="popupwindow('help.html'); return false;">Complexity</a></td></tr></thead>
<tbody>
<tr><td><b>All Packages</b></td><td class="value">2</td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">49%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:49px"><span class="text">151/307</span></div></div></td></tr></table></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">39%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:39px"><span class="text">55/138</span></div></div></td></tr></table></td><td class="value"><span class="hidden">2.0;</span>2</td></tr>
<tr><td><a href="frame-summary-org.owasp.dependencycheck.taskdefs.html" onclick='parent.sourceFileList.location.href="frame-sourcefiles-org.owasp.dependencycheck.taskdefs.html"'>org.owasp.dependencycheck.taskdefs</a></td><td class="value">2</td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">49%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:49px"><span class="text">151/307</span></div></div></td></tr></table></td><td><table cellpadding="0px" cellspacing="0px" class="percentgraph"><tr class="percentgraph"><td align="right" class="percentgraph" width="40">39%</td><td class="percentgraph"><div class="percentgraph"><div class="greenbar" style="width:39px"><span class="text">55/138</span></div></div></td></tr></table></td><td class="value"><span class="hidden">2.0;</span>2</td></tr>
</tbody>
</table>
<script type="text/javascript">
var packageTable = new SortableTable(document.getElementById("packageResults"),
["String", "Number", "Percentage", "Percentage", "FormattedNumber"]);
packageTable.sort(0);
</script>
<div class="footer">Report generated by <a href="http://cobertura.sourceforge.net/" target="_top">Cobertura</a> 2.0.3 on 5/11/15 8:42 PM.</div>
</body>
</html>

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css"/>
<title>Coverage Report - Help</title>
</head>
<body>
<dl>
<dt>Line Coverage</dt>
<dd>The percent of lines executed by this test run.</dd>
<dt>Branch Coverage</dt>
<dd>The percent of branches executed by this test run.</dd>
<dt>Complexity</dt>
<dd>Average McCabe's cyclomatic code complexity for all methods. This is basically a count of the number of different code paths in a method (incremented by 1 for each if statement, while loop, etc.)</dd>
<dt>N/A</dt>
<dd>Line coverage and branch coverage will appear as "Not Applicable" when Cobertura can not find line number information in the .class file. This happens for stub and skeleton classes, interfaces, or when the class was not compiled with "debug=true."</dd>
</dl>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Coverage Report</title>
</head>
<frameset cols="20%,80%">
<frameset rows="30%,70%">
<frame src="frame-packages.html" name="packageList" title="All Packages"/>
<frame src="frame-sourcefiles.html" name="sourceFileList" title="All classes and interfaces (except non-static nested types)"/>
</frameset>
<frame src="frame-summary.html" name="summary" title="Package, class and interface descriptions" scrolling="yes"/>
<noframes>
<body>
<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a frame-incapable web client.</p>
<p><a href="frame-summary.html">Click here to view a non-frame version.</a></p>
</body>
</noframes>
</frameset>
</html>

View File

@@ -0,0 +1,65 @@
/*
* Cobertura - http://cobertura.sourceforge.net/
*
* Copyright (C) 2005 Mark Doliner
* Copyright (C) 2005 Olivier Parent
*
* Cobertura is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
* Cobertura is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Cobertura; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
function percentageSortType( s )
{
var ret;
var i = s.indexOf( "%" );
if (i != -1) {
s = s.substr( 0, i );
}
ret = parseFloat(s);
if (isNaN(ret)) {
ret = -1;
}
return ret;
}
SortableTable.prototype.addSortType( "Percentage", percentageSortType );
// This is needed for correctly sorting numbers in different
// locales. The stock number converter only expects to sort
// numbers which use a period as a separator instead of a
// comma (like French).
function formattedNumberSortType( s )
{
var ret;
var i = s.indexOf(';');
if (i != -1) {
s = s.substring(0, i);
}
ret = parseFloat(s);
if (isNaN(ret)) {
return -1;
}
return ret;
}
SortableTable.prototype.addSortType( "FormattedNumber", formattedNumberSortType );

View File

@@ -0,0 +1,8 @@
var newwindow;
function popupwindow(url)
{
newwindow=window.open(url,'name','height=500,width=500,resizable=yes,scrollbars=yes');
if (window.focus) {
newwindow.focus()
}
}

View File

@@ -0,0 +1,455 @@
/*----------------------------------------------------------------------------\
| Sortable Table 1.12 |
|-----------------------------------------------------------------------------|
| Created by Erik Arvidsson |
| (http://webfx.eae.net/contact.html#erik) |
| For WebFX (http://webfx.eae.net/) |
|-----------------------------------------------------------------------------|
| A DOM 1 based script that allows an ordinary HTML table to be sortable. |
|-----------------------------------------------------------------------------|
| Copyright (c) 1998 - 2004 Erik Arvidsson |
|-----------------------------------------------------------------------------|
| This software is provided "as is", without warranty of any kind, express or |
| implied, including but not limited to the warranties of merchantability, |
| fitness for a particular purpose and noninfringement. In no event shall the |
| authors or copyright holders be liable for any claim, damages or other |
| liability, whether in an action of contract, tort or otherwise, arising |
| from, out of or in connection with the software or the use or other |
| dealings in the software. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| This software is available under the three different licenses mentioned |
| below. To use this software you must chose, and qualify, for one of those. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| The WebFX Non-Commercial License http://webfx.eae.net/license.html |
| Permits anyone the right to use the software in a non-commercial context |
| free of charge. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| The WebFX Commercial license http://webfx.eae.net/commercial.html |
| Permits the license holder the right to use the software in a commercial |
| context. Such license must be specifically obtained, however it's valid for |
| any number of implementations of the licensed software. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| GPL - The GNU General Public License http://www.gnu.org/licenses/gpl.txt |
| Permits anyone the right to use and modify the software without limitations |
| as long as proper credits are given and the original and modified source |
| code are included. Requires that the final product, software derivate from |
| the original source or any software utilizing a GPL component, such as |
| this, is also licensed under the GPL license. |
|-----------------------------------------------------------------------------|
| 2003-01-10 | First version |
| 2003-01-19 | Minor changes to the date parsing |
| 2003-01-28 | JScript 5.0 fixes (no support for 'in' operator) |
| 2003-02-01 | Sloppy typo like error fixed in getInnerText |
| 2003-07-04 | Added workaround for IE cellIndex bug. |
| 2003-11-09 | The bDescending argument to sort was not correctly working |
| | Using onclick DOM0 event if no support for addEventListener |
| | or attachEvent |
| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |
| | easier to add new, custom sort types. |
| 2004-01-27 | Switch to use descending = false as the default sort order. |
| | Change defaultDescending to suit your needs. |
| 2004-03-14 | Improved sort type None look and feel a bit |
| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |
| | can use another tHead or no tHead, and you can chose some |
| | other tBody. |
|-----------------------------------------------------------------------------|
| Created 2003-01-10 | All changes are in the log above. | Updated 2004-08-26 |
\----------------------------------------------------------------------------*/
function SortableTable(oTable, oSortTypes) {
this.sortTypes = oSortTypes || [];
this.sortColumn = null;
this.descending = null;
var oThis = this;
this._headerOnclick = function (e) {
oThis.headerOnclick(e);
};
if (oTable) {
this.setTable( oTable );
this.document = oTable.ownerDocument || oTable.document;
}
else {
this.document = document;
}
// only IE needs this
var win = this.document.defaultView || this.document.parentWindow;
this._onunload = function () {
oThis.destroy();
};
if (win && typeof win.attachEvent != "undefined") {
win.attachEvent("onunload", this._onunload);
}
}
SortableTable.gecko = navigator.product == "Gecko";
SortableTable.msie = /msie/i.test(navigator.userAgent);
// Mozilla is faster when doing the DOM manipulations on
// an orphaned element. MSIE is not
SortableTable.removeBeforeSort = SortableTable.gecko;
SortableTable.prototype.onsort = function () {};
// default sort order. true -> descending, false -> ascending
SortableTable.prototype.defaultDescending = false;
// shared between all instances. This is intentional to allow external files
// to modify the prototype
SortableTable.prototype._sortTypeInfo = {};
SortableTable.prototype.setTable = function (oTable) {
if ( this.tHead )
this.uninitHeader();
this.element = oTable;
this.setTHead( oTable.tHead );
this.setTBody( oTable.tBodies[0] );
};
SortableTable.prototype.setTHead = function (oTHead) {
if (this.tHead && this.tHead != oTHead )
this.uninitHeader();
this.tHead = oTHead;
this.initHeader( this.sortTypes );
};
SortableTable.prototype.setTBody = function (oTBody) {
this.tBody = oTBody;
};
SortableTable.prototype.setSortTypes = function ( oSortTypes ) {
if ( this.tHead )
this.uninitHeader();
this.sortTypes = oSortTypes || [];
if ( this.tHead )
this.initHeader( this.sortTypes );
};
// adds arrow containers and events
// also binds sort type to the header cells so that reordering columns does
// not break the sort types
SortableTable.prototype.initHeader = function (oSortTypes) {
if (!this.tHead) return;
var cells = this.tHead.rows[0].cells;
var doc = this.tHead.ownerDocument || this.tHead.document;
this.sortTypes = oSortTypes || [];
var l = cells.length;
var img, c;
for (var i = 0; i < l; i++) {
c = cells[i];
if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {
img = doc.createElement("IMG");
img.src = "images/blank.png";
c.appendChild(img);
if (this.sortTypes[i] != null)
c._sortType = this.sortTypes[i];
if (typeof c.addEventListener != "undefined")
c.addEventListener("click", this._headerOnclick, false);
else if (typeof c.attachEvent != "undefined")
c.attachEvent("onclick", this._headerOnclick);
else
c.onclick = this._headerOnclick;
}
else
{
c.setAttribute( "_sortType", oSortTypes[i] );
c._sortType = "None";
}
}
this.updateHeaderArrows();
};
// remove arrows and events
SortableTable.prototype.uninitHeader = function () {
if (!this.tHead) return;
var cells = this.tHead.rows[0].cells;
var l = cells.length;
var c;
for (var i = 0; i < l; i++) {
c = cells[i];
if (c._sortType != null && c._sortType != "None") {
c.removeChild(c.lastChild);
if (typeof c.removeEventListener != "undefined")
c.removeEventListener("click", this._headerOnclick, false);
else if (typeof c.detachEvent != "undefined")
c.detachEvent("onclick", this._headerOnclick);
c._sortType = null;
c.removeAttribute( "_sortType" );
}
}
};
SortableTable.prototype.updateHeaderArrows = function () {
if (!this.tHead) return;
var cells = this.tHead.rows[0].cells;
var l = cells.length;
var img;
for (var i = 0; i < l; i++) {
if (cells[i]._sortType != null && cells[i]._sortType != "None") {
img = cells[i].lastChild;
if (i == this.sortColumn)
img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");
else
img.className = "sort-arrow";
}
}
};
SortableTable.prototype.headerOnclick = function (e) {
// find TD element
var el = e.target || e.srcElement;
while (el.tagName != "TD")
el = el.parentNode;
this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);
};
// IE returns wrong cellIndex when columns are hidden
SortableTable.getCellIndex = function (oTd) {
var cells = oTd.parentNode.childNodes
var l = cells.length;
var i;
for (i = 0; cells[i] != oTd && i < l; i++)
;
return i;
};
SortableTable.prototype.getSortType = function (nColumn) {
return this.sortTypes[nColumn] || "String";
};
// only nColumn is required
// if bDescending is left out the old value is taken into account
// if sSortType is left out the sort type is found from the sortTypes array
SortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {
if (!this.tBody) return;
if (sSortType == null)
sSortType = this.getSortType(nColumn);
// exit if None
if (sSortType == "None")
return;
if (bDescending == null) {
if (this.sortColumn != nColumn)
this.descending = this.defaultDescending;
else
this.descending = !this.descending;
}
else
this.descending = bDescending;
this.sortColumn = nColumn;
if (typeof this.onbeforesort == "function")
this.onbeforesort();
var f = this.getSortFunction(sSortType, nColumn);
var a = this.getCache(sSortType, nColumn);
var tBody = this.tBody;
a.sort(f);
if (this.descending)
a.reverse();
if (SortableTable.removeBeforeSort) {
// remove from doc
var nextSibling = tBody.nextSibling;
var p = tBody.parentNode;
p.removeChild(tBody);
}
// insert in the new order
var l = a.length;
for (var i = 0; i < l; i++)
tBody.appendChild(a[i].element);
if (SortableTable.removeBeforeSort) {
// insert into doc
p.insertBefore(tBody, nextSibling);
}
this.updateHeaderArrows();
this.destroyCache(a);
if (typeof this.onsort == "function")
this.onsort();
};
SortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {
var oThis = this;
this._asyncsort = function () {
oThis.sort(nColumn, bDescending, sSortType);
};
window.setTimeout(this._asyncsort, 1);
};
SortableTable.prototype.getCache = function (sType, nColumn) {
if (!this.tBody) return [];
var rows = this.tBody.rows;
var l = rows.length;
var a = new Array(l);
var r;
for (var i = 0; i < l; i++) {
r = rows[i];
a[i] = {
value: this.getRowValue(r, sType, nColumn),
element: r
};
};
return a;
};
SortableTable.prototype.destroyCache = function (oArray) {
var l = oArray.length;
for (var i = 0; i < l; i++) {
oArray[i].value = null;
oArray[i].element = null;
oArray[i] = null;
}
};
SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {
// if we have defined a custom getRowValue use that
if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)
return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);
var s;
var c = oRow.cells[nColumn];
if (typeof c.innerText != "undefined")
s = c.innerText;
else
s = SortableTable.getInnerText(c);
return this.getValueFromString(s, sType);
};
SortableTable.getInnerText = function (oNode) {
var s = "";
var cs = oNode.childNodes;
var l = cs.length;
for (var i = 0; i < l; i++) {
switch (cs[i].nodeType) {
case 1: //ELEMENT_NODE
s += SortableTable.getInnerText(cs[i]);
break;
case 3: //TEXT_NODE
s += cs[i].nodeValue;
break;
}
}
return s;
};
SortableTable.prototype.getValueFromString = function (sText, sType) {
if (this._sortTypeInfo[sType])
return this._sortTypeInfo[sType].getValueFromString( sText );
return sText;
/*
switch (sType) {
case "Number":
return Number(sText);
case "CaseInsensitiveString":
return sText.toUpperCase();
case "Date":
var parts = sText.split("-");
var d = new Date(0);
d.setFullYear(parts[0]);
d.setDate(parts[2]);
d.setMonth(parts[1] - 1);
return d.valueOf();
}
return sText;
*/
};
SortableTable.prototype.getSortFunction = function (sType, nColumn) {
if (this._sortTypeInfo[sType])
return this._sortTypeInfo[sType].compare;
return SortableTable.basicCompare;
};
SortableTable.prototype.destroy = function () {
this.uninitHeader();
var win = this.document.parentWindow;
if (win && typeof win.detachEvent != "undefined") { // only IE needs this
win.detachEvent("onunload", this._onunload);
}
this._onunload = null;
this.element = null;
this.tHead = null;
this.tBody = null;
this.document = null;
this._headerOnclick = null;
this.sortTypes = null;
this._asyncsort = null;
this.onsort = null;
};
// Adds a sort type to all instance of SortableTable
// sType : String - the identifier of the sort type
// fGetValueFromString : function ( s : string ) : T - A function that takes a
// string and casts it to a desired format. If left out the string is just
// returned
// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort
// compare function. Takes two values and compares them. If left out less than,
// <, compare is used
// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function
// that takes the row and the column index and returns the value used to compare.
// If left out then the innerText is first taken for the cell and then the
// fGetValueFromString is used to convert that string the desired value and type
SortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {
this._sortTypeInfo[sType] = {
type: sType,
getValueFromString: fGetValueFromString || SortableTable.idFunction,
compare: fCompareFunction || SortableTable.basicCompare,
getRowValue: fGetRowValue
};
};
// this removes the sort type from all instances of SortableTable
SortableTable.prototype.removeSortType = function (sType) {
delete this._sortTypeInfo[sType];
};
SortableTable.basicCompare = function compare(n1, n2) {
if (n1.value < n2.value)
return -1;
if (n2.value < n1.value)
return 1;
return 0;
};
SortableTable.idFunction = function (x) {
return x;
};
SortableTable.toUpperCase = function (s) {
return s.toUpperCase();
};
SortableTable.toDate = function (s) {
var parts = s.split("-");
var d = new Date(0);
d.setFullYear(parts[0]);
d.setDate(parts[2]);
d.setMonth(parts[1] - 1);
return d.valueOf();
};
// add sort types
SortableTable.prototype.addSortType("Number", Number);
SortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);
SortableTable.prototype.addSortType("Date", SortableTable.toDate);
SortableTable.prototype.addSortType("String");
// None is a special case

View File

@@ -0,0 +1,79 @@
/*----------------------------------------------------------------------------\
| String Builder 1.02 |
|-----------------------------------------------------------------------------|
| Created by Erik Arvidsson |
| (http://webfx.eae.net/contact.html#erik) |
| For WebFX (http://webfx.eae.net/) |
|-----------------------------------------------------------------------------|
| A class that allows more efficient building of strings than concatenation. |
|-----------------------------------------------------------------------------|
| Copyright (c) 1999 - 2002 Erik Arvidsson |
|-----------------------------------------------------------------------------|
| This software is provided "as is", without warranty of any kind, express or |
| implied, including but not limited to the warranties of merchantability, |
| fitness for a particular purpose and noninfringement. In no event shall the |
| authors or copyright holders be liable for any claim, damages or other |
| liability, whether in an action of contract, tort or otherwise, arising |
| from, out of or in connection with the software or the use or other |
| dealings in the software. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| This software is available under the three different licenses mentioned |
| below. To use this software you must chose, and qualify, for one of those. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| The WebFX Non-Commercial License http://webfx.eae.net/license.html |
| Permits anyone the right to use the software in a non-commercial context |
| free of charge. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| The WebFX Commercial license http://webfx.eae.net/commercial.html |
| Permits the license holder the right to use the software in a commercial |
| context. Such license must be specifically obtained, however it's valid for |
| any number of implementations of the licensed software. |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| GPL - The GNU General Public License http://www.gnu.org/licenses/gpl.txt |
| Permits anyone the right to use and modify the software without limitations |
| as long as proper credits are given and the original and modified source |
| code are included. Requires that the final product, software derivate from |
| the original source or any software utilizing a GPL component, such as |
| this, is also licensed under the GPL license. |
|-----------------------------------------------------------------------------|
| 2000-10-02 | First version |
| 2000-10-05 | Added a cache of the string so that it does not need to be |
| | regenerated every time in toString |
| 2002-10-03 | Added minor improvement in the toString method |
|-----------------------------------------------------------------------------|
| Created 2000-10-02 | All changes are in the log above. | Updated 2002-10-03 |
\----------------------------------------------------------------------------*/ function StringBuilder(sString) {
// public
this.length = 0;
this.append = function (sString) {
// append argument
this.length += (this._parts[this._current++] = String(sString)).length;
// reset cache
this._string = null;
return this;
};
this.toString = function () {
if (this._string != null)
return this._string;
var s = this._parts.join("");
this._parts = [s];
this._current = 1;
this.length = s.length;
return this._string = s;
};
// private
this._current = 0;
this._parts = [];
this._string = null; // used to cache the string
// init
if (sString != null)
this.append(sString);
}