<?xml version="1.0" encoding="utf-8"?>

<workflow xmlns="http://eprints.org/ep3/workflow" xmlns:epc="http://eprints.org/ep3/control">

  <flow>
  	<stage ref="type"/>
  	<stage ref="settings"/>
	<epc:if test="type='compound' or type='multilang'">
		<stage ref="sub_fields"/>
	</epc:if>
  	<stage ref="phrases"/>
	<stage ref="commit"/>
  </flow>
   
  <stage name="type">
  	<component><field ref="name"/></component>
  	<component><field ref="multiple"/></component>
  	<component><field ref="type"/></component>
  </stage>

  <stage name="settings">
	<component type="XHTML"><epc:phrase ref="metafield_properties_help"/></component>
  	<component><field ref="required"/></component>
  	<component><field ref="volatile"/></component>
  	<component><field ref="export_as_xml"/></component>
  	<component><field ref="allow_null"/></component>
  	<component><field ref="sql_index"/></component>
	<epc:if test="type='counter'">
		<component><field ref="sql_counter" required="yes"/></component>
	</epc:if>
    <component type="Field::Multi">
		<title>Rendering Options</title>
		<field ref="render_input"/>
		<field ref="render_value"/>
		<epc:if test="type!='boolean' and type!='compound'">
			<field ref="browse_link"/>
		</epc:if>
	</component>
	<epc:if test="type='search' or type='fields' or type='subobject' or type='itemref'">
		<component><field ref="datasetid" required="yes"/></component>
	</epc:if>
	<epc:if test="multiple='TRUE'">
		<component type="Field::Multi">
			<title>Multiple Values</title>
			<field ref="input_boxes"/>
			<field ref="input_ordered"/>
		</component>
	</epc:if>
	<epc:if test="type!='boolean' and type!='compound'">
		<component><field ref="maxlength"/></component>
		<component><field ref="input_cols"/></component>
	</epc:if>
	<epc:if test="type='longtext' or type='boolean' or type='set' or type='namedset' or type='subject'">
		<component><field ref="input_rows"/></component>
	</epc:if>
	<epc:if test="type='subject'">
		<component><field ref="top"/></component>
	</epc:if>
	<epc:if test="type='name'">
		<component type="Field::Multi">
			<title>Name Options</title>
			<field ref="render_order"/>
			<field ref="hide_honourific"/>
			<field ref="hide_lineage"/>
			<field ref="family_first"/>
		</component>
	</epc:if>
	<epc:if test="type='subobject'">
		<component><field ref="datasetid"/></component>
	</epc:if>
	<epc:if test="type='date'">
		<component><field ref="min_resolution" options="year,month,day"/></component>
	</epc:if>
	<epc:if test="type='time'">
		<component><field ref="min_resolution"/></component>
	</epc:if>
	<epc:if test="type='boolean'">
		<component><field ref="input_style" options="menu,radio"/></component>
	</epc:if>
	<epc:if test="type='set' or type='namedset'">
		<component><field ref="input_style" options="short,medium,long"/></component>
	</epc:if>
	<epc:if test="type='set'">
		<component><field ref="options"/></component>
	</epc:if>
	<epc:if test="type='namedset'">
		<component><field ref="set_name"/></component>
	</epc:if>
  </stage>

  <stage name="sub_fields">
		<component type="Field::SubFields"><field ref="fields" required="yes"/></component>
  </stage>

  <stage name="phrases">
		<component><field ref="phrase_name"/></component>
		<component><field ref="phrase_help"/></component>
  </stage>

  <stage name="commit" action_buttons="none">
  		<component type="MetaField::Commit" surround="None"></component>
  </stage>

</workflow>
