<config xmlns="http://www.orbeon.com/oxf/controller"
    xmlns:xu="http://www.xmldb.org/xupdate"
    xmlns:oxf="http://www.orbeon.com/oxf/processors"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xhtml="http://www.w3.org/1999/xhtml">

    <!-- Files to serve directly -->
    <files path-info="*.gif"/>
    <files path-info="*.css"/>
    <files path-info="*.pdf"/>
    <files path-info="*.js"/>
    <files path-info="*.png"/>
    <files path-info="*.jpg"/>
    <files path-info="*.wsdl"/>
    <files path-info="*.html" mime-type="text/html"/>
    <files path-info="*.java" mime-type="text/plain"/>
    <files path-info="*.txt" mime-type="text/plain"/>
    <files path-info="*.htm" mime-type="text/html"/>

	<!-- Redirect to frontpage so that relative urls will resolve. -->
	<page path-info='/'>
		<action>
			<!--  <result page='front-page' /> -->
			<result page='administration' />
		</action>
	</page>
	
	<page id='step11' 
 	path-info='/step11'
 	xforms='oxf:/FormationOrbeon/TestMigration/Model/model1.xml'
    view='oxf:/FormationOrbeon/TestMigration/Views/step11.xsl' 
    />
 
 	<page id='step1' 
 	path-info='/step1'
 	xforms='oxf:/FormationOrbeon/TestMigration/Model/model.xml'
    view='oxf:/FormationOrbeon/TestMigration/Views/step1.xsl' 
    >
    <action when="/form/action = 'suivantStep1' and not(/form/authentification/* [@xxforms:valid = 'false' ])">
      <result page='step2'>
                <xu:update select="/form/action">
					<xu:value-of
						select="doc('input:instance')/form/action" />
				</xu:update>
				<xu:update select="/form/authentification/login">
					<xu:value-of
						select="doc('input:instance')/form/authentification/login" />
				</xu:update>
				<xu:update select="/form/authentification/password">
					<xu:value-of
						select="doc('input:instance')/form/authentification/password" />
				</xu:update>
				<xu:update select="/form/authentification/level">
					<xu:value-of
						select="doc('input:instance')/form/authentification/level" />
				</xu:update>
      </result>
    </action>
     <action when="/form/action = 'suivantStep1' " >
      <result page='step1'>
        		<xu:update select="/form/show-errors">
					true
				</xu:update>
				<xu:update select="/form/authentification/login">
					<xu:value-of
						select="doc('input:instance')/form/authentification/login" />
				</xu:update>
				<xu:update select="/form/authentification/password">
					<xu:value-of
						select="doc('input:instance')/form/authentification/password" />
				</xu:update>
				<xu:update select="/form/authentification/level">
					<xu:value-of
						select="doc('input:instance')/form/authentification/level" />
				</xu:update>
      </result>
    </action>
    <action when="/form/action = 'annule' ">
      <result page='authentif'>
      </result>
    </action>
    
    </page>
    
    <page id='step2' 
 	path-info='/step2'
 	xforms='oxf:/FormationOrbeon/TestMigration/Model/model.xml'
    view='oxf:/FormationOrbeon/TestMigration/Views/step2.xsl' >
    
     <action when="/form/action = 'suivantStep2' and not(/form/info-general/*[@xxforms:valid = 'false' ])  ">
      <result page='step3' >
       <xu:update select="/form/action">
					<xu:value-of
						select="doc('input:instance')/form/action" />
				</xu:update>
				<xu:update select="/form/authentification/login">
					<xu:value-of
						select="doc('input:instance')/form/authentification/login" />
				</xu:update>
				<xu:update select="/form/authentification/password">
					<xu:value-of
						select="doc('input:instance')/form/authentification/password" />
				</xu:update>
				<xu:update select="/form/authentification/level">
					<xu:value-of
						select="doc('input:instance')/form/authentification/level" />
				</xu:update>
								<xu:update select="/form/info-general/cin">
					<xu:value-of
						select="doc('input:instance')/form/info-general/cin" />
				</xu:update>
				<xu:update select="/form/info-general/cne">
					<xu:value-of
						select="doc('input:instance')/form/info-general/cne" />
				</xu:update>
				<xu:update select="/form/info-general/nom">
					<xu:value-of
						select="doc('input:instance')/form/info-general/nom" />
				</xu:update>
				<xu:update select="/form/info-general/prenom">
					<xu:value-of
						select="doc('input:instance')/form/info-general/prenom" />
				</xu:update>
				<xu:update select="/form/info-general/date-naissance">
					<xu:value-of
						select="doc('input:instance')/form/info-general/date-naissance" />
				</xu:update>
				<xu:update select="/form/info-general/email">
					<xu:value-of
						select="doc('input:instance')/form/info-general/email" />
				</xu:update>
				<xu:update select="/form/info-general/site-web">
					<xu:value-of
						select="doc('input:instance')/form/info-general/site-web" />
				</xu:update>
				<xu:update select="/form/info-general/telephone">
					<xu:value-of
						select="doc('input:instance')/form/info-general/telephone" />
				</xu:update>
				<xu:update select="/form/info-general/adresse">
					<xu:value-of
						select="doc('input:instance')/form/info-general/adresse" />
				</xu:update>
				<xu:update select="/form/info-general/situation-familiale">
					<xu:value-of
						select="doc('input:instance')/form/info-general/situation-familiale" />
				</xu:update>
				</result>
    </action>
    <action when="/form/action = 'suivantStep2'  ">
      <result page='step2'>
               <xu:update select="/form/show-errors">
					true
				</xu:update>
								<xu:update select="/form/authentification/login">
					<xu:value-of
						select="doc('input:instance')/form/authentification/login" />
				</xu:update>
				<xu:update select="/form/authentification/password">
					<xu:value-of
						select="doc('input:instance')/form/authentification/password" />
				</xu:update>
				<xu:update select="/form/authentification/level">
					<xu:value-of
						select="doc('input:instance')/form/authentification/level" />
				</xu:update>
				<xu:update select="/form/info-general/cin">
					<xu:value-of
						select="doc('input:instance')/form/info-general/cin" />
				</xu:update>
				<xu:update select="/form/info-general/cne">
					<xu:value-of
						select="doc('input:instance')/form/info-general/cne" />
				</xu:update>
				<xu:update select="/form/info-general/nom">
					<xu:value-of
						select="doc('input:instance')/form/info-general/nom" />
				</xu:update>
				<xu:update select="/form/info-general/prenom">
					<xu:value-of
						select="doc('input:instance')/form/info-general/prenom" />
				</xu:update>
				<xu:update select="/form/info-general/date-naissance">
					<xu:value-of
						select="doc('input:instance')/form/info-general/date-naissance" />
				</xu:update>
				<xu:update select="/form/info-general/email">
					<xu:value-of
						select="doc('input:instance')/form/info-general/email" />
				</xu:update>
				<xu:update select="/form/info-general/site-web">
					<xu:value-of
						select="doc('input:instance')/form/info-general/site-web" />
				</xu:update>
				<xu:update select="/form/info-general/telephone">
					<xu:value-of
						select="doc('input:instance')/form/info-general/telephone" />
				</xu:update>
				<xu:update select="/form/info-general/adresse">
					<xu:value-of
						select="doc('input:instance')/form/info-general/adresse" />
				</xu:update>
				<xu:update select="/form/info-general/situation-familiale">
					<xu:value-of
						select="doc('input:instance')/form/info-general/situation-familiale" />
				</xu:update>
				
      </result>
    </action>
      <action when="/form/action = 'annule' ">
      <result page='authentif'>
      </result>
    </action>
    </page>
    
    <page id='step3' 
 	path-info='/step3'
 	xforms='oxf:/FormationOrbeon/TestMigration/Model/model.xml'
    view='oxf:/FormationOrbeon/TestMigration/Views/step3.xsl'>
    <action when="/form/action = 'displayData'  " action="oxf:/FormationOrbeon/TestMigration/Model/insert.xpl">
       <result page='display'>
        				<xu:update select="/form/authentification/login">
					<xu:value-of
						select="doc('input:instance')/form/authentification/login" />
				</xu:update>
				<xu:update select="/form/authentification/password">
					<xu:value-of
						select="doc('input:instance')/form/authentification/password" />
				</xu:update>
				<xu:update select="/form/authentification/level">
					<xu:value-of
						select="doc('input:instance')/form/authentification/level" />
				</xu:update>
           <xu:update select="/form/info-general/cin">
			   <xu:value-of
						select="doc('input:instance')/form/info-general/cin" />
				</xu:update>
				<xu:update select="/form/info-general/cne">
					<xu:value-of
						select="doc('input:instance')/form/info-general/cne" />
				</xu:update>
				<xu:update select="/form/info-general/nom">
					<xu:value-of
						select="doc('input:instance')/form/info-general/nom" />
				</xu:update>
				<xu:update select="/form/info-general/prenom">
					<xu:value-of
						select="doc('input:instance')/form/info-general/prenom" />
				</xu:update>
				<xu:update select="/form/info-general/date-naissance">
					<xu:value-of
						select="doc('input:instance')/form/info-general/date-naissance" />
				</xu:update>
				<xu:update select="/form/info-general/email">
					<xu:value-of
						select="doc('input:instance')/form/info-general/email" />
				</xu:update>
				<xu:update select="/form/info-general/site-web">
					<xu:value-of
						select="doc('input:instance')/form/info-general/site-web" />
				</xu:update>
				<xu:update select="/form/info-general/telephone">
					<xu:value-of
						select="doc('input:instance')/form/info-general/telephone" />
				</xu:update>
				<xu:update select="/form/info-general/adresse">
					<xu:value-of
						select="doc('input:instance')/form/info-general/adresse" />
				</xu:update>
				<xu:update select="/form/info-general/situation-familiale">
					<xu:value-of
						select="doc('input:instance')/form/info-general/situation-familiale" />
				</xu:update>
				<xu:update select="/form/formations/fonction-actuelle">
					<xu:value-of
						select="doc('input:instance')/form/formations/fonction-actuelle" />
				</xu:update>
				<!-- update toutes les diplomes en model -->
				<xu:update select="/form/formations/diplomes">
				    <xu:for-each select="doc('input:instance')/form/formations/diplomes/diplome">
				       <xu:element name="diplome">
				         <xu:element name="intitule"><xu:value-of select="normalize-space(intitule)"/> </xu:element>
				         <xu:element name="annee"><xu:value-of select="normalize-space(annee)"/> </xu:element>
				         <xu:element name="mention"> <xu:value-of select="normalize-space(mention)"/></xu:element>
				       </xu:element>
				    </xu:for-each>
				</xu:update>
				
       </result>
    </action>
     <action when="/form/action = 'annule' ">
      <result page='authentif'>
      </result>
     </action>
    </page>
    
    <page id='authentif' 
 	path-info='/authentification'
 	xforms='oxf:/FormationOrbeon/TestMigration/Model/model.xml'
    view='oxf:/FormationOrbeon/TestMigration/Views/authentification.xsl'>
    
    <action when="/form/action = 'verifierLogin'  and not(/form/authentification/* [@xxforms:valid = 'false' ]) "
              action="oxf:/FormationOrbeon/TestMigration/Model/select.xpl">
    </action>
    <action when="/form/action = 'verifierLogin'">
              <result page="authentif">
                 <xu:update select="/form/show-errors">
					true
				</xu:update>
				
					<xu:update select="/form/authentification/login">
					<xu:value-of
						select="doc('input:instance')/form/authentification/login" />
				</xu:update>
				<xu:update select="/form/authentification/password">
					<xu:value-of
						select="doc('input:instance')/form/authentification/password" />
				</xu:update>
              </result>
    </action>
    </page>
    
    <page id='welcome' 
 	path-info='/welcome'
 	xforms='oxf:/FormationOrbeon/TestMigration/Model/model.xml'
    view='oxf:/FormationOrbeon/TestMigration/Views/welcome.xsl' />
   
    <page id='error' 
 	path-info='/error'
 	xforms='oxf:/FormationOrbeon/TestMigration/Model/model.xml'
    view='oxf:/FormationOrbeon/TestMigration/Views/error.xsl' />
    
   <page id='administration' 
 	path-info='/administration'
 	xforms='oxf:/FormationOrbeon/TestMigration/Model/model.xml'
 	model='oxf:/FormationOrbeon/TestMigration/Model/selectAdmin.xpl'
    view='oxf:/FormationOrbeon/TestMigration/Views/administration.xsl' />
    
    <page id='display' 
 	path-info='/display'
 	xforms='oxf:/FormationOrbeon/TestMigration/Model/model.xml'
    view='oxf:/FormationOrbeon/TestMigration/Views/display.xsl'>
      <action when="/form/action = 'annule' ">
      <result page='authentif'>
      </result>
    </action>
    </page>




	<!-- CSS generated by a pipeline.  This is needed by Presentation Server runtime. -->
	<page id='layout-css' path-info='/oxf-theme/orbeon-layout.cssd'
		model='/oxf-theme/orbeon-layout.xpl' />

	<epilogue url='oxf:/config/epilogue.xpl' />

</config>