cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Data List

zazugue
Champ in-the-making
Champ in-the-making
Hello everyone. So i am creating a custom data list to link many Accounts ID. Actually, i am on Alfresco Community 5.0d.
I followed this tutorial http://docs.alfresco.com/5.1/references/dev-extension-points-data-lists.html to make my custom data list but it doesn't show in the list of datalist. I added the two files custom_users_Datalist.xml and custom_users_Datalist_context.xml in the repetory : "\tomcat\shared\classes\alfresco\extension". Where did i made a mistake or mistakes?

So this is my file custom_users_Datalist.xml :

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="cl:clCustomdatalist" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!– Optional meta-data about the model –>
<description>Users Datalist</description>
<author></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"/>
     <!– Import Alfresco Data List Model Definitions –>
     <import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl"/>
</imports>

<!– Introduction of new namespaces defined by this model –>
<namespaces>
     <namespace uri="http://www.exersys.com/model/datalist/1.0" prefix="cl"/>
</namespaces>
<types>
<!– Data list defintions For this model go here –>
     <type name="cl:clListUsers">
         <title>Liste des utilisateurs</title>
         <description>Liste des utilisateurs Alfresco associés avec les comptes "Mon expert en Gestion" et "I-Suite Expert"</description>
         <parent>dl:dataListItem</parent>

        <properties>
            <property name="cl:clUsersAlf">
                 <title>Utilisateur Alfresco</title>
                 <type>d:text</type>
                 <mandatory>true</mandatory>
            </property>
         <property name="cl:clUsersMEG">
                 <title>Utilsateur MEG</title>
                 <type>d:text</type>
                 <mandatory>true</mandatory>
            </property>
         <property name="cl:clPasswordMEG">
                 <title>Mot de passe MEG </title>
                 <type>d:text</type>
                 <mandatory>true</mandatory>
            </property>
         <property name="cl:clUsersISE">
                 <title>Utilisateur ISE</title>
                 <type>d:text</type>
                 <mandatory>true</mandatory>
            </property>
         <property name="cl:clPasswordISE">
                 <title>Mot de passe ISE</title>
                 <type>d:text</type>
                 <mandatory>true</mandatory>
            </property>
        </properties>
      
      <associations>
             <association name="cl:clAttachments">
                 <title>Attachements</title>
                 <source>
                     <mandatory>false</mandatory>
                     <many>true</many>
                 </source>
                 <target>
                     <class>cm:content</class>
                     <mandatory>false</mandatory>
                     <many>true</many>
                 </target>
             </association>
         </associations>
     </type>
</types>
</model>


My file custom_users_Datalist_context.xml :

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
    <!– Registration of new models –>
    <bean id="org.alfresco.tutorial.customdatalist.dictionaryBootstrap"
          parent="dictionaryModelBootstrap"
          depends-on="dictionaryBootstrap">
    <property name="models">
        <list>
            <value>alfresco/extension/custom_users_Datalist</value>
        </list>
    </property>
</bean>
</beans>


And what i add in the file share-config-custom.xml :

<!– Custom –>
<config evaluator="model-type" condition="cl:clListUsers">
<!– Create item form –>
     <form>
         <field-visibility>
              <show id="cl:clUsersALF" />
              <show id="cl:clUsersMEG"/>
              <show id="cl:clPasswordMEG"/>
           <show id="cl:clUsersISE"/>
           <show id="cl:clPasswordISE"/>           
          </field-visibility>
         <create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" />
         <appearance>
         <field id="cl:clUsersALF">
                <control template="/org/alfresco/components/form/controls/textarea.ftl" />
            </field>
            <field id="cl:clUsersMEG">
                <control template="/org/alfresco/components/form/controls/textarea.ftl" />
            </field>
            <field id="cl:clPasswordMEG">
                <control>
                    <control-param name="startLocation">{doclib}</control-param>
                </control>
            </field>
         <field id="cl:clUsersISE">
                <control template="/org/alfresco/components/form/controls/textarea.ftl" />
            </field>
            <field id="cl:clPasswordISE">
                <control>
                    <control-param name="startLocation">{doclib}</control-param>
                </control>
            </field>
         </appearance>
     </form>

<!– Data Grid view –>
    <form id="datagrid">
        <field-visibility>
              <show id="cl:clUsersALF" />
              <show id="cl:clUsersMEG"/>
              <show id="cl:clPasswordMEG"/>
              <show id="cl:clUsersISE"/>
              <show id="cl:clPasswordISE"/>           
         </field-visibility>
    </form>
</forms>
</config>

<!– Edit view –>
<config evaluator="node-type" condition="cl:clListUsers">
<forms>
     <!– Edit marketing item form –>
     <form>
          <field-visibility>
              <show id="cl:clUsersALF" />
              <show id="cl:clUsersMEG"/>
              <show id="cl:clPasswordMEG"/>
           <show id="cl:clUsersISE"/>
           <show id="cl:clPasswordISE"/>           
          </field-visibility>
          <create-form template="/org/alfresco/components/data-lists/forms/dataitem.ftl" />
          <appearance>
              <field id="cl:clUsersALF">
                 <control template="/org/alfresco/components/form/controls/textarea.ftl" />
              </field>
              <field id="cl:clUsersMEG">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
              </field>
              <field id="cl:clPasswordMEG">
                  <control>
                      <control template="/org/alfresco/components/form/controls/textarea.ftl" />
                  </control>
              </field>
           <field id="cl:clUsersISE">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
              </field>
              <field id="cl:clPasswordISE">
                  <control>
                      <control template="/org/alfresco/components/form/controls/textarea.ftl" />
                  </control>
              </field>
          </appearance>
     </form>
</forms>
</config>
6 REPLIES 6

douglascrp
World-Class Innovator
World-Class Innovator
Hello.

You have to fix your model registration into the -context.xml file.

<property name="models">
    <list>
        <value>alfresco/extension/custom_users_Datalist.xml</value>
    </list>
</property>

I saw that you forgot to include the "xml" extension.

zazugue
Champ in-the-making
Champ in-the-making
Thank you for you answer. I put ".xml" but no change. I tried to change the bean :


         <bean id="custom_users_Datalist.extension.dictionaryBootstrap"
          parent="dictionaryModelBootstrap"
          depends-on="dictionaryBootstrap">


But maybe i forgot something?
- I create a file name : xxxx.xml
- I create a file name : xxxx_context.xml
- Add the content inside : share-config-custom.xml
- Restart

steven_okennedy
Star Contributor
Star Contributor
Hi zazugue,

I think the first thing to evaluate is whether the problem is with the model configuration or with the share configuration.  You can verify whether or not the new type has been registered correctly by making a call to the classes webscript giving your new type, e.g. http://localhost:8080/alfresco/service/api/classes/cl_clListUsers.  If the new type has successfully been interpreted and loaded, then you should see the details of the type & its properties etc if you put the url above into your browser (needs admin username/password)

If it doesn't show up then the model itself hasn't loaded and there's a problem with either the model file or the -context.xml.  If you do see the details, then it's a problem with the Share config (although as far as I know, the Share screen just looks for any types that inherit from dl:dataListItem and shows them), or with the data that Share is getting when trying to load the page.  It might be worth checking in your browser for any errors on the console/script errors etc

Regards

Steven

zazugue
Champ in-the-making
Champ in-the-making
Maybe this is a stupid question. The tutorial i found is for Alfresco One 5.1 or I am on Alfresco Community 5.0 and i don't find the tutorial on the doc.alfresco for this version. Is it possible it doesn't work on Community 5.0?

Data lists and this mechanism for create custom lists has been around since about Alfresco 3.3 or 3.4, so no problem there - Alfresco have just been doing a lot of work expanding and improving their developer documentation which is why this is not referenced in the 5.0 docs.

Sorry, I've just seen the problem and as always with these kinds of things it's the little things….

You need to make sure your context file is called xxxx-context.xml not xxxx_context.xml if you want Spring to pick it up. so rename your file to replace the final underscore with a hyphen and you should be set

Regards

Steven

zazugue
Champ in-the-making
Champ in-the-making
I found the error . In the share_config_custom.xml. I didn't noticed i forgot a <forms> tag. And yeah, i just saw about xxxx_context.xml …

It's always cause of little thing -_-

Thanks for your help, it works now !