Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

new: support autosend and autodelete #281

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

florianm
Copy link
Contributor

@florianm florianm commented Jan 28, 2022

Add support to optionally override Collect's autosend and autodelete form management settings.

  • Closes Support for auto-send and auto-delete #165
  • Form properties (index.erb): add two dropdowns for each setting - empty on legacy forms, three options default, always, never.
  • The dropdowns are styled like the other form properties elements (styles.css).
  • The form data is plumbed through data.js to end up as a child node in the model, tacking onto what submission_url does.
  • Screenshot 1: with options always and never, respectively
    image
  • Screenshot 2: with option "default" = "Follow ODK Collect settings"
    image
  • When loading a new form from "My forms", autosend and autodelete are loaded from that form.
  • When exporting to XML with autosend always, autodelete never:
    • New namespace orx
    • New model child <submission method="form-data-post" orx:auto-send="true" orx:auto-delete="false"/>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:orx="http://openrosa.org/xforms" xmlns:odk="http://www.opendatakit.org/xforms">
  <h:head>
    <h:title>Untitled Form</h:title>
    <model>
      <instance>
        <data id="Untitled-Form" version="1643332534">
          <meta>
            <instanceID/>
          </meta>
          <untitled2/>
        </data>
      </instance>
      <itext>
        <translation lang="English">
          <text id="/data/untitled2:label">
            <value>test</value>
          </text>
        </translation>
      </itext>
      <bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid"/>
      <submission method="form-data-post" orx:auto-send="true" orx:auto-delete="false"/>
      <bind nodeset="/data/untitled2" type="string"/>
    </model>
  </h:head>
  <h:body>
    <input ref="/data/untitled2">
      <label ref="jr:itext('/data/untitled2:label')"/>
    </input>
  </h:body>
</h:html>
  • With both settings to "default" (follow Collect), no submission method node is inserted.
  • With only one setting to non-default (e.g. autosend always, autodelete default), only the non-default is exported:
      <submission method="form-data-post" orx:auto-send="true"/>
  • Export to XLSForm does not break, but also silently drops the autosend/autodelete settings.
  • Once this PR is merged, I'll send a PR for metadata kinds email and audit to conclude the rework of Support audit, email, bearing #266.

@florianm florianm added this to the 0.4.3 auto-send/delete milestone Jan 28, 2022
@florianm florianm added this to In progress in Roadmap via automation Jan 28, 2022
@florianm florianm self-assigned this Jan 28, 2022
Roadmap automation moved this from In progress to Reviewer approved Jan 28, 2022
Copy link
Member

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Export to XLSForm does not break, but also silently drops the autosend/autodelete settings.

Is the idea to address this eventually, then?

@florianm
Copy link
Contributor Author

florianm commented Jan 28, 2022

Absolutely! Tracked at getodk/build2xlsform#22

@florianm florianm merged commit a729e41 into getodk:master Jan 28, 2022
Roadmap automation moved this from Reviewer approved to Done Jan 28, 2022
@florianm florianm deleted the 165-autosend-autodelete branch January 28, 2022 18:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

Successfully merging this pull request may close these issues.

Support for auto-send and auto-delete
2 participants