Rev 1312 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cmPort="http://www.cm-portalegre.pt/projectos/" version="1.0" xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon" xmlns:d="http://www.estgp.pt/baco/directory/" xmlns:foo="foo" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<xsl:import href="utils.xsl"/>
<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="yes" />
<xsl:param name="language"></xsl:param>
<xsl:param name="slideMenu">false</xsl:param>
<xsl:param name="contextPath">/baco</xsl:param>
<xsl:param name="username">jmachado</xsl:param>
<xsl:param name="name">Jorge Machado</xsl:param>
<xsl:param name="roles">professor,administrador</xsl:param>
<!--<xsl:param name="ACTUAL">pagina_a1.2.1</xsl:param>-->
<!--<xsl:param name="ACTUAL">ficha_trabalhoIncluido</xsl:param>-->
<xsl:param name="ACTUAL">ionline</xsl:param>
<xsl:param name="ACTUAL_REMOTE_CHILD">FTP_3_Trabalhos</xsl:param>
<xsl:param name="includeXML">oai_dc.xml</xsl:param>
<xsl:template match="/">
<div>
<xsl:apply-templates select="//*[@id=$ACTUAL]" mode="root"/>
</div>
</xsl:template>
<xsl:template match="cmPort:dadosProjecto">
<table>
<tr>
<th colspan="2">Dados de Projecto</th>
</tr>
<tr>
<th>Nome</th>
<td><xsl:value-of select="./cmPort:nome/text()"/></td>
</tr>
<tr>
<th>Data</th>
<td><xsl:value-of select="./cmPort:data/text()"/></td>
</tr>
<tr>
<th>Local</th>
<td><xsl:value-of select="./cmPort:local/text()"/></td>
</tr>
<tr>
<th>Equipa Técnica</th>
<td><xsl:value-of select="./cmPort:equipaTecnica/text()"/></td>
</tr>
<xsl:if test="./cmPort:parecer/text()">
<tr>
<th>Parecer</th>
<td><xsl:value-of select="./cmPort:parecer/text()"/></td>
</tr>
</xsl:if>
</table>
</xsl:template>
<xsl:template match="/" mode="single">
<html>
<head>
<title>O meu Directório ESTG</title>
<style type="text/css">
body
{
color: black;
border: 0;
padding: 0;
margin-left: auto;
margin-right: auto;
margin-top: 0;
font-family: sans-serif;
font-size: 0.7em;
}
ul
{
margin:0;
}
#header, #header td, #header td a
{
padding-left:10px;
background-color:#396F9D;
color:white;
}
#bigTable
{
width:100%;
}
#latNavContainer
{
width:160px;
vertical-align:top;
}
#footer
{
border-top: 1px solid black;
text-align:center;
}
#latNav
{
padding-left:10px;
background-color:lightgreen;
}
#latNav h2
{
font-family: sans-serif;
font-size: 0.7em;
background-color: blue;
color:yellow;
margin-bottom:0;
}
#latNav ul
{
list-style:none;
padding-left: 15px;
margin-left:0;
}
#latNav li
{
font-size: 0.7em;
white-space:nowrap;
}
#latNav li .selected
{
background-color:green;
}
#topnav
{
padding-left:10px;
background-color:yellow;
}
#content
{
padding:4px;
border: 1px solid black;
}
<!--Blocos do conteudo dos directorios-->
.block
{
margin-bottom:10px;
border-left: 1px solid #8EC73F;
}
.block .head
{
font-style:italic;
}
.block
{
font-family: sans-serif;
font-size: 0.7em;
}
.block ul li p
{
background-color:transparent;
font-style:italic;
}
.block ul li ul li
{
padding-left: 0;
}
.block p, .navLeftMenu h2 {
background-color: #8EC73F;
padding-left: 0;
margin: 0;
}
.block ul
{
list-style:none;
padding-left: 5px;
margin-left:0;
}
.block ul li{
padding-top:3px;
padding-left:0;
margin-left:0;
}
.block a {
color: #4d4d4d;
text-decoration: none;
}
.block a:visited {
/*color: #4d4d4d;*/
text-decoration: none;
}
.block a:hover, .linkUnderlineGrayToGreen a:hover {
color: #8EC73F;
text-decoration: underline;
}
.links p
{
background-color:yellow;
}
.links .block
{
border-left: 1px solid yellow;
}
.columnTable
{
width:100%;
}
.columnTable td
{
margin-left: 10px;
}
td.column {
vertical-align: top;
}
</style>
</head>
<body>
<xsl:call-template name="header"/>
<xsl:apply-templates select="//*[@id=$ACTUAL]" mode="root"/>
<xsl:call-template name="footer"/>
</body>
</html>
</xsl:template>
<xsl:template name="header">
<div id="header">
<h1>Bem vindos ao meu directorio</h1>
Está autenticado como <xsl:value-of select="$name"/> com os papeis: <xsl:value-of select="$roles"/>
</div>
</xsl:template>
<xsl:template name="footer">
<div id="footer">
Sistema de Directorios da <a href="http://www.estgp.pt">ESTG</a> 2008
</div>
</xsl:template>
<!--
===========================================================
| Página de Apresentação de um Nó no Corpo da Página
===========================================================
-->
<xsl:template match="d:directory" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<xsl:apply-templates select="." mode="childs"/>
</xsl:template>
<xsl:template match="d:leaf[@node='true']" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<td id="leftPage">
<xsl:apply-templates select=".." mode="latNav"/>
</td>
<td class="contentPortal">
<div class="portal">
<xsl:apply-templates select="." mode="childs"/>
</div>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="d:directory" mode="childs">
<div class="row">
<xsl:for-each select="d:leaf">
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-2">
<div class="list-group">
<div class="list-group-item list-group-item-heading">
<!--<xsl:apply-templates select="." mode="link"/>-->
<xsl:apply-templates select="." mode="label"/>
</div>
<xsl:for-each select="d:leaf[@node='false']">
<div class="list-group-item">
<xsl:apply-templates select="." mode="link"/>
</div>
</xsl:for-each>
</div>
</div>
</xsl:for-each>
</div>
</xsl:template>
<xsl:template match="d:leaf[@node='true']" mode="childs">
<table class="columnTable">
<tr>
<td class="column">
<xsl:if test="d:leaf[@node='false']">
<div class="block links">
<p><xsl:call-template name="leafsBlockLabel"/></p>
<ul>
<xsl:for-each select="d:leaf[@node='false']">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</td>
<xsl:if test="d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="d:groupsDeclaration/d:group/d:name">
<xsl:for-each select="d:groupsDeclaration/d:group/d:name">
<tr>
<xsl:variable name="group" select="."/>
<xsl:for-each select="../../../d:leaf[@node='true' and @group=$group]">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="d:leaf[@node='true']">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</tr>
</table>
</xsl:template>
<xsl:template match="d:leaf[@node='true']" mode="block">
<div class="block">
<p><xsl:apply-templates select="." mode="link"/></p>
<ul>
<xsl:for-each select="d:leaf[@node='false']">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
<xsl:for-each select="d:leaf[@node='true']">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:template>
<!--
===========================================================
| Página de Apresentação de uma Folha no Corpo da Página
===========================================================
-->
<xsl:template match="d:leaf[@node='false']" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<table id="bigTable" cellspacing="0" cellpadding="0">
<tr>
<td id="leftPage">
<xsl:apply-templates select=".." mode="latNav"/>
</td>
<td class="contentPortal">
<xsl:choose>
<xsl:when test="not(@remoteExtensionRoot='true') and not(./d:*[@ftpDirectory])">
<xsl:apply-templates select="." mode="bodyContent"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="//*[@id=$ACTUAL_REMOTE_CHILD]">
<xsl:apply-templates select="//*[@id=$ACTUAL_REMOTE_CHILD]" mode="remoteChildsContent"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="remoteChildsContent"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="d:*" mode="remoteChildsContent">
<xsl:apply-templates select="." mode="topNavRemote"/>
<div class="files">
<table cellpadding="0" cellspacing="0">
<tr>
<th>
Nome do ficheiro/pasta
</th>
<th>
Data de Modificação
</th>
<th>
Tamanho
</th>
</tr>
<xsl:apply-templates select="./d:leaf[@node='false' and @ftpDirectory='true']" mode="ftpLine"/>
<xsl:apply-templates select="./d:leaf[@node='false' and @ftpDirectory='false']" mode="ftpLine"/>
</table>
</div>
</xsl:template>
<xsl:template match="d:leaf[@node='false']" mode="ftpLine">
<xsl:choose>
<xsl:when test="./@ftpDirectory='true'">
<tr class="dir">
<td colspan="3" >
<!--<img>
<xsl:attribute name="src"><xsl:value-of select="$contextPath"/>/imgs/folder.gif</xsl:attribute>
</img>-->
<span class="glyphicon glyphicon-folder-open"> </span>
<xsl:text> </xsl:text>
<xsl:apply-templates select="." mode="link"/>
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr class="file">
<td>
<xsl:apply-templates select="." mode="mime"/><xsl:text> </xsl:text>
<xsl:apply-templates select="." mode="link"/>
</td>
<td>
<xsl:value-of select="./@lastModification"/>
</td>
<td>
<xsl:value-of select="./@size"/>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="d:leaf[@node='false']" mode="mime">
<img>
<xsl:attribute name="alt"><xsl:value-of select="."/></xsl:attribute>
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="contains(@extension, 'rtf')"><xsl:value-of select="$contextPath"/>/imgs/mime/doc.gif</xsl:when>
<xsl:when test="contains(@extension, 'doc')"><xsl:value-of select="$contextPath"/>/imgs/mime/doc.gif</xsl:when>
<xsl:when test="contains(@extension, 'docx')"><xsl:value-of select="$contextPath"/>/imgs/mime/doc.gif</xsl:when>
<xsl:when test="contains(@extension, 'pdf')"><xsl:value-of select="$contextPath"/>/imgs/mime/pdf.gif</xsl:when>
<xsl:when test="contains(@extension, 'ppt')"><xsl:value-of select="$contextPath"/>/imgs/mime/ppt.gif</xsl:when>
<xsl:when test="contains(@extension, 'zip')"><xsl:value-of select="$contextPath"/>/imgs/mime/zip.gif</xsl:when>
<xsl:when test="contains(@extension, 'gz')"><xsl:value-of select="$contextPath"/>/imgs/mime/zip.gif</xsl:when>
<xsl:when test="contains(@extension, 'tgz')"><xsl:value-of select="$contextPath"/>/imgs/mime/zip.gif</xsl:when>
<xsl:when test="contains(@extension, 'rar')"><xsl:value-of select="$contextPath"/>/imgs/mime/rar.gif</xsl:when>
<xsl:when test="contains(@extension, 'html')"><xsl:value-of select="$contextPath"/>/imgs/mime/html.gif</xsl:when>
<xsl:when test="contains(@extension, 'html')"><xsl:value-of select="$contextPath"/>/imgs/mime/html.gif</xsl:when>
<xsl:when test="contains(@extension, 'xls')"><xsl:value-of select="$contextPath"/>/imgs/mime/xls.gif</xsl:when>
<xsl:when test="contains(@extension, 'xlsx')"><xsl:value-of select="$contextPath"/>/imgs/mime/xls.gif</xsl:when>
<xsl:when test="contains(@extension, 'txt')"><xsl:value-of select="$contextPath"/>/imgs/mime/txt.gif</xsl:when>
<xsl:otherwise><xsl:value-of select="$contextPath"/>/imgs/mime/unknown.gif</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</img>
</xsl:template>
<!--<xsl:function name="d:parse" as="document-node()">
<xsl:param name="s" as="xs:string"/>
<xsl:sequence select="doc(concat('data:text/xml','<ola>teste</ola>'))"/>
--><!--<xsl:sequence select="doc(concat('data:text/xml',$s))"/> --><!--
</xsl:function>-->
<!--
===========================================================
| Barra de Navegação Superior
===========================================================
-->
<xsl:template match="d:leaf[@node='false']" mode="topNav">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>
</xsl:template>
<xsl:template match="d:leaf[@node='true']" mode="topNav">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>
</xsl:template>
<xsl:template match="d:directory" mode="topNav">
<!--O Baco faz isto por nós para que a barra superior fique alinhada correctamente-->
<!--<div id="topnav">
<ul>
<li class="navPlace">
<xsl:call-template name="homeLink"/>
</li>
<li class="navPlace">
>
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>-->
</xsl:template>
<xsl:template match="d:leaf[@node='false']" mode="topNavRemote">
<div id="topnav">
<ul>
<li class="navPlace">
<xsl:value-of select="@label"/>
</li>
</ul>
</div>
</xsl:template>
<xsl:template match="d:leaf[@node='true']" mode="topNavRemote">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBackRemote"/>
<li class="navPlace">
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>
</xsl:template>
<xsl:template match="d:directory" mode="navBack">
<li class="navPlace">
<xsl:call-template name="homeLink"/>
<span class="glyphicon glyphicon-menu-right"/>
</li>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
<span class="glyphicon glyphicon-menu-right"/>
</li>
</xsl:template>
<xsl:template match="d:leaf[@node='true']" mode="navBack">
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
<span class="glyphicon glyphicon-menu-right"/>
</li>
</xsl:template>
<xsl:template match="d:leaf[@node='false']" mode="navBack">
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
<span class="glyphicon glyphicon-menu-right"/>
</li>
</xsl:template>
<xsl:template match="d:leaf[@node='false']" mode="navBackRemote">
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:template>
<xsl:template match="d:leaf[@node='true']" mode="navBackRemote">
<xsl:apply-templates select=".." mode="navBackRemote"/>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
<span class="glyphicon glyphicon-menu-right"/>
</li>
</xsl:template>
<!--
===========================================================
| Barra de Navegação Lateral Esquerda
===========================================================
-->
<xsl:template match="d:leaf[@node='true']" mode="latNav">
<!--<xsl:if test="./d:leaf or ./d:node">-->
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
<xsl:apply-templates select="." mode="label"/>
</li>
</xsl:when>
<xsl:otherwise>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf[@node='false']">
<li class="navPlace"><xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
<!--</xsl:if>-->
</xsl:template>
<xsl:template match="d:leaf[@node='false']" mode="latNav">
<!--<xsl:if test="./d:leaf or ./d:node">-->
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
<xsl:apply-templates select="." mode="label"/>
</li>
</xsl:when>
<xsl:otherwise>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf[@node='false']">
<li class="navPlace"><xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
<!--</xsl:if>-->
</xsl:template>
<xsl:template match="d:directory" mode="latNav">
<!--<xsl:if test="./d:leaf or ./d:node">-->
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:leaf[@node='true']">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
<xsl:apply-templates select="." mode="label"/>
</li>
</xsl:when>
<xsl:otherwise>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf[@node='false']">
<li class="navPlace"><xsl:call-template name="linkPrefix"/><xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
<!--</xsl:if>-->
</xsl:template>
<xsl:template name="linkPrefix">
</xsl:template>
<!--
===========================================================
| Apresentar Todo o Directorio em árvore - NAO ESTA EM USO DE MOMENTO
===========================================================
-->
<xsl:template name="treeRoot">
<xsl:if test="/d:directory/d:leaf[@node='true']">
<ul>
<xsl:for-each select="/d:directory/d:leaf[@node='true']">
<li>
<xsl:apply-templates select="." mode="treeLoop"/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
<xsl:template match="d:leaf[@node='true']" mode="treeLoop">
<div>
<xsl:if test="$ACTUAL=@id">
<xsl:attribute name="style">background-color:yellow</xsl:attribute>
</xsl:if>
<p><xsl:value-of select="@label"/></p>
<xsl:if test="./d:leaf[@node='false']">
<xsl:for-each select="./d:leaf[@node='false']">
<xsl:apply-templates select="." mode="tree"/>
</xsl:for-each>
</xsl:if>
<xsl:if test="./d:leaf[@node='true']">
<ul>
<xsl:for-each select="./d:leaf[@node='true']">
<li>
<xsl:apply-templates select="." mode="treeLoop"/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="d:leaf[@node='false']" mode="tree">
<div>
<xsl:if test="$ACTUAL=@id">
<xsl:attribute name="style">background-color:yellow</xsl:attribute>
</xsl:if>
<p><xsl:apply-templates mode="label"/></p>
</div>
</xsl:template>
<!--
===========================================================
| TEMPLATES DE OUTROS ESQUEMAS
===========================================================
-->
<!-- Foo Templates -->
<xsl:template match="foo:record">
<p>titulo:<xsl:value-of select="foo:title"/></p>
<p>texto:<xsl:value-of select="foo:text"/></p>
</xsl:template>
<!--OAIDC Templates-->
<xsl:template match="oai_dc:dc">
<table>
<tr>
<th colspan="2">Registo Bibliografico</th>
</tr>
<xsl:apply-templates select="./dc:*"/>
</table>
</xsl:template>
<xsl:template match="dc:*">
<tr>
<th><xsl:value-of select="local-name(.)"/></th>
<td><xsl:value-of select="./text()"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>