Skip to content

Commit

Permalink
Hiding instances of system classes in bs2:Row and bs2:RowForm modes
Browse files Browse the repository at this point in the history
  • Loading branch information
namedgraph committed Dec 8, 2023
1 parent ab27ff9 commit 6354829
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ extension-element-prefixes="ixsl"
<button type="button" class="btn btn-primary create-action add-resource-content">
<xsl:apply-templates select="key('resources', 'resource', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
</button>
<button type="button" class="btn btn-primary create-action add-query-content">
<!-- <button type="button" class="btn btn-primary create-action add-query-content">
<xsl:apply-templates select="key('resources', '&sp;Query', document(ac:document-uri('&sp;')))" mode="ac:label"/>
</button>
<button type="button" class="btn btn-primary create-action add-chart-content">
<xsl:apply-templates select="key('resources', '&ldh;Chart', document(ac:document-uri('&ldh;')))" mode="ac:label"/>
</button>
<button type="button" class="btn btn-primary create-action add-view-content">
<xsl:apply-templates select="key('resources', '&ldh;View', document(ac:document-uri('&ldh;')))" mode="ac:label"/>
</button>
</button>-->
</p>
</div>
</div>
Expand All @@ -211,7 +211,7 @@ extension-element-prefixes="ixsl"
<xsl:template match="rdf:RDF" mode="bs2:Row">
<!-- select elements explicitly, because Saxon-JS chokes on text nodes here -->
<!-- hide the current document resource and the content resources -->
<xsl:apply-templates select="*[not(@rdf:about = ac:absolute-path(base-uri()) and rdf:type/@rdf:resource = ('&def;Root', '&dh;Container', '&dh;Item')) and not(rdf:type/@rdf:resource = '&ldh;Content')]" mode="#current">
<xsl:apply-templates select="*" mode="#current">
<xsl:sort select="ac:label(.)"/>
</xsl:apply-templates>
</xsl:template>
Expand Down Expand Up @@ -866,7 +866,7 @@ extension-element-prefixes="ixsl"

<!-- MODAL FORM ACTIONS -->

<xsl:template match="rdf:RDF" mode="bs2:ModalFormActions">
<!-- <xsl:template match="rdf:RDF" mode="bs2:ModalFormActions">
<xsl:param name="class" select="'form-actions modal-footer'" as="xs:string?"/>
<xsl:param name="button-class" select="'btn btn-primary'" as="xs:string?"/>
Expand Down Expand Up @@ -899,7 +899,7 @@ extension-element-prefixes="ixsl"
<xsl:apply-templates select="key('resources', 'reset', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
</button>
</div>
</xsl:template>
</xsl:template>-->

<!-- FORM ACTIONS -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ exclude-result-prefixes="#all">
<xsl:param name="ldh:createGraph" select="false()" as="xs:boolean"/>
<xsl:param name="ldh:ajaxRendering" select="true()" as="xs:boolean"/>
<xsl:param name="ldhc:enableWebIDSignUp" as="xs:boolean"/>
<xsl:param name="ldh:renderSystemResources" select="false()" as="xs:boolean"/>
<xsl:param name="google:clientID" as="xs:string?"/>
<xsl:param name="default-classes" as="map(xs:string, xs:anyURI)">
<xsl:map>
Expand Down Expand Up @@ -817,17 +818,17 @@ LIMIT 100
</xsl:apply-templates>
</xsl:variable>

<xsl:choose>
<!-- <xsl:choose>
<xsl:when test="$ac:mode = '&ac;ModalMode'">
<xsl:apply-templates select="$constructor" mode="bs2:ModalForm">
<xsl:with-param name="constructor-query" select="$constructor-query" tunnel="yes"/>
<xsl:with-param name="constraint-query" select="$constraint-query" tunnel="yes"/>
<xsl:with-param name="shape-query" select="$shape-query" tunnel="yes"/>
<xsl:with-param name="base-uri" select="ac:absolute-path(base-uri())" tunnel="yes"/> <!-- ac:absolute-path(base-uri()) is empty on constructed documents -->
<xsl:with-param name="base-uri" select="ac:absolute-path(base-uri())" tunnel="yes"/> ac:absolute-path(base-uri()) is empty on constructed documents
<xsl:sort select="ac:label(.)"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:otherwise>-->
<xsl:apply-templates select="$constructor" mode="bs2:RowForm">
<xsl:with-param name="classes" select="$classes"/>
<xsl:with-param name="constructor-query" select="$constructor-query" tunnel="yes"/>
Expand All @@ -836,26 +837,26 @@ LIMIT 100
<xsl:with-param name="base-uri" select="ac:absolute-path(base-uri())" tunnel="yes"/> <!-- ac:absolute-path(base-uri()) is empty on constructed documents -->
<xsl:sort select="ac:label(.)"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
<!-- </xsl:otherwise>
</xsl:choose>-->
</xsl:when>
<xsl:when test="$ldh:forShape and $ac:method = 'GET'">
<xsl:variable name="shapes" select="ldh:query-result(map{ '$Shape': $ldh:forShape }, resolve-uri('ns', $ldt:base), $shape-query)" as="document-node()"/>
<xsl:variable name="constructor" as="document-node()">
<xsl:apply-templates select="$shapes" mode="ldh:Shape"/>
</xsl:variable>

<xsl:choose>
<!-- <xsl:choose>
<xsl:when test="$ac:mode = '&ac;ModalMode'">
<xsl:apply-templates select="ldh:reserialize($constructor)" mode="bs2:ModalForm">
<xsl:with-param name="constructor-query" select="$constructor-query" tunnel="yes"/>
<xsl:with-param name="constraint-query" select="$constraint-query" tunnel="yes"/>
<xsl:with-param name="shape-query" select="$shape-query" tunnel="yes"/>
<xsl:with-param name="base-uri" select="ac:absolute-path(base-uri())" tunnel="yes"/> <!-- ac:absolute-path(base-uri()) is empty on constructed documents -->
<xsl:with-param name="base-uri" select="ac:absolute-path(base-uri())" tunnel="yes"/> ac:absolute-path(base-uri()) is empty on constructed documents
<xsl:sort select="ac:label(.)"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:otherwise>-->
<xsl:apply-templates select="ldh:reserialize($constructor)" mode="bs2:RowForm">
<xsl:with-param name="classes" select="$classes"/>
<xsl:with-param name="constructor-query" select="$constructor-query" tunnel="yes"/>
Expand All @@ -864,8 +865,8 @@ LIMIT 100
<xsl:with-param name="base-uri" select="ac:absolute-path(base-uri())" tunnel="yes"/> <!-- ac:absolute-path(base-uri()) is empty on constructed documents -->
<xsl:sort select="ac:label(.)"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
<!-- </xsl:otherwise>
</xsl:choose>-->
</xsl:when>
<!-- check if the current document has content or its class has content -->
<xsl:when test="(empty($ac:mode) and $has-content) or $ac:mode = '&ldh;ContentMode'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,9 @@ extension-element-prefixes="ixsl"
</xsl:if>
</xsl:template>

<!-- hide instances of system classes -->
<xsl:template match="*[not($ldh:renderSystemResources)][[not(@rdf:about = ac:absolute-path(base-uri()) and rdf:type/@rdf:resource = ('&def;Root', '&dh;Container', '&dh;Item')) and not(rdf:type/@rdf:resource = '&ldh;Content')]]" mode="bs2:Row" priority="1" use-when="system-property('xsl:product-name') = 'SAXON'"/>

<xsl:template match="*[*][@rdf:about] | *[*][@rdf:nodeID]" mode="bs2:Row">
<xsl:param name="id" select="generate-id()" as="xs:string?"/>
<xsl:param name="class" select="'row-fluid'" as="xs:string?"/>
Expand Down Expand Up @@ -1039,6 +1042,9 @@ extension-element-prefixes="ixsl"
<!-- hide constraint violations and HTTP responses in the form - they are displayed as errors on the edited resources -->
<xsl:template match="*[rdf:type/@rdf:resource = ('&spin;ConstraintViolation', '&sh;ValidationResult', '&sh;ValidationReport', '&http;Response')]" mode="bs2:RowForm" priority="3" use-when="system-property('xsl:product-name') = 'SAXON'"/>

<!-- hide instances of system classes -->
<xsl:template match="*[not($ldh:renderSystemResources)][[not(@rdf:about = ac:absolute-path(base-uri()) and rdf:type/@rdf:resource = ('&def;Root', '&dh;Container', '&dh;Item')) and not(rdf:type/@rdf:resource = '&ldh;Content')]]" mode="bs2:Row" priority="2.5" use-when="system-property('xsl:product-name') = 'SAXON'"/>

<!-- hide object blank nodes that only have a single rdf:type property from constructed models, unless the type is owl:NamedIndividual -->
<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'"/>

Expand Down

0 comments on commit 6354829

Please sign in to comment.