diff options
Diffstat (limited to 'HTTPServer/data/htdocs')
| -rw-r--r-- | HTTPServer/data/htdocs/@settings/index.xsl | 297 | 
1 files changed, 190 insertions, 107 deletions
| diff --git a/HTTPServer/data/htdocs/@settings/index.xsl b/HTTPServer/data/htdocs/@settings/index.xsl index d8e8f4e..e180baa 100644 --- a/HTTPServer/data/htdocs/@settings/index.xsl +++ b/HTTPServer/data/htdocs/@settings/index.xsl @@ -1,121 +1,204 @@ -<?xasml version="1.0" encoding="ISO-8859-1"?>
 +<?xml version="1.0" encoding="ISO-8859-1" ?>
  <xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!-- Icons by Everaldo Coelho (www.everaldo.com) -->
 -<xsl:template match="/">
 -	<xsl:variable name="dirname">
 -		<xsl:choose>
 -			<xsl:when test="config/dirname=''">my Miranda Webserver</xsl:when>
 -			<xsl:otherwise><xsl:value-of select="config/dirname"/></xsl:otherwise>
 -		</xsl:choose>
 -	</xsl:variable>
 +		<!--
 +		 * template for HTTPServer Plugin for Miranda IM by Houdini
 +				http://addons.miranda-im.org/details.php?action=viewfile&id=2304
 -<html>
 -	<head>
 -		<title>Directory Listing of <xsl:value-of select="$dirname"/></title>
 -		<style type="text/css">
 -			td { font-family:tahoma, arial; font-size:14px; color:#000033;}
 -			a:link { text-decoration: none; color:#003366; }
 -			a:visited { text-decoration: none; color:#003366; }
 -			a:active { text-decoration: none; color:#FFAA33; }
 -			a:hover { text-decoration: underline; color:#FFAA33; }
 -		</style>
 -	</head>
 +		 * Template modded by FREAK_THEMIGHTY using Notepad++ v5.8.2
 +			[+] header bar
 +			[+] bottom bar with number of total files and total file size
 +			[+] tooltips on each field (with real byte-size)
 +			[+] moved design to seperate CSS file
 +			[*] proper support for "shortcut icon" aka "favicon" (with link tag)
 +			[*] lots of code changes
 +		-->
 -	<body bgcolor='#B0B0CC'>
 -		<font face='tahoma, arial'>
 -			<table border='0' cellspacing='1' cellpadding='2' width='700'>
 -				<tr height='40' bgcolor='#EEEEFF'>
 -					<td colspan='3' align='center'>
 -						<h3 style='margin:0px'><font color="#666688">Directory Listing of <xsl:value-of select="$dirname"/></font></h3>
 -					</td>
 -				</tr>
 -				<xsl:for-each select="config/item">
 -					<xsl:sort select="@isdir" order="descending"/>
 -					<xsl:sort select="@name"/>
 -					<xsl:element name='tr'>
 -						<xsl:attribute name="bgcolor">
 -							<xsl:choose>
 -								<xsl:when test="position() mod 2 = 0">#EEEEFF</xsl:when>
 -								<xsl:otherwise>#DDDDEE</xsl:otherwise>
 -							</xsl:choose>
 -						</xsl:attribute>
 -						<xsl:element name='td'>
 -							<xsl:attribute name="colspan">
 +
 +	<!-- site properties -->
 +	<xsl:output method="xml" version="1.1" doctype-public="-//W3C//DTD XHTML 1.1//EN"
 +		doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" encoding="ISO-8859-1" 
 +			omit-xml-declaration="no" indent="yes" standalone="no" media-type="application/xhtml+xml" />
 +
 +	<xsl:template match="config">
 +		<!-- title of the site -->
 +		<xsl:variable name="title">
 +			<xsl:choose>
 +				<xsl:when test="dirname!=''">Verzeichnis <xsl:value-of select="dirname" /></xsl:when>
 +				<xsl:otherwise>Miranda IM Webserver</xsl:otherwise>
 +			</xsl:choose>
 +		</xsl:variable>
 +		
 +		<!-- total size (in bytes) of all files -->
 +		<xsl:variable name="size" select="sum(item/@size)" />
 +		
 +		<xsl:variable name="total-realsize">
 +			<xsl:call-template name="convert">
 +				<xsl:with-param name="bytes" select="$size" />
 +			</xsl:call-template>
 +		</xsl:variable>
 +		
 +		<!--begin of the site -->
 +		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
 +			<head>
 +				<!-- title of the page -->
 +				<title><xsl:value-of select="$title" /></title>
 +				
 +				<!-- path to the FavIcon -->
 +				<link type="image/vnd.microsoft.icon" rel="shortcut icon" href="/favicon.ico" />
 +				
 +				<!-- path to the CSS file -->
 +				<link type="text/css" rel="stylesheet" href="/icons/themes/simpleTheme.css" />
 +			</head>
 +			<body>
 +				<table id="listing" class="listing">
 +					<caption id="tablecaption" class="tablecaption" title="{$title}"><xsl:value-of select="$title" /></caption>
 +					<tr id="header" class="header">
 +						<th id="fileheader" class="file">Name</th>
 +						<th id="sizeheader" class="size">Grösse</th>
 +						<th id="modifiedheader" class="modified">Geändert</th>
 +						<th id="createdheader" class="created">Erstellt</th>
 +					</tr>
 +					<xsl:for-each select="child::item">
 +						<!-- an item can have following attributes:
 +							@name		- name of the file /folder
 +							@isdir		- 'true' if the item represents a folder, missing  for files
 +							@ext		- extension of the file (only for files)
 +							@size 		- size of the file (number of bytes) (only for files)
 +							@created	- date the file was created (only for files)
 +							@modified	- date the file was last modified (only for files)
 +						-->
 +						<!--sorting order-->
 +						<xsl:sort select="@isdir='true'" order="descending" />
 +						<xsl:sort select="@ext" data-type="text" case-order="lower-first" order="ascending" /> <!-- sort by extension-->
 +						<xsl:sort select="@name" data-type="text" case-order="lower-first" order="ascending" /> <!-- sort by name-->
 +						<!--<xsl:sort select="@size" data-type="number" order="ascending" />--> <!-- sort by size-->
 +						
 +						<tr id="item{position()}">
 +							<xsl:attribute name="class"> 
 +								<!-- either even or odd-->
  								<xsl:choose>
 -									<xsl:when test="@isdir='true'">3</xsl:when>
 -									<xsl:otherwise>1</xsl:otherwise>
 +									<xsl:when test="(position() mod 2) = 0">even</xsl:when>
 +									<xsl:otherwise>odd</xsl:otherwise>
  								</xsl:choose>
  							</xsl:attribute>
 -							<xsl:variable name="ext">
 -								<xsl:value-of select="translate(@ext, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
 -							</xsl:variable>
 -							<xsl:variable name="icon">
 -								<xsl:choose>
 -									<xsl:when test="@isdir='true'">folder_gray.png</xsl:when>
 -									<xsl:when test="$ext='jpg' or $ext='jpeg' or $ext='gif' or $ext='png' or $ext='bmp'">image2.png</xsl:when>
 -									<xsl:when test="$ext='zip' or $ext='rar' or $ext='ace' or $ext='arj' or $ext='lha' or ext='lhz' or ext='tar' or ext='gz'">tar.png</xsl:when>
 -									<xsl:when test="$ext='rtf' or $ext='doc'">document2.png</xsl:when>
 -									<xsl:when test="$ext='txt' or $ext='diz'">txt.png</xsl:when>
 -									<xsl:when test="$ext='pdf'">pdf.png</xsl:when>
 -									<xsl:when test="$ext='exe' or $ext='bat'">win_apps.png</xsl:when>
 -									<xsl:when test="$ext='html' or $ext='htm' or $ext='xml'">www.png</xsl:when>
 -									<xsl:when test="$ext='avi' or $ext='mpg'">video.png</xsl:when>
 -									<xsl:when test="$ext='c' or $ext='cpp' or $ext='h'">source.png</xsl:when>
 -									<xsl:when test="$ext='mp3' or $ext='ogg' or $ext='wav' or $ext='mid' or $ext='mod' or $ext='xm'">sound.png</xsl:when>
 -									<xsl:otherwise>empty.png</xsl:otherwise>
 -								</xsl:choose>
 -							</xsl:variable>
 -							<xsl:element name='img'>
 -								<xsl:attribute name="src">/icons/<xsl:value-of select="$icon"/></xsl:attribute>
 -							</xsl:element>
 -							<xsl:element name='img'>
 -								<xsl:attribute name="src">/placeholder.gif</xsl:attribute>
 -								<xsl:attribute name="width">5</xsl:attribute>
 -							</xsl:element>
 -							<xsl:element name="a">
 -								<xsl:attribute name="href">
 -									<xsl:value-of select="@name"/>
 -									<xsl:if test="@ext!=''">.<xsl:value-of select="@ext"/></xsl:if>
 -									<xsl:if test="@isdir='true'">/</xsl:if>
 -								</xsl:attribute>
 -								<xsl:value-of select="@name"/>
 -								<xsl:if test="@ext!=''">.<xsl:value-of select="@ext"/></xsl:if>
 -							</xsl:element>
 -						</xsl:element>
 -						<xsl:choose>
 -							<xsl:when test="@isdir='true'"></xsl:when>
 -							<xsl:otherwise>
 -								<td><xsl:value-of select="@modified"/></td>
 -								<!-- <td><xsl:value-of select="@created"/></td> -->
 -								<td width='100' align='right'>
 -									<xsl:choose>
 -										<xsl:when test="@size >= 1073741824">
 -											<xsl:value-of select="round(@size div 107374182.4) div 10"/><font size="-1"> GB</font>
 -										</xsl:when>
 -										<xsl:when test="@size >= 1048576">
 -											<xsl:value-of select="round(@size div 104857.6) div 10"/><font size="-1"> MB</font>
 -										</xsl:when>
 -										<xsl:when test="@size >= 1024">
 -											<xsl:value-of select="round(@size div 102.4) div 10"/><font size="-1"> KB</font>
 -										</xsl:when>
 -										<xsl:otherwise>
 -											<xsl:value-of select="@size"/><font size="-1"> Byte</font>
 -										</xsl:otherwise>
 -									</xsl:choose>
 -								</td>
 -							</xsl:otherwise>
 -						</xsl:choose>
 -					</xsl:element>
 -				</xsl:for-each>
 -			</table>
 -		</font>
 -	</body>
 -</html>
 +							<xsl:choose>
 +								<xsl:when test="@isdir='true'">
 +									<!-- this is a folder -->
 +									<td class="folder" id="folder{position()}" colspan="4" title="Verzeichnis: {@name}">
 +										<a href="{@name}/" class="folder" id="link{position()}" title="{@name} (Verzeichnis)">
 +											<img src="/icons/folder_gray.png" alt="folder" />
 +											<xsl:value-of select="@name" />
 +										</a>
 +									</td>
 +								</xsl:when>
 +								<xsl:otherwise>
 +									<!-- this is a file -->
 +									
 +									<!-- complete name of the file (with extension, if there is one)-->
 +									<xsl:variable name="filename">
 +										<xsl:value-of select="@name" /><xsl:if test="@ext!=''">.<xsl:value-of select="@ext" /></xsl:if>
 +									</xsl:variable>
 +									
 +									<!-- filesize with appropriate units-->
 +									<xsl:variable name="realsize">
 +										<xsl:call-template name="convert">
 +											<xsl:with-param name="bytes" select="@size" />
 +										</xsl:call-template>
 +									</xsl:variable>
 +									
 +									<!-- extension in lowercase -->
 +									<xsl:variable name="l_ext" select="translate(@ext,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" />
 +									
 +									<td class="file" id="file{position()}" title="Datei: {$filename}">
 +										<a href="{$filename}" class="{$l_ext}" id="link{position()}" title="{$filename} ({$realsize})">
 +											<xsl:element name="img">
 +												<xsl:attribute name="alt"><xsl:value-of select="@ext" /></xsl:attribute>
 +												<xsl:attribute name="src">
 +													<xsl:choose>
 +														<!-- try to find appropriate icon (case-insensitive compare, as extensions are always case-insensitive in Windows) -->
 +														<xsl:when test="$l_ext='jpg' or $l_ext='jpeg' or $l_ext='gif' or $l_ext='png' or $l_ext='bmp'">/icons/image2.png</xsl:when> 
 +														<xsl:when test="$l_ext='zip' or $l_ext='rar' or $l_ext='ace' or $l_ext='arj' or $l_ext='lha' or $l_ext='lhz' or $l_ext='tar' or $l_ext='gz' or $l_ext='7z'">/icons/tar.png</xsl:when> 
 +														<xsl:when test="$l_ext='rtf' or $l_ext='doc'">/icons/document2.png</xsl:when> 
 +														<xsl:when test="$l_ext='txt' or $l_ext='diz'">/icons/txt.png</xsl:when> 
 +														<xsl:when test="$l_ext='pdf'">/icons/pdf.png</xsl:when>
 +														<xsl:when test="$l_ext='tex'">/icons/tex.png</xsl:when>
 +														<xsl:when test="$l_ext='java' or $l_ext='jar'">/icons/source_java.png</xsl:when> 
 +														<xsl:when test="$l_ext='exe' or $l_ext='bat' or $l_ext='dll'">/icons/win_apps.png</xsl:when> 
 +														<xsl:when test="$l_ext='html' or $l_ext='htm' or $l_ext='xml' or $l_ext='php' or $l_ext='css'">/icons/www.png</xsl:when> 
 +														<xsl:when test="$l_ext='avi' or $l_ext='mpg' or $l_ext='mpeg'">/icons/video.png</xsl:when> 
 +														<xsl:when test="$l_ext='c' or $l_ext='cpp' or $l_ext='h'">/icons/source.png</xsl:when> 
 +														<xsl:when test="$l_ext='mp3' or $l_ext='ogg' or $l_ext='wav' or $l_ext='mid' or $l_ext='mod' or $l_ext='xm'">/icons/sound.png</xsl:when> 
 +														<xsl:otherwise>/icons/empty.png</xsl:otherwise> 
 +													</xsl:choose>
 +												</xsl:attribute><!--src-->
 +											</xsl:element><!--img-->
 +											<xsl:value-of select="$filename" />
 +										</a>
 +									</td>
 +									
 +									<!-- size -->
 +									<td class="size" id="size{position()}" title="Grösse: {$realsize} ({format-number(@size,'###,###,###,###,### Byte')})" >
 +										<xsl:value-of select="$realsize" />
 +									</td>
 +									
 +									<!-- modified -->
 +									<td class="modified" id="modified{position()}" title="Geändert: {@modified}">
 +										<xsl:value-of select="@modified" />
 +									</td>
 +									
 +									<!-- created -->
 +									<td class="created" id="created{position()}" title="Erstellt: {@created}">
 +										<xsl:value-of select="@created" />
 +									</td>
 +								</xsl:otherwise>
 +							</xsl:choose>
 +						</tr>
 +					</xsl:for-each><!--item-->
 +					
 +					<tr id="stats" class="stats">
 +						<th id="filestats" class="file">
 +							<xsl:value-of select="count(item[@isdir='true' and @name!='..'])" /> Verzeichnis(se), <xsl:value-of select="count(item[@isdir!='true'])" />  Datei(en)
 +						</th>
 +						<th id="sizestats" class="size" title="Gesamtgrösse: {$total-realsize} ({format-number($size,'###,###,###,###,### Byte')})">
 +							<xsl:value-of select="$total-realsize" />
 +						</th>
 +						<th id="modifiedstats" class="modified">insgesamt</th>
 +						<th id="createdstats" class="created"><a href="#header" id="uplink" title="An den Anfang der Liste">nach oben</a></th>
 +					</tr>
 +				</table>
 +			</body>
 +		</html>
 +	</xsl:template> <!--config-->
 +	
 +	<!-- converts byte sizes into human-readable text -->
 +	<xsl:template name="convert">
 +		<xsl:param name="bytes" />
 +		<xsl:choose>
 +			<xsl:when test="$bytes <= 0">
 +				...
 +			</xsl:when>
 +			<xsl:when test="$bytes < 1024">
 +				<xsl:value-of select="format-number($bytes,'#,### Byte')" />
 +			</xsl:when>
 +			<xsl:when test="$bytes < 1048576">
 +				<xsl:value-of select="format-number($bytes div 1024,'#,###.# KB')" />
 +			</xsl:when>
 +			<xsl:when test="$bytes < 1073741824">
 +				<xsl:value-of select="format-number($bytes div 1048576,'#,###.# MB')" />
 +			</xsl:when>
 +			<xsl:when test="$bytes < 1099511627776">
 +				<xsl:value-of select="format-number($bytes div 1073741824,'#,###.# GB')" />
 +			</xsl:when>
 +			<xsl:otherwise>
 +				<xsl:value-of select="format-number($bytes div 1099511627776,'#,###.# TB')" />
 +			</xsl:otherwise>
 +		</xsl:choose>
 +	</xsl:template>
 -</xsl:template>
  </xsl:stylesheet>
 | 
