summaryrefslogtreecommitdiff
path: root/example/list.xsl
blob: 86c3150f82a11954187410d9ee635de721690c08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xhtml="http://www.w3.org/1999/xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                version="1.0">
  <xsl:output method="xml" indent="yes"/>
  <xsl:include href="common.xsl"/>
  <xsl:param name="project" />
  <xsl:param name="description" />
  <xsl:param name="limit" select="10" />
  <xsl:param name="offset" select="0" />

  <xsl:template match="table">
    <!-- Report form -->
    <h2>Report</h2>
    <form method="post" action="view.xhtml?q=insert%20into%20bugs%20(%20:fields%20)%20values%20(%20:values%20)%20returning%20xmlelement(name%20table,xmlelement(name%20row,xmlelement(name%20id,id),xmlelement(name%20reported,reported),xmlelement(name%20reporter,reporter),xmlelement(name%20project,project),xmlelement(name%20description,description)))">
      <dl>
        <dt><label for="report_project">Project</label></dt>
        <dd>
          <input type="text" name="project" id="report_project"
                 required="required" maxlength="128"
                 placeholder="Project name or URL" />
        </dd>
        <dt><label for="report_description">Description</label></dt>
        <dd>
          <textarea name="description" required="required"
                    id="report_description" maxlength="10240"
                    placeholder="Issue description" />
        </dd>
      </dl>
      <input type="submit" value="Report" />
    </form>

    <!-- Search form -->
    <h2>Search</h2>
    <form method="get" action="list.xhtml">
      <dl>
        <dt><label for="search_project">Project</label></dt>
        <dd>
          <input id="search_project" type="search" name="project"
                 value="{$project}" />
        </dd>
        <dt><label for="search_description">Description</label></dt>
        <dd>
          <input id="search_description" type="search" name="description"
                 value="{$description}" />
        </dd>
        <dt><label for="search_limit">Limit</label></dt>
        <dd>
          <input id="search_limit" type="number" name="limit" min="1"
                 value="{$limit}" />
        </dd>
        <dt><label for="search_offset">Offset</label></dt>
        <dd>
          <input id="search_offset" type="number" name="offset" min="0"
                 value="{$offset}" />
        </dd>
        <input type="hidden" name="q"
               value="select bug_search( q:project , q:description , q:limit , q:offset )" />
      </dl>
      <input type="submit" value="Search" />
    </form>

    <!-- Search results -->
    <table>
      <tr>
        <th>Reported</th>
        <th>Reporter</th>
        <th>Project</th>
        <th>Summary</th>
      </tr>
      <xsl:for-each select="row">
        <tr>
          <td><xsl:copy-of select="reported/text()" /></td>
          <td><xsl:copy-of select="reporter/text()" /></td>
          <td>
            <a href="list.xhtml?q=select%20bug_search('{project/text()}','',{$limit},{$offset})">
              <xsl:copy-of select="project/text()" />
            </a>
          </td>
          <td>
            <a href="view.xhtml?q=select%20query_to_xml('select%20*%20from%20bugs%20where%20id=''{id}''',false,false,'foo')">
              <xsl:copy-of select="summary/text()" />
            </a>
          </td>
        </tr>
      </xsl:for-each>
    </table>
  </xsl:template>

</xsl:stylesheet>