Skip to content

Commit

Permalink
bs2:RowForm fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
namedgraph committed Dec 19, 2023
1 parent 68b26ca commit 4e53229
Showing 1 changed file with 48 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1042,14 +1042,14 @@ extension-element-prefixes="ixsl"
<xsl:template match="*[@rdf:nodeID][$ac:forClass or $ldh:forShape][$ac:method = 'GET'][key('predicates-by-object', @rdf:nodeID)][not(* except rdf:type or rdf:type/@rdf:resource = '&owl;NamedIndividual')]" mode="bs2:RowForm" priority="2" use-when="system-property('xsl:product-name') = 'SAXON'"/>

<xsl:template match="*[*][@rdf:about] | *[*][@rdf:nodeID]" mode="bs2:RowForm"> <!-- use-when="system-property('xsl:product-name') = 'SAXON'" -->
<xsl:param name="id" select="generate-id()" as="xs:string?"/>
<xsl:param name="class" select="'main span7 offset2'" as="xs:string?"/>
<!-- <xsl:param name="id" select="generate-id()" as="xs:string?"/>-->
<!--<xsl:param name="class" select="'main span7 offset2 '" as="xs:string?"/>-->
<!-- <xsl:param name="typeof" select="rdf:type/@rdf:resource/xs:anyURI(.)" as="xs:anyURI*"/>-->
<xsl:param name="method" select="'post'" as="xs:string"/>
<xsl:param name="base-uri" select="base-uri()" as="xs:anyURI" tunnel="yes"/>
<xsl:param name="action" select="ldh:href($ldt:base, ac:absolute-path($base-uri), map{}, ac:build-uri(ac:absolute-path($base-uri), map{ '_method': 'PUT', 'mode': for $mode in $ac:mode return string($mode) }))" as="xs:anyURI"/>
<xsl:param name="id" select="concat('form-', generate-id())" as="xs:string?"/>
<xsl:param name="class" select="'form-horizontal'" as="xs:string?"/>
<xsl:param name="class" select="'main span7 offset2 form-horizontal'" as="xs:string?"/>
<xsl:param name="accept-charset" select="'UTF-8'" as="xs:string?"/>
<xsl:param name="enctype" select="'multipart/form-data'" as="xs:string?"/>
<xsl:param name="button-class" select="'btn btn-primary wymupdate'" as="xs:string?"/>
Expand All @@ -1065,74 +1065,62 @@ extension-element-prefixes="ixsl"
<xsl:variable name="type-metadata" select="if (exists($types)) then ldh:send-request(resolve-uri('ns', $ldt:base), 'POST', 'application/sparql-query', 'DESCRIBE $Type' || ' VALUES $Type { ' || string-join(for $type in $types return '&lt;' || $type || '&gt;', ' ') || ' }', map{ 'Accept': 'application/rdf+xml' }) else ()" as="document-node()?"/>
<xsl:variable name="property-uris" select="distinct-values(*/concat(namespace-uri(), local-name()))" as="xs:string*"/>
<xsl:variable name="property-metadata" select="if (exists($property-uris)) then ldh:send-request(resolve-uri('ns', $ldt:base), 'POST', 'application/sparql-query', 'DESCRIBE $Type' || ' VALUES $Type { ' || string-join(for $uri in $property-uris return '&lt;' || $uri || '&gt;', ' ') || ' }', map{ 'Accept': 'application/rdf+xml' }) else ()" as="document-node()?"/>
<div>

<form method="{$method}" action="{$action}">
<xsl:if test="$id">
<xsl:attribute name="id" select="$id"/>
</xsl:if>
<xsl:if test="$class">
<xsl:attribute name="class" select="$class"/>
</xsl:if>
<!-- <xsl:if test="$typeof">
<xsl:attribute name="typeof" select="$typeof"/>
</xsl:if>-->
<xsl:if test="$accept-charset">
<xsl:attribute name="accept-charset" select="$accept-charset"/>
</xsl:if>
<xsl:if test="$enctype">
<xsl:attribute name="enctype" select="$enctype"/>
</xsl:if>

<form method="{$method}" action="{$action}">
<xsl:if test="$id">
<xsl:attribute name="id" select="$id"/>
</xsl:if>
<xsl:if test="$class">
<xsl:attribute name="class" select="$class"/>
</xsl:if>
<xsl:if test="$accept-charset">
<xsl:attribute name="accept-charset" select="$accept-charset"/>
</xsl:if>
<xsl:if test="$enctype">
<xsl:attribute name="enctype" select="$enctype"/>
</xsl:if>
<xsl:comment>This form uses RDF/POST encoding: https://atomgraph.github.io/RDF-POST/</xsl:comment>
<xsl:call-template name="xhtml:Input">
<xsl:with-param name="name" select="'rdf'"/>
<xsl:with-param name="type" select="'hidden'"/>
</xsl:call-template>

<xsl:comment>This form uses RDF/POST encoding: https://atomgraph.github.io/RDF-POST/</xsl:comment>
<xsl:call-template name="xhtml:Input">
<xsl:with-param name="name" select="'rdf'"/>
<xsl:with-param name="type" select="'hidden'"/>
</xsl:call-template>

<xsl:apply-templates mode="bs2:Exception"/>

<!-- show the current document on the top -->
<xsl:apply-templates select="*[@rdf:about = ac:absolute-path(base-uri())]" mode="bs2:FormControl">
<xsl:with-param name="inline" select="false()" tunnel="yes"/>
<xsl:with-param name="constructors" select="$constructors" tunnel="yes"/>
<xsl:with-param name="constraints" select="$constraints" tunnel="yes"/>
<xsl:with-param name="type-metadata" select="$type-metadata" tunnel="yes"/>
<xsl:with-param name="property-metadata" select="$property-metadata" tunnel="yes"/>
</xsl:apply-templates>
<!-- show the rest of the resources (contents, instances) below it -->
<xsl:apply-templates select="*[not(@rdf:about = ac:absolute-path(base-uri()))]" mode="bs2:FormControl">
<xsl:sort select="ac:label(.)"/>
<xsl:with-param name="inline" select="false()" tunnel="yes"/>
<xsl:with-param name="constructors" select="$constructors" tunnel="yes"/>
<xsl:with-param name="constraints" select="$constraints" tunnel="yes"/>
<xsl:with-param name="shapes" select="$shapes" tunnel="yes"/>
<xsl:with-param name="type-metadata" select="$type-metadata" tunnel="yes"/>
<xsl:with-param name="property-metadata" select="$property-metadata" tunnel="yes"/>
</xsl:apply-templates>
<xsl:apply-templates mode="bs2:Exception"/>

<xsl:if test="$create-resource">
<div class="create-resource row-fluid">
<div class="main offset2 span7">
<xsl:apply-templates select="." mode="bs2:Create">
<xsl:with-param name="classes" select="$classes"/>
</xsl:apply-templates>
</div>
<!-- show the current document on the top -->
<xsl:apply-templates select="*[@rdf:about = ac:absolute-path(base-uri())]" mode="bs2:FormControl">
<xsl:with-param name="inline" select="false()" tunnel="yes"/>
<xsl:with-param name="constructors" select="$constructors" tunnel="yes"/>
<xsl:with-param name="constraints" select="$constraints" tunnel="yes"/>
<xsl:with-param name="type-metadata" select="$type-metadata" tunnel="yes"/>
<xsl:with-param name="property-metadata" select="$property-metadata" tunnel="yes"/>
</xsl:apply-templates>
<!-- show the rest of the resources (contents, instances) below it -->
<xsl:apply-templates select="*[not(@rdf:about = ac:absolute-path(base-uri()))]" mode="bs2:FormControl">
<xsl:sort select="ac:label(.)"/>
<xsl:with-param name="inline" select="false()" tunnel="yes"/>
<xsl:with-param name="constructors" select="$constructors" tunnel="yes"/>
<xsl:with-param name="constraints" select="$constraints" tunnel="yes"/>
<xsl:with-param name="shapes" select="$shapes" tunnel="yes"/>
<xsl:with-param name="type-metadata" select="$type-metadata" tunnel="yes"/>
<xsl:with-param name="property-metadata" select="$property-metadata" tunnel="yes"/>
</xsl:apply-templates>

<xsl:if test="$create-resource">
<div class="create-resource row-fluid">
<div class="main offset2 span7">
<xsl:apply-templates select="." mode="bs2:Create">
<xsl:with-param name="classes" select="$classes"/>
</xsl:apply-templates>
</div>
</xsl:if>
</div>
</xsl:if>

<xsl:apply-templates select="." mode="bs2:FormActions">
<xsl:with-param name="button-class" select="$button-class"/>
</xsl:apply-templates>
</form>
</div>
<xsl:apply-templates select="." mode="bs2:FormActions">
<xsl:with-param name="button-class" select="$button-class"/>
</xsl:apply-templates>
</form>
</xsl:template>

<!-- FORM -->
Expand Down

0 comments on commit 4e53229

Please sign in to comment.