AnsweredAssumed Answered

Problem with Custom Data Lists

Question asked by lemmy on May 1, 2011
Latest reply on Oct 25, 2011 by cjimenez2581
Hi,

I was really struggling to create a custom data list in share. I was trying to implement the demo at http://ecmarchitect.com/archives/2010/04/25/1156. I didn't get correctly where which file had to be deployed so I'm documenting it here for the next one… This documentation is just the first shot. You should implement it as Jeff has described it in the video. But you might not be able to do this without a first idea of what to place where.

You need to create the following files.

tomcat\webapps\alfresco\WEB-INF\classes\alfresco\module\IssuesDataList\module.properties
tomcat\webapps\alfresco\WEB-INF\classes\alfresco\module\IssuesDataList\module-context.xml
tomcat\webapps\alfresco\WEB-INF\classes\alfresco\module\IssuesDataList\messages\issues-data-list-model.properties
tomcat\webapps\alfresco\WEB-INF\classes\alfresco\module\IssuesDataList\model\issuesDataListModel.xml

tomcat\webapps\share\WEB-INF\classes\share\web-extension\fdk-config-custom.xml

module.properties
# module properties
module.id=IssuesDataList
#module.aliases=none
module.version=0.1
module.title=Issues Data List
module.description=Provides a custom data list type

# The following optional properties can be used to prevent the module from being added
# to inappropriate versions of the WAR file.
module.repo.version.min=3.3
#module.repo.version.max=2.1

module-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>
   
   <bean id="custom.issues.datalist.bootstrapExtraBundlesBean" class="org.alfresco.web.app.ResourceBundleBootstrap">
      <property name="resourceBundles">
         <list>
            <value>alfresco.module.IssuesDataList.messages.issues-data-list-model</value>
         </list>
      </property>
   </bean>
  
    <!– Registration of new models –>
    <bean id="custom.issues.datalist.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/module/IssuesDataList/model/issuesDataListModel.xml</value>
            </list>
        </property>
    </bean>   
</beans>

issues-data-list-model.properties
scidl_issuesDataListModel.type.scidl_issuesList.title=Issues List
scidl_issuesDataListModel.type.scidl_issuesList.description=A simple issues list with status and optional assignee.
scidl_issuesDataListModel.property.scidl_issueTitle.title=Title
scidl_issuesDataListModel.property.scidl_issueDueDate.title=Due Date
scidl_issuesDataListModel.property.scidl_issueStatus.title=Status
scidl_issuesDataListModel.property.scidl_issueType.title=Type
scidl_issuesDataListModel.property.scidl_issuePriority.title=Priority
scidl_issuesDataListModel.property.scidl_issueNotes.title=Notes
scidl_issuesDataListModel.property.scidl_issueResolution.title=Resolution
scidl_issuesDataListModel.association.scidl_assignee.title=Assignee

issuesDataListModel.xml
<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="scidl:issuesDataListModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Issues Data List Model</description>
   <author>Jeff Potts</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 uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
      <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.someco.com/model/issuesDataList/1.0" prefix="scidl" />
   </namespaces>
   
   <constraints>
        <constraint name="scidl:issueStatusList" type="LIST">
         <parameter name="allowedValues">
            <list>
                    <value>New</value>
                    <value>Accepted</value>
                    <value>Started</value>
                    <value>Blocked</value>
                    <value>Resolved</value>
                    <value>Invalid</value>
            </list>
           </parameter>
      </constraint>
        <constraint name="scidl:issueTypeList" type="LIST">
         <parameter name="allowedValues">
            <list>
                    <value>Enhancement</value>
                    <value>Defect</value>
                    <value>Task</value>
            </list>
           </parameter>
      </constraint>
    </constraints>

   <types>
      <type name="scidl:issuesList">
         <title>Issues List</title>
         <parent>dl:dataListItem</parent>
         <properties>
            <property name="scidl:issueTitle">
               <title>Title</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
              </property>
              <property name="scidl:issueDueDate">
               <title>Due Date</title>
               <type>d:datetime</type>
               <mandatory>false</mandatory>
              </property>
              <property name="scidl:issueStatus">
               <title>Status</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
               <constraints>
                  <constraint ref="scidl:issueStatusList" />
               </constraints>
            </property>
              <property name="scidl:issueType">
               <title>Type</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
               <constraints>
                  <constraint ref="scidl:issueTypeList" />
               </constraints>
              </property>
              <property name="scidl:issuePriority">
               <title>Priority</title>
               <type>d:int</type>
               <mandatory>false</mandatory>
              </property>
              <property name="scidl:issueNotes">
               <title>Notes</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
              </property>
              <property name="scidl:issueResolution">
               <title>Resolution</title>
               <type>d:text</type>
               <mandatory>false</mandatory>
              </property>
         </properties>
         <associations>
            <association name="scidl: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="scidl: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>
   </types>
</model>

fdk-config-custom.xml
<alfresco-config>
   <!– scidl:issuesList type –>
   <config evaluator="model-type" condition="scidl:issuesList">
      <forms>
         <!– Create item form –>
         <form>
            <field-visibility>
               <show id="scidl:issueTitle" />
               <show id="scidl:issueType" />
               <show id="scidl:issueDueDate" />
               <show id="scidl:issueStatus" />
               <show id="scidl:issuePriority" />
               <show id="scidl:issueNotes" />
               <show id="scidl:issueResolution" />
               <show id="scidl:assignee" />
               <show id="scidl:attachments" />
            </field-visibility>
            <create-form template="../data-lists/forms/row-new.ftl" />
            <appearance>
               <field id="scidl:issueNotes">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
               </field>
               <field id="scidl:issueResolution">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
               </field>
            </appearance>
         </form>

         <!– Data Grid view –>
         <form id="datagrid">
            <field-visibility>
               <show id="scidl:issueTitle" />
               <show id="scidl:issueType" />
               <show id="scidl:issueStatus" />
               <show id="scidl:issueDueDate" />
               <show id="scidl:issuePriority" />
               <show id="scidl:assignee" />               
            </field-visibility>
         </form>
      </forms>
   </config>

   <!– scidl_issuesList type (existing nodes) –>
   <config evaluator="node-type" condition="scidl:issuesList">
      <forms>
         <!– Data List pop-up edit form –>
         <form>
            <field-visibility>
               <show id="scidl:issueTitle" />
               <show id="scidl:issueStatus" />
               <show id="scidl:issueDueDate" />
               <show id="scidl:issuePriority" />
               <show id="scidl:issueNotes" />
               <show id="scidl:assignee" />
               <show id="scidl:attachments" />
            </field-visibility>
            <edit-form template="../data-lists/forms/row-edit.ftl" />
            <appearance>
               <field id="scidl:issueNotes">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl" />
               </field>
            </appearance>
         </form>
      </forms>
   </config>

</alfresco-config>

Restart the server. You'll find the custom data list 'Issues List' in Share -> Data Lists -> New List.

Hope this help,
Lemmy

Outcomes