Jump to content
Ketarin forum

Recommended Posts

I recently made a change to the structure I use for all my variables and needed to publish it to my server. Since Ketarin doesn't (yet) support commands for non-updates I needed to get the data in a structured format from Ketarin to the database (I'll be passing it through Excel). Anyway... this is what I came up with.

  • It uses Kryogenix sorttable, and some styling and stuff from a few other projects.
  • You can use the aCols array to control which columns are hidden by default. 
  • For your own custom variables assign the variable name in one of these Variables/item[key/string='myVariableName']/value/UrlVariable/TextualContent
  • Since parsed variables (like version) aren't cached automatically I setup temporary variables (LastVersion and LastUpdate) to store the version whenever it's updated so it can be accessed through the XML. This uses the script from @Ambimind here.
  • Save the code below to a new file "ketarin.xsl".
  • When you export your XML file you'll need to add this XSL rule above the <Jobs> line:
    <?xml-stylesheet type="text/xsl" href="ketarin.xsl" ?>
  • I'm sure I'm forgetting stuff, but you are welcome to ask questions here and I'll reply.

ketarin.xsl

<?xml version="1.0" encoding="UTF-8"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<head>
<title>Ketarin.xml</title>
<script type="text/javascript" src="sorttable.js" note="https://www.kryogenix.org/code/browser/sorttable/"></script>
<script type="text/javascript">
var toggleDisplay = function (element) {
	element.style.display = (element.style.display === 'none')?'table-cell':'none';
};
function toggleCol(){
	// Slug, Updated, Size, ?
	aCols=[2,11,12,13,15,16];
	for(var lCol = 0; lCol &lt; aCols.length; lCol++){
		document.querySelectorAll('th:nth-child('+aCols[lCol]+'), td:nth-child('+aCols[lCol] + ')').forEach(toggleDisplay);
	}
};
</script>
<style type="text/css">
body{
	font-family:Verdana;
	font-size:12px;
	background-color:#ffffff;
}
table {
	border: none !important;
	background-color: #eee;
	width: 100%;
	text-align: left;
	border-collapse: collapse;
}
table th, table th tr {
	text-align: center;
	border: 0;
	padding: 0;
	margin: 0;
}
table td {
	border: 1px solid #CCCCCC;
	padding: 3px 2px;
	vertical-align: middle;
}
table tbody td {
	font-size: 11px;
	vertical-align: middle;
}
table tr:nth-child(even) {
	background: #D0F5E4;
}
table thead {
	background: #16a085;
	background: -moz-linear-gradient(top, #258b62 0%, #32bd7c 50%, #16a085 100%);
	background: -webkit-linear-gradient(top, #258b62 0%, #32bd7c 50%, #16a085 100%);
	background: linear-gradient(to bottom, #258b62 0%, #32bd7c 50%, #16a085 100%);
	border: 0 0 0 0;
	margin: 0 0 2px 0;
}
table thead tr, table thead tr th {
	font-size: 14px;
	font-weight: bold;
	color: #eee;
	border: 0 0 0 0 !important;
	padding: 2px 5px;
	border-radius: 16px;
}
table thead th:first-child {
	border-left: none;
}
table tfoot {
	font-size: 12px;
	font-weight: bold;
	color: #eee;
	background: #D0E4F5;
	background: -moz-linear-gradient(top, #dcebf7 0%, #d4e6f6 66%, #D0E4F5 100%);
	background: -webkit-linear-gradient(top, #dcebf7 0%, #d4e6f6 66%, #D0E4F5 100%);
	background: linear-gradient(to bottom, #dcebf7 0%, #d4e6f6 66%, #D0E4F5 100%);
	border-top: 2px solid #444444;
}
table tfoot td {
	font-size: 12px;
}
table tfoot .links {
	text-align: right;
}
table tfoot .links a{
	display: inline-block;
	background: #1C6EA4;
	color: #FFFFFF;
	padding: 1px 5px;
	border-radius: 5px;
}
th {
	position: sticky;
	background: #16a085;
	top: 0; /* Don't forget this, required for the stickiness */
}
table tr td img{width:12px; height:12px; margin:0 6px 0; padding:0 0 0 0; }
#platforms img{width:18px; height:18px; margin:0 10px 0 10px; border:0;}
.nowrap{ white-space: nowrap; }

/* responsive columns */
.col-toggle {
	-webkit-appearance: none;
	-webkit-tap-highlight-color: transparent;
	position: relative;
	border: 0;
	outline: 0;
	cursor: pointer;
	margin: 10px;
}
/* To create surface of toggle button */
.col-toggle:after {
	content: '';
	width: 45px;
	height: 14px;
	display: inline-block;
	background: rgba(196, 195, 195, 0.55);
	border-radius: 18px;
	clear: both;
}
/* Contents before checkbox to create toggle handle */
.col-toggle:before {
	content: '';
	width: 16px;
	height: 16px;
	display: block;
	position: absolute;
	left: 0;
	top: -2px;
	border-radius: 50%;
	background: rgb(255, 255, 255);
	box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}
/* Shift the handle to left on check event */
.col-toggle:checked:before {
	left: 31px;
	box-shadow: -1px 1px 3px rgba(0, 0, 0, 0.6);
}
/* Background color when toggle button will be active */
.col-toggle:checked:after {
	background: #16a085;
}
.cm-toggle,
.cm-toggle:before,
.cm-toggle:after,
.cm-toggle:checked:before,
.cm-toggle:checked:after {
	transition: ease .5s;
	-webkit-transition: ease .5s;
	-moz-transition: ease .5s;
	-o-transition: ease .5s;
}

</style>
</head>
<body onload="toggleCol();">
<h2>Ketarin</h2>
<div id="platforms" style="float:right; text-align:right;">
<input type="checkbox" name="checkbox" class="col-toggle" onclick="toggleCol()" />
</div>

<table border="1" class="sortable">
	<thead>
		<tr>
			<th class="sorttable_alpha">Guid</th>
			<th class="sorttable_alpha">Enabled</th>
			<th class="sorttable_alpha">Vendor</th>
			<th class="sorttable_alpha">Name</th>
			<th class="sorttable_alpha">Version</th>
			<th class="sorttable_alpha">Slug</th>
			<th class="sorttable_alpha">Category</th>
			<th class="sorttable_alpha">Bits</th>
			<th class="sorttable_numeric">Size</th>
			<th class="sorttable_alpha">Platform</th>
			<th class="sorttable_date">Updated</th>
			<th class="sorttable_date">Filetime</th>
			<th class="sorttable_alpha">Website0</th>
			<th class="sorttable_alpha">Website1</th>
			<th class="sorttable_alpha">Changelog</th>
			<th class="sorttable_nosort">Notes</th>
		</tr>
	</thead>
	<tbody>

<xsl:for-each select="Jobs/ApplicationJob">
	<tr>
		<td class="nowrap"><xsl:value-of select="./@Guid"/></td>
		<td><xsl:value-of select="Enabled"/></td>
		<td><xsl:value-of select="Variables/item[key/string='svendor']/value/UrlVariable/TextualContent" /></td>
		<td><xsl:value-of select="Name"/></td>
		<td><xsl:value-of select="Variables/item[key/string='LastVersion']/value/UrlVariable/TextualContent" /></td>
		<td><xsl:value-of select="Variables/item[key/string='spc']/value/UrlVariable/TextualContent" /></td>
		<td><xsl:value-of select="Category"/></td>
		<td><xsl:value-of select="Variables/item[key/string='sbits']/value/UrlVariable/TextualContent" /></td>
		<td>
			<xsl:attribute name="sorttable_customkey"><xsl:value-of select="LastFileSize"/></xsl:attribute>
			<xsl:variable name="thesize" select="LastFileSize"/>
			<xsl:choose>
				<xsl:when test="$thesize &gt;= 1073741824">
					<xsl:value-of select="format-number($thesize div 1073741824,'#,###.00')"/>
					<xsl:text> GB</xsl:text>
				</xsl:when>
				<xsl:when test="$thesize &gt;= 1048576">
					<xsl:value-of select="format-number($thesize div 1048576,'#,###.0')"/>
					<xsl:text> MB</xsl:text>
				</xsl:when>
				<xsl:when test="$thesize &gt;= 1024">
					<xsl:value-of select="format-number($thesize div 1024,'#,###')"/>
					<xsl:text> KB</xsl:text>
				</xsl:when>
				<xsl:when test="$thesize &gt; 0 and $thesize &lt; 1024">
					<xsl:value-of select="format-number($thesize div 0,'#,###')"/>
					<xsl:text> Bytes</xsl:text>
				</xsl:when>
			</xsl:choose>
		</td>
		<td><xsl:value-of select="Variables/item[key/string='splatform']/value/UrlVariable/TextualContent" /></td>
		<td class="nowrap"><xsl:value-of select="LastUpdated"/></td>
		<td class="nowrap"><xsl:value-of select="LastFileDate"/></td>
		<td><xsl:value-of select="WebsiteUrl"/></td>
		<td><xsl:value-of select="Variables/item[key/string='swebsite']/value/UrlVariable/TextualContent" /></td>
		<td><xsl:value-of select="Variables/item[key/string='schangelog']/value/UrlVariable/TextualContent" /></td>
		<td><xsl:value-of select="Variables/item[key/string='snotes']/value/UrlVariable/TextualContent" /></td>
		
	</tr>
</xsl:for-each>

	</tbody>
</table>

</body>
</html>

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.