1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <xsl : stylesheet xmlns : xsl =" http://www.w3.org/1999/XSL/Transform" version =" 1.0" >
3+
4+ <xsl : output method =" html" encoding =" UTF-8" />
5+ <xsl : key name =" file-category" match =" //files/file" use =" @name" />
6+ <xsl : param name =" root-directory" />
7+
8+ <xsl : template match =" /" >
9+ <html >
10+ <head >
11+ <title >PhpAssumptions report</title >
12+ <link rel =" stylesheet" ><xsl : attribute name =" href" ><xsl : value-of select =" $bootstrap.min.css" /></xsl : attribute ></link >
13+ <style >
14+ .file {
15+ background: #f9f9f9
16+ }
17+ .fixed-navbar {
18+ list-style-type: none;
19+ position: fixed;
20+ top: 0;
21+ right: 1em;
22+ }
23+ </style >
24+ <script >
25+ var onDocumentReady = [
26+ function () {
27+ $('[data-file]').each(function () {
28+ var pathWithoutRoot = $(this).text().replace('<xsl : value-of select =" $root-directory" ></xsl : value-of >', '');
29+ $(this).text(pathWithoutRoot);
30+ });
31+ }
32+ ];
33+ </script >
34+ </head >
35+ <body >
36+
37+ <div class =" container-fluid" >
38+
39+ <h1 >PhpAssumptions report</h1 >
40+
41+ <nav >
42+ <ul class =" nav nav-pills" role =" tablist" >
43+ <li role =" presentation" class =" active" >
44+ <a href =" #overview" aria-controls =" overview" role =" tab" data-toggle =" tab" >Overview</a >
45+ </li >
46+ <li role =" presentation" >
47+ <a href =" #errors" aria-controls =" errors" role =" tab" data-toggle =" tab" >Errors</a >
48+ </li >
49+ </ul >
50+ </nav >
51+
52+ <div class =" tab-content" >
53+
54+ <div role =" tabpanel" class =" tab-pane active" id =" overview" >
55+ <table class =" table table-striped" >
56+ <thead >
57+ <tr >
58+ <th >File</th >
59+ <th >Errors</th >
60+ </tr >
61+ </thead >
62+ <!-- http://stackoverflow.com/a/9589085/4587679 -->
63+ <xsl : for-each select =" //files/file[generate-id() = generate-id(key('file-category', ./@name)[1])]" >
64+ <xsl : variable name =" group" select =" @name" />
65+ <tr >
66+ <td ><strong data-file =" " ><xsl : value-of select =" $group" /></strong ></td >
67+ <td ><xsl : value-of select =" count(//files/file[@name = $group]/line)" /></td >
68+ </tr >
69+ </xsl : for-each >
70+ <tfoot >
71+ <tr >
72+ <th ><span class =" label label-info" ><xsl : value-of select =" count(//files/file[generate-id() = generate-id(key('file-category', @name)[1])])" /></span ></th >
73+ <th >
74+ <span class =" label label-danger" ><xsl : value-of select =" count(//files/file/line)" /></span >
75+ <span class =" label label-warning" ><xsl : value-of select =" /phpa/@percentage" /><xsl : text >%</xsl : text ></span >
76+ </th >
77+ </tr >
78+ </tfoot >
79+ </table >
80+ </div >
81+
82+ <div role =" tabpanel" class =" tab-pane" id =" errors" >
83+ <div class =" fixed-navbar" >
84+ <div class =" input-group" style =" width: 20em" >
85+ <span class =" input-group-addon" ><span class =" glyphicon glyphicon-search" aria-hidden =" true" ></span ></span >
86+ <input data-search =" errors" type =" text" class =" form-control" placeholder =" undefined..." />
87+ </div >
88+ </div >
89+ <script >
90+ onDocumentReady.push(function () {
91+ var groups = $('[data-filterable] tbody tr[data-permanent]');
92+ var rows = $('[data-filterable] tbody tr:not([data-permanent])');
93+
94+ $("[data-search]").keyup(function () {
95+ var term = $(this).val().toLowerCase();
96+
97+ rows.hide();
98+ groups.show();
99+ matchElements(rows).show();
100+ matchEmptyGroups().hide();
101+
102+ function matchElements(elements) {
103+ return elements.filter(function () {
104+ var rowContent = $(this).text().toLowerCase();
105+ return rowContent.indexOf(term) !== -1
106+ });
107+ }
108+
109+ function matchEmptyGroups() {
110+ return groups.filter(function () {
111+ var group = $(this).data('permanent');
112+ return rows
113+ .filter(function () {
114+ return $(this).data('group') == group <![CDATA[ &&]]> $(this).is(':visible');
115+ })
116+ .length == 0;
117+ });
118+ }
119+ });
120+ });
121+ </script >
122+
123+ <table class =" table" data-filterable =" errors" >
124+ <thead >
125+ <tr >
126+ <th >Error</th >
127+ <th >Line</th >
128+ </tr >
129+ </thead >
130+ <xsl : for-each select =" //files/file[generate-id() = generate-id(key('file-category', ./@name)[1])]" >
131+ <xsl : variable name =" group" select =" @name" />
132+ <tr >
133+ <xsl : attribute name =" data-permanent" >
134+ <xsl : value-of select =" $group" />
135+ </xsl : attribute >
136+ <td colspan =" 3" class =" file" ><strong data-file =" " ><xsl : value-of select =" $group" /></strong ></td >
137+ </tr >
138+ <xsl : for-each select =" //files/file[@name = $group]/line" >
139+ <tr >
140+ <xsl : attribute name =" data-group" >
141+ <xsl : value-of select =" ../@name" />
142+ </xsl : attribute >
143+ <td >
144+ <pre class =" text-muted" ><xsl : value-of select =" @message" /></pre >
145+ </td >
146+ <td ><xsl : value-of select =" @number" /></td >
147+ </tr >
148+ </xsl : for-each >
149+ </xsl : for-each >
150+ </table >
151+ </div >
152+ </div >
153+ </div >
154+
155+
156+ <script ><xsl : attribute name =" src" ><xsl : value-of select =" $jquery.min.js" /></xsl : attribute ></script >
157+ <script ><xsl : attribute name =" src" ><xsl : value-of select =" $bootstrap.min.js" /></xsl : attribute ></script >
158+ <script >
159+ $(document).ready(onDocumentReady);
160+ </script >
161+ </body >
162+ </html >
163+ </xsl : template >
164+ </xsl : stylesheet >
0 commit comments