Skip to content

Commit

Permalink
Updated chart rendering in ldh:RenderRow mode
Browse files Browse the repository at this point in the history
  • Loading branch information
namedgraph committed Nov 15, 2024
1 parent 91c640e commit 7f82be8
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ exclude-result-prefixes="#all"
</xsl:for-each>

<xsl:for-each select="$container//div[contains-token(@class, 'main')]">
<xsl:result-document href="?." method="ixsl:append-content">
<xsl:variable name="header" select="./div/div[@class = 'well']" as="element()"/>

<xsl:result-document href="?." method="ixsl:replace-content">
<xsl:copy-of select="$header"/>

<form method="{$method}" action="{$action}">
<xsl:if test="$accept-charset">
<xsl:attribute name="accept-charset" select="$accept-charset"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,10 @@ exclude-result-prefixes="#all"

<ixsl:set-style name="cursor" select="'progress'" object="ixsl:page()//body"/>

<!-- create new cache entry using content URI as key
<ixsl:set-property name="{'`' || $block-uri || '`'}" select="ldh:new-object()" object="ixsl:get(ixsl:window(), 'LinkedDataHub.contents')"/>
store this content element
<ixsl:set-property name="content" select="$value" object="ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`')"/>-->

<xsl:for-each select="$block//div[contains-token(@class, 'bar')]">
<!-- update progress bar -->
<!-- <xsl:for-each select="$block//div[contains-token(@class, 'bar')]">
update progress bar
<ixsl:set-style name="width" select="'50%'" object="."/>
</xsl:for-each>
</xsl:for-each>-->

<xsl:apply-templates select="$view-html" mode="ldh:RenderRow">
<xsl:with-param name="block" select="$block"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,49 @@ exclude-result-prefixes="#all"

<ixsl:set-style name="display" select="'none'" object="$container/ul"/>
</xsl:template>

<!-- backlinks -->

<xsl:template match="div[contains-token(@class, 'backlinks-nav')]//*[contains-token(@class, 'nav-header')]" mode="ixsl:onclick">
<xsl:variable name="backlinks-container" select="ancestor::div[contains-token(@class, 'backlinks-nav')]" as="element()"/>
<xsl:variable name="block" select="ancestor::div[contains-token(@class, 'block')][1]" as="element()"/>
<xsl:variable name="block-uri" select="$block/@about" as="xs:anyURI"/>
<xsl:variable name="query-string" select="replace($backlinks-string, '$this', '&lt;' || $block-uri || '&gt;', 'q')" as="xs:string"/>
<xsl:variable name="service-uri" select="if (ixsl:contains(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`')) then (if (ixsl:contains(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'service-uri')) then ixsl:get(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'service-uri') else ()) else ()" as="xs:anyURI?"/>
<xsl:variable name="service" select="if ($service-uri) then key('resources', $service-uri, document(ac:build-uri(ac:document-uri($service-uri), map{ 'accept': 'application/rdf+xml' }))) else ()" as="element()?"/> <!-- TO-DO: refactor asynchronously -->
<xsl:variable name="endpoint" select="($service/sd:endpoint/@rdf:resource/xs:anyURI(.), sd:endpoint())[1]" as="xs:anyURI"/>
<xsl:variable name="results-uri" select="ac:build-uri($endpoint, map{ 'query': string($query-string) })" as="xs:anyURI"/>
<xsl:variable name="request-uri" select="ldh:href($ldt:base, ac:absolute-path(ldh:base-uri(.)), map{}, $results-uri)" as="xs:anyURI"/>

<ixsl:set-style name="cursor" select="'progress'" object="ixsl:page()//body"/>

<xsl:choose>
<!-- backlink nav list is not rendered yet - load it -->
<xsl:when test="not(following-sibling::*[contains-token(@class, 'nav')])">
<!-- toggle the caret direction -->
<xsl:for-each select="span[contains-token(@class, 'caret')]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'caret-reversed' ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>

<xsl:variable name="request" as="item()*">
<ixsl:schedule-action http-request="map{ 'method': 'GET', 'href': $request-uri, 'headers': map{ 'Accept': 'application/rdf+xml' } }">
<xsl:call-template name="onBacklinksLoad">
<xsl:with-param name="backlinks-container" select="$backlinks-container"/>
</xsl:call-template>
</ixsl:schedule-action>
</xsl:variable>
<xsl:sequence select="$request[current-date() lt xs:date('2000-01-01')]"/>
</xsl:when>
<!-- show the nav list -->
<xsl:when test="ixsl:style(following-sibling::*[contains-token(@class, 'nav')])?display = 'none'">
<ixsl:set-style name="display" select="'block'" object="following-sibling::*[contains-token(@class, 'nav')]"/>
</xsl:when>
<!-- hide the nav list -->
<xsl:otherwise>
<ixsl:set-style name="display" select="'none'" object="following-sibling::*[contains-token(@class, 'nav')]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<!-- CALLBACKS -->

Expand Down
43 changes: 0 additions & 43 deletions src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/client.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1271,49 +1271,6 @@ WHERE
<ixsl:set-property name="request" select="$request" object="ixsl:get(ixsl:window(), 'LinkedDataHub')"/>
</xsl:template>

<!-- backlinks -->

<xsl:template match="div[contains-token(@class, 'backlinks-nav')]//*[contains-token(@class, 'nav-header')]" mode="ixsl:onclick">
<xsl:variable name="backlinks-container" select="ancestor::div[contains-token(@class, 'backlinks-nav')]" as="element()"/>
<xsl:variable name="block" select="ancestor::div[contains-token(@class, 'block')][1]" as="element()"/>
<xsl:variable name="block-uri" select="$block/@about" as="xs:anyURI"/>
<xsl:variable name="query-string" select="replace($backlinks-string, '$this', '&lt;' || $block-uri || '&gt;', 'q')" as="xs:string"/>
<xsl:variable name="service-uri" select="if (ixsl:contains(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`')) then (if (ixsl:contains(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'service-uri')) then ixsl:get(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'service-uri') else ()) else ()" as="xs:anyURI?"/>
<xsl:variable name="service" select="if ($service-uri) then key('resources', $service-uri, document(ac:build-uri(ac:document-uri($service-uri), map{ 'accept': 'application/rdf+xml' }))) else ()" as="element()?"/> <!-- TO-DO: refactor asynchronously -->
<xsl:variable name="endpoint" select="($service/sd:endpoint/@rdf:resource/xs:anyURI(.), sd:endpoint())[1]" as="xs:anyURI"/>
<xsl:variable name="results-uri" select="ac:build-uri($endpoint, map{ 'query': string($query-string) })" as="xs:anyURI"/>
<xsl:variable name="request-uri" select="ldh:href($ldt:base, ac:absolute-path(ldh:base-uri(.)), map{}, $results-uri)" as="xs:anyURI"/>

<ixsl:set-style name="cursor" select="'progress'" object="ixsl:page()//body"/>

<xsl:choose>
<!-- backlink nav list is not rendered yet - load it -->
<xsl:when test="not(following-sibling::*[contains-token(@class, 'nav')])">
<!-- toggle the caret direction -->
<xsl:for-each select="span[contains-token(@class, 'caret')]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'caret-reversed' ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>

<xsl:variable name="request" as="item()*">
<ixsl:schedule-action http-request="map{ 'method': 'GET', 'href': $request-uri, 'headers': map{ 'Accept': 'application/rdf+xml' } }">
<xsl:call-template name="onBacklinksLoad">
<xsl:with-param name="backlinks-container" select="$backlinks-container"/>
</xsl:call-template>
</ixsl:schedule-action>
</xsl:variable>
<xsl:sequence select="$request[current-date() lt xs:date('2000-01-01')]"/>
</xsl:when>
<!-- show the nav list -->
<xsl:when test="ixsl:style(following-sibling::*[contains-token(@class, 'nav')])?display = 'none'">
<ixsl:set-style name="display" select="'block'" object="following-sibling::*[contains-token(@class, 'nav')]"/>
</xsl:when>
<!-- hide the nav list -->
<xsl:otherwise>
<ixsl:set-style name="display" select="'none'" object="following-sibling::*[contains-token(@class, 'nav')]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<!-- file drop -->

<xsl:template match="div[ixsl:query-params()?mode = '&ac;ReadMode'][acl:mode() = '&acl;Write']" mode="ixsl:ondragover">
Expand Down

0 comments on commit 7f82be8

Please sign in to comment.