Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate isDisabled parameter through boxed elements #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
target
doc/en/iso19115-3.2018.rst
doc/fr/iso19115-3.2018.rst
.classpath
.project
.settings
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@
<xsl:template mode="mode-iso19115-3.2018" match="*[cit:CI_Telephone]" priority="2000">
<xsl:param name="schema" select="$schema" required="no"/>
<xsl:param name="labels" select="$labels" required="no"/>
<xsl:param name="isDisabled" required="no" />

<xsl:apply-templates mode="mode-iso19115-3.2018" select="*/cit:*">
<xsl:with-param name="schema" select="$schema"/>
<xsl:with-param name="labels" select="$labels"/>
<xsl:with-param name="isDisabled" select="$isDisabled" />
</xsl:apply-templates>
</xsl:template>

Expand All @@ -51,6 +53,9 @@
match="cit:number[parent::node()/name() = 'cit:CI_Telephone']">
<xsl:param name="schema" select="$schema" required="no"/>
<xsl:param name="labels" select="$labels" required="no"/>
<xsl:param name="isDisabled" required="no"/>



<xsl:variable name="labelConfig"
select="gn-fn-metadata:getLabel($schema, name(), $labels)"/>
Expand All @@ -73,7 +78,7 @@
<xsl:call-template name="render-codelist-as-select">
<xsl:with-param name="listOfValues" select="$codelist"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="isDisabled" select="ancestor-or-self::node()[@xlink:href]"/>
<xsl:with-param name="isDisabled" select="$isDisabled or ancestor-or-self::node()[@xlink:href]"/>
<xsl:with-param name="elementRef" select="../cit:numberType/cit:CI_TelephoneTypeCode/gn:element/@ref"/>
<xsl:with-param name="isRequired" select="true()"/>
<xsl:with-param name="hidden" select="false()"/>
Expand All @@ -93,7 +98,7 @@
type="tel"
name="{concat('_', gco:CharacterString/gn:element/@ref)}"
value="{normalize-space(gco:CharacterString)}">
<xsl:if test="ancestor-or-self::node()[@xlink:href]">
<xsl:if test="$isDisabled or ancestor-or-self::node()[@xlink:href]">
<xsl:attribute name="disabled" select="'disabled'"/>
</xsl:if>
</input>
Expand All @@ -112,10 +117,12 @@
</div>
</div>
<div class="col-sm-1 gn-control">
<xsl:call-template name="render-form-field-control-remove">
<xsl:with-param name="editInfo" select="../gn:element"/>
<xsl:with-param name="parentEditInfo" select="../../gn:element"/>
</xsl:call-template>
<xsl:if test="not($isDisabled)">
<xsl:call-template name="render-form-field-control-remove">
<xsl:with-param name="editInfo" select="../gn:element"/>
<xsl:with-param name="parentEditInfo" select="../../gn:element"/>
</xsl:call-template>
</xsl:if>
</div>
</div>
</xsl:template>
Expand Down
9 changes: 8 additions & 1 deletion src/main/plugin/iso19115-3.2018/layout/layout.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@
<xsl:param name="schema" select="$schema" required="no"/>
<xsl:param name="labels" select="$labels" required="no"/>
<xsl:param name="refToDelete" required="no"/>
<xsl:param name="isDisabled" required="no"/>

<xsl:apply-templates mode="mode-iso19115-3.2018" select="*|@*">
<xsl:with-param name="schema" select="$schema"/>
<xsl:with-param name="labels" select="$labels"/>
<xsl:with-param name="refToDelete" select="$refToDelete"/>
<xsl:with-param name="isDisabled" select="$isDisabled"/>
</xsl:apply-templates>
</xsl:template>

Expand Down Expand Up @@ -145,6 +147,7 @@
not(gco:CharacterString)]">
<xsl:param name="schema" select="$schema" required="no"/>
<xsl:param name="labels" select="$labels" required="no"/>
<xsl:param name="isDisabled" required="no"/>

<xsl:variable name="xpath" select="gn-fn-metadata:getXPath(.)"/>
<xsl:variable name="isoType" select="if (../@gco:isoType) then ../@gco:isoType else ''"/>
Expand Down Expand Up @@ -174,14 +177,16 @@
<xsl:with-param name="errors" select="$errors"/>
<xsl:with-param name="cls" select="local-name()"/>
<xsl:with-param name="xpath" select="$xpath"/>
<xsl:with-param name="isDisabled" select="$isDisabled"/>
<xsl:with-param name="attributesSnippet" select="$attributes"/>
<xsl:with-param name="subTreeSnippet">
<!-- Process child of those element. Propagate schema
and labels to all subchilds (eg. needed like iso19110 elements
and labels to all subchildren (eg. needed like iso19110 elements
contains gmd:* child. -->
<xsl:apply-templates mode="mode-iso19115-3.2018" select="*">
<xsl:with-param name="schema" select="$schema"/>
<xsl:with-param name="labels" select="$labels"/>
<xsl:with-param name="isDisabled" select="$isDisabled"/>
</xsl:apply-templates>
</xsl:with-param>
</xsl:call-template>
Expand Down Expand Up @@ -484,6 +489,7 @@
<xsl:param name="labels" select="$labels" required="no"/>
<xsl:param name="codelists" select="$codelists" required="no"/>
<xsl:param name="overrideLabel" select="''" required="no"/>
<xsl:param name="isDisabled" required="no"/>

<xsl:variable name="elementName" select="name()"/>
<xsl:variable name="xpath" select="gn-fn-metadata:getXPath(.)"/>
Expand Down Expand Up @@ -516,6 +522,7 @@
<xsl:with-param name="listOfValues"
select="gn-fn-metadata:getCodeListValues($schema, name(*[@codeListValue]), $codelists, .)"/>
<xsl:with-param name="isFirst" select="count(preceding-sibling::*[name() = $elementName]) = 0"/>
<xsl:with-param name="isDisabled" select="$isDisabled or count(ancestor-or-self::node()[@xlink:href]) > 0"/>
</xsl:call-template>
</xsl:template>

Expand Down