notify.xsl 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  29. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  30. exclude-result-prefixes="atom rdf xsl"
  31. version="1.0">
  32. <xsl:output
  33. method="html"
  34. doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  35. doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
  36. <xsl:variable name="xml_base">../..</xsl:variable>
  37. <xsl:variable name="xml_base_pub" select="concat($xml_base,'/o')"/>
  38. <xsl:variable name="skin_base" select="concat($xml_base,'/themes/current')"/>
  39. <xsl:variable name="cgi_base" select="concat($xml_base,'/seppo.cgi')"/>
  40. <xsl:template match="/a:feed">
  41. <html xmlns="http://www.w3.org/1999/xhtml" data-xml-base-pub="{$xml_base_pub}" class="logged-out script-inactive">
  42. <head>
  43. <link href="{$skin_base}/style.css" rel="stylesheet" type="text/css"/>
  44. <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  45. <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
  46. <script src="{$skin_base}/notify.js"></script>
  47. <!-- script src="{$xml_base}/live.js"></script -->
  48. <title><xsl:value-of select="a:title"/></title>
  49. </head>
  50. <body>
  51. <div id="header">
  52. <a class="btn" href="{$xml_base}" rel="first">🏡 <span class="hidden-xs">Home</span></a>
  53. <h1><xsl:value-of select="a:title"/></h1>
  54. <xsl:call-template name="prev-next"/>
  55. </div>
  56. <form id="notify" method="post" action="{$cgi_base}/notify">
  57. <input type="submit" class="noscript" value="Send"/>
  58. <ul>
  59. <xsl:for-each select="a:link[@rel='notify' or @rel='subscribed' ]">
  60. <li class="actor">
  61. <input type="checkbox" name="{@title}" checked="checked" disabled="disabled"/>
  62. <img alt="Avatar" src="{$cgi_base}/activitypub/actor.xml/icon?id={@href}"/>
  63. <xsl:value-of select="@title"/>
  64. <xsl:text> </xsl:text>
  65. <xsl:choose>
  66. <xsl:when test='@rfc7033'>
  67. <a href="{$cgi_base}/{@rfc7033}">
  68. <xsl:value-of select="substring-after(@rfc7033,'acct:')"/>
  69. </a>
  70. </xsl:when>
  71. <xsl:otherwise>
  72. <a href="{$cgi_base}/activitypub/actor.xml?id={@href}">
  73. <xsl:value-of select="@href"/>
  74. </a>
  75. </xsl:otherwise>
  76. </xsl:choose>
  77. </li>
  78. </xsl:for-each>
  79. </ul>
  80. <input type="submit" class="noscript" value="Send"/>
  81. </form>
  82. <xsl:call-template name="prev-next"/>
  83. </body>
  84. </html>
  85. </xsl:template>
  86. <xsl:template name="prev-next">
  87. <xsl:if test="a:link[@rel='first'] or a:link[@rel='last']">
  88. <table class="prev-next">
  89. <tbody>
  90. <tr>
  91. <td class="text-left" aria-label="First">
  92. <a href="{a:link[@rel='first']/@href}" class="first btn"><xsl:value-of select="a:link[@rel='first']/@title"/></a>
  93. </td>
  94. <td class="text-center">
  95. <a href="{a:link[@rel='previous']/@href}" class="previous enabled btn">&#160;&lt;&#160;</a>
  96. </td>
  97. <td class="text-center">
  98. <span class="hidden-xs"></span><xsl:value-of select="a:link[@rel='self']/@title"/>
  99. </td>
  100. <td class="text-center">
  101. <xsl:variable name="disabled"><xsl:if test="not(a:link[@rel='next'])">disabled</xsl:if></xsl:variable>
  102. <a href="{a:link[@rel='next']/@href}" class="next {$disabled} btn">&#160;&gt;&#160;</a>
  103. </td>
  104. <td class="text-right">
  105. <xsl:variable name="disabled"><xsl:if test="a:link[@rel='last']/@href = a:link[@rel='self']/@href">disabled</xsl:if></xsl:variable>
  106. <a href="{a:link[@rel='last']/@href}" class="last {$disabled} btn"><xsl:value-of select="a:link[@rel='last']/@title"/></a>
  107. </td>
  108. </tr>
  109. </tbody>
  110. </table>
  111. </xsl:if>
  112. </xsl:template>
  113. </xsl:stylesheet>