cancel
Showing results for 
Search instead for 
Did you mean: 

Data lists in Share 3.3

efestione
Champ in-the-making
Champ in-the-making
Hi all,
I really like this new feature (data lists).
I need an address book to share customer contacts with my collaborators. Is it possibile to add a custom data list type?
Thank you
Ale
16 REPLIES 16

mikeh
Star Contributor
Star Contributor
Yes, although the documentation to do this isn't in place yet. It's a two-stage process…

Essentially, you need to create a custom model type that represents your list. Make your your custom type is a child of dl:dataListItem. Currently the "duplicate" action only duplicates properties and associations directly applied to the custom list type, so you can't create deeply nested data structures just yet. The create form configuration to decide which type fields you want to appear in the Create, Edit and Data Grid.

It might look long-winded, but actually gives you lots of control.

The "To Do List" out-of-the-box sample model is defined in datalistModel.xml and looks like this:
      <type name="dl:todoList">
         <title>To Do List</title>
         <parent>dl:dataListItem</parent>
         <properties>
            <property name="dl:todoTitle">
               <title>Title</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
            </property>
            <property name="dl:todoDueDate">
               <title>Due Date</title>
               <type>d:datetime</type>
               <mandatory>false</mandatory>
            </property>
            <property name="dl:todoPriority">
               <title>Priority</title>
               <type>d:int</type>
               <mandatory>false</mandatory>
            </property>
            <property name="dl:todoNotes">
               <title>Notes</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
         </properties>
         <associations>
            <association name="dl:assignee">
               <title>Assignee</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:person</class>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </association>
            <association name="dl:attachments">
               <title>Attachments</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:cmobject</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
      </type>

The corresponding form configuration in share-form-config.xml is:
   <!– dl:todoList type –>
   <config evaluator="model-type" condition="dl:todoList">
      <forms>
         <!– Create item form –>
         <form>
            <field-visibility>
               <show id="dl:todoTitle" />
               <show id="dl:todoDueDate" />
               <show id="dl:todoPriority" />
               <show id="dl:todoNotes" />
               <show id="dl:assignee" />
               <show id="dl:attachments" />
            </field-visibility>
            <create-form template="../data-lists/forms/row-new.ftl" />
            <appearance>
               <field id="dl:todoNotes">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
               </field>
            </appearance>
         </form>

         <!– Data Grid view –>
         <form id="datagrid">
            <field-visibility>
               <show id="dl:todoTitle" />
               <show id="dl:todoDueDate" />
               <show id="dl:todoPriority" />
               <show id="dl:assignee" />
               <show id="dl:attachments" />
            </field-visibility>
         </form>
      </forms>
   </config>

   <!– dl_todoList type (existing nodes) –>
   <config evaluator="node-type" condition="dl:todoList">
      <forms>
         <!– Data List pop-up edit form –>
         <form>
            <field-visibility>
               <show id="dl:todoTitle" />
               <show id="dl:todoDueDate" />
               <show id="dl:todoPriority" />
               <show id="dl:todoNotes" />
               <show id="dl:assignee" />
               <show id="dl:attachments" />
            </field-visibility>
            <edit-form template="../data-lists/forms/row-edit.ftl" />
            <appearance>
               <field id="dl:todoNotes">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
               </field>
            </appearance>
         </form>
      </forms>
   </config>

We'll likely be bundling further samples in with a future release, so it would be interesting to hear what people are using.

One more point: the model's i18n strings are in the Repository along with the custom model. Look in data-list-model.properties for the To Do List sample.

Thanks,
Mike

efestione
Champ in-the-making
Champ in-the-making
Thank you Mike for your quick reply.
I guess using your explanations i will be able to make a simple address book.

Another typology of data list could be a simple issue tracker. But I think this needs a minimum workflow that can't be done in data lists context, right?

mikeh
Star Contributor
Star Contributor
Another typology of data list could be a simple issue tracker. But I think this needs a minimum workflow that can't be done in data lists context, right?
Remember data list items are all Repository nodes, so you can use workflow, rules, etc. just as for normal content items.

Note however that rules don't currently fire on 3.3dev due to: http://issues.alfresco.com/jira/browse/ALF-2186

Thanks,
Mike

pamolendijk
Champ in-the-making
Champ in-the-making
This is brilliant.
We are really looking forward to the datalists feature.

jk328
Champ in-the-making
Champ in-the-making
Is it possible to create a hierarchical data list?
Preferably with the possibility of combining different data sets for the main element and next level element.

jk328
Champ in-the-making
Champ in-the-making
Remember data list items are all Repository nodes, so you can use workflow, rules, etc. just as for normal content items.

Another question - will it be possible to automatically add entries in the data lists using Rules or Workflow? I would like to set up a list of ready made documents and would like to add entry in data list using rule from DocumentLibrary. And automatically fill out the entry form with relevant document attributes.

My responsibility is customer business needs not a programming, then sorry for questions that programmers may seem primitive. Smiley Wink

mikeh
Star Contributor
Star Contributor
Is it possible to create a hierarchical data list?
Preferably with the possibility of combining different data sets for the main element and next level element.
'm not sure exactly what you mean here - could you give a concrete example please?

Remember data list items are all Repository nodes, so you can use workflow, rules, etc. just as for normal content items.

Another question - will it be possible to automatically add entries in the data lists using Rules or Workflow? I would like to set up a list of ready made documents and would like to add entry in data list using rule from DocumentLibrary. And automatically fill out the entry form with relevant document attributes.

My responsibility is customer business needs not a programming, then sorry for questions that programmers may seem primitive. Smiley Wink
Yes, you can use a Rule that fires a script to do this. The script would create the correct type of node and populate the properties as required.

Thanks,
Mike

jk328
Champ in-the-making
Champ in-the-making
Is it possible to create a hierarchical data list?
Preferably with the possibility of combining different data sets for the main element and next level element.
'm not sure exactly what you mean here - could you give a concrete example please?

I will try to figure out how to explain desired functionality. This classification is one of our local record-keeping requirement.
Thanks, MikeH!

rjch
Champ in-the-making
Champ in-the-making
Yes, although the documentation to do this isn't in place yet. It's a two-stage process…

Essentially, you need to create a custom model type that represents your list. Make your your custom type is a child of dl:dataListItem. Currently the "duplicate" action only duplicates properties and associations directly applied to the custom list type, so you can't create deeply nested data structures just yet. The create form configuration to decide which type fields you want to appear in the Create, Edit and Data Grid.

It might look long-winded, but actually gives you lots of control.
It certainly does look flexible, however I'm afraid some of your explanation has gone over my head.  I'm comfortable enough working out the XML structure and I agree that it appears to be very very flexible, however no matter what I do, I can't seem to get the data lists to appear.  I'm running the community version of 3.3g.

I have the following two files in my extensions directory:-

membershipModel.xml
<?xml version="1.0" encoding="UTF-8"?>
<model name="scidl:memberDBModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
        <description>Membership Database List Model</description>
        <author>Rob Hillis</author>
        <version>0.1</author>

        <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 uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
                <import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl"/>
        </imports>

        <namespaces>
                <namespace uri="http://www.yvr.org.au/model/membershipDataList/1.0" prefix="scidl">
        </namespaces>

        <constraints>
                <constraint name="dl:memberType" type="LIST">
                        <parameter name="allowedValues">
                                <list>
                                        <value>Single</value>
                                        <value>Family</value>
                                        <value>Junior</value>
                                        <value>Complimentary</value>
                                        <value>Life</value>
                                </list>
                        </parameter>
                </constraint>
        </constraints>

        <type name="scidl:memberDb">
                <title>Membership Database</title>
                <parent>dl:dataListItem</parent>
                <properties>
                        <property name="dl:memberNumber">
                                <title>Member No</title>
                                <type>d:int</type>
                                <mandatory>true</mandatory>
                        </property>
                        <property name="dl:memberSurname">
                                <title>Surname</title>
                                <type>d:text</type>
                                <mandatory>true</mandatory>
                        </property>
                        <property name="dl:memberFirstName">
                                <title>First Name</title>
                                <type>d:text</type>
                                <mandatory>true</mandatory>
                        </property>
                        <property name="dl:memberAddress">
                                <title>Address</title>
                                <type>d:text</type>
                                <mandatory>true</mandatory>
                        </property>
                        <property name="dl:memberSuburb">
                                <title>Suburb</title>
                                <type>d:text</type>
                                <mandatory>true</mandatory>
                        </property>
                        <property name="dl:memberPCode">
                                <title>Postcode</title>
                                <type>d:int</type>
                                <mandatory>true</mandatory>
                        </property>
                        <property name="dl:memberHomePhone">
                                <title>Home Phone</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberWorkPhone">
                                <title>Word Phone</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberFax">
                                <title>Fax</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberMobile">
                                <title>Mobile</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberEmail">
                                <title>eMail Address</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberType">
                                <title>Membership Type</title>
                                <type>d:text</type>
                                <mandatory>true</mandatory>
                        </property>
                        <property name="dl:memberDateJoined">
                                <title>Date Joined</title>
                                <type>d:date</type>
                                <mandatory>true</mandatory>
                        </property>
                        <property name="dl:memberDateResigned">
                                <title>Date Resigned</title>
                                <type>d:date</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberMedicareNo">
                                <title>Medicare No</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberMedicalConditions">
                                <title>Medical Conditions</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberNoKSurname">
                                <title>Next of Kin's Surname</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberNoKFirstName">
                                <title>Next of Kin's First Name</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberNoKAddress">
                                <title>Next of Kin's Address</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberNoKSuburb">
                                <title>Next of Kin's Suburb</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberNoKPostcode">
                                <title>Next of Kin's Postcode</title>
                                <type>d:int</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberNokPhone">
                                <title>Next of Kin's Phone</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                        <property name="dl:memberNoKMobile">
                                <title>Next of Kin's Mobile</title>
                                <type>d:text</type>
                                <mandatory>false</mandatory>
                        </property>
                </properties>
        </type>
</model>

share-config-custom.xml
<alfresco-config>
        <config evaluator="model-type" condition="dl:memberDb">
                <forms>
                        <form>
                                <field-visibility>
                                        <show id="dl:memberNumber" />
                                        <show id="dl:memberSurname" />
                                        <show id="dl:memberFirstName" />
                                        <show id="dl:memberAddress" />
                                        <show id="dl:memberSuburb" />
                                        <show id="dl:memberPCode" />
                                        <show id="dl:memberHomePhone" />
                                        <show id="dl:memberWorkPhone" />
                                        <show id="dl:memberFax" />
                                        <show id="dl:memberMobile" />
                                        <show id="dl:memberEmail" />
                                        <show id="dl:memberType" />
                                        <show id="dl:memberDateJoined" />
                                        <show id="dl:memberDateResigned" />
                                        <show id="dl:memberMedicareNo" />
                                        <show id="dl:memberMedicalConditions" />
                                        <show id="dl:memberNoKSurname" />
                                        <show id="dl:memberNoKFirstName" />
                                        <show id="dl:memberNoKAddress" />
                                        <show id="dl:memberNoKSuburb" />
                                        <show id="dl:memberNoKPostcode" />
                                        <show id="dl:memberNokPhone" />
                                        <show id="dl:memberNoKMobile" />
                                </field-visibility>
                        </form>
                </forms>
        </config>
</alfresco-config>

I've tried to extrapolate what is necessary by looking at the existing files and by watching this video, so I could very easily have gotten something wrong.  I suspect I need to register the model, but I don't know exactly how to do that.

If you could give me a hint as to where I might be going wrong, I'd be most appreciative and will probably go and add a wiki page to ease things for others.  Smiley Happy