Skip to content

Commit ddd84f4

Browse files
committed
bs2:FormControl fix for datetime-local
1 parent ec448e0 commit ddd84f4

1 file changed

Lines changed: 51 additions & 18 deletions

File tree

  • src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/imports

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/imports/default.xsl

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,32 +1137,65 @@ exclude-result-prefixes="#all"
11371137

11381138
<!-- datetimes -->
11391139

1140-
<xsl:template match="text()[../@rdf:datatype = '&xsd;dateTime'][. castable as xs:dateTime][../@rdf:datatype = '&xsd;dateTime']" mode="xhtml:Input" priority="1" >
1140+
<xsl:template match="text()[../@rdf:datatype = '&xsd;dateTime'][. castable as xs:dateTime][../@rdf:datatype = '&xsd;dateTime']" mode="bs2:FormControl" priority="1">
11411141
<xsl:param name="type" select="'datetime-local'" as="xs:string"/>
1142-
<xsl:param name="id" as="xs:string?"/>
1142+
<xsl:param name="id" select="generate-id()" as="xs:string"/>
11431143
<xsl:param name="class" as="xs:string?"/>
11441144
<xsl:param name="disabled" select="false()" as="xs:boolean"/>
1145+
<xsl:param name="type-label" select="true()" as="xs:boolean"/>
11451146

1146-
<xsl:call-template name="xhtml:Input">
1147-
<xsl:with-param name="name" select="'ol'"/>
1148-
<xsl:with-param name="type" select="'datetime-local'"/> <!-- TO-DO: what is passing $type? Cannot use it because the value is 'text' -->
1147+
<xsl:apply-templates select="." mode="xhtml:Input">
1148+
<xsl:with-param name="type" select="$type"/>
11491149
<xsl:with-param name="id" select="$id"/>
11501150
<xsl:with-param name="class" select="$class"/>
11511151
<xsl:with-param name="disabled" select="$disabled"/>
1152-
<xsl:with-param name="value" select="format-dateTime(xs:dateTime(.), '[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]')"/>
1153-
</xsl:call-template>
1154-
1155-
<xsl:call-template name="xhtml:Input">
1156-
<xsl:with-param name="type" select="'hidden'"/>
1157-
<xsl:with-param name="name" select="'lt'"/>
1158-
<xsl:with-param name="value" select="../@rdf:datatype"/>
1159-
</xsl:call-template>
1152+
</xsl:apply-templates>
11601153

1161-
<xsl:call-template name="xhtml:Input">
1162-
<xsl:with-param name="class" select="'input-mini input-timezone'"/>
1163-
<xsl:with-param name="type" select="'text'"/>
1164-
<xsl:with-param name="value" select="format-dateTime(xs:dateTime(.), '[Z]')"/>
1165-
</xsl:call-template>
1154+
<xsl:if test="$type-label">
1155+
<xsl:apply-templates select="." mode="bs2:FormControlTypeLabel">
1156+
<xsl:with-param name="type" select="$type"/>
1157+
</xsl:apply-templates>
1158+
</xsl:if>
1159+
</xsl:template>
1160+
1161+
<xsl:template match="text()[../@rdf:datatype = '&xsd;dateTime'][. castable as xs:dateTime][../@rdf:datatype = '&xsd;dateTime']" mode="xhtml:Input" priority="1">
1162+
<xsl:param name="type" select="'datetime-local'" as="xs:string"/>
1163+
<xsl:param name="id" as="xs:string?"/>
1164+
<xsl:param name="class" as="xs:string?"/>
1165+
<xsl:param name="disabled" select="false()" as="xs:boolean"/>
1166+
1167+
<xsl:choose>
1168+
<xsl:when test="$type = 'datetime-local'"> <!-- could also be 'hidden' -->
1169+
<xsl:call-template name="xhtml:Input">
1170+
<xsl:with-param name="name" select="'ol'"/>
1171+
<xsl:with-param name="type" select="$type"/>
1172+
<xsl:with-param name="id" select="$id"/>
1173+
<xsl:with-param name="class" select="$class"/>
1174+
<xsl:with-param name="disabled" select="$disabled"/>
1175+
<xsl:with-param name="value" select="format-dateTime(xs:dateTime(.), '[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]')"/>
1176+
</xsl:call-template>
1177+
1178+
<xsl:call-template name="xhtml:Input">
1179+
<xsl:with-param name="type" select="'hidden'"/>
1180+
<xsl:with-param name="name" select="'lt'"/>
1181+
<xsl:with-param name="value" select="../@rdf:datatype"/>
1182+
</xsl:call-template>
1183+
1184+
<xsl:call-template name="xhtml:Input">
1185+
<xsl:with-param name="class" select="'input-mini input-timezone'"/>
1186+
<xsl:with-param name="type" select="'text'"/>
1187+
<xsl:with-param name="value" select="format-dateTime(xs:dateTime(.), '[Z]')"/>
1188+
</xsl:call-template>
1189+
</xsl:when>
1190+
<xsl:otherwise>
1191+
<xsl:next-match>
1192+
<xsl:with-param name="type" select="$type"/>
1193+
<xsl:with-param name="id" select="$id"/>
1194+
<xsl:with-param name="class" select="$class"/>
1195+
<xsl:with-param name="disabled" select="$disabled"/>
1196+
</xsl:next-match>
1197+
</xsl:otherwise>
1198+
</xsl:choose>
11661199
</xsl:template>
11671200

11681201
<!-- XHTML CONTENT IDENTITY TRANSFORM -->

0 commit comments

Comments
 (0)