AssistDesq: Difference between revisions
Line 102: | Line 102: | ||
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0" encoding=" | <?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" exclude-result-prefixes="msxsl"> | ||
<xsl:output method="html" indent="yes" /> | |||
<xsl:template match="/"> | |||
<html> | <html> | ||
<head> | |||
<style type="text/css"> | |||
table { | |||
width: 100%; | |||
} | |||
<table> | th { | ||
<caption> | height: 50px; | ||
<tr> | text-align: left; | ||
<th>Date</th> | } | ||
<th>ID</th> | |||
<th>Subject</th> | tr:hover { | ||
<th>Description</th> | background-color: #f5f5f5 | ||
<th>Created by</th> | } | ||
<th>Priority</th> | th, td { | ||
</tr> | border-bottom: 1px solid #ddd; | ||
} | |||
<tr> | </style> | ||
<td><xsl:value-of select="details/date"/></td> | <title>Tickets</title> | ||
<td><xsl:value-of select="@id"/></td> | </head> | ||
<td><xsl:value-of select="title"/></td> | <body> | ||
<td><xsl:value-of select="description"/></td> | <table> | ||
<td><xsl:value-of select="details/user"/></td> | <caption> | ||
<td><xsl:value-of select="details/priority"/></td> | <b>Current tickets</b> | ||
</tr> | </caption> | ||
<tr> | |||
</table> | <th>Date</th> | ||
<th>ID</th> | |||
<th>Subject</th> | |||
<th>Description</th> | |||
<th>Created by</th> | |||
<th>Priority</th> | |||
</tr> | |||
<xsl:for-each select="/tickets/ticket"> | |||
<tr> | |||
<td> | |||
<xsl:value-of select="details/date" /> | |||
</td> | |||
<td> | |||
<xsl:value-of select="@id" /> | |||
</td> | |||
<td> | |||
<xsl:value-of select="title" /> | |||
</td> | |||
<td> | |||
<xsl:value-of select="description" /> | |||
</td> | |||
<td> | |||
<xsl:value-of select="details/user" /> | |||
</td> | |||
<td> | |||
<xsl:value-of select="details/priority" /> | |||
</td> | |||
</tr> | |||
</xsl:for-each> | |||
</table> | |||
<p> | |||
Total number of current tickets: | |||
<xsl:value-of select="count(tickets/ticket)" /> | |||
</p> | |||
</body> | |||
</html> | </html> | ||
</xsl:template> | |||
</xsl:stylesheet> | </xsl:stylesheet> | ||
</source> | </source> |
Revision as of 22:05, 20 March 2017
Meeskond
Anna Linskaja
Karen Grigorjan
Sergei Hristoforov
Artyom Likhachev
Idee
Kasutajatugi süsteem "Forever beta".
Ülesanne on teostada veebirakendus, mis võimaldaks hallata kasutajatoele saadetud pöördumisi. Süsteemi funktsionaalsus oleks järgmine:
• Kasutaja saab sisestada pöördumise.
• Pöördumisel peab olema kirjeldus, sisestamise aeg, lahendamise tähtaeg. Sisestamise ajaks märgitakse pöördumise sisestamise aeg, teised kohustuslikud väljad täidab kasutaja.
• Kasutajale kuvatakse aktiivsed pöördumised koos kõigi väljadega nimekirjas sorteeritult kahanevalt lahendamise tähtaja järgi.
• Pöördumised, mille lahendamise tähtajani on jäänud vähem kui 1 tund või mis on juba ületanud lahendamise tähtaja, kuvatakse nimekirjas punasena.
• Kasutaja saab nimekirjas pöördumisi lahendatuks märkida, mis kaotab pöördumise nimekirjast.
Projekt
XML
Teema
Ticket system XML
XML
<?xml version="1.0" encoding="UTF-8"?>
<tickets>
<ticket id="1" category="3">
<title><![CDATA[Title]]></title>
<description><![CDATA[Description]]></description>
<details>
<priority id="H">High</priority>
<user role="1" id="12323" email="top@kek.ee">chubakapra90</user>
<date>2017-03-19</date>
</details>
<attachments>
<attachment id="1">dsdsad</attachment>
</attachments>
</ticket>
<ticket id="2" category="1">
<title><![CDATA[Title]]></title>
<description><![CDATA[Description]]></description>
<details>
<priority id="M">Medium</priority>
<user role="2" id="3333" email="hehe@lol.ee">ivanka_trump</user>
<date>2017-03-20</date>
</details>
<attachments>
<attachment id="1">dsdsad</attachment>
</attachments>
</ticket>
</tickets>
XML schema (XSD)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xs:element name="tickets">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="ticket">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="description" type="xs:string" />
<xs:element name="details">
<xs:complexType>
<xs:sequence>
<xs:element name="priority" type="xs:string">
<xs:attribute name="id" type="xs:string" use="required" />
</xs:element>
<xs:element name="user" type="xs:string">
<xs:attribute name="role" type="xs:integer" use="required" />
<xs:attribute name="id" type="xs:integer" use="required" />
<xs:attribute name="email" type="xs:string" use="required" />
</xs:element>
<xs:element name="date" type="xs:date" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="attachment" type="xs:string">
<xs:attribute name="id" type="xs:integer" use="required" />
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required" />
<xs:attribute name="category" type="xs:integer" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XSLT 1
XSLT => HTML
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" exclude-result-prefixes="msxsl">
<xsl:output method="html" indent="yes" />
<xsl:template match="/">
<html>
<head>
<style type="text/css">
table {
width: 100%;
}
th {
height: 50px;
text-align: left;
}
tr:hover {
background-color: #f5f5f5
}
th, td {
border-bottom: 1px solid #ddd;
}
</style>
<title>Tickets</title>
</head>
<body>
<table>
<caption>
<b>Current tickets</b>
</caption>
<tr>
<th>Date</th>
<th>ID</th>
<th>Subject</th>
<th>Description</th>
<th>Created by</th>
<th>Priority</th>
</tr>
<xsl:for-each select="/tickets/ticket">
<tr>
<td>
<xsl:value-of select="details/date" />
</td>
<td>
<xsl:value-of select="@id" />
</td>
<td>
<xsl:value-of select="title" />
</td>
<td>
<xsl:value-of select="description" />
</td>
<td>
<xsl:value-of select="details/user" />
</td>
<td>
<xsl:value-of select="details/priority" />
</td>
</tr>
</xsl:for-each>
</table>
<p>
Total number of current tickets:
<xsl:value-of select="count(tickets/ticket)" />
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XSLT 2
XSLT => XML
DRAFT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
...
</xsl:template>
</xsl:stylesheet>