Skip to content

Commit aa205eb

Browse files
committed
[bugfix] Make sure the tei:change element is added to the TEI document in the correct place
1 parent 44a266a commit aa205eb

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

src/main/formGenerator/generateXForm.xsl

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:sc="http://www.ascc.net/xml/schematron" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:srophe="https://srophe.app" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:local="http://syriaca.org/ns" version="3.0">
33
<!--
4-
Generate XForms from a schema. Designed for TEI XML creation and editing. Run as an eXist-db application.
5-
Resulting TEI can be saved to eXist-db, downloaded to local filesystem, or saved to a GitHub repository
4+
Generate XForms from a schema. Designed for TEI XML creation and editing. Run as an Elemental application.
5+
Resulting TEI can be saved to Elemental, downloaded to local filesystem, or saved to a GitHub repository
66
77
Expectations:
88
@@ -12,7 +12,7 @@
1212
- Local schema constrainst, such as an ODD file
1313
- Main schema as an ODD file
1414
- XSLTForms
15-
- eXist-db
15+
- Elemental
1616
1717
Version: 1.72 Beta
1818
-1.23 marks a major redesign
@@ -652,9 +652,6 @@
652652
<xf:setvalue ref="instance('i-rec')//*:titleStmt/*:editor[last()]" value="instance('i-user')//*:fullName"/>
653653
<xf:setvalue ref="instance('i-rec')//*:titleStmt/*:editor[last()]/@xml:id" value="instance('i-user')//*:user"/>
654654
-->
655-
<xf:insert ref="instance('i-rec')//*:revisionDesc/child::*" at="1" origin="instance('i-admin')//*:change[1]" position="before"/>
656-
<xf:setvalue ref="instance('i-rec')//*:revisionDesc/*:change[1]/@who" value="concat('#',instance('i-user')//*:user)"/>
657-
<xf:setvalue ref="instance('i-rec')//*:revisionDesc/*:change[1]/@when" value="getXMLDate()"/>
658655
<xf:setvalue ref="instance('i-new')//*:new" value="'true'"/>
659656
</xf:action>
660657
<xf:message level="modeless" ev:event="xforms-submit-error"> Submit error. </xf:message>
@@ -669,9 +666,6 @@
669666
<xf:setvalue ref="instance('i-rec')//*:titleStmt/*:editor[last()]" value="instance('i-user')//*:fullName"/>
670667
<xf:setvalue ref="instance('i-rec')//*:titleStmt/*:editor[last()]/@xml:id" value="instance('i-user')//*:user"/>
671668
-->
672-
<xf:insert ref="instance('i-rec')//*:revisionDesc/child::*" at="1" origin="instance('i-admin')//*:change[1]" position="before"/>
673-
<xf:setvalue ref="instance('i-rec')//*:revisionDesc/*:change[1]/@who" value="concat('#',instance('i-user')//*:user)"/>
674-
<xf:setvalue ref="instance('i-rec')//*:revisionDesc/*:change[1]/@when" value="getXMLDate()"/>
675669
<xf:setvalue ref="instance('i-new')//*:new" value="'false'"/>
676670
</xf:action>
677671
<xf:message level="modeless" ev:event="xforms-submit-error"> Submit error. </xf:message>
@@ -719,6 +713,10 @@
719713

720714
<!-- Save record to github -->
721715
<xf:submission id="s-github" ref="instance('i-rec')" replace="instance" instance="i-submission" method="post">
716+
<xf:action ev:event="xforms-submit">
717+
<!-- Set the change details in the record before saving -->
718+
<xf:insert context="instance('i-rec')//tei:teiHeader/tei:revisionDesc" nodeset="tei:change" at="1" position="before" origin="instance('i-admin')/tei:change"/>
719+
</xf:action>
722720
<xf:resource value="concat('services/submit.xql?type=github','&amp;new=',string(instance('i-new')//*:new),'&amp;eXistCollection=',string(instance('i-submission-params')//*:saveOptions/*:option[@name='exist-db']/*:parameter[@name='eXistCollection']),'&amp;githubRepoName=',string(instance('i-submission-params')//*:parameter[@name='githubRepoName']),'&amp;githubPath=',string(instance('i-submission-params')//*:parameter[@name='githubPath']),'&amp;githubOwner=',string(instance('i-submission-params')//*:parameter[@name='githubOwner']),'&amp;githubBranch=',string(instance('i-submission-params')//*:parameter[@name='githubBranch']))"/>
723721
<xf:action ev:event="xforms-submit-done">
724722
<xf:message ref="instance('i-submission')//*:message"/>
@@ -1104,7 +1102,7 @@
11041102
</div>
11051103
<div class="input-group mb-3">
11061104
<h3>Credits</h3>
1107-
<xf:repeat ref="instance('i-rec')//*:revisionDesc/*:change" id="changeRec">
1105+
<xf:repeat ref="instance('i-rec')//tei:teiHeader/tei:revisionDesc/tei:change" id="changeRec">
11081106
<div class="change">
11091107
<xf:output value="concat(@who,' (', @when,'): ', .)"/>
11101108
</div>
@@ -1156,21 +1154,25 @@
11561154
<div class="fileLoading">
11571155
<p>Write a one-sentence description of the changes you made to the file.</p>
11581156
<div class="input-group mb-3 full-width">
1159-
<xf:textarea ref="instance('i-rec')//*:revisionDesc/*:change[1]" class="large-textarea"/>
1157+
<xf:textarea ref="instance('i-admin')/tei:change" class="large-textarea"/>
11601158
</div>
11611159
<div class="mb-3">
11621160
<xf:trigger class="btn btn-outline-secondary" appearance="minimal">
11631161
<xf:label> Save</xf:label>
11641162
<xf:action ev:event="DOMActivate">
1163+
<xf:setvalue ref="instance('i-admin')/tei:change/@who" value="concat('#', instance('i-user')//*:user)"/>
1164+
<xf:setvalue ref="instance('i-admin')/tei:change/@when" value="getXMLDate()"/>
11651165
<xf:toggle case="changeElementHide" ev:event="DOMActivate"/>
11661166
<xf:send submission="s-github"/>
11671167
</xf:action>
11681168
</xf:trigger>
11691169
<xf:trigger class="btn btn-outline-secondary" appearance="minimal">
11701170
<xf:label> Cancel</xf:label>
11711171
<xf:action ev:event="DOMActivate">
1172+
<xf:setvalue ref="instance('i-admin')/tei:change/@who" value="'#'"/>
1173+
<xf:setvalue ref="instance('i-admin')/tei:change/@when" value="''"/>
1174+
<xf:setvalue ref="instance('i-admin')/tei:change" value="''"/>
11721175
<xf:toggle case="changeElementHide" ev:event="DOMActivate"/>
1173-
<xf:setvalue ref="instance('i-rec')//*:revisionDesc/*:change[1]" value="''"/>
11741176
</xf:action>
11751177
</xf:trigger>
11761178
</div>

0 commit comments

Comments
 (0)