Seppo.Social -> Seppo.mro.name
[Seppo.git] / doc / wb / themes / current / actor.xsl
blob838e89a4dffa4b601f57c5379d6e4cc2dd6884d4
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 _ _ ____ _
4 _| || |_/ ___| ___ _ __ _ __ ___ | |
5 |_ .. _\___ \ / _ \ '_ \| '_ \ / _ \| |
6 |_ _|___) | __/ |_) | |_) | (_) |_|
7 |_||_| |____/ \___| .__/| .__/ \___/(_)
8 |_| |_|
10 Personal Social Web.
12 Copyright (C) The #Seppo contributors. All rights reserved.
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 https://www.w3.org/TR/1999/REC-xslt-19991116
28 https://www.w3.org/TR/1999/REC-xpath-19991116
29 -->
30 <xsl:stylesheet
31 xmlns="http://www.w3.org/1999/xhtml"
32 xmlns:as="https://www.w3.org/ns/activitystreams#"
33 xmlns:h="http://www.w3.org/1999/xhtml"
34 xmlns:ldp="http://www.w3.org/ns/ldp#"
35 xmlns:math="http://exslt.org/math"
36 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
37 xmlns:schema="http://schema.org#"
38 xmlns:sec="https://w3id.org/security#"
39 xmlns:seppo="http://seppo.mro.name/2023/ns#"
40 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
41 exclude-result-prefixes="as ldp math rdf schema sec seppo"
42 version="1.0">
44 <!-- xsl:strip-space elements="seppo:isBlocked seppo:isFollowed" / -->
46 <!-- replace linefeeds with <br> tags -->
47 <xsl:template name="linefeed2br">
48 <xsl:param name="string" select="''"/>
49 <xsl:param name="pattern" select="'&#10;'"/>
50 <xsl:choose>
51 <xsl:when test="contains($string, $pattern)">
52 <xsl:value-of select="substring-before($string, $pattern)"/><br class="br"/><!-- xsl:comment>Why do we see 2 br on Safari and output/@method=html here? http://purl.mro.name/safari-xslt-br-bug</xsl:comment -->
53 <xsl:call-template name="linefeed2br">
54 <xsl:with-param name="string" select="substring-after($string, $pattern)"/>
55 <xsl:with-param name="pattern" select="$pattern"/>
56 </xsl:call-template>
57 </xsl:when>
58 <xsl:otherwise>
59 <xsl:value-of select="$string"/>
60 </xsl:otherwise>
61 </xsl:choose>
62 </xsl:template>
64 <xsl:output
65 method="html"
66 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
67 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
69 <xsl:variable name="xml_base_absolute" select="/*/@xml:base"/>
70 <xsl:variable name="xml_base" select="normalize-space($xml_base_absolute)"/>
71 <xsl:variable name="xml_base_pub" select="concat($xml_base,'/o')"/>
72 <xsl:variable name="skin_base" select="concat($xml_base,'/themes/current')"/>
73 <xsl:variable name="cgi_url" select="concat($xml_base,'seppo.cgi')"/>
75 <xsl:template name="banner-input">
76 <xsl:param name="id"/>
77 <xsl:param name="value"/>
78 <xsl:param name="txt"/>
79 <xsl:param name="disabled"/>
80 <label for="{$id}" role="button">
81 <xsl:if test="'pending' = $value">
82 <xsl:attribute name="class">pending</xsl:attribute>
83 </xsl:if>
84 <xsl:if test="$disabled">
85 <xsl:attribute name="aria-disabled">true</xsl:attribute>
86 </xsl:if>
87 <input type="checkbox" name="{$id}" id="{$id}">
88 <!--
89 <xsl:if test="$disabled">
90 <xsl:attribute name="disabled">disabled</xsl:attribute>
91 </xsl:if>
92 -->
93 <xsl:if test="'no' != $value">
94 <xsl:attribute name="checked">checked</xsl:attribute>
95 </xsl:if>
96 </input>
97 <span class="if-pending" title="pending"></span>
98 <xsl:copy-of select="$txt"/>
99 </label>
100 </xsl:template>
102 <xsl:template match="/rdf:RDF">
103 <html xmlns="http://www.w3.org/1999/xhtml" data-xml-base-pub="{$xml_base_pub}" class="script-inactive" bgcolor="darkgreen">
104 <xsl:for-each select="as:Person|as:Group">
105 <xsl:variable name="host1" select="as:id/@rdf:resource"/>
106 <xsl:variable name="host0" select="substring-after($host1,'://')"/>
107 <xsl:variable name="host" select="substring-before($host0,'/')"/>
108 <head>
109 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
110 <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
111 <link href="{$skin_base}/style.css" rel="stylesheet" type="text/css"/>
112 <link href="{$skin_base}/actor.css" rel="stylesheet" type="text/css"/>
113 <link rel="icon" type="image/jpg" href="{$xml_base}/me-avatar.jpg"/>
115 <title><xsl:value-of select="as:name"/></title>
116 </head>
117 <body>
118 <div id="banner">
119 <div id="banner-img">
120 <img alt="Banner" src="{as:image[1]/as:Image[1]/as:url[1]/@rdf:resource}"/>
121 </div>
122 <form name="actor" action="actor.xml" method="post">
123 <xsl:variable name="subscriber" select="normalize-space(../*/seppo:is_subscriber)"/>
124 <xsl:variable name="subscribed" select="normalize-space(../*/seppo:am_subscribed_to)"/>
125 <xsl:variable name="blocked" select="normalize-space(../*/seppo:is_blocked)"/>
126 <xsl:variable name="token" select="normalize-space(../*/seppo:token)"/>
127 <input type="hidden" name="token" value="{$token}"/>
128 <input type="hidden" name="id" value="{as:id/@rdf:resource}"/>
129 <input type="hidden" name="inbox" value="{ldp:inbox/@rdf:resource}"/>
130 <input type="hidden" name="~is_subscriber" value="{$subscriber}"/>
131 <input type="hidden" name="~am_subscribed_to" value="{$subscribed}"/>
132 <input type="hidden" name="~is_blocked" value="{$blocked}"/>
134 <!-- a href="{$cgi_url}/timeline/p/" rel="start" role="button" title="Timeline">🕞</a -->
135 <a href="{$cgi_url}/timeline/p/" rel="start" role="button" title="Home">🏡</a>
136 <!-- a href="{as:url/@rdf:resource}" role="button">📄 Profile</a -->
137 <a aria-disabled="true" href="" role="button">✉️ <span class="hidden-xs">Message</span></a>
139 <!--
140 <label class="pending" title="pending" for="subscribed2" role="button">
141 <input type="checkbox" id="subscribed2" name="subscribed2" checked="checked"/>
142 <span class="if-pending"> … </span>
143 <span class="hidden-xs">Subscrubed to</span> 👂
144 </label>
146 <xsl:call-template name="banner-input">
147 <xsl:with-param name="id">am_subscribed_to</xsl:with-param>
148 <xsl:with-param name="value" select="$subscribed"/>
149 <xsl:with-param name="txt"><span class="hidden-xs">Subscribed to</span> 👂</xsl:with-param>
150 </xsl:call-template>
151 <xsl:call-template name="banner-input">
152 <xsl:with-param name="id">is_subscriber</xsl:with-param>
153 <xsl:with-param name="value" select="$subscriber"/>
154 <xsl:with-param name="txt"><span class="hidden-xs">is Subscriber</span> 📣</xsl:with-param>
155 <xsl:with-param name="disabled" select="'true'"/>
156 </xsl:call-template>
157 <xsl:call-template name="banner-input">
158 <xsl:with-param name="id">is_blocked</xsl:with-param>
159 <xsl:with-param name="value" select="$blocked"/>
160 <xsl:with-param name="txt"><span class="hidden-xs">Blocked</span> 🤐</xsl:with-param>
161 </xsl:call-template>
163 <input class="noscript" type="submit"/>
164 </form>
165 </div>
166 <div id="avatar">
167 <xsl:for-each select="as:icon/as:Image/as:url">
168 <a href="{../../../as:url/@rdf:resource}"><img id="avatar" alt="Avatar" src="{@rdf:resource}"/></a>
169 </xsl:for-each>
170 </div>
172 <h3 id="name"><a href="{as:url/@rdf:resource}" title="name"><xsl:value-of select="as:name"/></a></h3>
174 <p><a href="{as:url/@rdf:resource}" title="preferredUsername">@<span id="preferredUsername"><xsl:value-of select="as:preferredUsername"/></span>@<xsl:value-of select="$host"/></a></p>
176 <p class="clickable" title="summary">
177 <xsl:call-template name="linefeed2br">
178 <xsl:with-param name="string" select="as:summary"/>
179 </xsl:call-template>
180 </p>
182 <dl class="clickable">
183 <xsl:for-each select="as:attachment/schema:PropertyValue[schema:value]">
184 <dt><xsl:value-of select="as:name"/></dt>
185 <dd><xsl:value-of select="schema:value"/></dd>
186 </xsl:for-each>
187 </dl>
189 <script src="{$skin_base}/actor.js"></script>
190 </body>
191 </xsl:for-each>
192 </html>
193 </xsl:template>
194 </xsl:stylesheet>