summaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2009-05-06 20:39:14 +0200
committerDavid Sommerseth <davids@redhat.com>2009-05-06 20:39:14 +0200
commit2986a76ad5eb5049ca06da204337a206d6058944 (patch)
treed22b8ee44c57c4381f39af0638d40988917c24b6 /xslt
parent249375ebb3dd3527c88413457b9ddc0d8d541690 (diff)
downloadeurephia-2986a76ad5eb5049ca06da204337a206d6058944.tar.gz
eurephia-2986a76ad5eb5049ca06da204337a206d6058944.tar.xz
eurephia-2986a76ad5eb5049ca06da204337a206d6058944.zip
Started implementing attempts command in eurephiadm
Only simple listing without details is implemented so far.
Diffstat (limited to 'xslt')
-rw-r--r--xslt/eurephiadm/CMakeLists.txt1
-rw-r--r--xslt/eurephiadm/attempts.xsl129
2 files changed, 130 insertions, 0 deletions
diff --git a/xslt/eurephiadm/CMakeLists.txt b/xslt/eurephiadm/CMakeLists.txt
index d8b1219..fedce10 100644
--- a/xslt/eurephiadm/CMakeLists.txt
+++ b/xslt/eurephiadm/CMakeLists.txt
@@ -5,5 +5,6 @@ SET(eurephiadm_XSLT
lastlog.xsl
usercerts.xsl
users.xsl
+ attempts.xsl
)
INSTALL(FILES ${eurephiadm_XSLT} DESTINATION ${EUREPHIADM_XSLT_PATH}/)
diff --git a/xslt/eurephiadm/attempts.xsl b/xslt/eurephiadm/attempts.xsl
new file mode 100644
index 0000000..d871339
--- /dev/null
+++ b/xslt/eurephiadm/attempts.xsl
@@ -0,0 +1,129 @@
+<?xml version="1.0"?>
+<!--
+ *
+ * GPLv2 only - Copyright (C) 2008, 2009
+ * David Sommerseth <dazo@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text" encoding="UTF-8"/>
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/eurephia">
+ <xsl:choose>
+ <xsl:when test="$view = 'list'">
+ <xsl:apply-templates select="attemptslog" mode="list"/>
+ </xsl:when>
+ <xsl:when test="$view = 'details' or $view = 'details2'">
+ <xsl:apply-templates select="attemptslog" mode="details"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">Invalid view: <xsl:value-of select="$view"/></xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="attemptslog" mode="list">
+ <xsl:text> ID Reference Last attempt&#10;</xsl:text>
+ <xsl:text>-------------------------------------------------------------------------------&#10;</xsl:text>
+ <xsl:apply-templates select="username|certificate|ipaddress" mode="list"/>
+ <xsl:text>-------------------------------------------------------------------------------&#10;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="attemptslog/username" mode="list">
+ <xsl:text> ** Username&#10;</xsl:text>
+ <xsl:apply-templates select="attempt" mode="list"/>
+ </xsl:template>
+
+ <xsl:template match="attemptslog/username/attempt" mode="list">
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="right-align">
+ <xsl:with-param name="value" select="@atpid"/>
+ <xsl:with-param name="width" select="4"/>
+ </xsl:call-template><xsl:text> </xsl:text>
+ <xsl:call-template name="left-align">
+ <xsl:with-param name="value" select="username"/>
+ <xsl:with-param name="width" select="59"/>
+ </xsl:call-template><xsl:text> </xsl:text>
+
+ <xsl:call-template name="right-align">
+ <xsl:with-param name="value" select="last_attempt"/>
+ <xsl:with-param name="width" select="10"/>
+ </xsl:call-template>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="attemptslog/certificate" mode="list">
+ <xsl:text> ** Certificate&#10;</xsl:text>
+ <xsl:apply-templates select="attempt" mode="list"/>
+ </xsl:template>
+
+ <xsl:template match="attemptslog/certificate/attempt" mode="list">
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="right-align">
+ <xsl:with-param name="value" select="@atpid"/>
+ <xsl:with-param name="width" select="4"/>
+ </xsl:call-template><xsl:text> </xsl:text>
+ <xsl:call-template name="left-align">
+ <xsl:with-param name="value" select="certificate"/>
+ <xsl:with-param name="width" select="59"/>
+ </xsl:call-template><xsl:text> </xsl:text>
+
+ <xsl:call-template name="right-align">
+ <xsl:with-param name="value" select="last_attempt"/>
+ <xsl:with-param name="width" select="10"/>
+ </xsl:call-template>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="attemptslog/ipaddress" mode="list">
+ <xsl:text> ** IP Address&#10;</xsl:text>
+ <xsl:apply-templates select="attempt" mode="list"/>
+ </xsl:template>
+
+ <xsl:template match="attemptslog/ipaddress/attempt" mode="list">
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="right-align">
+ <xsl:with-param name="value" select="@atpid"/>
+ <xsl:with-param name="width" select="4"/>
+ </xsl:call-template><xsl:text> </xsl:text>
+ <xsl:call-template name="left-align">
+ <xsl:with-param name="value" select="ipaddress"/>
+ <xsl:with-param name="width" select="59"/>
+ </xsl:call-template><xsl:text> </xsl:text>
+
+ <xsl:call-template name="right-align">
+ <xsl:with-param name="value" select="last_attempt"/>
+ <xsl:with-param name="width" select="10"/>
+ </xsl:call-template>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
+
+ <xsl:template name="left-align">
+ <xsl:param name="value"/>
+ <xsl:param name="width"/>
+ <xsl:value-of select="substring(concat($value, ' '), 1, $width)"/>
+ </xsl:template>
+
+ <xsl:template name="right-align">
+ <xsl:param name="value"/>
+ <xsl:param name="width"/>
+ <xsl:value-of select="concat(substring(' ', 1, $width - string-length($value)), substring($value, 1, $width))"/>
+ </xsl:template>
+
+</xsl:stylesheet>