subscribers.xsl 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. _ _ ____ _
  4. _| || |_/ ___| ___ _ __ _ __ ___ | |
  5. |_ .. _\___ \ / _ \ '_ \| '_ \ / _ \| |
  6. |_ _|___) | __/ |_) | |_) | (_) |_|
  7. |_||_| |____/ \___| .__/| .__/ \___/(_)
  8. |_| |_|
  9. Personal Social Web.
  10. Copyright (C) The #Seppo contributors. All rights reserved.
  11. This program is free software: you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation, either version 3 of the License, or
  14. (at your option) any later version.
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU General Public License for more details.
  19. You should have received a copy of the GNU General Public License
  20. along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. https://www.w3.org/TR/xslt-10/
  22. https://www.w3.org/TR/xpath-10/
  23. -->
  24. <xsl:stylesheet
  25. xmlns="http://www.w3.org/1999/xhtml"
  26. xmlns:h="http://www.w3.org/1999/xhtml"
  27. xmlns:a="http://www.w3.org/2005/Atom"
  28. xmlns:atom="http://www.w3.org/2005/Atom"
  29. xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  30. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  31. exclude-result-prefixes="atom rdf xsl"
  32. version="1.0">
  33. <xsl:output
  34. method="html"
  35. doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  36. doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
  37. <xsl:variable name="xml_base">../..</xsl:variable>
  38. <xsl:variable name="xml_base_pub" select="concat($xml_base,'/o')"/>
  39. <xsl:variable name="skin_base" select="concat($xml_base,'/themes/current')"/>
  40. <xsl:variable name="cgi_url" select="concat($xml_base,'/seppo.cgi')"/>
  41. <xsl:template match="/a:feed">
  42. <html xmlns="http://www.w3.org/1999/xhtml" data-xml-base-pub="{$xml_base_pub}" class="logged-out script-inactive" bgcolor="darkgreen">
  43. <head>
  44. <link href="{$skin_base}/style.css" rel="stylesheet" type="text/css"/>
  45. <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  46. <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
  47. <script src="{$skin_base}/subscribers.js"></script>
  48. <!-- script src="{$xml_base}/live.js"></script -->
  49. <title><xsl:value-of select="a:title"/></title>
  50. </head>
  51. <body>
  52. <div id="header">
  53. <!-- a href="{$cgi_url}/timeline/p/" rel="start" role="button" title="Timeline">🕞 <span class="hidden-xs">Timeline </span></a -->
  54. <a href="{$cgi_url}/timeline/p/" rel="start" role="button" title="Home">🏡 <span class="hidden-xs">Home</span></a>
  55. <h1><xsl:value-of select="a:title"/></h1>
  56. <form id="webfinger" method="get" action="../../seppo.cgi/activitypub/actor.xml"><label for="resource">Look up somebody:</label><input type="text" name="resource" placeholder="@alice@example.com"/></form>
  57. <xsl:call-template name="pagination">
  58. <xsl:with-param name="id">pagination-lower</xsl:with-param>
  59. </xsl:call-template>
  60. </div>
  61. <xsl:variable name="entries" select="a:link[@rel='subscribers' or @rel='subscribed_to' or @rel='blocked']"/>
  62. <xsl:if test="count($entries) &lt; 1">
  63. <p>Here will show up a paged list of accounts. There are none until you pick some, however.</p>
  64. </xsl:if>
  65. <form id="subscribers" method="post" action="{$cgi_url}/subscribers">
  66. <input type="submit" class="noscript" value="Send"/>
  67. <ol class="actors" role="main">
  68. <xsl:for-each select="$entries">
  69. <li class="actor">
  70. <input type="checkbox" name="{@title}" checked="checked" disabled="disabled"/>
  71. <img alt="Avatar" src="{$cgi_url}/activitypub/actor.xml/icon?id={@href}"/>
  72. <xsl:value-of select="@title"/>
  73. <xsl:text> </xsl:text>
  74. <xsl:choose>
  75. <xsl:when test='@rfc7565'>
  76. <a href="{$cgi_url}/{@rfc7565}">
  77. <xsl:value-of select="substring-after(@rfc7565,'acct:')"/>
  78. </a>
  79. </xsl:when>
  80. <xsl:otherwise>
  81. <a href="{$cgi_url}/activitypub/actor.xml?id={@href}">
  82. <xsl:value-of select="@href"/>
  83. </a>
  84. </xsl:otherwise>
  85. </xsl:choose>
  86. </li>
  87. </xsl:for-each>
  88. </ol>
  89. <input type="submit" class="noscript" value="Send"/>
  90. </form>
  91. <xsl:call-template name="pagination">
  92. <xsl:with-param name="id">pagination-upper</xsl:with-param>
  93. </xsl:call-template>
  94. </body>
  95. </html>
  96. </xsl:template>
  97. <xsl:template name="pagination">
  98. <xsl:param name="id">-</xsl:param>
  99. <xsl:if test="a:link[@rel='previous'] or a:link[@rel='next']">
  100. <xsl:variable name="xml_base_relative"/>
  101. <xsl:variable name="self" select="a:link[@rel='self']"/>
  102. <ol id="{$id}" class="noshade" role="navigation" aria-label="pagination">
  103. <li>
  104. <xsl:variable name="link" select="a:link[@rel='first']"/>
  105. <a title="most recent page" href="{$xml_base_relative}{$link/@href}#pagination-upper" rel="first" role="button"><xsl:value-of select="$link/@title"/></a>
  106. </li>
  107. <li>
  108. <a title="more recent page" rel="previous" role="button">
  109. <xsl:variable name="link" select="a:link[@rel='previous']"/>
  110. <xsl:choose>
  111. <xsl:when test="$link/@href">
  112. <xsl:attribute name="href"><xsl:value-of select="concat($xml_base_relative, $link/@href, '#pagination-lower')"/></xsl:attribute>
  113. <xsl:attribute name="class">probe-2xx</xsl:attribute>
  114. </xsl:when>
  115. <xsl:otherwise>
  116. <xsl:attribute name="aria-disabled">true</xsl:attribute>
  117. </xsl:otherwise>
  118. </xsl:choose>
  119. &#160;<xsl:value-of select="$link/@title"/>&#160;</a>
  120. </li>
  121. <li aria-current="page">
  122. <a href="{$xml_base_relative}{$self/@href}#{$id}" title="current page" rel="self"><xsl:value-of select="$self/@title"/></a>
  123. </li>
  124. <li>
  125. <a title="next older page" rel="next" role="button">
  126. <xsl:variable name="link" select="a:link[@rel='next']"/>
  127. <xsl:choose>
  128. <xsl:when test="$link/@href">
  129. <xsl:attribute name="href"><xsl:value-of select="concat($xml_base_relative, $link/@href, '#pagination-upper')"/></xsl:attribute>
  130. <xsl:attribute name="class">probe-2xx</xsl:attribute>
  131. </xsl:when>
  132. <xsl:otherwise>
  133. <xsl:attribute name="aria-disabled">true</xsl:attribute>
  134. </xsl:otherwise>
  135. </xsl:choose>
  136. &#160;<xsl:value-of select="$link/@title"/>&#160;</a>
  137. </li>
  138. <li>
  139. <xsl:variable name="link" select="a:link[@rel='last']"/>
  140. <a title="oldest page" href="{$xml_base_relative}{$link/@href}#pagination-lower" rel="last" role="button"><xsl:value-of select="$link/@title"/></a>
  141. </li>
  142. </ol>
  143. </xsl:if>
  144. </xsl:template>
  145. </xsl:stylesheet>