Skip to content

Commit

Permalink
Fix #3513 "Wizard: cannot activate TOC subsection links"
Browse files Browse the repository at this point in the history
  • Loading branch information
ebruchez committed Mar 14, 2018
1 parent b56d190 commit cce174c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
25 changes: 18 additions & 7 deletions form-runner/jvm/src/main/resources/xbl/orbeon/wizard/wizard.xbl
Expand Up @@ -136,8 +136,8 @@
<xf:bind ref="show-toc" type="xs:boolean" xxf:default="true()"/>
<xf:bind ref="show-body" type="xs:boolean" xxf:default="not(Wizard:isWizardSeparateToc())"/>

<xf:instance id="available-sections" xxf:expose-xpath-types="true">
<available-sections/>
<xf:instance id="available-top-level-sections" xxf:expose-xpath-types="true">
<available-top-level-sections/>
</xf:instance>

</xf:model>
Expand Down Expand Up @@ -517,7 +517,7 @@
exists($next-top-level-case-id) and
exists(
index-of(
xxf:split(xxf:instance('available-sections')),
xxf:split(xxf:instance('available-top-level-sections')),
frf:controlNameFromIdOpt(replace($next-top-level-case-id, '-case$', ''))
)
)"/>
Expand Down Expand Up @@ -553,13 +553,13 @@

<xf:var
name="maps"
value="Wizard:gatherSectionStatusJava($relevant-top-level-section-ids)"/>
value="Wizard:gatherTopLevelSectionStatusJava($relevant-top-level-section-ids)"/>

<!-- Update available sections instance -->
<!-- We do this because we don't want to run `Wizard:gatherSectionStatusJava` at each refresh, and we want to
depend on instance values, although in practice it might not make much of a difference. -->
<xf:setvalue
ref="xxf:instance('available-sections')"
ref="xxf:instance('available-top-level-sections')"
value="
string-join(
for $m in $maps
Expand Down Expand Up @@ -647,7 +647,12 @@
for $id in $relevant-top-level-section-ids[position() gt 1]
return
if (
exists(index-of(xxf:split(xxf:instance('available-sections')), frf:controlNameFromIdOpt($id))) and
exists(
index-of(
xxf:split(xxf:instance('available-top-level-sections')),
frf:controlNameFromIdOpt($id)
)
) and
exists(xxf:binding($id)/@fr:section-status)
) then
$id
Expand Down Expand Up @@ -821,7 +826,13 @@

<xf:var name="top-level-section-available">
<xxf:value
value="exists(index-of(xxf:split(xxf:instance('available-sections')), '{frf:controlNameFromIdOpt($static-section-id)}'))"
value="
exists(
index-of(
xxf:split(xxf:instance('available-top-level-sections')),
'{frf:controlNameFromIdOpt($static-top-level-section-id)}'
)
)"
xxbl:scope="inner"/>
</xf:var>

Expand Down
6 changes: 3 additions & 3 deletions form-runner/jvm/src/main/scala/org/orbeon/xbl/Wizard.scala
Expand Up @@ -79,8 +79,8 @@ object Wizard {
findWizardVariableValue("fr-wizard-is-first-nav") exists booleanValue

//@XPathFunction
def gatherSectionStatusJava(relevantTopLevelSectionIds: Array[String]): SequenceIterator =
gatherSectionStatus(relevantTopLevelSectionIds.to[List]) map { sectionStatus
def gatherTopLevelSectionStatusJava(relevantTopLevelSectionIds: Array[String]): SequenceIterator =
gatherTopLevelSectionStatus(relevantTopLevelSectionIds.to[List]) map { sectionStatus
MapFunctions.createValue(
Map[AtomicValue, ValueRepresentation](
(SaxonUtils.fixStringValue("name") , sectionStatus.name),
Expand Down Expand Up @@ -136,7 +136,7 @@ object Wizard {
case _ false
}

def gatherSectionStatus(relevantTopLevelSectionIds: List[String]): List[SectionStatus] = {
def gatherTopLevelSectionStatus(relevantTopLevelSectionIds: List[String]): List[SectionStatus] = {

val topLevelSectionNamesWithErrorsMap =
ErrorSummary.topLevelSectionsWithErrors(
Expand Down

0 comments on commit cce174c

Please sign in to comment.