cancel
Showing results for 
Search instead for 
Did you mean: 

Display of custom properties and share forms configuration in Alfresco community 5.0.c

drisschelouati
Champ on-the-rise
Champ on-the-rise
Hi, i recently started content modeling in alfresco, having a lot of problems i finally succeeded to write simple custom types and aspects model and get them to work. Having understood the basics of modeling, i now have issues with the share configuration, to display the custom properties and to configure the share forms for my custom type.

I built my project mith Maven.


REPO AMP:

1- invoice model


<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="ad:myinvoice-model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
    <!– Optional meta-data about the model –>
    <description>myinvoice-model</description>
    <author>Driss Chelouati</author>   
<version>1.0</version>

    <!– Imports are required to allow references to definitions in other models –>
    <imports>
        <!– Import Alfresco Dictionary Definitions –>
        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
        <!– Import Alfresco Content Domain Model Definitions –>
        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
    </imports>

    <!– Introduction of new namespaces defined by this model –>
    <namespaces>
        <namespace uri="http://www.ad.com/model/content/1.0" prefix="ad" />
    </namespaces>
   
        <constraints>
        <constraint name="ad:myinvoiceList" type="LIST">
            <parameter name="allowedValues">
                <list>
                    <value>Fournisseur</value>
                    <value>Client</value>
                </list>
            </parameter>
        </constraint>
        <constraint name="ad:mycurrenciesList" type="LIST">
            <parameter name="allowedValues">
                <list>
                    <value>Dirhams</value>
                    <value>Euros</value>
                    <value>USD</value> 
                </list>
            </parameter>
        </constraint>
     </constraints>

<types>
        <!– cmcontent children document types –>
        <type name="ad:myinvoice">
            <title>Facture</title>
            <parent>cm:content</parent>
            <properties>
               <property name="ad:genre">
               <type>d:text</type>
               <mandatory>true</mandatory>
               <multiple>true</multiple>
               <constraints>
                   <constraint ref="ad:myinvoiceList" />
               </constraints>
               </property>
               <property name="ad:paydate">
               <type>d:date</type>
               <mandatory>true</mandatory>
               </property>
               <property name="ad:ammount">
               <type>d:text</type>
               <mandatory>true</mandatory>
               </property>
               <property name="ad:currency">
               <type>d:text</type>
               <mandatory>true</mandatory>
               <multiple>true</multiple>
               <constraints>
                   <constraint ref="ad:mycurrenciesList" />
               </constraints>
               </property>
               <property name="ad:reference">
               <type>d:text</type>
               <mandatory>true</mandatory>
               </property>
            </properties>
        </type>
      </types>

<aspects>
        <aspect name="ad:documentrelated">
            <title>documents associes</title>
              <associations>
                 <association name="ad:doclink">
                 <title>Association de documents</title>
                 <source>
                 <mandatory>true</mandatory>
                 <many>true</many>
                 </source>
                 <target>
                 <class>cm:content</class>
                 <mandatory>true</mandatory>
                 <many>false</many>
                 </target>
                 </association>
             </associations>
        </aspect>
</aspects>

</model>




2- service context (spring registration for the model)


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<!–
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
       
    http://www.apache.org/licenses/LICENSE-2.0
       
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
–>
<beans>
   
    <!– A simple class that is initialized by Spring –>
    <bean id="changeme.exampleBean" class="org.alfresco.demoamp.Demo" init-method="init" />
   
    <!– A simple module component that will be executed once –>
    <bean id="changeme.exampleComponent" class="org.alfresco.demoamp.DemoComponent" parent="module.baseComponent" >
        <property name="moduleId" value="${project.artifactId}" />  <!– See module.properties –>
        <property name="name" value="exampleComponent" />
        <property name="description" value="A demonstration component" />
        <property name="sinceVersion" value="2.0" />
        <property name="appliesFromVersion" value="2.0" />
        <property name="nodeService" ref="NodeService" />
        <property name="nodeLocatorService" ref="nodeLocatorService" />
    </bean>
        <!– Registration of new models –>
<bean id="${project.artifactId}_dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
    <property name="models">
        <list>
            <value>alfresco/module/${project.artifactId}/model/myinvoice-model.xml</value>
        </list>
    </property>
</bean>
</beans>



SHARE AMP:

1- Share configuration


<!– Alfresco 5.0.c share-config-custom.xml sample –>
<alfresco-config>

   <!– Global config section –>
   <config replace="true">
      <flags>
         <!–
            Developer debugging setting to turn on DEBUG mode for client scripts in the browser
         –>
         <client-debug>false</client-debug>

         <!–
            LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift).
            This flag automatically activates logging on page load.
         –>
         <client-debug-autologging>false</client-debug-autologging>
      </flags>
   </config>
  
   <config evaluator="string-compare" condition="WebFramework">
      <web-framework>
         <!– SpringSurf Autowire Runtime Settings –>
         <!–
              Developers can set mode to 'development' to disable; SpringSurf caches,
              FreeMarker template caching and Rhino JavaScript compilation.
         –>
         <autowire>
            <!– Pick the mode: "production" or "development" –>
            <mode>production</mode>
         </autowire>

         <!– Allows extension modules with <auto-deploy> set to true to be automatically deployed –>
         <module-deployment>
            <mode>manual</mode>
            <enable-auto-deploy-modules>true</enable-auto-deploy-modules>
         </module-deployment>
      </web-framework>
   </config>

   <!– Disable the CSRF Token Filter –>
   <!–
   <config evaluator="string-compare" condition="CSRFPolicy" replace="true">
      <filter/>
   </config>
   –>

   <!–
      To run the CSRF Token Filter behind 1 or more proxies that do not rewrite the Origin or Referere headers:

      1. Copy the "CSRFPolicy" default config in share-security-config.xml and paste it into this file.
      2. Replace the old config by setting the <config> element's "replace" attribute to "true" like below:
         <config evaluator="string-compare" condition="CSRFPolicy" replace="true">
      3. To every <action name="assertReferer"> element add the following child element
         <param name="referer">http://www.proxy1.com/.*|http://www.proxy2.com/.*</param>
      4. To every <action name="assertOrigin"> element add the following child element
         <param name="origin">http://www.proxy1.com|http://www.proxy2.com</param>
   –>

   <!–
      Remove the default wildcard setting and use instead a strict whitelist of the only domains that shall be allowed
      to be used inside iframes (i.e. in the WebView dashlet on the dashboards)
   –>
   <!–
   <config evaluator="string-compare" condition="IFramePolicy" replace="true">
      <cross-domain>
         <url>http://www.trusted-domain-1.com/</url>
         <url>http://www.trusted-domain-2.com/</url>
      </cross-domain>
   </config>
   –>

   <!– Turn off header that stops Share from being displayed in iframes on pages from other domains –>
   <!–
   <config evaluator="string-compare" condition="SecurityHeadersPolicy">
      <headers>
         <header>
            <name>X-Frame-Options</name>
            <enabled>false</enabled>
         </header>
      </headers>
   </config>
   –>

   <!– Prevent browser communication over HTTP (for HTTPS servers) –>
   <!–
   <config evaluator="string-compare" condition="SecurityHeadersPolicy">
      <headers>
         <header>
            <name>Strict-Transport-Security</name>
            <value>max-age=31536000</value>
         </header>
      </headers>
   </config>
   –>

   <config evaluator="string-compare" condition="Replication">
      <share-urls>
         <!–
            To discover a Repository Id, browse to the remote server's CMIS landing page at:
              http://{server}:{port}/alfresco/service/cmis/index.html
            The Repository Id field is found under the "CMIS Repository Information" expandable panel.

            Example config entry:
              <share-url repositoryId="622f9533-2a1e-48fe-af4e-ee9e41667ea4">http://new-york-office:8080/share/</share-url>
         –>
      </share-urls>
   </config>

   <!– Document Library config section –>
   <config evaluator="string-compare" condition="DocumentLibrary" replace="true">

      <tree>
         <!–
            Whether the folder Tree component should enumerate child folders or not.
            This is a relatively expensive operation, so should be set to "false" for Repositories with broad folder structures.
         –>
         <evaluate-child-folders>false</evaluate-child-folders>
        
         <!–
            Optionally limit the number of folders shown in treeview throughout Share.
         –>
         <maximum-folder-count>1000</maximum-folder-count>
        
         <!– 
            Default timeout in milliseconds for folder Tree component to recieve response from Repository
         –>
         <timeout>7000</timeout>
      </tree>

      <!–
         Used by the "Manage Aspects" action

         For custom aspects, remember to also add the relevant i18n string(s)
            cm_myaspect=My Aspect
      –>
      <aspects>
         <!– Aspects that a user can see –>
         <visible>
            <aspect name="cm:generalclassifiable" />
            <aspect name="cm:complianceable" />
            <aspect name="cm:dublincore" />
            <aspect name="cm:effectivity" />
            <aspect name="cm:summarizable" />
            <aspect name="cm:versionable" />
            <aspect name="cm:templatable" />
            <aspect name="cm:emailed" />
            <aspect name="emailserver:aliasable" />
            <aspect name="cm:taggable" />
            <aspect name="app:inlineeditable" />
            <aspect name="gd:googleEditable" />
            <aspect name="cm:geographic" />
            <aspect name="exif:exif" />
            <aspect name="audio:audio" />
            <aspect name="cm:indexControl" />
            <aspect name="dp:restrictable" />
            <aspect name="ad:documentrelated" />
         </visible>

         <!– Aspects that a user can add. Same as "visible" if left empty –>
         <addable>
         </addable>

         <!– Aspects that a user can remove. Same as "visible" if left empty –>
         <removeable>
         </removeable>
      </aspects>

      <!–
         Used by the "Change Type" action

         Define valid subtypes using the following example:
            <type name="cm:content">
               <subtype name="cm:mysubtype" />
            </type>

         Remember to also add the relevant i18n string(s):
            cm_mysubtype=My SubType
      –>
      <types>
         <type name="cm:content">
         <subtype name="ad:myinvoice" />
         </type>

         <type name="cm:folder">
         </type>

         <type name="trx:transferTarget">
            <subtype name="trx:fileTransferTarget" />
         </type>
      </types>
     
        <!– Forms –>

<config evaluator="node-type" condition="ad:myinvoice" replace="true">
           <forms>
               <form>
                <field-visibility>
               
                    <show id="cm:name" />
                    <hide id="cm:title" />
                    <hide id="cm:description" force="true" />

                    <show id="ad:genre" />
                    <show id="ad:paydate" />
                    <show id="ad:ammount" />
                    <show id="ad:currency" />
                    <show id="ad:reference" />
                   
                    <show id="ad:doclink" />
                                      
                    <hide id="cm:creator" for-mode="view" />
                    <hide id="cm:created" for-mode="view" />
                    <hide id="cm:modifier" for-mode="view" />
                    <hide id="cm:modified" for-mode="view" />

               </field-visibility>

            <appearance>
               <set id="general" appearance="panel" label="General" />
               <set id="metadata" appearance="panel" label="Metadata" />

                    <field id="cm:name" label="nom du fichier" description="Nom du fichier." set="General">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                    </field>

                    <field id="ad:genre" label="type de facture" description="Type de facture." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/selectone.ftl" />
                          <control>
                            <control-param name="options">Fournisseur,Client</control-param>
                          </control>
                    </field>


                    <field id="ad:paydate" label="date de facturation" description="Date de facturation." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/date.ftl" />
                    </field>

                    <field id="ad:ammount" label="montant" description="Montant a payer." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                    </field>

                    <field id="ad:currency" label="devises" description="Type de devises." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/selectone.ftl" />
                          <control>
                            <control-param name="options">Dirhams,Euros,USD</control-param>
                          </control>
                    </field>

                    <field id="ad:reference" label="reference" description="Reference." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                    </field>
            </appearance>
        </form>
    </forms>
</config>

<config evaluator="doclib-simple-metadata" condition="ad:myinvoice" replace="true">
   <forms>
      <form>
            <edit-form template="/org/alfresco/2-columns.ftl" />

                <field-visibility>
               
                    <show id="cm:name" />
                    <hide id="cm:title" />
                    <hide id="cm:description" force="true" />

                    <show id="ad:genre" />
                    <show id="ad:paydate" />
                    <show id="ad:ammount" />
                    <show id="ad:currency" />
                    <show id="ad:reference" />
                   
                   
                    <hide id="cm:creator" for-mode="view" />
                    <hide id="cm:created" for-mode="view" />
                    <hide id="cm:modifier" for-mode="view" />
                    <hide id="cm:modified" for-mode="view" />

               </field-visibility>

            <appearance>
               <set id="general" appearance="panel" label="General" />
               <set id="metadata" appearance="panel" label="Metadata" />

                    <field id="cm:name" label="nom du fichier" description="Nom du fichier." set="General">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                    </field>

                    <field id="ad:genre" label="type de facture" description="Type de facture." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/selectone.ftl" />
                          <control>
                            <control-param name="options">Fournisseur,Client</control-param>
                          </control>
                    </field>


                    <field id="ad:paydate" label="date de facturation" description="Date de facturation." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/date.ftl" />
                    </field>

                    <field id="ad:ammount" label="montant" description="Montant a payer." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                    </field>

                    <field id="ad:currency" label="devises" description="Type de devises." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/selectone.ftl" />
                          <control>
                            <control-param name="options">Dirhams,Euros,USD</control-param>
                          </control>
                    </field>

                    <field id="ad:reference" label="reference" description="Reference." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                    </field>
            </appearance>
      </form>
   </forms>
</config>



<config evaluator="aspect" condition="ad:documentrelated" replace="true">
    <forms>
        <form>
            <field-visibility>
                <show id="ad:documentsassocies" />

                <!– surf:widget aspect –>
            <show id="surf:widgetType"/>
            <show id="surf:mid"/>
            <show id="surf:label"/>
            </field-visibility>

            <appearance>                   
                <field id="ad:documentsassocies" label-id="Documents associes" />
                        <control template="/org/alfresco/components/form/controls/association.ftl" />
                          <control>
                            <control-param name="displayMode">list</control-param>
                            <control-param name="startLocation">{doclib}</control-param>
                            <control-param name="selectActionLabel">Ajouter</control-param>
                          </control>
            </appearance>
        </form>
    </forms>
</config>
     
     
     

      <!–
         If set, will present a WebDAV link for the current item on the Document and Folder details pages.
         Also used to generate the "View in Alfresco Explorer" action for folders.
      –>
      <repository-url>http://localhost:8080/alfresco</repository-url>

      <!–
         Google Docs integration
      –>
      <google-docs>
         <!–
            Enable/disable the Google Docs UI integration (Extra types on Create Content menu, Google Docs actions).
         –>
         <enabled>false</enabled>

         <!–
            The mimetypes of documents Google Docs allows you to create via the Share interface.
            The I18N label is created from the "type" attribute, e.g. google-docs.doc=Google Docs&trade; Document
         –>
         <creatable-types>
            <creatable type="doc">application/msword</creatable>
            <creatable type="xls">application/vnd.ms-excel</creatable>
            <creatable type="ppt">application/vnd.ms-powerpoint</creatable>
         </creatable-types>
      </google-docs>

      <!–
         File upload configuration
      –>
      <file-upload>
         <!–
            Adobe Flash™
            In certain environments, an HTTP request originating from Flash cannot be authenticated using an existing session.
            See: http://bugs.adobe.com/jira/browse/FP-4830
            For these cases, it is useful to disable the Flash-based uploader for Share Document Libraries.
         –>
         <adobe-flash-enabled>true</adobe-flash-enabled>
      </file-upload>
   </config>


   <!– Custom DocLibActions config section –>
   <config evaluator="string-compare" condition="DocLibActions">
      <actionGroups>
         <actionGroup id="document-browse">

            <!– Simple Repo Actions –>
            <!–
            <action index="340" id="document-extract-metadata" />
            <action index="350" id="document-increment-counter" />
            –>

            <!– Dialog Repo Actions –>
            <!–
            <action index="360" id="document-transform" />
            <action index="370" id="document-transform-image" />
            <action index="380" id="document-execute-script" />
            –>

         </actionGroup>
      </actionGroups>
   </config>

   <!– Global folder picker config section –>
   <config evaluator="string-compare" condition="GlobalFolder">
      <siteTree>
         <container type="cm:folder">
            <!– Use a specific label for this container type in the tree –>
            <rootLabel>location.path.documents</rootLabel>
            <!– Use a specific uri to retreive the child nodes for this container type in the tree –>
            <uri>slingshot/doclib/treenode/site/{site}/{container}{path}?children={evaluateChildFoldersSite}&amp;max={maximumFolderCountSite}</uri>
         </container>
      </siteTree>
   </config>

   <!– Repository Library config section –>
   <config evaluator="string-compare" condition="RepositoryLibrary" replace="true">
      <!–
         Root nodeRef or xpath expression for top-level folder.
         e.g. alfresco://user/home, /app:company_home/st:sites/cm:site1
         If using an xpath expression, ensure it is properly ISO9075 encoded here.
      –>
      <root-node>alfresco://company/home</root-node>

      <tree>
         <!–
            Whether the folder Tree component should enumerate child folders or not.
            This is a relatively expensive operation, so should be set to "false" for Repositories with broad folder structures.
         –>
         <evaluate-child-folders>false</evaluate-child-folders>
        
         <!–
            Optionally limit the number of folders shown in treeview throughout Share.
         –>
         <maximum-folder-count>500</maximum-folder-count>
      </tree>

      <!–
         Whether the link to the Repository Library appears in the header component or not.
      –>
      <visible>true</visible>
   </config>
  
   <!– Kerberos settings –>
   <!– To enable kerberos rename this condition to "Kerberos" –>
   <config evaluator="string-compare" condition="KerberosDisabled" replace="true">
      <kerberos>
         <!–
            Password for HTTP service account.
            The account name *must* be built from the HTTP server name, in the format :
               HTTP/<server_name>@<realm>
            (NB this is because the web browser requests an ST for the
            HTTP/<server_name> principal in the current realm, so if we're to decode
            that ST, it has to match.)
         –>
         <password>secret</password>
         <!–
            Kerberos realm and KDC address.
         –>
         <realm>ALFRESCO.ORG</realm>
         <!–
            Service Principal Name to use on the repository tier.
            This must be like: HTTP/host.name@REALM
         –>
         <endpoint-spn>HTTP/repository.server.com@ALFRESCO.ORG</endpoint-spn>
         <!–
            JAAS login configuration entry name.
         –>
         <config-entry>ShareHTTP</config-entry>
      </kerberos>
   </config>

   <!– Uncomment and modify the URL to Activiti Admin Console if required. –>
   <!–
   <config evaluator="string-compare" condition="ActivitiAdmin" replace="true">
      <activiti-admin-url>http://localhost:8080/alfresco/activiti-admin</activiti-admin-url>
   </config>
   –>

   <config evaluator="string-compare" condition="Remote">
      <remote>
         <endpoint>
            <id>alfresco-noauth</id>
            <name>Alfresco - unauthenticated access</name>
            <description>Access to Alfresco Repository WebScripts that do not require authentication</description>
            <connector-id>alfresco</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
            <identity>none</identity>
         </endpoint>

         <endpoint>
            <id>alfresco</id>
            <name>Alfresco - user access</name>
            <description>Access to Alfresco Repository WebScripts that require user authentication</description>
            <connector-id>alfresco</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
            <identity>user</identity>
         </endpoint>

         <endpoint>
            <id>alfresco-feed</id>
            <name>Alfresco Feed</name>
            <description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description>
            <connector-id>http</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
            <basic-auth>true</basic-auth>
            <identity>user</identity>
         </endpoint>
        
         <endpoint>
            <id>activiti-admin</id>
            <name>Activiti Admin UI - user access</name>
            <description>Access to Activiti Admin UI, that requires user authentication</description>
            <connector-id>activiti-admin-connector</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/activiti-admin</endpoint-url>
            <identity>user</identity>
         </endpoint>
      </remote>
   </config>

   <!–
        Overriding endpoints to reference an Alfresco server with external SSO enabled
        NOTE: If utilising a load balancer between web-tier and repository cluster, the "sticky
              sessions" feature of your load balancer must be used.
        NOTE: If alfresco server location is not localhost:8080 then also combine changes from the
              "example port config" section below.
        *Optional* keystore contains SSL client certificate + trusted CAs.
        Used to authenticate share to an external SSO system such as CAS
        Remove the keystore section if not required i.e. for NTLM.
       
        NOTE: For Kerberos SSO rename the "KerberosDisabled" condition above to "Kerberos"
       
        NOTE: For external SSO, switch the endpoint connector to "AlfrescoHeader" and set
              the userHeader to the name of the HTTP header that the external SSO
              uses to provide the authenticated user name.
   –>
   <!–
   <config evaluator="string-compare" condition="Remote">
      <remote>
         <keystore>
             <path>alfresco/web-extension/alfresco-system.p12</path>
             <type>pkcs12</type>
             <password>alfresco-system</password>
         </keystore>
        
         <connector>
            <id>alfrescoCookie</id>
            <name>Alfresco Connector</name>
            <description>Connects to an Alfresco instance using cookie-based authentication</description>
            <class>org.alfresco.web.site.servlet.SlingshotAlfrescoConnector</class>
         </connector>
        
         <connector>
            <id>alfrescoHeader</id>
            <name>Alfresco Connector</name>
            <description>Connects to an Alfresco instance using header and cookie-based authentication</description>
            <class>org.alfresco.web.site.servlet.SlingshotAlfrescoConnector</class>
            <userHeader>SsoUserHeader</userHeader>
         </connector>

         <endpoint>
            <id>alfresco</id>
            <name>Alfresco - user access</name>
            <description>Access to Alfresco Repository WebScripts that require user authentication</description>
            <connector-id>alfrescoCookie</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/wcs</endpoint-url>
            <identity>user</identity>
            <external-auth>true</external-auth>
         </endpoint>
      </remote>
   </config>
   –>
  
</alfresco-config>


2- service context (spring registration)



<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
    <!– Add Someco messages –>
    <bean id="${project.artifactId}_resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
        <property name="resourceBundles">
            <list>
                <value>alfresco.module.${project.artifactId}.messages.myinvoice</value>
            </list>
        </property>
    </bean>
</beans>



3- properties file for i18N strings


#ad:myinvoice
type.ad_myinvoice=Facture
prop.ad_genre=Type de facture
prop.ad_paydate=Date de paiement
prop.ad_ammount=Montant
prop.ad_currency=Devise
prop.ad_reference=Numero de reference

#ad:documentrelated
aspect.ad_documentrelated=Documents associes
prop.ad_doclink=lien documentaire




So i successfully build the AMPs and they install successfully with the method provided on the alfresco documentation. But when i launch share, i can see that my new "ad:myinvoice" subtype is available in the rules and change type actions, but the associated metadata form is a mess, whatever i do to try and configure it, using config evaluators and all the stuff. Maybe something is wrong in the share config syntax, i dont know and iam still trying without success. The system apparently doesnt recognize my configuration when it comes to field sets, labels, control templates, form templates.

I attached some screen captures to show you what iam talking about.

If you have a bit of time, please look to my share configuration file and tell me please what is wrong with this, alfresco community 5 lacks of form customization tutorials. I also followed the ECM architect tutorial for share config, but its still the same, did alfresco 5 come up with changes in terms of share config? making content modeling tutorials on the web out of date?

Thanks a lot in advance!


6 REPLIES 6

s_palyukh
Star Contributor
Star Contributor
Hi,

You made a mistake in your share config file. The parent of all
 <config>  
elements should be
 <alfresco-config> 
, but you put form configs under the 
 <config evaluator="string-compare" condition="DocumentLibrary" replace="true">
. The following content should be right:


<!– Alfresco 5.0.c share-config-custom.xml sample –>
<alfresco-config>

    <!– Global config section –>
    <config replace="true">
        <flags>
            <!–
               Developer debugging setting to turn on DEBUG mode for client scripts in the browser
            –>
            <client-debug>false</client-debug>

            <!–
               LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift).
               This flag automatically activates logging on page load.
            –>
            <client-debug-autologging>false</client-debug-autologging>
        </flags>
    </config>

    <config evaluator="string-compare" condition="WebFramework">
        <web-framework>
            <!– SpringSurf Autowire Runtime Settings –>
            <!–
                 Developers can set mode to 'development' to disable; SpringSurf caches,
                 FreeMarker template caching and Rhino JavaScript compilation.
            –>
            <autowire>
                <!– Pick the mode: "production" or "development" –>
                <mode>production</mode>
            </autowire>

            <!– Allows extension modules with <auto-deploy> set to true to be automatically deployed –>
            <module-deployment>
                <mode>manual</mode>
                <enable-auto-deploy-modules>true</enable-auto-deploy-modules>
            </module-deployment>
        </web-framework>
    </config>

    <!– Disable the CSRF Token Filter –>
    <!–
    <config evaluator="string-compare" condition="CSRFPolicy" replace="true">
       <filter/>
    </config>
    –>

    <!–
       To run the CSRF Token Filter behind 1 or more proxies that do not rewrite the Origin or Referere headers:

       1. Copy the "CSRFPolicy" default config in share-security-config.xml and paste it into this file.
       2. Replace the old config by setting the <config> element's "replace" attribute to "true" like below:
          <config evaluator="string-compare" condition="CSRFPolicy" replace="true">
       3. To every <action name="assertReferer"> element add the following child element
          <param name="referer">http://www.proxy1.com/.*|http://www.proxy2.com/.*</param>
       4. To every <action name="assertOrigin"> element add the following child element
          <param name="origin">http://www.proxy1.com|http://www.proxy2.com</param>
    –>

    <!–
       Remove the default wildcard setting and use instead a strict whitelist of the only domains that shall be allowed
       to be used inside iframes (i.e. in the WebView dashlet on the dashboards)
    –>
    <!–
    <config evaluator="string-compare" condition="IFramePolicy" replace="true">
       <cross-domain>
          <url>http://www.trusted-domain-1.com/</url>
          <url>http://www.trusted-domain-2.com/</url>
       </cross-domain>
    </config>
    –>

    <!– Turn off header that stops Share from being displayed in iframes on pages from other domains –>
    <!–
    <config evaluator="string-compare" condition="SecurityHeadersPolicy">
       <headers>
          <header>
             <name>X-Frame-Options</name>
             <enabled>false</enabled>
          </header>
       </headers>
    </config>
    –>

    <!– Prevent browser communication over HTTP (for HTTPS servers) –>
    <!–
    <config evaluator="string-compare" condition="SecurityHeadersPolicy">
       <headers>
          <header>
             <name>Strict-Transport-Security</name>
             <value>max-age=31536000</value>
          </header>
       </headers>
    </config>
    –>

    <config evaluator="string-compare" condition="Replication">
        <share-urls>
            <!–
               To discover a Repository Id, browse to the remote server's CMIS landing page at:
                 http://{server}:{port}/alfresco/service/cmis/index.html
               The Repository Id field is found under the "CMIS Repository Information" expandable panel.

               Example config entry:
                 <share-url repositoryId="622f9533-2a1e-48fe-af4e-ee9e41667ea4">http://new-york-office:8080/share/</share-url>
            –>
        </share-urls>
    </config>

    <!– Document Library config section –>
    <config evaluator="string-compare" condition="DocumentLibrary" replace="true">

        <tree>
            <!–
               Whether the folder Tree component should enumerate child folders or not.
               This is a relatively expensive operation, so should be set to "false" for Repositories with broad folder structures.
            –>
            <evaluate-child-folders>false</evaluate-child-folders>

            <!–
               Optionally limit the number of folders shown in treeview throughout Share.
            –>
            <maximum-folder-count>1000</maximum-folder-count>

            <!–
               Default timeout in milliseconds for folder Tree component to recieve response from Repository
            –>
            <timeout>7000</timeout>
        </tree>

        <!–
           Used by the "Manage Aspects" action

           For custom aspects, remember to also add the relevant i18n string(s)
              cm_myaspect=My Aspect
        –>
        <aspects>
            <!– Aspects that a user can see –>
            <visible>
                <aspect name="cm:generalclassifiable"/>
                <aspect name="cm:complianceable"/>
                <aspect name="cm:dublincore"/>
                <aspect name="cm:effectivity"/>
                <aspect name="cm:summarizable"/>
                <aspect name="cm:versionable"/>
                <aspect name="cm:templatable"/>
                <aspect name="cm:emailed"/>
                <aspect name="emailserver:aliasable"/>
                <aspect name="cm:taggable"/>
                <aspect name="app:inlineeditable"/>
                <aspect name="gd:googleEditable"/>
                <aspect name="cm:geographic"/>
                <aspect name="exif:exif"/>
                <aspect name="audio:audio"/>
                <aspect name="cm:indexControl"/>
                <aspect name="dp:restrictable"/>
                <aspect name="ad:documentrelated"/>
            </visible>

            <!– Aspects that a user can add. Same as "visible" if left empty –>
            <addable>
            </addable>

            <!– Aspects that a user can remove. Same as "visible" if left empty –>
            <removeable>
            </removeable>
        </aspects>

        <!–
           Used by the "Change Type" action

           Define valid subtypes using the following example:
              <type name="cm:content">
                 <subtype name="cm:mysubtype" />
              </type>

           Remember to also add the relevant i18n string(s):
              cm_mysubtype=My SubType
        –>
        <types>
            <type name="cm:content">
                <subtype name="ad:myinvoice"/>
            </type>

            <type name="cm:folder">
            </type>

            <type name="trx:transferTarget">
                <subtype name="trx:fileTransferTarget"/>
            </type>
        </types>

        <!–
      If set, will present a WebDAV link for the current item on the Document and Folder details pages.
      Also used to generate the "View in Alfresco Explorer" action for folders.
   –>
        <repository-url>http://localhost:8080/alfresco</repository-url>

        <!–
           Google Docs integration
        –>
        <google-docs>
            <!–
               Enable/disable the Google Docs UI integration (Extra types on Create Content menu, Google Docs actions).
            –>
            <enabled>false</enabled>

            <!–
               The mimetypes of documents Google Docs allows you to create via the Share interface.
               The I18N label is created from the "type" attribute, e.g. google-docs.doc=Google Docs&trade; Document
            –>
            <creatable-types>
                <creatable type="doc">application/msword</creatable>
                <creatable type="xls">application/vnd.ms-excel</creatable>
                <creatable type="ppt">application/vnd.ms-powerpoint</creatable>
            </creatable-types>
        </google-docs>

        <!–
           File upload configuration
        –>
        <file-upload>
            <!–
               Adobe Flash™
               In certain environments, an HTTP request originating from Flash cannot be authenticated using an existing session.
               See: http://bugs.adobe.com/jira/browse/FP-4830
               For these cases, it is useful to disable the Flash-based uploader for Share Document Libraries.
            –>
            <adobe-flash-enabled>true</adobe-flash-enabled>
        </file-upload>

        <!– Forms –>
    </config>

    <config evaluator="node-type" condition="ad:myinvoice" replace="true">
        <forms>
            <form>
                <field-visibility>

                    <show id="cm:name"/>
                    <hide id="cm:title"/>
                    <hide id="cm:description" force="true"/>

                    <show id="ad:genre"/>
                    <show id="ad:paydate"/>
                    <show id="ad:ammount"/>
                    <show id="ad:currency"/>
                    <show id="ad:reference"/>

                    <show id="ad:doclink"/>

                    <hide id="cm:creator" for-mode="view"/>
                    <hide id="cm:created" for-mode="view"/>
                    <hide id="cm:modifier" for-mode="view"/>
                    <hide id="cm:modified" for-mode="view"/>

                </field-visibility>

                <appearance>
                    <set id="general" appearance="panel" label="General"/>
                    <set id="metadata" appearance="panel" label="Metadata"/>

                    <field id="cm:name" label="nom du fichier" description="Nom du fichier." set="General">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl"/>
                    </field>

                    <field id="ad:genre" label="type de facture" description="Type de facture." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/selectone.ftl"/>
                        <control>
                            <control-param name="options">Fournisseur,Client</control-param>
                        </control>
                    </field>


                    <field id="ad:paydate" label="date de facturation" description="Date de facturation."
                           set="Metadata">
                        <control template="/org/alfresco/components/form/controls/date.ftl"/>
                    </field>

                    <field id="ad:ammount" label="montant" description="Montant a payer." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl"/>
                    </field>

                    <field id="ad:currency" label="devises" description="Type de devises." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/selectone.ftl"/>
                        <control>
                            <control-param name="options">Dirhams,Euros,USD</control-param>
                        </control>
                    </field>

                    <field id="ad:reference" label="reference" description="Reference." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl"/>
                    </field>
                </appearance>
            </form>
        </forms>
    </config>

    <config evaluator="doclib-simple-metadata" condition="ad:myinvoice" replace="true">
        <forms>
            <form>
                <edit-form template="/org/alfresco/2-columns.ftl"/>

                <field-visibility>

                    <show id="cm:name"/>
                    <hide id="cm:title"/>
                    <hide id="cm:description" force="true"/>

                    <show id="ad:genre"/>
                    <show id="ad:paydate"/>
                    <show id="ad:ammount"/>
                    <show id="ad:currency"/>
                    <show id="ad:reference"/>


                    <hide id="cm:creator" for-mode="view"/>
                    <hide id="cm:created" for-mode="view"/>
                    <hide id="cm:modifier" for-mode="view"/>
                    <hide id="cm:modified" for-mode="view"/>

                </field-visibility>

                <appearance>
                    <set id="general" appearance="panel" label="General"/>
                    <set id="metadata" appearance="panel" label="Metadata"/>

                    <field id="cm:name" label="nom du fichier" description="Nom du fichier." set="General">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl"/>
                    </field>

                    <field id="ad:genre" label="type de facture" description="Type de facture." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/selectone.ftl"/>
                        <control>
                            <control-param name="options">Fournisseur,Client</control-param>
                        </control>
                    </field>


                    <field id="ad:paydate" label="date de facturation" description="Date de facturation."
                           set="Metadata">
                        <control template="/org/alfresco/components/form/controls/date.ftl"/>
                    </field>

                    <field id="ad:ammount" label="montant" description="Montant a payer." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl"/>
                    </field>

                    <field id="ad:currency" label="devises" description="Type de devises." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/selectone.ftl"/>
                        <control>
                            <control-param name="options">Dirhams,Euros,USD</control-param>
                        </control>
                    </field>

                    <field id="ad:reference" label="reference" description="Reference." set="Metadata">
                        <control template="/org/alfresco/components/form/controls/textfield.ftl"/>
                    </field>
                </appearance>
            </form>
        </forms>
    </config>

    <config evaluator="aspect" condition="ad:documentrelated" replace="true">
        <forms>
            <form>
                <field-visibility>
                    <show id="ad:documentsassocies"/>

                    <!– surf:widget aspect –>
                    <show id="surf:widgetType"/>
                    <show id="surf:mid"/>
                    <show id="surf:label"/>
                </field-visibility>

                <appearance>
                    <field id="ad:documentsassocies" label-id="Documents associes"/>
                    <control template="/org/alfresco/components/form/controls/association.ftl"/>
                    <control>
                        <control-param name="displayMode">list</control-param>
                        <control-param name="startLocation">{doclib}</control-param>
                        <control-param name="selectActionLabel">Ajouter</control-param>
                    </control>
                </appearance>
            </form>
        </forms>
    </config>

    <!– Custom DocLibActions config section –>
    <config evaluator="string-compare" condition="DocLibActions">
        <actionGroups>
            <actionGroup id="document-browse">

                <!– Simple Repo Actions –>
                <!–
                <action index="340" id="document-extract-metadata" />
                <action index="350" id="document-increment-counter" />
                –>

                <!– Dialog Repo Actions –>
                <!–
                <action index="360" id="document-transform" />
                <action index="370" id="document-transform-image" />
                <action index="380" id="document-execute-script" />
                –>

            </actionGroup>
        </actionGroups>
    </config>

    <!– Global folder picker config section –>
    <config evaluator="string-compare" condition="GlobalFolder">
        <siteTree>
            <container type="cm:folder">
                <!– Use a specific label for this container type in the tree –>
                <rootLabel>location.path.documents</rootLabel>
                <!– Use a specific uri to retreive the child nodes for this container type in the tree –>
                <uri>slingshot/doclib/treenode/site/{site}/{container}{path}?children={evaluateChildFoldersSite}&amp;max={maximumFolderCountSite}</uri>
            </container>
        </siteTree>
    </config>

    <!– Repository Library config section –>
    <config evaluator="string-compare" condition="RepositoryLibrary" replace="true">
        <!–
           Root nodeRef or xpath expression for top-level folder.
           e.g. alfresco://user/home, /app:company_home/st:sites/cm:site1
           If using an xpath expression, ensure it is properly ISO9075 encoded here.
        –>
        <root-node>alfresco://company/home</root-node>

        <tree>
            <!–
               Whether the folder Tree component should enumerate child folders or not.
               This is a relatively expensive operation, so should be set to "false" for Repositories with broad folder structures.
            –>
            <evaluate-child-folders>false</evaluate-child-folders>

            <!–
               Optionally limit the number of folders shown in treeview throughout Share.
            –>
            <maximum-folder-count>500</maximum-folder-count>
        </tree>

        <!–
           Whether the link to the Repository Library appears in the header component or not.
        –>
        <visible>true</visible>
    </config>

    <!– Kerberos settings –>
    <!– To enable kerberos rename this condition to "Kerberos" –>
    <config evaluator="string-compare" condition="KerberosDisabled" replace="true">
        <kerberos>
            <!–
               Password for HTTP service account.
               The account name *must* be built from the HTTP server name, in the format :
                  HTTP/<server_name>@<realm>
               (NB this is because the web browser requests an ST for the
               HTTP/<server_name> principal in the current realm, so if we're to decode
               that ST, it has to match.)
            –>
            <password>secret</password>
            <!–
               Kerberos realm and KDC address.
            –>
            <realm>ALFRESCO.ORG</realm>
            <!–
               Service Principal Name to use on the repository tier.
               This must be like: HTTP/host.name@REALM
            –>
            <endpoint-spn>HTTP/repository.server.com@ALFRESCO.ORG</endpoint-spn>
            <!–
               JAAS login configuration entry name.
            –>
            <config-entry>ShareHTTP</config-entry>
        </kerberos>
    </config>

    <!– Uncomment and modify the URL to Activiti Admin Console if required. –>
    <!–
    <config evaluator="string-compare" condition="ActivitiAdmin" replace="true">
       <activiti-admin-url>http://localhost:8080/alfresco/activiti-admin</activiti-admin-url>
    </config>
    –>

    <config evaluator="string-compare" condition="Remote">
        <remote>
            <endpoint>
                <id>alfresco-noauth</id>
                <name>Alfresco - unauthenticated access</name>
                <description>Access to Alfresco Repository WebScripts that do not require authentication</description>
                <connector-id>alfresco</connector-id>
                <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
                <identity>none</identity>
            </endpoint>

            <endpoint>
                <id>alfresco</id>
                <name>Alfresco - user access</name>
                <description>Access to Alfresco Repository WebScripts that require user authentication</description>
                <connector-id>alfresco</connector-id>
                <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
                <identity>user</identity>
            </endpoint>

            <endpoint>
                <id>alfresco-feed</id>
                <name>Alfresco Feed</name>
                <description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet
                </description>
                <connector-id>http</connector-id>
                <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
                <basic-auth>true</basic-auth>
                <identity>user</identity>
            </endpoint>

            <endpoint>
                <id>activiti-admin</id>
                <name>Activiti Admin UI - user access</name>
                <description>Access to Activiti Admin UI, that requires user authentication</description>
                <connector-id>activiti-admin-connector</connector-id>
                <endpoint-url>http://localhost:8080/alfresco/activiti-admin</endpoint-url>
                <identity>user</identity>
            </endpoint>
        </remote>
    </config>

    <!–
         Overriding endpoints to reference an Alfresco server with external SSO enabled
         NOTE: If utilising a load balancer between web-tier and repository cluster, the "sticky
               sessions" feature of your load balancer must be used.
         NOTE: If alfresco server location is not localhost:8080 then also combine changes from the
               "example port config" section below.
         *Optional* keystore contains SSL client certificate + trusted CAs.
         Used to authenticate share to an external SSO system such as CAS
         Remove the keystore section if not required i.e. for NTLM.

         NOTE: For Kerberos SSO rename the "KerberosDisabled" condition above to "Kerberos"

         NOTE: For external SSO, switch the endpoint connector to "AlfrescoHeader" and set
               the userHeader to the name of the HTTP header that the external SSO
               uses to provide the authenticated user name.
    –>
    <!–
    <config evaluator="string-compare" condition="Remote">
       <remote>
          <keystore>
              <path>alfresco/web-extension/alfresco-system.p12</path>
              <type>pkcs12</type>
              <password>alfresco-system</password>
          </keystore>

          <connector>
             <id>alfrescoCookie</id>
             <name>Alfresco Connector</name>
             <description>Connects to an Alfresco instance using cookie-based authentication</description>
             <class>org.alfresco.web.site.servlet.SlingshotAlfrescoConnector</class>
          </connector>

          <connector>
             <id>alfrescoHeader</id>
             <name>Alfresco Connector</name>
             <description>Connects to an Alfresco instance using header and cookie-based authentication</description>
             <class>org.alfresco.web.site.servlet.SlingshotAlfrescoConnector</class>
             <userHeader>SsoUserHeader</userHeader>
          </connector>

          <endpoint>
             <id>alfresco</id>
             <name>Alfresco - user access</name>
             <description>Access to Alfresco Repository WebScripts that require user authentication</description>
             <connector-id>alfrescoCookie</connector-id>
             <endpoint-url>http://localhost:8080/alfresco/wcs</endpoint-url>
             <identity>user</identity>
             <external-auth>true</external-auth>
          </endpoint>
       </remote>
    </config>
    –>

</alfresco-config>

Hello mr S.Palyukh, thanks a lot for your quick reply, i replaced my file with your content, and unfortunatly, it didnt work. In fact, 127.0.0.1:8080/share/page now points a blank page, i cant get any login page or access to Alfresco. You have an idea about this?

s_palyukh
Star Contributor
Star Contributor
Maybe I also made some mistake I didn't test it. So I just wanted to explain you that you need to make correct structure for your config file. To understand what is wrong take a look at errors in /tomcat/logs/catalina.out

drisschelouati
Champ on-the-rise
Champ on-the-rise
alright, ill check the log back at home tonight and will upload it so you can see it, youre right, what is important is the structure. But it is really hard to get required informations to set up a good structure. Ill keep trying.

drisschelouati
Champ on-the-rise
Champ on-the-rise
Finally, i made it, my model now works perfectly, it was all about a "config evaluator" that was not closed by the correct "/config" end tag.

The reason the model didnt work with the changes you made to it was that they were mistakes in the syntax. The Jeff Potts content modeling tutorial helped me to solve the issues. I even created advanced search forms!

Iam really happy that i could achieve that, i now can use alfresco with its full content modeling potential. Ill move now to more advanced tutorials.

Thanks to the people who helped me solve those issues!

marc4sure
Champ in-the-making
Champ in-the-making
Hello,
I'm trying to configure the advanced search form, in order to put some fields for a custom content type, but as you said, without proper documentation and manual, it's very hard to know which elements and attributes you have to include in the share-config-custom.xml file, in order to get things working. I managed to create the custom content type, and customize the form to edit the properties of the custom content, but I have two problems: 1. Find out how to customize the Advanced search form with the exact fields, including aspect fields, and 2. I managed to get a partially custom advanced search form but when I use it, it doesn't find the contents that I entered before, and I'm sure that the contents exists and have the proper values in the search criteria fields.
As far as I read in your comments, you succeded in those goals, and I wonder if you or somebody in the forum have some manual/doc/information/url references that could help me to get my custom content type to work even with the search functionality.
I've noticed that most of the material in Alfresco Official places about forms and customization is related with previous releases (3.2, 4.0, 4.2). It's very difficult to find material for 5.0 (Community or One) related with this issue.
Thank you in advance.