Projet

General

Profil

Controls

The module beCPG controls provides controls for the Alfresco Share forms, it is required by the designer. These controls can be installed and used without the designer.

Installation

The module beCPG controls is composed of two AMP that can be downloaded here. The AMP core must be deployed in Alfresco and the AMP share must be deployed in Share:

java -jar  $ALF/bin/alfresco-mmt.jar install becpg-controls-core-$BECPG_VERSION.amp $SERVER/webapps/alfresco.war -force
java -jar  $ALF/bin/alfresco-mmt.jar install becpg-controls-share-$BECPG_VERSION.amp $SERVER/webapps/share.war -force

Multilingual control

This control will automatically appear next to MLText field, it allow to provide field translation.

Click on flag link to open multilingual dialog:

Choose a language to add:

To override locale list add under share-config-custom.xml:

<config evaluator="string-compare" condition="Languages" replace="true">
      <!-- the list of available language files -->
      <languages>
         <language locale="en_US">English</language>
         <language locale="de_DE">German</language>
         <language locale="es_ES">Spanish</language>
         <language locale="fr_FR">French</language>
         <language locale="it_IT">Italian</language>
         <language locale="ja_JP">Japanese</language>
         <language locale="nl_NL">Dutch</language>
         <language locale="ru_RU">Russian</language>
         <language locale="zh_CN">Chinese (Simplified)</language>
         <language locale="pt_PT">Protuguese</language>
         <language locale="no_NO">Norwegian</language>
         <language locale="sv_SE">Swedish</language>
         <language locale="el_GR">Greek</language>
      </languages>
   </config>

Autocomplete control

This module provides 2 usable controls :
  • the control autocomplete.ftl that suggests text values
  • the control autocomplete-association.ftl that suggests association values (nodes with noderef)

Configuration

autocomplete.ftl

Control path:
  • /fr/becpg/components/form/controls/autocomplete.ftl
Parameters:
  • ds (string) The datasource used by the control
  • parent (optional,string) The parent field
  • local (optional,boolean, false) The datasource is local (webscript share/alfresco)
  • style (optional,string) The style applied to the field
  • maxLength (optional,int) The max length for the text field
  • size (optional,int) The size of the text field
  • showTooltip (optional,boolean, false) Should we show tooltips
  • showPage (optional,boolean, true) Should we show pagination
  • saveTitle (optional,boolean, false) Should we save the label or value

autocomplete-association.ftl

Control path:
  • /fr/becpg/components/form/controls/autocomplete-association.ftl">
Parameters:
  • ds (string) The datasource used by the control

Datasource

To provide a datasource, we need to implement a Java plugin.

An exemple is provided in the designer module.

Class Java:

public class ExempleListValuePlugin extends AbstractBaseListValuePlugin {

    @Override
    public String[] getHandleSourceTypes() {
        return new String[] {"exempleSourceType" };
    }

    @Override
    public ListValuePage suggest(String sourceType, String query, Integer pageNum, Map<String, Serializable> props) {
           ...
        }

}

Config Spring:

<bean id="exempleListValuePlugin" parent="baseListValuePlugin"  init-method="init" 
             class="fr.becpg.repo.designer.listvalue.ExempleListValuePlugin"/>

Url of datasource

<control template="/fr/becpg/components/form/controls/autocomplete.ftl">
   <control-param name="ds">becpg/autocomplete/exempleSourceType</control-param>
</control>