upload form with xforms, part 1

git-svn-id: http://yolanda.mister-muffin.de/svn@331 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
erlehmann 2008-04-29 13:29:53 +00:00
parent 5b231dcfc0
commit e45f3c4c12
4 changed files with 131 additions and 25 deletions

View file

@ -101,7 +101,8 @@ div
div.uploadform
{
line-height: 2.5em;
margin: 1.5em;
/* correct spacing to avoid overlapping with float:right elements */
margin-right: 22em;
}
div.loginbox

View file

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<xsl:output
@ -17,7 +20,10 @@
omit-xml-declaration="no"
/>
<!-- each xsl:template should have it's own file -->
<!--
each xsl template should have it's own file
exception: templates which are only use by ONE other template may reside in that templates file
-->
<xsl:include href="./xhtml/advancedsearch.xsl" />
<xsl:include href="./xhtml/embedded.xsl" />
<xsl:include href="./xhtml/footer.xsl" />

View file

@ -1,14 +1,116 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<xsl:template name="uploadform">
<div class="uploadform">
<form method="post">
<xsl:for-each select="/page/xforms:instance/*/*">
<xsl:choose>
<xsl:when test="@xsi:type='xsd:normalizedString'">
<input type="text">
<xsl:attribute name="value">
<xsl:value-of select="name()"/>
</xsl:attribute>
</input>
</xsl:when>
<xsl:when test="@xsi:type='xsd:string'">
<textarea>
<xsl:value-of select="name()"/>
</textarea>
</xsl:when>
<xsl:when test="@xsi:type='xsd:gDay'">
<select>
<option>
<xsl:value-of select="name()"/>
</option>
<xsl:call-template name="for-loop">
<xsl:with-param name="start">1</xsl:with-param>
<xsl:with-param name="end">31</xsl:with-param>
<xsl:with-param name="element">option</xsl:with-param>
</xsl:call-template>
</select>
</xsl:when>
<xsl:when test="@xsi:type='xsd:gMonth'">
<select>
<option>
<xsl:value-of select="name()"/>
</option>
<xsl:call-template name="for-loop">
<xsl:with-param name="start">1</xsl:with-param>
<xsl:with-param name="end">12</xsl:with-param>
<xsl:with-param name="element">option</xsl:with-param>
</xsl:call-template>
</select>
</xsl:when>
<xsl:when test="@xsi:type='xsd:gYear'">
<select>
<option>
<xsl:value-of select="name()"/>
</option>
<xsl:call-template name="for-loop">
<xsl:with-param name="start">1890</xsl:with-param>
<xsl:with-param name="end">2008</xsl:with-param>
<xsl:with-param name="element">option</xsl:with-param>
</xsl:call-template>
</select>
</xsl:when>
<xsl:when test="@xsi:type='xsd:language'">
<select>
<option>
<xsl:value-of select="name()"/>
</option>
<xsl:variable name="language" select="//@locale" />
<xsl:for-each select="$language_strings">
<option>
<xsl:attribute name="value">
<xsl:value-of select="short" />
</xsl:attribute>
<!--
<xsl:if test="$short=$language">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
-->
<xsl:value-of select="name[@lang='en']" /><!-- language hardcoded to en - this will be solved through simple if/else -->
<xsl:value-of select="name[@lang=$language]" />
<xsl:value-of select="$language" /><!-- debug debug debug -->
</option>
</xsl:for-each>
</select>
</xsl:when>
</xsl:choose>
<br />
</xsl:for-each>
</form>
<!--
information below this line won't match anything anytime soon.
this code will be removed in furute revisions but is kept for reference reasons.
-->
<xsl:choose>
<xsl:when test="//uploadform/@page=1">

View file

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<xsl:template name="xhtml-body">
@ -25,35 +28,32 @@
<xsl:call-template name="loginbox" />
</xsl:if>
<xsl:choose>
<xsl:when test="//frontpage">
<xsl:call-template name="tagcloud" />
<xsl:if test="//message">
<xsl:call-template name="message"/>
</xsl:if>
<xsl:choose>
<xsl:when test="//frontpage">
<xsl:call-template name="tagcloud" />
<xsl:call-template name="splashbox" />
<xsl:call-template name="results"/>
</xsl:when>
<xsl:when test="//page/video">
<!--
<xsl:call-template name="tagbar" />
-->
<xsl:if test="//message">
<xsl:call-template name="message"/>
</xsl:if>
<xsl:call-template name="video"/>
</xsl:when>
<xsl:when test="//page//results">
<xsl:when test="//page/results">
<xsl:call-template name="results"/>
</xsl:when>
<xsl:when test="//page/xforms:instance">
<xsl:call-template name="uploadform"/>
</xsl:when>
</xsl:choose>
<xsl:choose>
@ -63,9 +63,6 @@
<xsl:when test="//loginform">
<xsl:call-template name="loginform"/>
</xsl:when>
<xsl:when test="//uploadform">
<xsl:call-template name="uploadform"/>
</xsl:when>
<xsl:when test="//advancedsearch">
<xsl:call-template name="advancedsearch"/>
</xsl:when>