summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/webpresence/webpresence_html.xsl
blob: e1e8f7cb11ae7acebf50d708822aff7232eeccf6 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<!--
		HTML 4.01 Transitional
	-->

	<xsl:output
		doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
		doctype-system="http://www.w3.org/TR/html4/loose.dtd"
		indent="yes"
		method="html"
		encoding="ISO-8859-1"
		omit-xml-declaration="yes"/>

	<xsl:template match="webpresence">
		<html>
			<head>
				<title>My IM Status</title>
			</head>
			<body>
				<p class="name"><xsl:value-of select="name"/></p>
				<xsl:apply-templates select="accounts"/>
				<hr/>
				<font size="-2">
					<xsl:text>Last update at: </xsl:text>
					<xsl:value-of select="listdate"/>
				</font>
			</body>
		</html>
	</xsl:template>

	<xsl:template match="accounts">
		<table>
			<xsl:for-each select="account">
			<tr>
				<td class="protocol">
					<xsl:apply-templates select="protocol"/>
				</td>
				<td class="accountname">
					<xsl:value-of select="accountname"/>
				</td>
				<td class="accountstatus">
					<xsl:apply-templates select="accountstatus"/>
				</td>
				<td class="accountaddress">
					<xsl:value-of select="accountaddress"/>
				</td>
			</tr>
			</xsl:for-each>
		</table>
	</xsl:template>

	<xsl:template match="protocol">
		<xsl:choose>
			<xsl:when test=".='ICQProtocol'">
				<xsl:text>ICQ</xsl:text>
			</xsl:when>
			<xsl:when test=".='JabberProtocol'">
				<xsl:text>Jabber</xsl:text>
			</xsl:when>
			<xsl:when test=".='YahooProtocol'">
				<xsl:text>Yahoo</xsl:text>
			</xsl:when>
			<xsl:when test=".='GaduProtocol'">
				<xsl:text>Gadu-Gadu</xsl:text>
			</xsl:when>
			<xsl:when test=".='WPProtocol'">
				<xsl:text>WinPopup</xsl:text>
			</xsl:when>
			<xsl:when test=".='SMSProtocol'">
				<xsl:text>SMS</xsl:text>
			</xsl:when>
			<xsl:when test=".='IRCProtocol'">
				<xsl:text>IRC</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>Unknown</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="accountstatus">
		<xsl:choose>
			<xsl:when test=".='ONLINE'">
				<font color="#00FF00">
					<xsl:value-of select="."/>
				</font>
			</xsl:when>
			<xsl:when test=".='OFFLINE'">
				<font color="red">
					<xsl:value-of select="."/>
				</font>
			</xsl:when>
			<xsl:when test=".='AWAY'">
				<font color="maroon">
					<xsl:value-of select="."/>
				</font>
				<xsl:if test="@statusdescription != 'Away' or @awayreason">
					<xsl:text> (</xsl:text>
				</xsl:if>
				<xsl:if test="@statusdescription != 'Away'">
					<xsl:value-of select="@statusdescription"/>
					<xsl:if test="@awayreason">
						<xsl:text>: </xsl:text>
					</xsl:if>
				</xsl:if>
				<xsl:if test="@awayreason">
					<xsl:value-of select="@awayreason"/>
				</xsl:if>
				<xsl:if test="@statusdescription != 'Away' or @awayreason">
					<xsl:text>)</xsl:text>
				</xsl:if>
			</xsl:when>
			<xsl:when test=".='UNKNOWN'">
				<font color="gray">
					<xsl:value-of select="."/>
				</font>
				<xsl:if test="@statusdescription">
					<xsl:text> (</xsl:text>
					<xsl:value-of select="@statusdescription"/>
					<xsl:text>)</xsl:text>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="."/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

</xsl:stylesheet>

<!-- vim: set ts=4 sts=4 sw=4: -->