1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-12-21 07:08:51 -05:00
xeps/xep-0346.xml
Emmanuel Gil Peyrot 7a64b7b1ed Remove spaces at the end of CDATA blocks in all XEPs.
sed -i 's/^\s\+]]>/]]>/g' xep-*.xml
2017-02-16 19:37:21 -06:00

233 lines
12 KiB
XML

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
<!ENTITY templatePrefix "fdp/template">
<!ENTITY completedPrefix "fdp/submitted">
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Form Discovery and Publishing</title>
<abstract>This specification describes a series of conventions that allow the management of form templates and publishing of completed forms.</abstract>
&LEGALNOTICE;
<number>0346</number>
<status>Experimental</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0001</spec>
<spec>XEP-0004</spec>
<spec>XEP-0030</spec>
<spec>XEP-0060</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>NOT_YET_ASSIGNED</shortname>
&ksmithisode;
<revision>
<version>0.1</version>
<date>2014-04-10</date>
<initials>editor (mam)</initials>
<remark>
<p>Initial published version approved by XMPP Council.</p>
</remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2014-04-07</date>
<initials>ks</initials>
<remark>
<p>First draft.</p>
</remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>There are many circumstances in which it is necessary for entities to 'fill out forms' to be consumed by other entities (such an example might be for reporting an accident in the workplace). This document provides a method by which an entity can discover which forms are available, fetch the templates and submit the completed forms, using standard XMPP &xep0060;.</p>
<p>This is achieved by every form having a pair of pubsub nodes on the same service; one of the nodes contains the template form (the empty form that is to be completed) and the other is used for publishing completed forms.</p>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic='Node naming' anchor='naming'>
<p>Pubsub nodes used for these forms are comprised of a standard prefix and an application-specific suffix. Templates and completed forms for the same form type have the same application-specific suffix, but a different prefix. The prefix for form templates is "&templatePrefix;/" and for completed forms is "&completedPrefix;/".</p>
<p>The application-specific suffix must be guaranteed to be unique to the application, so it is suggested to start with a domain under the application author's control; as such if Isode Ltd. were to use this approach for feedback on the Christmas party, a node ID might be formed as "&templatePrefix;/isode.com/christmas-party-feedback/2013" to contain the form template and "&completedPrefix;/isode.com/christmas-party-feedback/2013" for the submitted nodes.</p>
</section2>
<section2 topic='Listing available templates' anchor='list_templates'>
<p>To find the templates present on a pubsub service, do a disco#items as described in &xep0060; section 5.2. Those items that have a node ID that starts with "&templatePrefix;" are form templates.</p>
<example caption='User discovers available nodes'><![CDATA[
<iq id="34385937-3740-411d-a360-374e9ba73202" to="pubsub.stan.isode.net" type="get">
<query xmlns="http://jabber.org/protocol/disco#items"/>
</iq>
<iq from='pubsub.stan.isode.net' to='sysop@stan.isode.net/4d67a58b4d16cc1d' type='result' id='34385937-3740-411d-a360-374e9ba73202'>
<query xmlns='http://jabber.org/protocol/disco#items'>
<item jid='pubsub.stan.isode.net' node='fdp/submitted/stan.isode.net/accidentreport' name='AccidentReport'/>
<item jid='pubsub.stan.isode.net' node='fdp/template/stan.isode.net/accidentreport' name='AccidentReport'/>
</query>
</iq>
]]></example>
<p>In the above example there is one form available, "stan.isode.net/accidentreport"</p>
</section2>
<section2 topic='Fetching a template' anchor='fetch_templates'>
<p>To fetch a template, first identify the node that the template is stored in and then request the last published item for that node, as in &xep0060; 6.5.5</p>
<example caption='User fetches a template'><![CDATA[
<iq id="fb73efb3-356e-43ce-98a3-f76d86132745" to="pubsub.stan.isode.net" type="get">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items max_items="1" node="fdp/template/stan.isode.net/accidentreport" xmlns="http://jabber.org/protocol/pubsub"/>
</pubsub>
</iq>
<iq from='pubsub.stan.isode.net' to='sysop@stan.isode.net/4d67a58b4d16cc1d' type='result' id='fb73efb3-356e-43ce-98a3-f76d86132745'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='fdp/template/stan.isode.net/accidentreport'>
<item id='version01'>
<x xmlns='jabber:x:data' type='form'>
<instructions>Please fill in all fields to complete this accident report.</instructions>
<title>Accident report form.</title>
<field type='list-single' label='Place of fall:' var='Place'>
<option label="Kitchen">
<value>Kitchen</value>
</option>
<option label="Conference Room">
<value>Conference Room</value>
</option>
<option label="Engineering">
<value>Engineering</value>
</option>
</field>
<field type='text-single' label='Type of injury:' var='Type'>
</field>
<field type='boolean' label='Ambulance needed?' var='Ambulance'>
</field>
</x>
</item>
</items>
</pubsub>
</iq>
]]></example>
</section2>
<section2 topic='Template format' anchor='template_format'>
<p>The format of the template should be a standard &xep0004; form; this can be extended with &xep0122; and/or &xep0141; as needed by individual form applications. The template will be the pubsub item.</p>
</section2>
<section2 topic='Submitting a completed form' anchor='submit_form'>
<p>When the form has been completed, the resultant &xep0004; payload shall be published to the completed items node corresponding to the form type using the protocol in &xep0060; 7.1. The node ID for publishing completed forms corresponds to the node the template was stored in, with the &templatePrefix; prefix replaced with the &completedPrefix; prefix.</p>
<example caption='User submits the completed form'><![CDATA[
<iq id="fc2e69de-4626-47d3-b04b-1cd6b4049b3f" to="pubsub.stan.isode.net" type="set">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="fdp/submitted/stan.isode.net/accidentreport" xmlns="http://jabber.org/protocol/pubsub">
<item id="" xmlns="http://jabber.org/protocol/pubsub">
<x type="submit" xmlns="jabber:x:data">
<title>Accident report form.</title>
<field label="Place of fall:" type="list-single" var="Place">
<value>Kitchen</value>
</field>
<field label="Type of injury:" type="text-single" var="Type">
<value>Ankle</value>
</field>
<field label="Ambulance needed?" type="boolean" var="Ambulance">
<value>1</value>
</field>
</x>
</item>
</publish>
</pubsub>
</iq>
]]></example>
</section2>
<section2 topic='Monitoring completed form' anchor='monitor_forms'>
<p>An entity can monitor completed forms by subscribing to the completed form node, as described in &xep0060; 6.1.</p>
<example caption='User subscribes to a completed form node'><![CDATA[
<iq id="0f66fbcf-6148-40ed-a084-a3a5e2a71329" to="pubsub.stan.isode.net" type="set">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<subscribe jid="sysop@stan.isode.net/763be9c30f8ee893" node="fdp/submitted/stan.isode.net/accidentreport" xmlns="http://jabber.org/protocol/pubsub"/>
</pubsub>
</iq>
]]></example>
</section2>
<section2 topic='Publishing form templates' anchor='publish_templates'>
<p>Form templates are made available by publishing them to the template node for that form using the protocol in &xep0060; 7.1.</p>
<example caption='Administrator publishes a form template'><![CDATA[
<iq id="309d632d-fa68-4004-8611-d11cc5074d66" to="pubsub.stan.isode.net" type="set">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="fdp/template/stan.isode.net/accidentreport">
<item id="version01">
<x xmlns="jabber:x:data" type="form">
<instructions>Please fill in all fields to complete this accident report.</instructions>
<title>Accident report form.</title>
<field type="list-single" label="Place of fall:" var="Place">
<option label="Kitchen">
<value>Kitchen</value>
</option>
<option label="Conference Room">
<value>Conference Room</value>
</option>
<option label="Engineering">
<value>Engineering</value>
</option>
</field>
<field type="text-single" label="Type of injury:" var="Type">
</field>
<field type="boolean" label="Ambulance needed?" var="Ambulance">
</field>
</x>
</item>
</publish>
</pubsub>
</iq>
]]></example>
</section2>
<section2 topic='Node configuration' anchor='node_configuration'>
<p>Template nodes must be configured to support at least one persistent item. Both templates and published nodes need to be configured with appropriate access to publish and subscribe. Deployments may be configured such that entities are allowed to read the templates and submit completed forms, but not to read the completed forms.</p>
</section2>
</section1>
<section1 topic='Determining Support' anchor='support'>
<p>All of the form activity happens over standard pubsub, so initial discovery is of the pubsub domain. A pubsub domain supporting these forms will have an additional disco identity (additional to the standard pubsub identity) with a category of 'pubsub' and a type of 'urn:xmpp:fdp:0'. </p>
<example caption='Entity Queries Pubsub Service Regarding Supported Features'><![CDATA[
<iq type='get'
from='sysop@stan.isode.net/763be9c30f8ee893'
to='pubsub.stan.isode.net'
id='feature1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]></example>
<example caption='Pubsub Service Includes FDP in its identities'><![CDATA[
<iq type='result'
from='pubsub.stan.isode.net'
to='sysop@stan.isode.net/763be9c30f8ee893'
id='feature1'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<identity category='pubsub' type='service'/>
<identity category='pubsub' type='urn:xmpp:fdp:0'/>
<feature var='http://jabber.org/protocol/pubsub'/>
</query>
</iq>]]></example>
<p>Discovery of the template forms or completed form nodes happens using the protocol described in <link url="#usecases">Use Cases</link>.
</p>
</section1>
<!-- <section1 topic='Implementation Notes' anchor='impl'>
</section1>-->
<section1 topic='Security Considerations' anchor='security'>
<p>This document introduces no security considerations beyond those in &xep0060;.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>Include the "urn:xmpp:fdp:0" namespace in the registry of protocol namespaces. Include "urn:xmpp:fdp:0" as an additional type in the pubsub category of service discovery identities.</p>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<p>As this document only defines semantics for existing protocol, additional schemas are not required.</p>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>Thanks to Matthew Wild, Richard Maudsley and Alex Clayton.</p>
</section1>
</xep>