Annotation of kupuMPIWG/silva/librarydrawer.xsl, revision 1.1.1.1

1.1       dwinter     1: <?xml version="1.0" encoding="UTF-8" ?>
                      2: <!--
                      3: ##############################################################################
                      4: #
                      5: # Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
                      6: #
                      7: # This software is distributed under the terms of the Kupu
                      8: # License. See LICENSE.txt for license text. For a list of Kupu
                      9: # Contributors see CREDITS.txt.
                     10: #
                     11: ##############################################################################
                     12: 
                     13: XSL transformation from Kupu Library XML to HTML for the library
                     14: drawer.
                     15: 
                     16: $Id: librarydrawer.xsl 9879 2005-03-18 12:04:00Z yuppie $
                     17: -->
                     18: <xsl:stylesheet
                     19:   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                     20:   version="1.0">
                     21: 
                     22:   <xsl:variable name="titlelength" select="14"/>
                     23: 
                     24:   <xsl:template match="/">
                     25:     <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
                     26:       <head>
                     27:         <title>Imagedrawer</title>
                     28:       </head>
                     29:       <body>
                     30:         <div id="kupu-librarydrawer">
                     31:           <div id="kupu-drawerheader">
                     32:             <xsl:apply-templates
                     33:               select="/libraries/*[@selected]"
                     34:               mode="header"
                     35:               />
                     36:           <form onsubmit="return false;">
                     37:             <input id="kupu-searchbox" name="searchbox" value=""
                     38:                    onkeyup="if (event.keyCode == 13 ) drawertool.current_drawer.search();" />
                     39:           </form>
                     40:           </div>
                     41:           <div id="kupu-panels">
                     42:             <table width="95%" border="1">
                     43:               <tr class="kupu-panelsrow">
                     44:                 <td id="kupu-librariespanel" width="10%">
                     45:                   <div id="kupu-librariesitems" class="overflow">
                     46:                     <xsl:apply-templates select="/libraries/library"/>
                     47:                   </div>
                     48:                 </td>
                     49:                 <td id="kupu-resourcespanel" width="10%">
                     50:                   <div id="kupu-resourceitems" class="overflow">
                     51:                     <xsl:apply-templates
                     52:                       select="/libraries/*[@selected]"
                     53:                       mode="currentpanel"
                     54:                       />
                     55:                   </div>
                     56:                 </td>
                     57:                 <td id="kupu-propertiespanel">
                     58:                   <div id="kupu-properties" class="overflow">
                     59:                     <xsl:apply-templates
                     60:                       select="//resource[@selected]"
                     61:                       mode="properties"
                     62:                       />
                     63:                   </div>
                     64:                 </td>
                     65:               </tr>
                     66:             </table>
                     67:           </div>
                     68:           <div id="kupu-dialogbuttons">
                     69:             <button type="button" class="button"
                     70:               onclick="drawertool.current_drawer.reloadCurrent();">Reload current</button>
                     71:             <button type="button" class="button"
                     72:               onclick="drawertool.closeDrawer();">Cancel</button>
                     73:             <button type="button" class="button"
                     74:               onclick="drawertool.current_drawer.save();">Ok</button>
                     75:           </div>
                     76:         </div>
                     77:       </body>
                     78:     </html>
                     79:   </xsl:template>
                     80: 
                     81:   <xsl:template match="library">
                     82:     <div onclick="drawertool.current_drawer.selectLibrary('{@id}');"
                     83:          class="kupu-libsource">
                     84:       <xsl:attribute name="id">
                     85:         <xsl:value-of select="@id" />
                     86:       </xsl:attribute>
                     87:       <xsl:if test="icon">
                     88:         <img src="{icon}" title="{title}" alt="{title}" />&#xa0;
                     89:       </xsl:if>
                     90:       <xsl:apply-templates select="title"/>
                     91:     </div>
                     92:   </xsl:template>
                     93: 
                     94:   <xsl:template match="library|collection" mode="currentpanel">
                     95:     <xsl:apply-templates select="items/collection|items/resource" />
                     96:   </xsl:template>
                     97: 
                     98:   <xsl:template match="library|collection|resource" mode="header">
                     99:     <xsl:text>Current location: </xsl:text>
                    100:     <xsl:value-of select="uri/text()" />
                    101:   </xsl:template>
                    102: 
                    103:   <xsl:template match="resource|collection">
                    104:     <div id="{@id}" class="kupu-libsource">
                    105:       <xsl:attribute name="onclick">
                    106:         <xsl:choose>
                    107:           <xsl:when test="local-name()='collection'">drawertool.current_drawer.selectCollection('<xsl:value-of select="@id" />');</xsl:when>
                    108:           <xsl:otherwise>drawertool.current_drawer.selectItem('<xsl:value-of select="@id" />')</xsl:otherwise>
                    109:         </xsl:choose>
                    110:       </xsl:attribute>
                    111:       <xsl:if test="@selected">
                    112:         <xsl:attribute name="style">background-color: #C0C0C0</xsl:attribute>
                    113:       </xsl:if>
                    114:       <xsl:if test="icon">
                    115:         <img src="{icon}" title="{title}" alt="{title}" />&#xa0;
                    116:       </xsl:if>
                    117:       <xsl:apply-templates select="title"/>
                    118:     </div>
                    119:   </xsl:template>
                    120:   
                    121:   <xsl:template match="title">
                    122:     <xsl:choose>
                    123:       <xsl:when test="string-length() &gt; $titlelength">
                    124:         <xsl:value-of select="substring(., 0, $titlelength)"/>...
                    125:       </xsl:when>
                    126:       <xsl:otherwise>
                    127:         <xsl:value-of select="."/>
                    128:       </xsl:otherwise>
                    129:     </xsl:choose>
                    130:   </xsl:template>
                    131: 
                    132:   <xsl:template match="resource|collection" mode="properties">
                    133:     <!-- Override this template for your custom library drawer -->
                    134:   </xsl:template>
                    135: </xsl:stylesheet>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>