Annotation of kupuMPIWG/common/kupudrawers/drawer.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 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:choose>
99: </div>
100: </td>
101: </tr>
102: </table>
103: </div>
104: <div class="kupu-dialogbuttons">
105: <button type="button"
106: class="kupu-dialog-button"
107: i18n:translate=""
108: onclick="drawertool.current_drawer.save();">Ok</button>
109: <button type="button"
110: class="kupu-dialog-button"
111: i18n:translate=""
112: onclick="drawertool.closeDrawer();">Cancel</button>
113: </div>
114: </div>
115: </div>
116: </body>
117: </html>
118: </xsl:template>
119: <xsl:template match="library">
120: <div onclick="drawertool.current_drawer.selectLibrary('{@id}');"
121: class="kupu-libsource" title="{title}" style="">
122: <xsl:attribute name="id">
123: <xsl:value-of select="@id"/>
124: </xsl:attribute>
125: <xsl:apply-templates select="icon"/>
126: <span class="drawer-item-title"><xsl:value-of select="title"/></span>
127: </div>
128: </xsl:template>
129: <xsl:template match="items">
130: <xsl:apply-templates select="collection|resource|uploadbutton" mode="currentpanel"/>
131: </xsl:template>
132: <xsl:template match="resource|collection" mode="currentpanel">
133: <div id="{@id}" class="kupu-{local-name()}" title="{description}">
134: <xsl:attribute name="onclick">
135: <xsl:choose>
136: <xsl:when
137: test="local-name()='collection'">drawertool.current_drawer.selectCollection('<xsl:value-of select="@id"/>');</xsl:when>
138:
139: <xsl:otherwise>drawertool.current_drawer.selectItem(this, '<xsl:value-of select="@id"/>')</xsl:otherwise>
140: </xsl:choose>
141: </xsl:attribute>
142: <xsl:apply-templates select="icon"/>
143: <xsl:apply-templates select="(label|title)[1]"/>
144: </div>
145: </xsl:template>
146: <xsl:template match="uploadbutton" mode="currentpanel">
147: <div class="kupu-upload">
148: <xsl:attribute name="onclick">
149: drawertool.current_drawer.selectUpload();
150: </xsl:attribute>
151: <span class="drawer-item-title"
152: i18n:translate="imagedrawer_upload_link">Upload ...</span>
153: </div>
154: </xsl:template>
155: <xsl:template match="icon">
156: <img src="{.}" alt="{../title}">
157: <xsl:attribute name="class">library-icon-<xsl:value-of select="local-name(..)"/>
158: </xsl:attribute>
159: </img>
160: </xsl:template>
161: <xsl:template match="label|title">
162: <span class="drawer-item-title">
163: <xsl:if test="../@selected">
164: <xsl:attribute name="class">drawer-item-title selected-item</xsl:attribute>
165: </xsl:if>
166: <xsl:choose>
167: <xsl:when test="string-length() > $titlelength">
168: <xsl:value-of select="substring(., 0, $titlelength)"/>... </xsl:when>
169: <xsl:otherwise>
170: <xsl:value-of select="."/>
171: </xsl:otherwise>
172: </xsl:choose>
173: </span>
174: </xsl:template>
175: <xsl:template match="resource|collection" mode="image-properties">
176: <div>
177: <xsl:value-of select="title"/>
178: </div>
179: <xsl:choose>
180: <xsl:when test="width">
181: <div>
182: <xsl:variable name="h" select="number(height) div 120"/>
183: <xsl:variable name="w" select="number(width) div 100"/>
184: <xsl:choose>
185: <xsl:when test="($h>$w) and $h>1">
186: <img src="{uri}" title="{title}" height="120"
187: width="{width div $h}" alt="{title}"/>
188: </xsl:when>
189: <xsl:when test="($w>$h) and $w>1">
190: <img src="{uri}" title="{title}"
191: height="{height div $w}" width="100" alt="{title}"/>
192: </xsl:when>
193: <xsl:otherwise>
194: <img src="{uri}" title="{title}" height="{height}"
195: width="{width}" alt="{title}"/>
196: </xsl:otherwise>
197: </xsl:choose>
198: </div>
199: </xsl:when>
200: <xsl:when test="preview">
201: <tr>
202: <td>
203: <strong i18n:translate="imagedrawer_upload_preview_label">Preview</strong>
204: <br/>
205: <img src="{preview}" title="{title}" height="{height}"
206: width="{width}" alt="{title}"/>
207: </td>
208: </tr>
209: </xsl:when>
210: </xsl:choose>
211: <div>
212: <xsl:value-of select="size"/>
213: <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>
214: </div>
215: <div>
216: <xsl:value-of select="description"/>
217: </div>
218: <div>
219: <form onsubmit="return false;">
220: <strong i18n:translate="imagedrawer_upload_alt_text">ALT-text</strong>
221: <br/>
222: <input type="text" id="image_alt" size="20" value="{title}"/>
223: <br/>
224: <input type="radio" name="image-align" id="image-align-left"
225: checked="checked" value="image-left"/>
226: <label for="image-align-left" i18n:translate="imagedrawer_left">Left</label>
227: <input type="radio" name="image-align" id="image-align-inline" value="image-inline"/>
228: <label for="image-align-inline" i18n:translate="imagedrawer_inline">Inline</label>
229: <input type="radio" name="image-align" id="image-align-right" value="image-right"/>
230: <label for="image-align-right" i18n:translate="imagedrawer_right">Right</label>
231: <xsl:if test="$usecaptions='yes'">
232: <br/>
233: <input type="checkbox" name="image-caption"
234: id="image-caption" checked="checked"/>
235: <label for="image-caption" i18n:translate="imagedrawer_caption_label">Caption</label>
236: </xsl:if>
237: </form>
238: </div>
239: </xsl:template>
240: <xsl:template match="resource|collection" mode="link-properties">
241: <form onsubmit="return false;">
242: <table>
243: <tr class="kupu-linkdrawer-title-row">
244: <td>
245: <strong i18n:translate="linkdrawer_title_label">Title</strong>
246: <br/>
247: <xsl:value-of select="title"/>
248: </td>
249: </tr>
250: <tr class="kupu-linkdrawer-description-row">
251: <td>
252: <strong i18n:translate="linkdrawer_description_label">Description</strong>
253: <br/>
254: <xsl:value-of select="description"/>
255: </td>
256: </tr>
257: <tr class="kupu-linkdrawer-name-row">
258: <td>
259: <strong i18n:translate="linkdrawer_name_label">Name</strong>
260: <br/>
261: <input type="text" id="link_name" size="10"/>
262: </td>
263: </tr>
264: <tr class="kupu-linkdrawer-target-row">
265: <td>
266: <strong i18n:translate="linkdrawer_target_label">Target</strong>
267: <br/>
268: <input type="text" id="link_target" value="_self"
269: size="10"/>
270: </td>
271: </tr>
272: </table>
273: </form>
274: </xsl:template>
275:
276: <!-- image upload form -->
277: <xsl:template match="uploadbutton" mode="image-upload">
278: <div>
279: <div id="kupu-upload-instructions" i18n:translate="imagedrawer_upload_instructions">
280: Select an image from your computer and click ok to have it
281: automatically uploaded to selected folder and inserted into the
282: editor.
283: </div>
284: <form name="kupu_upload_form" method="POST" action="" scrolling="off" target="kupu_upload_form_target"
285: enctype="multipart/form-data" style="margin: 0; border: 0;">
286:
287: <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>
288: <input id="kupu-upload-file" type="file" name="node_prop_image" size="20"/><br/>
289: <label for="kupu-upload-title"
290: i18n:translate="imagedrawer_upload_title_label">Title:</label>
291: <input id="kupu-upload-title" type="text" name="node_prop_caption" size="23" value=""/><br/>
292: </form>
293:
294: <iframe id="kupu-upload-form-target" name="kupu_upload_form_target"
295: src="kupublank.html" scrolling="off" frameborder="0" width="0px" height="0px" display="None">
296: </iframe>
297: </div>
298: </xsl:template>
299:
300: </xsl:stylesheet>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>