Integration Manual v1.9.0 - v1.13.0


  1. Installation
  2. Life cycles of form entries
    1. Step 1: standard workflow integration Ametys
    2. Step 2: customize standard workflow (optional)
    3. Step 3: Add a new workflow (optional)

Installation

  • Stop the server
  • Download jars from plugin and add them (ametys-plugin-forms-1.9.0.jar and ametys- plugin-forms-resources-1 .9.0.jar) to your application's WEB-INF/lib directory. Ametys

  • The plugin requires the creation of tables SQL for workflow storage of form entries
    Run the script SQL corresponding to your installation: http://viewvc.ametys.org/viewvc/trunk/plugins /workflow/tags/1 .5.0/main/plugin -workflow/scripts/

  • Add button to view form data in file WEB-INF/params/cms-ribbon-default.xml. The menu identifier is org.ametys.forms.ShowFormEntries.
    Add button to contextual content tab org.ametys.cms.content.Tab

  • In the same file, to be able to create a form in the content editor, also add the button org.ametys.plugins.forms.Insert in the org.ametys.cms.content.EditionTab

  • In the same file, adding the button displays all the forms present in the site contents, in the Home tab. The button identifier is org.ametys.plugins.forms.FormsList

  • In this same file, import the ribbon file specific to forms cocoon://plugins/forms/ribbon.xml
<tabs>
	<tab label="RIBBON_TABS_TAB_HOME_LABEL">
   		<groups>
        	<group label="RIBBON_TABS_TAB_HOME_GROUPS_GROUP_TOOL_LABEL" icon="">
				<large>...</large>
            	<medium>
					[...]
					<control id="org.ametys.plugins.forms.FormsList"/>
				</medium>
				<small>...</small>
			</group>
	 <tab label="plugin.cms:RIBBON_TABS_TAB_CONTENT_LABEL" id="org.ametys.cms.content.Tab">
    	<groups>
			[...]
			<group label="plugin.cms:RIBBON_TABS_TAB_CONTENT_GROUPS_GROUP_TOOL_LABEL" icon="" priority="-10">
				<large>
					[...]
					<control id="org.ametys.forms.ShowFormEntries"/>
				</large>
				<medium>
					[...]
					<control id="org.ametys.forms.ShowFormEntries"/>
				</medium>
				<small/>
    		</group>
			[...]
		</groups>
	<tab>
	[...]
	<tab label="plugin.cms:RIBBON_TABS_TAB_CONTENT_EDIT_LABEL" id="org.ametys.cms.content.EditionTab">
		<groups>
			[...]
			<group label="plugin.cms:RIBBON_TABS_TAB_CONTENT_EDIT_GROUPS_GROUP_INSERT_LABEL" icon="">
				<large>...</large>				
				<medium>
					...
					<layout align="top" size="small">
                    	<control id="org.ametys.cms.edition.toc.Insert"/>
                        <control id="org.ametys.cms.edition.symbol.Insert"/>
                        <control id="org.ametys.plugins.forms.Insert"/>
					</layout>
					...
				</medium>
				<small>...</small>
			</group>
		</groups
	</tab>
	
	<!-- Forms -->
	<import>cocoon://plugins/forms/ribbon.xml</import>
</tabs>

Please note! If the group contains a description , and , the button must be added to the 3.

 

  • In the content workflow file WEB-INF/param/workflow.xmladd a post-function org.ametys.plugins.forms.workflow.FormEditionFunction to process the forms present in the content at the time of saving.
    To do this, copy the following code XML and copy it at the end of the editing action with identifier n°2, just after the tag <results>

    <post-functions>
        <function type="avalon">
            <arg name="role">org.ametys.plugins.forms.workflow.FormEditionFunction</arg>
        </function>
    </post-functions>
    

    So you should have:

    <action id="2" name="plugin.web:WORKFLOW_ACTION_EDIT">
                <restrict-to>
                    <conditions type="AND">
                        <condition type="avalon">
                            <arg name="role">org.ametys.cms.workflow.ContentCheckRightsCondition</arg>
                            <arg name="right">Workflow_Rights_Edition_Online</arg>
                        </condition>
                        <condition type="avalon">
                            <arg name="role">org.ametys.cms.workflow.LockCondition</arg>
                        </condition>
                    </conditions>
                </restrict-to>
                <pre-functions>
                    <function type="avalon">
                        <arg name="role">org.ametys.cms.workflow.EditContentFunction</arg>
                    </function>
                </pre-functions>
                <results>
                    <unconditional-result old-status=" " status=" " step="1" />
                </results>
                 <post-functions>
                    <function type="avalon">
                        <arg name="role">org.ametys.plugins.forms.workflow.FormEditionFunction</arg>
                    </function>
                </post-functions>
    </action>
    



  • Restart the server

Life cycles of form entries

One or more workflow cycles can be defined for form entries.

For each life cycle, you will need to define :

  • a XML workflow description file
  • any rights associated with workflow actions
  • labels and icons associated with each workflow status/action
  • buttons available in the back office to advance the workflow

To add one or more workflows for forms, you need to add a plugin to your application.

Workflow on entries requires table creation SQL
Run script SQL for your installation if you haven't already done so at the installation stage: http://viewvc.ametys.org/viewvc/trunk/plugins /workflow/tags/1 .5.0/main/plugin -workflow/scripts/

 

Step 1: standard workflow integration Ametys

Ametys provides an example of a standard workflow that you can then customize and add to.

To integrate the standard workflow, follow these steps:

1) Download and unzip the plugin "default-form-workflow" file provided here into your application's plugins directory : default-form-workflow.zip

This plugin defines a 4-state life cycle for each input:

  • Submitted: a visitor has submitted a request (form response)
  • Accepted: the webmaster has accepted the request
  • Refused: the webmaster refused the request
  • Request for additional information: the webmaster has requested additional information from the submitter of the request.

In this workflow, it is possible to send a mail to the requesting party when requesting additions:

 

2) Add workflow description file

Download and save the workflow description file in your application's WEB-INF/param directory: workflow-form-default. xml

This file contains descriptions of life cycle states and actions.

3) Add reference to new workflow

In the WEB-INF/param/workflows.xmladd a reference to the new workflow "form-default"

workflows.xml

<?xml version="1.0" encoding="UTF-8"?>
<workflows>
	<workflow name="content" type="file" location="workflow.xml"/>
  	<workflow name="newsletter" type="file" location="workflow-newsletter.xml"/>
  	<workflow name="ugc" type="file" location="workflow-ugc.xml"/>
  	<workflow name="blog" type="file" location="workflow-blog.xml"/>
  	<workflow name="form-default" type="file" location="workflow-form-default.xml"/>
</workflows>

Workflow names specific to form entries must begin with "form-".

4) Define your workflow label

In translation files WEB-INF/i18n/application*.xmlAdd a line to define the name of your workflow. The key is "WORKFLOW_" followed by the workflow name, i.e. WORLFLOW_form-default

<message key="WORKFLOW_form-default">Standard</message> 

The workflow is ready! You can restart the server and use it in your forms

Step 2: customize standard workflow (optional)

You can customize the standard workflow by adding/removing workflow actions/states.

Workflow settings are identical to the other workflows in the application. Go to the Workflow settings page to find out more.

If you are adding a report, you will need to add to the plugin.xml the declaration of the button representing this state.

This button must be defined as shown below:

<extension id="form-wokflow-button.form-default.[id_etat]"
           point="org.ametys.cms.workspace.ribbon.RibbonControlsManager"
           class="org.ametys.plugins.forms.workflow.FormEntriesWorkflowMenu">
     <workflow name="form-default">
     	<step>[id_etat]</step>        
           	<actions mode="include">
				<!-- Liste des actions disponibles depuis cet état -->
				<action>[id_action]</action>
				<action>[id_action]</action>
			</actions>
           
			<!-- Activiter ou désactiver les commentaires -->
            <comments mode="include"/>
	  <workflow>
</extension>            

The button identifier must be composed of "form-wokflow-button." followed by the workflow name, followed by ".", followed by theworkflow state identifier.

Don't forget to add the i18n keys and icons associated with your new reports.

Step 3: Add a new workflow (optional)

Each time you add a new workflow, follow these steps:

  1. Create a workflow description file in the WEB-INF/param of your application. 
    Go to the Workflow settings to find out more.

  2. Name and reference your workflow in the WEB-INF/param/workflows.xml

    The workflow name must begin with "form- "(e.g. form-monworkflow).

  3. Define the worflow label in the WEB-INF/i18n/application*xml
    The key must be "WORKFLOW_" followed by the workflow name. (e.g. WORKFLOW_form-monworkflow)

  4. Copy/paste the following extension declaration into a file plugin.xmlreplace "form-default" with the name of your workflow

    <extension id="form-wokflow-tab.form-default" 
               point="org.ametys.cms.workspace.ribbon.RibbonTabsManager" 
               class="org.ametys.runtime.ui.impl.StaticContextualClientSideElement">
        <action class="org.ametys.plugins.forms.workflow.FormEntriesWorkflowTab">
         	<param name="target-type">^(content-form)$</param>
            <param name="workflow-name">^(form-default)$</param>
        </action>
        <scripts>
        	<file plugin="forms">js/org/ametys/forms/workflow/FormEntriesWorkflowTab.js</file>
        </scripts>
    </extension>
    
  5. Define a workflow button for each workflow state, based on the following model:

    <extension id="form-wokflow-button.[nom_workflow].[id_etat]"
               point="org.ametys.cms.workspace.ribbon.RibbonControlsManager"
               class="org.ametys.plugins.forms.workflow.FormEntriesWorkflowMenu">
         <workflow name="form-default">
         	<step>[id_etat]</step>        
               	<actions mode="include">
    				<!-- Liste des actions disponibles depuis cet état -->
    				<action>[id_action]</action>
    				<action>[id_action]</action>
    			</actions>
                 
    			<!-- Activiter ou désactiver les commentaires -->       
                <comments mode="include"/>
    	  <workflow>
    </extension>            
    

    The button identifier must be composed of "form-wokflow-button." followed by the workflow name, followed by ".", followed by theworkflow state identifier.

     

Back to top

Forms