You need to define one or more workflows for the content you wish to make available on the site.

To do this, you need to define a workflow file XML.

Please refer to the parameter manual for more information on workflow file creation.

The workflow file name must begin with "ugc-". In fact, in the "Content proposal" service parameters, only workflows beginning with "ugc-" are available.

In addition, the workflow associated with the proposed content must contain action 1111 as shown below:

<!-- Création -->      
<action id="1111" name="plugin.classified-ads:PLUGINS_CLASSIFIED_ADS_WORKFLOW_ACTION_CREATE">      
    <pre-functions>      
        <function type="avalon">      
            <arg name="role">org.ametys.web.workflow.CreateContentFunction</arg>      
        </function>      
        <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>      
        <function type="avalon">      
            <arg name="role">org.ametys.cms.workflow.SetCurrentStepIdAndNotifyFunction</arg>      
        </function>      
        <function type="avalon">      
            <arg name="role">org.ametys.cms.workflow.CreateVersionFunction</arg>      
        </function>      
    </post-functions>      
</action>      

This 1111 action is used when submitting content from the Content Proposal service.

The life cycle depends on your use, and can be very close to the standard life cycle.

If, for example, you wish to moderate content after the fact, add the validation function to action 1111.

If you use plugin UGC with an integration mode that transforms the proposed content into another type of content, the lifecycle can be minimalist, containing only the 1111 action and a single state.

plugin Classified Ads provides 2 lifecycles for classified ads: a lifecycle with a priori validation and a lifecycle with a posteriori validation. You can use these examples to create your own workflow.

Send mail notifications to authors

plugin UGC also provides a workflow function (org.ametys.plugins.ugc.workflow.SendMailToCreatorFunction) which, by simple configuration, sends a mail to the creator of the proposed content.

The purpose and message of mail can be configured.

It can be used, for example, as a post-function for content validation and/or rejection.

<function type="avalon">     
   <arg name="role">org.ametys.plugins.ugc.workflow.SendMailToCreatorFunction</arg>     
   <arg name="subjectKey">plugin.classified-ads:PLUGINS_CLASSIFIED_ADS_WORKFLOW_MAIL_SUBJECT_ACTION_VALIDATE</arg>     
   <arg name="bodyKey">plugin.classified-ads:PLUGINS_CLASSIFIED_ADS_WORKFLOW_MAIL_BODY_ACTION_VALIDATE</arg>     
</function>     

The mail object can be configured with :

  • {0} Content name
  • {1} Site name

The mail message can be set with :

  • {0} The user who acts on the content (validates, modifies, etc ...)
  • {1} Content name
  • {2} Site name
  • {3} Page title (if any)
  • {4} Link to content page (if available)

Examples:

<message key="PLUGINS_CLASSIFIED_ADS_WORKFLOW_MAIL_BODY_ACTION_VALIDATE">L'utilisateur {0} a validé la petite annonce "{1}" du site "{2}". &#13;&#13;Pour vous rendre sur la page cliquez sur le lien ci-après {4}.</message>    
<message key="PLUGINS_CLASSIFIED_ADS_WORKFLOW_MAIL_BODY_ACTION_VALIDATE_ORPHAN">L'utilisateur {0} a validé la petite annonce "{1}" du site "{2}".</message>    

The **_ORPHAN key is used when there is no page associated with the content.

Access to lifecycle buttons

To access lifecycle actions and status from the ribbon, you need to define the buttons/menus linked to this lifecycle.

Here is an example based on plugin Classified Ads and the post-clearance workflow

<extension id="org.ametys.plugins.classified.ads.postvalidation.WorkflowSteps" 
           point="org.ametys.core.ui.RibbonControlsManager" 
           class="org.ametys.cms.clientsideelement.WorkflowStepsClientSideElement"> 
    <workflow name="ugc-classified-ads-postvalidation"> 
        <workflow-actions mode="exclude"> 
            <action>2</action> 
            <action>220</action> 
            <action>222</action> 
            <action>6</action> 
            <action>8</action> 
            <action>10</action> 
            <action>12</action> 
        </workflow-actions> 
        <steps> 
            <step id="1"> <!-- Draft --> 
                <comments mode="include" /> 
            </step> 

            <step id="4"> <!-- Refused --> 
                <comments mode="include" /> 
            </step> 

            <step id="3"> <!-- Validated --> 
                <comments mode="include"/> 
            </step> 
        </steps> 
    </workflow> 
</extension> 

All that remains is to add these menus/buttons to the content tab. They will only be visible for content linked to this workflow (i.e. classified ads here).

To do this, the ribbon and the "Content" tab must be overloaded as follows:

<tab label="plugin.cms:RIBBON_TABS_TAB_CONTENT_LABEL" override="true"> 
    <groups> 
        <group label="plugin.cms:RIBBON_TABS_TAB_CONTENT_GROUPS_GROUP_WORKFLOW_LABEL" override="true" controlsOrder="1.10"> 
            <control id="org.ametys.plugins.classified.ads.postvalidation.WorkflowSteps"/> 
            <control id="org.ametys.plugins.classified.ads.prevalidation.WorkflowSteps"/> 
        </group> 
    </groups> 
</tab> 
Back to top

UGC