[ Index ]
 

Code source de Kupu-1.3.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/common/kupudrawers/ -> drawer.xsl (source)

   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 image library
  14  drawer.
  15  
  16  $Id: imagedrawer.xsl 4105 2004-04-21 23:56:13Z guido $
  17  -->
  18  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  19      xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns="http://www.w3.org/1999/xhtml"
  20      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
  21      i18n:domain="kupu">
  22   <tal:block define="x python:request.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=UTF-8')" />
  23      <xsl:param name="drawertype">image</xsl:param>
  24      <xsl:param name="drawertitle">Image Drawer</xsl:param>
  25      <xsl:param name="showupload"></xsl:param>
  26      <xsl:param name="usecaptions"></xsl:param>
  27      <xsl:variable name="titlelength" select="60"/>
  28          <xsl:variable name="i18n_drawertitle"> 
  29          <xsl:choose>
  30              <xsl:when i18n:translate="imagedrawer_title" test="$drawertype='image'">Insert Image</xsl:when>
  31              <xsl:when i18n:translate="linkdrawer_title"
  32  test="$drawertype='link'">Insert Link</xsl:when>
  33          </xsl:choose>
  34  </xsl:variable>
  35      <xsl:template match="/">
  36          <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  37              <head>
  38                  <title>
  39                      <xsl:value-of select="$i18n_drawertitle"/>
  40                  </title>
  41                  <link type="text/css" rel="stylesheet">
  42                      <xsl:attribute name="href">kupudrawerstyles.css </xsl:attribute>
  43                  </link>
  44              </head>
  45              <body>
  46                  <div style="width: 500px; border: solid black 1px; width: 100px">
  47                      <div id="kupu-librarydrawer">
  48                          <h1 style="padding: 0;float: left;">
  49                              <xsl:value-of select="$i18n_drawertitle"/>
  50                          </h1>
  51                          <div id="kupu-searchbox" style="text-align: right">
  52                              <form onsubmit="return false;">
  53                                  <xsl:variable name="search_value" 
  54                                                i18n:translate="kupudrawer_search">search</xsl:variable>
  55                                  <input id="kupu-searchbox-input"
  56                                      class="kupu-searchbox-input nofocus"
  57                                      name="searchbox"
  58                                      style="font-style: italic;"
  59                                      onkeyup="if (event.keyCode == 13 ) drawertool.current_drawer.search();">
  60                                     <xsl:attribute name="value">
  61                                        <xsl:value-of select="$search_value" />
  62                                     </xsl:attribute>
  63                                     <xsl:attribute name="onclick">
  64                                        if (this.value == '<xsl:value-of select="$search_value" />') this.value = ''; this.style.fontStyle='normal';</xsl:attribute>
  65                                  </input>
  66                              </form>
  67                          </div>
  68                          <div class="kupu-panels">
  69                              <table>
  70                                  <tr class="kupu-panelsrow">
  71                                      <td id="kupu-librariespanel" class="panel">
  72                                          <div id="kupu-librariesitems" class="overflow">
  73                                          <xsl:apply-templates select="/libraries/library"/>
  74                                          </div>
  75                                      </td>
  76                                      <td id="kupu-resourcespanel" class="panel">
  77                                          <div id="kupu-resourceitems" class="overflow">
  78                                          <xsl:apply-templates select="/libraries/*[@selected]/items"/>
  79                                          </div>
  80                                      </td>
  81                                      <td id="kupu-propertiespanel" class="panel">
  82                                          <div id="kupu-properties" class="overflow">
  83                                          <xsl:choose>
  84                                          <xsl:when test="$drawertype='image'">
  85                                              <xsl:if test="//resource[@selected]">
  86                                                  <xsl:apply-templates
  87                                                  select="/libraries/*[@selected]//resource[@selected]" mode="image-properties"/>
  88                                              </xsl:if>
  89                                              <!-- use image upload template -->
  90                                              <xsl:if test="$showupload='yes'">
  91                                                  <xsl:apply-templates select="/libraries/*[@selected]//uploadbutton" mode="image-upload"/>
  92                                              </xsl:if>
  93                                          </xsl:when>
  94                                          <xsl:when test="$drawertype='link'">
  95                                          <xsl:apply-templates
  96                                          select="/libraries/*[@selected]//resource[@selected]" mode="link-properties"/>
  97                                          </xsl:when>
  98                                          <xsl:otherwise>
  99                                              <xsl:apply-templates
 100                                              select="/libraries/*[@selected]//resource[@selected]" mode="properties"/>
 101                                          </xsl:otherwise>
 102                                          </xsl:choose>
 103                                          </div>
 104                                      </td>
 105                                  </tr>
 106                              </table>
 107                          </div>
 108                          <div class="kupu-dialogbuttons">                            
 109                              <button type="button" 
 110                                      class="kupu-dialog-button"
 111                                      i18n:translate="" 
 112                                      onclick="drawertool.current_drawer.save();">Ok</button>
 113                              <button type="button"
 114                                      class="kupu-dialog-button" 
 115                                      i18n:translate="" 
 116                                      onclick="drawertool.closeDrawer();">Cancel</button>
 117                          </div>
 118                      </div>
 119                  </div>
 120              </body>
 121          </html>
 122      </xsl:template>
 123      <xsl:template match="library">
 124          <div onclick="drawertool.current_drawer.selectLibrary('{@id}');"
 125              class="kupu-libsource" title="{title}" style="">
 126              <xsl:attribute name="id">
 127                  <xsl:value-of select="@id"/>
 128              </xsl:attribute>
 129              <xsl:apply-templates select="icon"/>
 130              <span class="drawer-item-title"><xsl:value-of select="title"/></span>
 131          </div>
 132      </xsl:template>
 133      <xsl:template match="items">
 134          <xsl:apply-templates select="collection|resource|uploadbutton" mode="currentpanel"/>
 135      </xsl:template>
 136      <xsl:template match="resource|collection" mode="currentpanel">
 137          <div id="{@id}" class="kupu-{local-name()}" title="{description}">
 138              <xsl:attribute name="onclick">
 139                  <xsl:choose>
 140                      <xsl:when
 141                              test="local-name()='collection'">drawertool.current_drawer.selectCollection('<xsl:value-of select="@id"/>');</xsl:when>
 142  
 143                      <xsl:otherwise>drawertool.current_drawer.selectItem(this, '<xsl:value-of select="@id"/>')</xsl:otherwise>
 144                  </xsl:choose>
 145              </xsl:attribute>
 146              <xsl:apply-templates select="icon"/>
 147              <xsl:apply-templates select="(label|title)[1]"/>
 148          </div>
 149      </xsl:template>
 150      <xsl:template match="uploadbutton" mode="currentpanel">
 151          <div class="kupu-upload">
 152              <xsl:attribute name="onclick">
 153                  drawertool.current_drawer.selectUpload();
 154              </xsl:attribute>
 155              <span class="drawer-item-title" 
 156                    i18n:translate="imagedrawer_upload_link">Upload ...</span>
 157          </div>
 158      </xsl:template>
 159      <xsl:template match="icon">
 160          <img src="{.}" alt="{../title}">
 161              <xsl:attribute name="class">library-icon-<xsl:value-of select="local-name(..)"/>
 162              </xsl:attribute>
 163          </img>
 164      </xsl:template>
 165      <xsl:template match="label|title">
 166          <span class="drawer-item-title">
 167              <xsl:if test="../@selected">
 168                  <xsl:attribute name="class">drawer-item-title selected-item</xsl:attribute>
 169              </xsl:if>
 170              <xsl:choose>
 171                  <xsl:when test="string-length() &gt; $titlelength">
 172                      <xsl:value-of select="substring(., 0, $titlelength)"/>... </xsl:when>
 173                  <xsl:otherwise>
 174                      <xsl:value-of select="."/>
 175                  </xsl:otherwise>
 176              </xsl:choose>
 177          </span>
 178      </xsl:template>
 179      <xsl:template match="resource|collection" mode="image-properties">
 180          <div>
 181              <xsl:value-of select="title"/>
 182          </div>
 183          <xsl:choose>
 184              <xsl:when test="width">
 185                  <div>
 186                      <xsl:variable name="h" select="number(height) div 120"/>
 187                      <xsl:variable name="w" select="number(width) div 100"/>
 188                      <xsl:choose>
 189                          <xsl:when test="($h&gt;$w) and $h&gt;1">
 190                              <img src="{uri}" title="{title}" height="120"
 191                                  width="{width div $h}" alt="{title}"/>
 192                          </xsl:when>
 193                          <xsl:when test="($w&gt;$h) and $w&gt;1">
 194                              <img src="{uri}" title="{title}"
 195                                  height="{height div $w}" width="100" alt="{title}"/>
 196                          </xsl:when>
 197                          <xsl:otherwise>
 198                              <img src="{uri}" title="{title}" height="{height}"
 199                                  width="{width}" alt="{title}"/>
 200                          </xsl:otherwise>
 201                      </xsl:choose>
 202                  </div>
 203              </xsl:when>
 204              <xsl:when test="preview">
 205                  <tr>
 206                      <td>
 207                          <strong i18n:translate="imagedrawer_upload_preview_label">Preview</strong>
 208                          <br/>
 209                          <img src="{preview}" title="{title}" height="{height}"
 210                              width="{width}" alt="{title}"/>
 211                      </td>
 212                  </tr>
 213              </xsl:when>
 214              <xsl:otherwise>
 215                  <img src="{uri}" title="{title}" height="120" alt="{title}" />
 216              </xsl:otherwise>
 217          </xsl:choose>
 218          <div>
 219              <xsl:value-of select="size"/>
 220              <xsl:if test="width" i18n:translate="imagedrawer_size">(<span i18n:name="width"><xsl:value-of select="width" /></span> by <span i18n:name="height"><xsl:value-of select="height" /></span>)</xsl:if>
 221          </div>
 222          <div>
 223              <xsl:value-of select="description"/>
 224          </div>
 225          <div>
 226              <form onsubmit="return false;">
 227                  <strong i18n:translate="imagedrawer_upload_alt_text">ALT-text</strong>
 228                  <br/>
 229                  <input type="text" id="image_alt" size="20" value="{title}"/>
 230                  <br/>
 231                  <input type="radio" name="image-align" id="image-align-left"
 232                      checked="checked" value="image-left"/>
 233                  <label for="image-align-left" i18n:translate="imagedrawer_left">Left</label>
 234                  <input type="radio" name="image-align" id="image-align-inline" value="image-inline"/>
 235                  <label for="image-align-inline" i18n:translate="imagedrawer_inline">Inline</label>
 236                  <input type="radio" name="image-align" id="image-align-right" value="image-right"/>
 237                  <label for="image-align-right" i18n:translate="imagedrawer_right">Right</label>
 238                  <xsl:if test="$usecaptions='yes'">
 239                      <br/>
 240                      <input type="checkbox" name="image-caption"
 241                          id="image-caption" checked="checked"/>
 242                      <label for="image-caption" i18n:translate="imagedrawer_caption_label">Caption</label>
 243                  </xsl:if>
 244              </form>
 245          </div>
 246      </xsl:template>
 247      <xsl:template match="resource|collection" mode="link-properties">
 248          <form onsubmit="return false;">
 249              <table>
 250                  <tr class="kupu-linkdrawer-title-row">
 251                      <td>
 252                          <strong i18n:translate="linkdrawer_title_label">Title</strong>
 253                          <br/>
 254                          <xsl:value-of select="title"/>
 255                      </td>
 256                  </tr>
 257                  <tr class="kupu-linkdrawer-description-row">
 258                      <td>
 259                          <strong i18n:translate="linkdrawer_description_label">Description</strong>
 260                          <br/>
 261                          <xsl:value-of select="description"/>
 262                      </td>
 263                  </tr>
 264                  <tr class="kupu-linkdrawer-name-row">
 265                      <td>
 266                          <strong i18n:translate="linkdrawer_name_label">Name</strong>
 267                          <br/>
 268                          <input type="text" id="link_name" size="10"/>
 269                      </td>
 270                  </tr>
 271                  <tr class="kupu-linkdrawer-target-row">
 272                      <td>
 273                          <strong i18n:translate="linkdrawer_target_label">Target</strong>
 274                          <br/>
 275                          <input type="text" id="link_target" value="_self" 
 276                                 size="10"/>
 277                      </td>
 278                  </tr>
 279              </table>
 280          </form>
 281      </xsl:template>
 282      
 283      <!-- image upload form -->
 284      <xsl:template match="uploadbutton" mode="image-upload">
 285       <div>
 286          <div id="kupu-upload-instructions" i18n:translate="imagedrawer_upload_instructions">
 287              Select an image from your computer and click ok to have it
 288              automatically uploaded to selected folder and inserted into the
 289              editor.
 290          </div>
 291          <form name="kupu_upload_form" method="POST" action="" scrolling="off" target="kupu_upload_form_target"
 292                enctype="multipart/form-data" style="margin: 0; border: 0;">
 293  
 294              <label for="kupu-upload-file" i18n:translate="imagedrawer_upload_to_label">Upload to: <span i18n:name="folder"><xsl:value-of select='/libraries/*[@selected]/title' /></span></label>
 295              <input id="kupu-upload-file" type="file" name="node_prop_image" size="20"/><br/>
 296              <label for="kupu-upload-title"
 297  i18n:translate="imagedrawer_upload_title_label">Title:</label>
 298              <input id="kupu-upload-title" type="text" name="node_prop_caption" size="23" value=""/><br/>
 299          </form>
 300  
 301          <iframe id="kupu-upload-form-target" name="kupu_upload_form_target"
 302                  src="kupublank.html" scrolling="off" frameborder="0" width="0px" height="0px" display="None">
 303          </iframe>
 304        </div>
 305      </xsl:template>
 306      
 307  </xsl:stylesheet>


Généré le : Sun Feb 25 15:30:41 2007 par Balluche grâce à PHPXref 0.7