Browse Source

Checkstyle on the parser works again.

Add contents of http://reports.dmdirc.com/ to repo so that we have a copy somewhere.

Change-Id: I2eb6aea620f7f2eb48cd76e54f7ca87190662fe4
Reviewed-on: http://gerrit.dmdirc.com/96
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
Tested-by: Shane Mc Cormack <shane@dmdirc.com>
Reviewed-by: Gregory Holmes <greboid@dmdirc.com>
Tested-by: Gregory Holmes <greboid@dmdirc.com>
tags/0.6.3b1
Git 14 years ago
parent
commit
8d6131b3d3

+ 0
- 1
.gitignore View File

@@ -3,7 +3,6 @@
3 3
 /build
4 4
 /dist
5 5
 /nbproject/private
6
-/reports
7 6
 /plugins
8 7
 /junitreports
9 8
 /junit*.properties

+ 1
- 1
build-reports.xml View File

@@ -60,7 +60,7 @@
60 60
                          classpath="checkstyle.jar"/>
61 61
         <checkstyle config="checkstyle/dmdirc_checks.xml" failureProperty="checkstyle.failure"
62 62
                                 failOnViolation="false">
63
-            <fileset dir="src/com/dmdirc/parser/irc/" includes="**/*.java"/>
63
+            <fileset dir="modules/parser/src/com/dmdirc/parser/irc/" includes="**/*.java"/>
64 64
             <formatter type="xml" tofile="reports/report-parser.xml"/>
65 65
         </checkstyle>
66 66
         <xslt in="reports/report-parser.xml" out="reports/report-parser.html" style="checkstyle/checkstyle.xsl"/>

+ 10
- 0
reports/frame-checkstyle-actions.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Checkstyle :: Actions</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-actions.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-checkstyle-all.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Checkstyle :: All</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-all.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-checkstyle-commandparser.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Checkstyle :: Command Parser</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-commandparser.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-checkstyle-config.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Checkstyle :: Config</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-config.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-checkstyle-core.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Checkstyle :: Core</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-core.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-checkstyle-logger.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Checkstyle :: Logger</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-logger.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-checkstyle-parser.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Checkstyle :: IRC Parser</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-parser.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-checkstyle-plugins.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Checkstyle :: Plugins</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-plugins.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-checkstyle-ui.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Checkstyle :: UI</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-ui.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-clover.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Clover</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=clover" scrolling="no" />
8
+  <frame src="clover/" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-cpd.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: CPD</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-cpd.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-doccheck.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Doc Check</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/doccheck/" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-findbugs.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Findbugs</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-fb.html" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-fisheye.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Fisheye</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=fisheye" scrolling="no" />
8
+  <frame src="http://fisheye.dmdirc.com/browse/DMDIrc" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-javadoc.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Javadoc</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=javadoc" scrolling="no" />
8
+  <frame src="http://www.dmdirc.com/javadoc/" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-junit.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: JUnit</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://www.dmdirc.com/junit/" />
9
+ </frameset>
10
+</html>

+ 10
- 0
reports/frame-pmd.html View File

@@ -0,0 +1,10 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: PMD</title>
5
+ </head>
6
+ <frameset rows="165,*" frameborder="0">
7
+  <frame src="frame-top.php?page=reports" scrolling="no" />
8
+  <frame src="http://reports.dmdirc.com/report-pmd.html" />
9
+ </frameset>
10
+</html>

+ 22
- 0
reports/frame-top.php View File

@@ -0,0 +1,22 @@
1
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+<html>
3
+ <head>
4
+  <title>DMDirc :: Reports</title>
5
+  <link rel="stylesheet" type="text/css" href="http://www.dmdirc.com/res/style.css">
6
+  <link rel="icon" type="image/png" href="http://www.dmdirc.com/res/favicon.png">
7
+ </head>
8
+ <body>
9
+  <div id="container">
10
+   <!-- <img id="logo" src="http://www.dmdirc.com/res/logo.png" alt="DMDirc logo"> -->
11
+<!--   <h1>DMDirc<span id="tagline">the intelligent IRC client</span></h1>-->
12
+<?PHP
13
+ ob_start();
14
+ define('NOINT', true); define('PREFIX', 'http://www.dmdirc.com/'); define('SUBPAGE', $_GET['page']); define('PAGE', 'dev'); require_once('/home/dmdirc/www/inc/menu.php');
15
+ $data = ob_get_contents();
16
+ ob_end_clean();
17
+
18
+ echo str_replace('href="', 'target="_parent" href="', $data);
19
+ ?>
20
+  </div>
21
+ </body>
22
+</html>

+ 83
- 0
reports/index.php View File

@@ -0,0 +1,83 @@
1
+<?PHP
2
+
3
+define('NOINT', true); define('PREFIX', 'http://www.dmdirc.com/'); define('SUBPAGE', 'reports'); define('PAGE', 'dev');
4
+define('TITLE', 'Reports');
5
+require_once('/home/dmdirc/www/inc/header.php');
6
+?>
7
+  <style type="text/css">
8
+   table { border-collapse: collapse; width: 100%; }
9
+   td, th { border: 1px solid black; padding: 3px; }
10
+   tr.good td.result { background-color: #0a0; color: white; }
11
+   tr.bad td.result { background-color: #a00; color: white; }
12
+  </style>
13
+  <div class="content">
14
+    <p>
15
+     We use a variety of tools for testing DMDirc. The output of these tools is
16
+     summarised below.
17
+    </p>
18
+    <table>
19
+     <tr><th>Tool</th><th>Information</th><th>Results</th></tr>
20
+<?PHP
21
+
22
+ function showTool($link, $name, $desc, $result, $status = 'unknown') {
23
+  echo '<tr class="', $status, '"><td><a href="', $link, '">', $name, '</a></td>';
24
+  echo '<td>', $desc, '</td>';
25
+  echo '<td class="result">', $result, '</td></tr>';
26
+ }
27
+
28
+ /** Junit **/
29
+ $data = @file_get_contents('/home/dmdirc/www/junit/overview-summary.html');
30
+ preg_match('#href="all-tests.html">([0-9]+)</a>#i', $data, $tests);
31
+ preg_match('#href="alltests-fails.html">([0-9]+)</a>#i', $data, $fails);
32
+ preg_match('#href="alltests-errors.html">([0-9]+)</a>#i', $data, $errors);
33
+ $result = $tests[1] . ' tests, ' . $fails[1] . ' failure(s), ' . $errors[1] . ' error(s)';
34
+ $status = ($fails[1] + $errors[1] == 0) ? 'good' : 'bad';
35
+ showTool('frame-junit.html', 'JUnit', 'Unit test framework', $result, $status);
36
+
37
+ /** Clover **/
38
+ $data = @file_get_contents('clover/dashboard.html');
39
+ preg_match('#\s*<table><tr><td>([0-9.]+)%\s*$#im', $data, $cover);
40
+ showTool('frame-clover.html', 'Clover', 'Unit test coverage analyser', $cover[1] . '% coverage', (double) $cover[1] < 25 ? 'bad' : 'good');
41
+
42
+ /** CPD **/
43
+ $data = @file_get_contents('report-cpd.html');
44
+ preg_match('#^<td class="SummaryNumber">([0-9]+)</td>#im', $data, $cpd);
45
+ showTool('frame-cpd.html', 'Copy &amp; Paste Detection', 'Detects repeated code that may be better off refactored', $cpd[1] . ' duplications', $cpd[1] > 100 ? 'bad' : 'good');
46
+
47
+ /** PMD **/
48
+ $data = @file_get_contents('report-pmd.html');
49
+ preg_match('#^<td>([0-9]+)</td><td>$#im', $data, $pmd);
50
+ showTool('frame-pmd.html', 'PMD', 'Detects potential problems with code', $pmd[1] . ' violations', $pmd[1] > 2600 ? 'bad' : 'good');
51
+
52
+ /** Checkstyle **/
53
+ function showCheckstyle($title, $page, $target = 100) {
54
+  $data = @file_get_contents('report-'.$page);
55
+  preg_match('#^<td>([0-9]+)</td><td>([0-9]+)</td>$#im', $data, $cs);
56
+  showTool('frame-checkstyle-'.$page, 'Checkstyle', 'Detects style errors (scope: ' . $title . ')', $cs[2] . ' errors', $cs[2] > $target ? 'bad' : 'good');
57
+ }
58
+
59
+ showCheckstyle('whole project', 'all.html', 750);
60
+ showCheckstyle('actions', 'actions.html');
61
+ showCheckstyle('command parser', 'commandparser.html');
62
+ showCheckstyle('core', 'core.html');
63
+ showCheckstyle('config', 'config.html');
64
+ showCheckstyle('logger', 'logger.html');
65
+ showCheckstyle('IRC parser', 'parser.html');
66
+ showCheckstyle('Plugins', 'plugins.html');
67
+ showCheckstyle('UI', 'ui.html');
68
+?>     
69
+    </table>
70
+    <h2>Findbugs report</h2>
71
+    <ul>
72
+      <li><a href="frame-findbugs.html" title="Findbugs report">Findbugs Report</a></li>
73
+    </ul>
74
+    <h2>Doc Check report</h2>
75
+    <ul>
76
+     <li><a href="frame-doccheck.html" title="DocCheck">Doc Check report</a></li>
77
+    </ul>
78
+   </div>
79
+   <div id="footer">
80
+   </div>
81
+  </div>
82
+ </body>
83
+</html>

+ 184
- 0
reports/sorttable.js View File

@@ -0,0 +1,184 @@
1
+//$Header: /cvsroot/pmd/pmd/etc/xslt/sorttable.js,v 1.1 2005/06/28 13:51:49 tomcopeland Exp $
2
+addEvent(window, "load", sortables_init);
3
+
4
+var SORT_COLUMN_INDEX;
5
+
6
+function sortables_init() {
7
+    // Find all tables with class sortable and make them sortable
8
+    if (!document.getElementsByTagName) return;
9
+    tbls = document.getElementsByTagName("table");
10
+    for (ti=0;ti<tbls.length;ti++) {
11
+        thisTbl = tbls[ti];
12
+        if (((' '+thisTbl.className+' ').indexOf("sortable") != -1) && (thisTbl.id)) {
13
+            //initTable(thisTbl.id);
14
+            ts_makeSortable(thisTbl);
15
+        }
16
+    }
17
+}
18
+
19
+function ts_makeSortable(table) {
20
+    if (table.rows && table.rows.length > 0) {
21
+        var firstRow = table.rows[0];
22
+    }
23
+    if (!firstRow) return;
24
+    
25
+    // We have a first row: assume it's the header, and make its contents clickable links
26
+    for (var i=0;i<firstRow.cells.length;i++) {
27
+        var cell = firstRow.cells[i];
28
+        var txt = ts_getInnerText(cell);
29
+        cell.innerHTML = '<a href="#" class="sortheader" onclick="ts_resortTable(this);return false;">'+txt+'<span class="sortarrow">&nbsp;&nbsp;&nbsp;</span></a>';
30
+    }
31
+}
32
+
33
+function ts_getInnerText(el) {
34
+	if (typeof el == "string") return el;
35
+	if (typeof el == "undefined") { return el };
36
+	if (el.innerText) return el.innerText;	//Not needed but it is faster
37
+	var str = "";
38
+	
39
+	var cs = el.childNodes;
40
+	var l = cs.length;
41
+	for (var i = 0; i < l; i++) {
42
+		switch (cs[i].nodeType) {
43
+			case 1: //ELEMENT_NODE
44
+				str += ts_getInnerText(cs[i]);
45
+				break;
46
+			case 3:	//TEXT_NODE
47
+				str += cs[i].nodeValue;
48
+				break;
49
+		}
50
+	}
51
+	return str;
52
+}
53
+
54
+function ts_resortTable(lnk) {
55
+    // get the span
56
+    var span;
57
+    for (var ci=0;ci<lnk.childNodes.length;ci++) {
58
+        if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') span = lnk.childNodes[ci];
59
+    }
60
+    var spantext = ts_getInnerText(span);
61
+    var td = lnk.parentNode;
62
+    var column = td.cellIndex;
63
+    var table = getParent(td,'TABLE');
64
+    
65
+    // Work out a type for the column
66
+    if (table.rows.length <= 1) return;
67
+    var itm = ts_getInnerText(table.rows[1].cells[column]);
68
+    sortfn = ts_sort_caseinsensitive;
69
+    if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) sortfn = ts_sort_date;
70
+    if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) sortfn = ts_sort_date;
71
+    if (itm.match(/^[£$]/)) sortfn = ts_sort_currency;
72
+    if (itm.match(/^[\d\.]+$/)) sortfn = ts_sort_numeric;
73
+    SORT_COLUMN_INDEX = column;
74
+    var firstRow = new Array();
75
+    var newRows = new Array();
76
+    for (i=0;i<table.rows[0].length;i++) { firstRow[i] = table.rows[0][i]; }
77
+    for (j=1;j<table.rows.length;j++) { newRows[j-1] = table.rows[j]; }
78
+
79
+    newRows.sort(sortfn);
80
+
81
+    if (span.getAttribute("sortdir") == 'down') {
82
+        ARROW = '&nbsp;&nbsp;&uarr;';
83
+        newRows.reverse();
84
+        span.setAttribute('sortdir','up');
85
+    } else {
86
+        ARROW = '&nbsp;&nbsp;&darr;';
87
+        span.setAttribute('sortdir','down');
88
+    }
89
+    
90
+    // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones
91
+    // don't do sortbottom rows
92
+    for (i=0;i<newRows.length;i++) { if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sortbottom') == -1))) table.tBodies[0].appendChild(newRows[i]);}
93
+    // do sortbottom rows only
94
+    for (i=0;i<newRows.length;i++) { if (newRows[i].className && (newRows[i].className.indexOf('sortbottom') != -1)) table.tBodies[0].appendChild(newRows[i]);}
95
+    
96
+    // Delete any other arrows there may be showing
97
+    var allspans = document.getElementsByTagName("span");
98
+    for (var ci=0;ci<allspans.length;ci++) {
99
+        if (allspans[ci].className == 'sortarrow') {
100
+            if (getParent(allspans[ci],"table") == getParent(lnk,"table")) { // in the same table as us?
101
+                allspans[ci].innerHTML = '&nbsp;&nbsp;&nbsp;';
102
+            }
103
+        }
104
+    }
105
+        
106
+    span.innerHTML = ARROW;
107
+}
108
+
109
+function getParent(el, pTagName) {
110
+	if (el == null) return null;
111
+	else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())	// Gecko bug, supposed to be uppercase
112
+		return el;
113
+	else
114
+		return getParent(el.parentNode, pTagName);
115
+}
116
+function ts_sort_date(a,b) {
117
+    // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX
118
+    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
119
+    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
120
+    if (aa.length == 10) {
121
+        dt1 = aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);
122
+    } else {
123
+        yr = aa.substr(6,2);
124
+        if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
125
+        dt1 = yr+aa.substr(3,2)+aa.substr(0,2);
126
+    }
127
+    if (bb.length == 10) {
128
+        dt2 = bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);
129
+    } else {
130
+        yr = bb.substr(6,2);
131
+        if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
132
+        dt2 = yr+bb.substr(3,2)+bb.substr(0,2);
133
+    }
134
+    if (dt1==dt2) return 0;
135
+    if (dt1<dt2) return -1;
136
+    return 1;
137
+}
138
+
139
+function ts_sort_currency(a,b) { 
140
+    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
141
+    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
142
+    return parseFloat(aa) - parseFloat(bb);
143
+}
144
+
145
+function ts_sort_numeric(a,b) { 
146
+    aa = parseFloat(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]));
147
+    if (isNaN(aa)) aa = 0;
148
+    bb = parseFloat(ts_getInnerText(b.cells[SORT_COLUMN_INDEX])); 
149
+    if (isNaN(bb)) bb = 0;
150
+    return aa-bb;
151
+}
152
+
153
+function ts_sort_caseinsensitive(a,b) {
154
+    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).toLowerCase();
155
+    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).toLowerCase();
156
+    if (aa==bb) return 0;
157
+    if (aa<bb) return -1;
158
+    return 1;
159
+}
160
+
161
+function ts_sort_default(a,b) {
162
+    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
163
+    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
164
+    if (aa==bb) return 0;
165
+    if (aa<bb) return -1;
166
+    return 1;
167
+}
168
+
169
+
170
+function addEvent(elm, evType, fn, useCapture)
171
+// addEvent and removeEvent
172
+// cross-browser event handling for IE5+,  NS6 and Mozilla
173
+// By Scott Andrew
174
+{
175
+  if (elm.addEventListener){
176
+    elm.addEventListener(evType, fn, useCapture);
177
+    return true;
178
+  } else if (elm.attachEvent){
179
+    var r = elm.attachEvent("on"+evType, fn);
180
+    return r;
181
+  } else {
182
+    alert("Handler could not be removed");
183
+  }
184
+} 

Loading…
Cancel
Save